{"version":3,"sources":["webpack:///../WCC.UI/App/components/editors/chat/blots/emoji.ts","webpack:///../WCC.UI/App/components/editors/chat/chat.html?8db3","webpack:///../WCC.UI/App/components/editors/chat/chat.scss?a885","webpack:///../WCC.UI/App/components/editors/chat/chat.ts","webpack:///../WCC.UI/App/components/editors/chat/managers/formatter.ts","webpack:///../WCC.UI/App/components/editors/chat/managers/quillWrapper.ts","webpack:///../WCC.UI/App/components/editors/chat/tools/colorpicker/colorpicker.html?818d","webpack:///../WCC.UI/App/components/editors/chat/tools/colorpicker/colorpicker.ts","webpack:///../WCC.UI/App/components/editors/chat/tools/emojis/emojis.html?606a","webpack:///../WCC.UI/App/components/editors/chat/tools/emojis/emojis.ts","webpack:///../WCC.UI/App/components/editors/chat/tools/icon/icon.html?0a6e","webpack:///../WCC.UI/App/components/editors/chat/tools/icon/icon.ts","webpack:///../WCC.UI/App/components/editors/chat/tools/select/select.html?9116","webpack:///../WCC.UI/App/components/editors/chat/tools/select/select.ts","webpack:///../WCC.UI/App/components/editors/chat/tools/tool.ts","webpack:///../WCC.UI/App/components/emojisPicker/models/emoji.ts","webpack:///../WCC.UI/App/libraries/quill.js","webpack:///../WCC.UI/App/managers/autofocus.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/editors/chat/chat.scss","webpack:///../WCC.UI/App/components/editors/chat/chat.html","webpack:///../WCC.UI/App/components/editors/chat/tools/colorpicker/colorpicker.html","webpack:///../WCC.UI/App/components/editors/chat/tools/emojis/emojis.html","webpack:///../WCC.UI/App/components/editors/chat/tools/icon/icon.html","webpack:///../WCC.UI/App/components/editors/chat/tools/select/select.html","webpack:///../WCC.UI/node_modules/quill-image-drop-and-paste/dist/quill-image-drop-and-paste.esm.js"],"names":["emojione","require","asciiEmojiPattern","RegExp","asciiRegexp","asciiEmojiBlackList","settings","parchment","Quill","import","Delta","Keyboard","handleAsciiEmoji","range","context","_","isEmpty","format","asciiCode","prefix","trim","split","last","contains","unicode","asciiList","find","value","insertAt","index","length","undefined","this","quill","deleteText","insertEmbed","setSelection","matchers","Node","TEXT_NODE","node","delta","_node$nodeValue","content","nodeValue","offset","match","emojiPattern","exec","shortName","emojioneList","compose","retain","delete","insert","slice","bindings","key","collapsed","handler","keys","ENTER","call","ChatEditorEmojiBlot","Embed","constructor","code","_$findKey","super","findKey","codes","includes","toString","emoji","Emoji","create","src","url","fromURL","blotName","className","tagName","expose","__esModule","default","api","module","i","options","exports","locals","components","registerLocal","preload","ChatEditorVM","config","info","effects","_ko$unwrap","_this","imagesUploader","WCCS3ImageUploader","changesCount","ko","observable","bodyNode","extrasNode","externalContentNode","attachmentsNode","quillNode","leftToolbarNode","rightToolbarNode","hasText","hasFocus","attachments","observableArray","extend","deferred","uploads","attachmentsAndUploads","pureComputed","concat","pickImages","async","files","FilesHelpers","uploadImages","removeAttachment","attachment","remove","setText","focus","invokeNotNull","getLength","history","clear","setContent","html","replace","clipboard","convert","setContents","insertEmoji","selection","getSelection","insertBlot","blot","onInsert","enable","reset","clearHistory","blur","onToolsMouseUp","m","e","cancelEvent","onToolsMouseDown","isAutoFocusEnabled","flattenComputed","autofocus","theme","getTheme","hasBackground","background","unwrap","quillWrapper","register","QuillWrapper","placeholder","formats","blots","onSelectionChange","formatter","update","onTextChange","text","getText","inc","Formatter","toolbar","buildToolbar","maxHeight","target","leftToolbarTracker","NodeTracker","width","leftToolbarWidth","height","leftToolbarHeight","rightToolbarTracker","rightToolbarWidth","rightToolbarHeight","externalContentHeight","hasExternalContent","toolbarSize","max","isPinnedToolbar","left","isPinned","right","isAnimationAllowed","minHeight","bodyPadding","leftToolbarSize","bodyMargin","placement","extrasMargin","ignoreDependencies","getContent","attachmentsGrid","source","columnWidth","threshold","isReady","hasMedia","onArrayChange","add","onUploadAdded","subscribe","requestAnimationFrame","focusRequired","applyBindingsToNode","toPx","AutofocusManager","element","when","then","init","forEach","file","isImage","upload","wccImage","push","scrollToAttachments","bodyRect","getBoundingClientRect","top","bottom","$","animate","scrollTop","_ko$unwrap2","_ko$unwrap3","noBorder","toolbarConfig","_toolbarConfig$left","_toolbarConfig$right","_toolbarConfig$placem","buildToolbarSection","groupsConfig","groups","map","groupConfig","buildToolsGroup","isVisible","reduce","result","group","toolsConfig","tools","isFunction","isArray","_groupConfig$isVisibl","some","tool","css","preventDefault","stopPropagation","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","_Formatter_quill","set","isBold","isItalic","isUnderlined","color","_classPrivateFieldGe","_classPrivateFieldGe2","_formats","_formats2","_formats3","_formats$color","_formats4","__classPrivateFieldGet","getFormat","bold","italic","underline","toggleBold","toggleFormat","toggleItalic","toggleUnderline","setColor","__classPrivateFieldSet","type","QuillImageDropAndPaste","defaultFormats","_config$formats","_config$blots","_this$quill$invokeNot","Array","from","root","children","filter","toLowerCase","getNodeContent","noop","allowedFormats","blotsFormats","uniq","withEffects","modules","keyboard","imageDropAndPaste","on","withEffect","dataset","innerHTML","dispose","DOMHelpers","isHTMLElement","childNodes","blotContent","isBlotMatch","instance","outerHTML","nodeType","_blot$className","classList","ColorPickerTool","Tool","jsonModel","_jsonModel$pick","_jsonModel$hide","component","pick","hide","ColorPickerToolVM","ToolVM","model","icon","EmojisTool","EmojisToolVM","IconTool","IconToolVM","SelectTool","select","SelectToolVM","_jsonModel$action","action","tooltip","isSpecial","isActive","isDisabled","cTooltip","cCSS","cIsSpecial","cIsActive","cIsDisabled","cIsVisible","message","unicodePattern","EmojisPickerEmoji","data","_data$title","title","pluck","emojioneIconsURL","$document","document","staticEffects","actions","isDocumentBlurred","hasActions","any","checkDocumentFocus","hasActiveInput","activeElement","is","off","focusFunc","onNodeEvent","ctrlKey","altKey","isEnabled","func","system","SystemHelpers","getTemplatesAndResources","head","appendChild","___CSS_LOADER_API_IMPORT___","utils","generateFilename","btoa","String","Math","random","Date","abortTimeout","validURL","test","Promise","resolve","reject","timer","img","Image","onerror","onabort","clearTimeout","onload","setTimeout","str","Boolean","URL","clipboardDataItems","isHtml","prototype","item","dataUrl","ArrayBuffer","arrayBufferToBase64Url","binary","len","buffer","arr","Uint8Array","charCodeAt","arrayBuffer","fromCharCode","body","createElement","previouslyFocusedElement","setAttribute","style","position","fontSize","originalRange","rangeCount","getRangeAt","append","selectionStart","selectionEnd","isSuccess","execCommand","_a","removeAllRanges","addRange","isType","Object","ImageData","name","getSuffix","option","maxWidth","quality","image","canvas","ctx","getContext","drawImage","canvasType","canvasDataUrl","toDataURL","resolveDataUrl","filename","window","File","toBlob","console","error","base64","buff","binaryStringToArrayBuffer","atob","createBlob","parts","properties","Blob","builder","BlobBuilder","MSBlobBuilder","MozBlobBuilder","WebKitBlobBuilder","getBlob","matched","ImageDropAndPaste","handleDrop","bind","handlePaste","addEventListener","dataTransfer","caretRangeFromPoint","clientX","clientY","setBaseAndExtent","startContainer","startOffset","readFiles","clipboardData","items","isRichText","callback","handleDataTransfer","handleDroppedFile","that","reader","FileReader","blob","getAsFile","readAsDataURL","getAsString","s","urlIsImage","catch","_index","insertText"],"mappings":"yZAMA,MAAMA,EAAWC,EAAQ,sDAEnBC,EAAoB,IAAIC,OAAOH,EAASI,cACxC,oBAAEC,GAAwBC,EAE1BC,EAAYC,IAAMC,OAAO,aACzBC,EAAQF,IAAMC,OAAO,SACrBE,EAAWH,IAAMC,OAAO,oBAkC9B,SAASG,EAA4BC,EAAoBC,GACrD,GAAIC,EAAEC,QAAQF,EAAQG,QAAS,CAC3B,MAAMC,EAAYH,EAAED,EAAQK,OAAOC,OAAOC,MAAM,MAAMC,OAEtD,IAAKP,EAAEV,GAAqBkB,SAASL,GAAY,CAC7C,MAAMM,EAAUT,EAAEf,EAASyB,WAAWC,KAAK,CAACF,EAAiBG,IAAkBA,IAAUT,GACnFU,EAAWf,EAAMgB,MAAQX,EAAUY,OAEzC,GAAeC,MAAXP,EAKA,OAJAQ,KAAKC,MAAMC,WAAWN,EAAUf,EAAMgB,MAAQD,GAC9CI,KAAKC,MAAME,YAAYP,EAAU,YAAaJ,GAC9CQ,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AAUpW,GAC9B,MAAM,KAAEkJ,EAAI,KAAE+J,EAAO,IAAOtO,EAC5B,GAAIuE,EAAK9P,MAAM,2CAA4C,CACvD4G,EAAEiH,iBACF,MAAMuP,EAAS,IAAIC,WACnBD,EAAOhG,OAAUxQ,IACTA,EAAE4B,QAAU5B,EAAE4B,OAAO2E,QACrB6P,EAASpW,EAAE4B,OAAO2E,OAAQ2C,EAAM+J,IAGxCuD,EAAOI,cAAcjS,IAK7B,OAAO1L,EAASiQ,GACZ,IAGI+N,EAHA9e,GAASG,KAAKC,MAAM+G,cAAa,IAAS,IAAInH,YACpCE,IAAVF,GAAuBA,EAAQ,KAC/BA,EAAQG,KAAKC,MAAMoG,aAEV,UAATuK,GACA+N,EAAS9e,EAAQ,EACjBG,KAAKC,MAAME,YAAYN,EAAO+Q,EAAMjQ,EAAS,SAE/B,SAATiQ,IACL+N,EAAS9e,EAAQc,EAAQb,OACzBE,KAAKC,MAAM2e,WAAW/e,EAAOc,EAAS,SAE1CwX,WAAW,KACPnY,KAAKC,MAAMG,aAAaue,MAIpC7B,EAAkBpC,UAAYA,EAC9BgB,OAAO7K,uBAAyBiM,EAC5B,UAAWpB,QACXA,OAAOld,MAAM8J,SAAS,4BAA6BwU","file":"110.aeeb321d775a09c5bf23.js","sourcesContent":["import Emoji from 'components/emojisPicker/models/emoji';\r\nimport { QuillBinding, QuillMatcher } from 'interfaces/quill';\r\nimport { DeltaStatic, Quill, RangeStatic } from 'libraries/quill';\r\nimport emojiPattern from 'patterns/emoji';\r\nimport { IChatEditorBlotInstance } from './iblot';\r\n\r\nconst emojione = require('emojione');\r\n\r\nconst asciiEmojiPattern = new RegExp(emojione.asciiRegexp);\r\nconst { asciiEmojiBlackList } = settings;\r\n\r\nconst parchment = Quill.import('parchment');\r\nconst Delta = Quill.import('delta');\r\nconst Keyboard = Quill.import('modules/keyboard');\r\n\r\nfunction emojiMatcher(node: HTMLElement, delta: DeltaStatic) {\r\n let content = node.nodeValue ?? '',\r\n offset = 0;\r\n\r\n let match = emojiPattern.exec(content);\r\n\r\n while (match != null) {\r\n const shortName = match[0];\r\n const unicode = _(emojione.emojioneList[shortName]).last();\r\n\r\n if (unicode != undefined) {\r\n delta = delta.compose(new Delta()\r\n .retain(match.index + offset)\r\n .delete(shortName.length)\r\n .insert({ 'wcc-emoji': unicode }));\r\n\r\n offset += match.index + 1;\r\n } else {\r\n delta = delta.compose(new Delta()\r\n .retain(match.index + offset)\r\n .delete(shortName.length));\r\n\r\n offset += match.index;\r\n }\r\n\r\n content = content.slice(match.index + shortName.length);\r\n match = emojiPattern.exec(content);\r\n }\r\n\r\n return delta;\r\n}\r\n\r\nfunction handleAsciiEmoji(this: any, range: RangeStatic, context: any) {\r\n if (_.isEmpty(context.format)) {\r\n const asciiCode = _(context.prefix.trim().split(' ')).last();\r\n\r\n if (!_(asciiEmojiBlackList).contains(asciiCode)) {\r\n const unicode = _(emojione.asciiList).find((unicode: string, value: string) => value === asciiCode);\r\n const insertAt = range.index - asciiCode.length;\r\n\r\n if (unicode != undefined) {\r\n this.quill.deleteText(insertAt, range.index - insertAt);\r\n this.quill.insertEmbed(insertAt, 'wcc-emoji', unicode);\r\n this.quill.setSelection(insertAt + 1);\r\n\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n}\r\n\r\nfunction handleAsciiEmojiAndContinue(this: any, range: RangeStatic, context: any) {\r\n handleAsciiEmoji.call(this, range, context);\r\n return true;\r\n}\r\n\r\nconst matchers: Array = [\r\n [Node.TEXT_NODE, emojiMatcher]\r\n]\r\n\r\nconst bindings: StringMap = {\r\n 'handleAsciiEmoji': {\r\n key: ' ',\r\n collapsed: true,\r\n prefix: asciiEmojiPattern,\r\n handler: handleAsciiEmoji\r\n },\r\n\r\n 'handleAsciiEmoji2': {\r\n key: Keyboard.keys.ENTER,\r\n collapsed: true,\r\n prefix: asciiEmojiPattern,\r\n handler: handleAsciiEmojiAndContinue\r\n }\r\n}\r\n\r\nexport class ChatEditorEmojiBlot extends parchment.Embed implements IChatEditorBlotInstance {\r\n static blotName = 'wcc-emoji'\r\n static className = 'emoji';\r\n static tagName = 'img';\r\n static matchers = matchers;\r\n static bindings = bindings;\r\n\r\n unicode: string\r\n code: string\r\n\r\n constructor(node: HTMLImageElement, code: string) {\r\n super(node);\r\n \r\n this.unicode = code;\r\n this.code = _(emojione.emojioneList).findKey((codes: Array) => codes.includes(this.unicode)) ?? '';\r\n }\r\n\r\n value() {\r\n return { 'emoji': this.unicode };\r\n }\r\n\r\n toString() {\r\n return this.code;\r\n }\r\n\r\n static create(unicode: string) {\r\n const emoji = new Emoji({ unicode: unicode });\r\n\r\n var node = super.create();\r\n node.src = emoji.url();\r\n\r\n return node;\r\n }\r\n\r\n static value(node: HTMLImageElement) {\r\n const url = node.src;\r\n const emoji = Emoji.fromURL(url);\r\n\r\n if (emoji != undefined)\r\n return emoji.code();\r\n }\r\n}","define([\n \"!!../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./chat.html\", \n \"!../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/sass-loader/dist/cjs.js!./chat.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import EmojisPickerEmoji from 'components/emojisPicker/models/emoji';\r\nimport { GridConfig } from 'components/grid/grid';\r\nimport { wccModules } from 'enums/wccModules';\r\nimport { FilesHelpers } from 'helpers/files';\r\nimport { inject, injectable } from 'inversify';\r\nimport { PureComputed, Subscribable } from 'knockout';\r\nimport { Quill } from 'libraries/quill';\r\nimport AutofocusManager from 'managers/autofocus';\r\nimport { NodeTracker } from 'managers/nodes/tracker';\r\nimport WCCS3ImageUploader from 'managers/uploads/s3/image';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport WCCAttachment from 'models/attachments/attachment';\r\nimport WCCUpload from 'models/upload';\r\nimport { IChatEditorBlot } from './blots/iblot';\r\nimport './chat.html';\r\nimport { ChatEditorToolbarConfig, ChatEditorToolsGroupConfig, ChatEditorVMConfig, ChatEditorVMTheme, ChatEditorVMToolbarPlacement, IChatEditorVM } from './chat.interfaces';\r\nimport './chat.scss';\r\nimport { Formatter } from './managers/formatter';\r\nimport { QuillWrapper } from './managers/quillWrapper';\r\nimport { Tool } from './tools/tool';\r\n\r\nconst attachmentsFocusAreaSize = 100;\r\n\r\ncomponents\r\n .registerLocal('chat-editor-icon-tool', () => require('./tools/icon/icon'))\r\n .registerLocal('chat-editor-colorpicker-tool', () => require('./tools/colorpicker/colorpicker'))\r\n .registerLocal('chat-editor-select-tool', () => require('./tools/select/select'))\r\n .registerLocal('chat-editor-emojis-tool', () => require('./tools/emojis/emojis'))\r\n .preload('grid-new', 'attachment-controls', 'wcc-generic-attachment');\r\n\r\ninterface ChatEditorToolbar {\r\n left: ChatEditorToolbarSection\r\n right: ChatEditorToolbarSection\r\n placement: ChatEditorVMToolbarPlacement\r\n}\r\n\r\ninterface ChatEditorToolbarSection {\r\n groups: Array\r\n\r\n isVisible: PureComputed\r\n isPinned: PureComputed\r\n}\r\n\r\ninterface ChatEditorToolsGroup {\r\n tools: Array\r\n\r\n css: PureComputed\r\n isVisible: PureComputed\r\n isPinned: PureComputed\r\n}\r\n\r\n@injectable()\r\nexport default class ChatEditorVM implements IChatEditorVM {\r\n private imagesUploader = new WCCS3ImageUploader(); \r\n private changesCount = ko.observable(0);\r\n\r\n private quill: Subscribable \r\n\r\n bodyNode = ko.observable();\r\n extrasNode = ko.observable();\r\n externalContentNode = ko.observable();\r\n attachmentsNode = ko.observable();\r\n quillNode = ko.observable();\r\n leftToolbarNode = ko.observable();\r\n rightToolbarNode = ko.observable();\r\n\r\n isEmpty = ko.observable(true);\r\n hasText = ko.observable(false);\r\n hasFocus = ko.observable(false);\r\n\r\n attachments = ko.observableArray().extend({ deferred: true });\r\n uploads = this.imagesUploader.uploads;\r\n attachmentsAndUploads = ko.pureComputed(() => (>this.attachments()).concat(this.uploads()));\r\n\r\n content: Subscribable\r\n\r\n attachmentsGrid: GridConfig\r\n toolbar: ChatEditorToolbar\r\n formatter: Formatter\r\n\r\n minHeight: Subscribable\r\n maxHeight: Subscribable\r\n bodyPadding: Subscribable\r\n bodyMargin: Subscribable\r\n\r\n isReady: Subscribable\r\n hasMedia: Subscribable\r\n hasExternalContent: PureComputed\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) config: ChatEditorVMConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.effects) effects: EffectsContainer\r\n ) {\r\n const isAutoFocusEnabled = ko.flattenComputed(config.autofocus, false);\r\n const theme = ko.pureComputed(() => this.getTheme(config));\r\n const hasBackground = ko.flattenComputed(config.background, true);\r\n\r\n this.hasFocus(ko.unwrap(config.focus) ?? false);\r\n\r\n const quillWrapper = effects.register(new QuillWrapper({\r\n node: this.quillNode,\r\n placeholder: config.placeholder,\r\n bindings: config.bindings,\r\n formats: config.formats,\r\n blots: config.blots,\r\n\r\n onSelectionChange: range => {\r\n if (range)\r\n this.formatter.update();\r\n\r\n this.hasFocus(range != undefined);\r\n },\r\n\r\n onTextChange: quill => {\r\n if (this.hasFocus())\r\n this.formatter.update();\r\n\r\n const text = quill.getText();\r\n\r\n this.isEmpty(quill.getLength() === 1 && text === '\\n');\r\n this.hasText(text.trim().length > 0);\r\n this.changesCount.inc();\r\n }\r\n }));\r\n\r\n this.quill = quillWrapper.quill;\r\n this.formatter = new Formatter({ quill: quillWrapper.quill });\r\n this.toolbar = this.buildToolbar(config.toolbar);\r\n\r\n this.maxHeight = ko.pureComputed(() => {\r\n const target = ko.unwrap(config.maxHeight);\r\n\r\n if (target && target > 0)\r\n return target;\r\n });\r\n\r\n const leftToolbarTracker = new NodeTracker({ node: this.leftToolbarNode });\r\n\r\n const {\r\n width: leftToolbarWidth,\r\n height: leftToolbarHeight\r\n } = leftToolbarTracker;\r\n\r\n const rightToolbarTracker = new NodeTracker({ node: this.rightToolbarNode });\r\n\r\n const {\r\n width: rightToolbarWidth,\r\n height: rightToolbarHeight\r\n } = rightToolbarTracker;\r\n\r\n const {\r\n height: externalContentHeight\r\n } = new NodeTracker({ node: this.externalContentNode });\r\n\r\n this.hasExternalContent = ko.pureComputed(() => externalContentHeight() > 0);\r\n\r\n const toolbarSize = ko.pureComputed(() => _([leftToolbarHeight(), rightToolbarHeight()]).max());\r\n const isPinnedToolbar = ko.pureComputed(() => this.toolbar.left.isPinned() && this.toolbar.right.isPinned());\r\n const isAnimationAllowed = ko.observable(false);\r\n\r\n this.minHeight = toolbarSize;\r\n\r\n this.bodyPadding = ko.pureComputed(() => {\r\n if (isPinnedToolbar()) {\r\n const leftToolbarSize = leftToolbarWidth();\r\n const rightToolbarSize = rightToolbarWidth();\r\n\r\n return `0 ${rightToolbarSize}px 0 ${leftToolbarSize}px`;\r\n }\r\n }).extend({ deferred: true });\r\n\r\n this.bodyMargin = ko.pureComputed(() => {\r\n if (!isPinnedToolbar()) {\r\n if (this.toolbar.placement === 'top')\r\n return `${toolbarSize()}px 0 0 0`;\r\n else\r\n return `0 0 ${toolbarSize()}px 0`;\r\n }\r\n }).extend({ deferred: true });\r\n\r\n const extrasMargin = {\r\n left: ko.pureComputed(() => isPinnedToolbar() ? -leftToolbarWidth() : 0).extend({ deferred: true }),\r\n right: ko.pureComputed(() => isPinnedToolbar() ? -rightToolbarWidth() : 0).extend({ deferred: true })\r\n }\r\n\r\n this.content = ko.pureComputed(() => ko.ignoreDependencies((changesCount) => quillWrapper.getContent(), this, [this.changesCount()]));\r\n\r\n this.attachmentsGrid = {\r\n source: this.attachmentsAndUploads,\r\n columnWidth: 100,\r\n offset: 5,\r\n threshold: 50\r\n }\r\n\r\n this.isReady = ko.pureComputed(() => {\r\n return this.quill() != undefined &&\r\n this.leftToolbarNode() != undefined &&\r\n this.rightToolbarNode() != undefined;\r\n });\r\n\r\n this.hasMedia = ko.pureComputed(() => this.attachmentsAndUploads().length > 0);\r\n\r\n effects.register([\r\n this.imagesUploader.uploads.onArrayChange({ add: () => this.onUploadAdded() }),\r\n isPinnedToolbar.subscribe(() => isAnimationAllowed(true)),\r\n\r\n this.isReady.subscribe(() => {\r\n requestAnimationFrame(() => {\r\n leftToolbarTracker.update(true);\r\n rightToolbarTracker.update(true);\r\n });\r\n })\r\n ]);\r\n\r\n effects.register((quill, focusRequired) => {\r\n if (quill != undefined) {\r\n if (focusRequired && !quill.hasFocus())\r\n quill.focus();\r\n else if (!focusRequired && quill.hasFocus())\r\n quill.blur();\r\n }\r\n }, [this.quill, this.hasFocus]);\r\n\r\n effects.register(node => {\r\n if (node) {\r\n ko.applyBindingsToNode(node, {\r\n 'style': {\r\n 'margin-left': extrasMargin.left.toPx(),\r\n 'margin-right': extrasMargin.right.toPx()\r\n }\r\n }, this);\r\n }\r\n }, [this.extrasNode]);\r\n\r\n effects.register(new AutofocusManager({\r\n enable: isAutoFocusEnabled,\r\n focus: () => this.focus()\r\n })); \r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'css': {\r\n 'chat-editor': true,\r\n 'chat-editor--with-background': hasBackground,\r\n 'chat-editor--animated': isAnimationAllowed,\r\n 'chat-editor--compact': isPinnedToolbar,\r\n 'chat-editor--toolbar-top': this.toolbar.placement === 'top',\r\n 'chat-editor--toolbar-bottom': this.toolbar.placement === 'bottom'\r\n },\r\n\r\n 'attr': {\r\n 'translate': 'no'\r\n }\r\n });\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'css': `chat-editor--${theme()}-theme`\r\n });\r\n\r\n this.isReady.when().then(() => {\r\n if (config.init)\r\n config.init(this);\r\n });\r\n }\r\n\r\n pickImages = async () => {\r\n const files = await FilesHelpers.pickImages();\r\n this.uploadImages(files);\r\n }\r\n\r\n uploadImages(files: File[]) {\r\n files.forEach(file => {\r\n if (FilesHelpers.isImage(file))\r\n this.upload(file);\r\n })\r\n }\r\n\r\n removeAttachment = (attachment: any) => {\r\n this.attachments.remove(attachment);\r\n }\r\n\r\n setText = (content: string, focus = true) => {\r\n this.quill.invokeNotNull(quill => {\r\n quill.setText(content);\r\n\r\n if (focus) {\r\n quill.focus();\r\n quill.setSelection(quill.getLength(), 0);\r\n }\r\n\r\n quill.history.clear();\r\n });\r\n }\r\n\r\n setContent = (html: string, focus = true) => {\r\n html = html.replace(/[\\n\\r]/g, '
');\r\n\r\n this.quill.invokeNotNull(quill => {\r\n const delta = quill.clipboard.convert(html);\r\n\r\n quill.setContents(delta);\r\n\r\n if (focus) {\r\n quill.focus();\r\n quill.setSelection(quill.getLength(), 0);\r\n }\r\n\r\n quill.history.clear();\r\n });\r\n }\r\n\r\n insertEmoji = (emoji: EmojisPickerEmoji) => {\r\n this.quill.invokeNotNull(quill => {\r\n const selection = quill.getSelection(true);\r\n\r\n if (selection) {\r\n quill.deleteText(selection.index, selection.length);\r\n quill.insertEmbed(selection.index, 'wcc-emoji', emoji.unicode());\r\n quill.setSelection(selection.index + 1, 0);\r\n }\r\n });\r\n }\r\n\r\n insertBlot = (blot: IChatEditorBlot, value: any, onInsert?: (blot: IChatEditorBlot) => void) => {\r\n this.quill.invokeNotNull(quill => {\r\n const selection = quill.getSelection(true);\r\n\r\n if (selection) {\r\n quill.deleteText(selection.index, selection.length);\r\n const st = quill.insertEmbed(selection.index, blot.blotName, value);\r\n quill.setSelection(selection.index + 1, 0);\r\n \r\n //if(onInsert)\r\n // onInsert(blot);\r\n }\r\n });\r\n }\r\n\r\n enable = (enable: boolean) => {\r\n this.quill.invokeNotNull(quill => quill.enable(enable));\r\n }\r\n\r\n reset = (focus = true) => {\r\n this.imagesUploader.reset();\r\n this.attachments([]);\r\n this.setText('', focus);\r\n }\r\n\r\n clearHistory = () => {\r\n this.quill.invokeNotNull(quill => quill.history.clear());\r\n }\r\n\r\n focus = () => {\r\n this.quill.invokeNotNull(quill => {\r\n if (!this.hasFocus())\r\n quill.focus();\r\n });\r\n }\r\n\r\n blur = () => {\r\n this.quill.invokeNotNull(quill => {\r\n if (this.hasFocus())\r\n quill.blur();\r\n });\r\n }\r\n\r\n onToolsMouseUp = (m: any, e: JQueryEventObject) => {\r\n this.cancelEvent(e);\r\n }\r\n\r\n onToolsMouseDown = (m: any, e: JQueryEventObject) => {\r\n this.cancelEvent(e);\r\n } \r\n\r\n private async upload(file: File) {\r\n const wccImage = await this.imagesUploader.upload(file);\r\n\r\n if (wccImage != undefined)\r\n this.attachments.push(wccImage);\r\n }\r\n\r\n private scrollToAttachments() {\r\n var bodyNode = this.bodyNode(),\r\n attachmentsNode = this.attachmentsNode();\r\n\r\n if (bodyNode && attachmentsNode) {\r\n var bodyRect = bodyNode.getBoundingClientRect(),\r\n attachmentsRect = attachmentsNode.getBoundingClientRect();\r\n\r\n var bottom = attachmentsRect.bottom - bodyRect.top,\r\n top = bottom - attachmentsFocusAreaSize;\r\n\r\n if (top < 0 || top > attachmentsFocusAreaSize)\r\n $(bodyNode).animate({ scrollTop: bodyNode.scrollTop + top });\r\n }\r\n }\r\n\r\n private onUploadAdded() {\r\n requestAnimationFrame(() => this.scrollToAttachments());\r\n }\r\n\r\n private getTheme(config: ChatEditorVMConfig): ChatEditorVMTheme {\r\n if (ko.unwrap(config.noBorder) ?? false)\r\n return 'noborder';\r\n else\r\n return ko.unwrap(config.theme) ?? 'classic';\r\n }\r\n\r\n private buildToolbar(toolbarConfig?: ChatEditorToolbarConfig): ChatEditorToolbar {\r\n const left = this.buildToolbarSection(toolbarConfig?.left ?? []);\r\n const right = this.buildToolbarSection(toolbarConfig?.right ?? []);\r\n\r\n const placement = toolbarConfig?.placement ?? 'bottom';\r\n\r\n return { left, right, placement }\r\n }\r\n\r\n private buildToolbarSection(groupsConfig: Array): ChatEditorToolbarSection {\r\n const groups = groupsConfig.map(groupConfig => this.buildToolsGroup(groupConfig));\r\n\r\n const isVisible = ko.pureComputed(() => groups.length > 0 && groups.reduce((result, group) => result && group.isVisible(), true));\r\n const isPinned = ko.pureComputed(() => groups.reduce((result, group) => result && (!group.isVisible() || group.isPinned()), true));\r\n\r\n return { groups, isVisible, isPinned }\r\n }\r\n\r\n private buildToolsGroup(groupConfig?: ChatEditorToolsGroupConfig): ChatEditorToolsGroup {\r\n const toolsConfig = groupConfig?.tools;\r\n\r\n var tools: Array = [];\r\n\r\n if (_.isFunction(toolsConfig))\r\n tools = toolsConfig(this);\r\n else if (_.isArray(toolsConfig))\r\n tools = toolsConfig;\r\n\r\n const isVisible = ko.pureComputed(() => tools.some(tool => tool.isVisible()) && ko.unwrap(groupConfig?.isVisible ?? true));\r\n const isPinned = ko.observable(groupConfig?.isPinned).unwrap().default(false);\r\n const css = ko.observable(groupConfig?.css).unwrap().default('');\r\n\r\n return { tools, isVisible, isPinned, css }\r\n }\r\n\r\n private cancelEvent(e: JQueryEventObject) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n } \r\n}","import { SubscribableOrValue, Observable, PureComputed } from \"knockout\";\r\nimport { Quill, StringMap } from 'libraries/quill';\r\n\r\nconst defaultColor = 'rgb(0, 0, 0)';\r\n\r\ninterface FormattableConfig {\r\n quill?: SubscribableOrValue\r\n}\r\n\r\nexport class Formatter {\r\n #quill: PureComputed\r\n\r\n isBold: Observable = ko.observable(false as boolean)\r\n isItalic: Observable = ko.observable(false as boolean)\r\n isUnderlined: Observable = ko.observable(false as boolean)\r\n color: Observable = ko.observable(defaultColor)\r\n\r\n update = (focus: boolean = true) => {\r\n let range = this.#quill()?.getSelection(focus as any),\r\n formats: StringMap | undefined;\r\n\r\n if (range)\r\n formats = this.#quill()?.getFormat();\r\n\r\n this.isBold(formats?.bold === true);\r\n this.isItalic(formats?.italic === true);\r\n this.isUnderlined(formats?.underline === true);\r\n this.color(formats?.color ?? defaultColor);\r\n }\r\n\r\n toggleBold = () => {\r\n this.toggleFormat('bold');\r\n }\r\n\r\n toggleItalic = () => {\r\n this.toggleFormat('italic');\r\n }\r\n\r\n toggleUnderline = () => {\r\n this.toggleFormat('underline');\r\n }\r\n\r\n setColor = (value: string) => {\r\n this.#quill.invokeNotNull(quill => {\r\n quill.focus();\r\n quill.format('color', value === defaultColor ? undefined : value);\r\n });\r\n }\r\n\r\n constructor(config: FormattableConfig) {\r\n this.#quill = ko.observable(config.quill).unwrap();\r\n } \r\n\r\n private toggleFormat(type: string) {\r\n this.#quill.invokeNotNull(quill => {\r\n let formats = quill.getFormat();\r\n\r\n if (formats[type]) {\r\n quill.format(type, null);\r\n } else {\r\n quill.format(type, true);\r\n }\r\n });\r\n\r\n this.update();\r\n }\r\n}","import { DOMHelpers } from 'helpers/dom';\r\nimport { QuillBinding, QuillMatcher } from 'interfaces/quill';\r\nimport { Observable, SubscribableOrNullableValue, SubscribableOrValue } from 'knockout';\r\nimport { Quill, SelectionChangeHandler } from 'libraries/quill';\r\nimport { withEffects } from 'mixins/withEffects';\r\nimport QuillImageDropAndPaste from 'quill-image-drop-and-paste';\r\nimport { withEffect } from '../../../../mixins/withEffect';\r\nimport { ChatEditorEmojiBlot } from '../blots/emoji';\r\nimport { IChatEditorBlot, IChatEditorBlotInstance } from '../blots/iblot';\r\n\r\nQuill.register('modules/imageDropAndPaste', QuillImageDropAndPaste);\r\n\r\nconst defaultFormats: Array = [\r\n 'bold',\r\n 'italic',\r\n 'underline',\r\n 'color',\r\n 'wcc-emoji'\r\n]\r\n\r\nexport type QuillFormats = 'bold' | 'italic' | 'underline' | 'color' | 'wcc-emoji'\r\n\r\ninterface QuillWrapperConfig {\r\n node: SubscribableOrValue\r\n placeholder?: SubscribableOrNullableValue\r\n bindings?: StringMap\r\n blots?: Array\r\n formats?: Array\r\n onSelectionChange?: SelectionChangeHandler\r\n onTextChange?: (editor: Quill) => void\r\n}\r\n\r\nexport class QuillWrapper {\r\n private blots: Array\r\n quill: Observable = ko.observable()\r\n\r\n isReady = ko.pureComputed(() => this.quill() != undefined)\r\n\r\n dispose: Action\r\n\r\n constructor(config: QuillWrapperConfig) {\r\n const {\r\n node,\r\n onSelectionChange = _.noop,\r\n onTextChange = _.noop\r\n } = config;\r\n\r\n const allowedFormats = config.formats ?? defaultFormats;\r\n\r\n this.blots = config.blots ?? [];\r\n\r\n if (allowedFormats.includes('wcc-emoji'))\r\n this.blots.push(>ChatEditorEmojiBlot);\r\n\r\n const bindings = this.blots.reduce((bindings, blot) => ({ ...blot.bindings, ...bindings }), config.bindings);\r\n const matchers = this.blots.reduce((matchers, blot) => blot.matchers != undefined ? [...matchers, ...blot.matchers] : matchers, new Array());\r\n const blotsFormats = this.blots.map(blot => blot.blotName); \r\n\r\n const placeholder = ko.flattenComputed(config.placeholder, '');\r\n const formats: Array = _.uniq([...allowedFormats, ...blotsFormats]);\r\n\r\n this.blots.forEach(blot => Quill.register(`blots/${blot.blotName}`, blot, true));\r\n\r\n const effects = withEffects();\r\n\r\n effects.register(node => {\r\n if (node) {\r\n const quill = new Quill(node, {\r\n formats: formats,\r\n\r\n modules: {\r\n keyboard: { bindings: bindings },\r\n clipboard: { matchers: matchers },\r\n imageDropAndPaste: { handler: _.noop }\r\n } \r\n });\r\n\r\n quill.on('selection-change', onSelectionChange);\r\n quill.on('text-change', () => onTextChange(quill as Quill));\r\n\r\n this.quill(quill);\r\n\r\n return [\r\n withEffect(placeholder => {\r\n quill.root.dataset.placeholder = placeholder;\r\n }, [placeholder]),\r\n\r\n () => node.innerHTML = ''\r\n ]\r\n } \r\n\r\n this.quill(undefined);\r\n }, [node]);\r\n\r\n this.dispose = effects.dispose;\r\n } \r\n\r\n getContent = () => {\r\n return this.quill.invokeNotNull(quill => {\r\n const html = Array.from(quill.root.children)\r\n .filter(node => node.tagName.toLowerCase() === 'p')\r\n .reduce((result, node) => result + this.getNodeContent(node) + '\\n', '');\r\n\r\n return html.trim();\r\n }) ?? '';\r\n } \r\n\r\n private getNodeContent(node: Node): string {\r\n if (DOMHelpers.isHTMLElement(node)) {\r\n if (node.tagName.toLowerCase() === 'p')\r\n return Array.from(node.childNodes).reduce((result, node) => result + this.getNodeContent(node), '');\r\n\r\n if (node.tagName.toLowerCase() === 'br')\r\n return ''; // this will be replaced by '\\n' in the parent node\r\n\r\n const blotContent = this.blots.reduce((content, blot) => {\r\n if (content == undefined && this.isBlotMatch(node, blot)) {\r\n const instance = Quill.find(node);\r\n\r\n if (instance != undefined)\r\n return instance.toString();\r\n }\r\n\r\n return content;\r\n }, undefined);\r\n\r\n if (blotContent != undefined)\r\n return blotContent;\r\n\r\n return node.outerHTML;\r\n } else {\r\n switch (node.nodeType) {\r\n case Node.TEXT_NODE: return node.nodeValue ?? '';\r\n default: return '';\r\n }\r\n } \r\n }\r\n\r\n private isBlotMatch(node: Node, blot: IChatEditorBlot) {\r\n if (DOMHelpers.isHTMLElement(node)) {\r\n const tagName = blot.tagName.toLowerCase();\r\n const className = blot.className?.toLowerCase();\r\n\r\n return tagName == node.tagName.toLowerCase() &&\r\n (className == undefined || node.classList.contains(className));\r\n }\r\n\r\n return false;\r\n }\r\n}","define([\n \"!!../../../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./colorpicker.html\", \n \"!../../../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","import { injectable, inject } from 'inversify';\r\nimport { PureComputed, SubscribableOrValue } from 'knockout';\r\n\r\nimport { Tool, ToolVM, JSONTool } from '../tool';\r\n\r\nimport { wccModules } from 'enums/wccModules';\r\n\r\nimport './colorpicker.html';\r\n\r\ncomponents.preload('wcc-colorpicker');\r\n\r\ninterface JSONColorPickerTool extends JSONTool {\r\n color?: SubscribableOrValue\r\n\r\n pick?: (value: string) => void\r\n hide?: (value: string) => void\r\n}\r\n\r\nexport class ColorPickerTool extends Tool {\r\n component = 'chat-editor-colorpicker-tool'\r\n\r\n color: PureComputed\r\n\r\n pick: (value: string) => void\r\n hide: (value: string) => void\r\n\r\n constructor(jsonModel: JSONColorPickerTool) {\r\n super(jsonModel);\r\n\r\n this.color = ko.observable(jsonModel.color).unwrap();\r\n\r\n this.pick = jsonModel.pick ?? _.noop;\r\n this.hide = jsonModel.hide ?? _.noop;\r\n }\r\n}\r\n\r\n@injectable()\r\nexport default class ColorPickerToolVM extends ToolVM {\r\n icon: PureComputed\r\n color: PureComputed\r\n\r\n pick: (value: string) => void\r\n hide: (value: string) => void\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) model: ColorPickerTool,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo\r\n ) {\r\n super(model, info.element);\r\n\r\n this.icon = model.icon;\r\n this.color = model.color;\r\n this.pick = model.pick;\r\n this.hide = model.hide;\r\n }\r\n}","define([\n \"!!../../../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./emojis.html\", \n \"!../../../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","import EmojisPickerEmoji from 'components/emojisPicker/models/emoji';\r\nimport { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { PureComputed } from 'knockout';\r\nimport { JSONTool, Tool, ToolVM } from '../tool';\r\nimport './emojis.html';\r\n\r\ncomponents.preload('wcc-emojispicker');\r\n\r\ninterface JSONEmojisTool extends JSONTool {\r\n pick?: (emoji: EmojisPickerEmoji) => void\r\n}\r\n\r\nexport class EmojisTool extends Tool {\r\n component = 'chat-editor-emojis-tool'\r\n\r\n pick: (emoji: EmojisPickerEmoji) => void\r\n\r\n constructor(jsonModel: JSONEmojisTool) {\r\n super(jsonModel);\r\n\r\n this.pick = jsonModel.pick ?? _.noop;\r\n }\r\n}\r\n\r\n@injectable()\r\nexport default class EmojisToolVM extends ToolVM {\r\n icon: PureComputed\r\n pick: (emoji: EmojisPickerEmoji) => void\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) model: EmojisTool,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo\r\n ) {\r\n super(model, info.element);\r\n\r\n this.icon = model.icon;\r\n this.pick = model.pick;\r\n }\r\n}","define([\n \"!!../../../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./icon.html\", \n \"!../../../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","import { PureComputed } from 'knockout';\r\nimport { injectable, inject } from 'inversify';\r\n\r\nimport { Tool, ToolVM } from '../tool';\r\nimport { wccModules } from 'enums/wccModules';\r\n\r\nimport './icon.html';\r\n\r\nexport class IconTool extends Tool {\r\n component = 'chat-editor-icon-tool'\r\n}\r\n\r\n@injectable()\r\nexport default class IconToolVM extends ToolVM {\r\n icon: PureComputed\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) model: IconTool,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo\r\n ) {\r\n super(model, info.element);\r\n\r\n this.icon = ko.observable(model.icon).unwrap();\r\n }\r\n}","define([\n \"!!../../../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./select.html\", \n \"!../../../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","import { PureComputed } from 'knockout';\r\nimport { injectable, inject } from 'inversify';\r\nimport { SelectDropdown } from 'components/dropdowns/select/select';\r\nimport { Tool, JSONTool, ToolVM } from '../tool';\r\nimport { wccModules } from 'enums/wccModules';\r\n\r\nimport './select.html';\r\n\r\ncomponents.preload('wcc-select');\r\n\r\ninterface JSONSelectTool extends JSONTool {\r\n select: SelectDropdown\r\n}\r\n\r\nexport class SelectTool extends Tool {\r\n component = 'chat-editor-select-tool'\r\n\r\n select: SelectDropdown \r\n\r\n constructor(jsonModel: JSONSelectTool) {\r\n super(jsonModel);\r\n\r\n this.select = jsonModel.select;\r\n }\r\n}\r\n\r\n@injectable()\r\nexport default class SelectToolVM extends ToolVM {\r\n icon: PureComputed\r\n\r\n select: SelectDropdown\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) model: SelectTool,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo\r\n ) {\r\n super(model, info.element);\r\n\r\n this.select = model.select;\r\n this.icon = model.icon;\r\n }\r\n}","import { SubscribableOrValue, PureComputed } from \"knockout\";\r\nimport { injectable } from \"inversify\";\r\n\r\nexport interface JSONTool {\r\n action?: () => void\r\n icon?: SubscribableOrValue\r\n tooltip?: SubscribableOrValue\r\n css?: SubscribableOrValue\r\n\r\n isSpecial?: SubscribableOrValue\r\n isActive?: SubscribableOrValue\r\n isDisabled?: SubscribableOrValue\r\n isVisible?: SubscribableOrValue\r\n}\r\n\r\nexport class Tool {\r\n action: () => void\r\n icon: PureComputed\r\n tooltip: PureComputed\r\n css: PureComputed\r\n\r\n isSpecial: PureComputed\r\n isActive: PureComputed\r\n isDisabled: PureComputed\r\n isVisible: PureComputed\r\n\r\n constructor(jsonModel: JSONTool) {\r\n this.action = jsonModel.action ?? _.noop;\r\n this.icon = ko.observable(jsonModel.icon).unwrap();\r\n this.tooltip = ko.observable(jsonModel.tooltip).unwrap();\r\n this.css = ko.observable(jsonModel.css).unwrap();\r\n\r\n this.isSpecial = ko.observable(jsonModel.isSpecial).unwrap().default(false);\r\n this.isActive = ko.observable(jsonModel.isActive).unwrap().default(false);\r\n this.isDisabled = ko.observable(jsonModel.isDisabled).unwrap().default(false);\r\n this.isVisible = ko.observable(jsonModel.isVisible).unwrap().default(true);\r\n }\r\n}\r\n\r\n@injectable()\r\nexport class ToolVM {\r\n constructor(tool: Tool, node: Node) {\r\n var cTooltip = tool.tooltip,\r\n cCSS = tool.css;\r\n\r\n var cIsSpecial = tool.isSpecial,\r\n cIsActive = tool.isActive,\r\n cIsDisabled = tool.isDisabled,\r\n cIsVisible = tool.isVisible;\r\n\r\n ko.applyBindingsToNode(node, {\r\n 'click': tool.action,\r\n 'visible': cIsVisible,\r\n\r\n 'css': {\r\n 'chat-editor__tool': true,\r\n 'chat-editor__tool--active': cIsActive,\r\n 'chat-editor__tool--disabled': cIsDisabled,\r\n 'chat-editor__tool--special': cIsSpecial\r\n },\r\n\r\n 'tooltip': { message: cTooltip }\r\n }, this);\r\n\r\n ko.applyBindingsToNode(node, {\r\n 'css': cCSS\r\n }, this);\r\n }\r\n}","import { Observable, Subscribable } from \"knockout\";\r\n\r\nconst emojione = require('emojione');\r\n\r\nconst unicodePattern = /png\\/(.*?)\\.png/;\r\n\r\nexport interface EmojisPickerEmojiConfig {\r\n title?: string\r\n unicode: string\r\n}\r\n\r\nexport default class EmojisPickerEmoji {\r\n title: Observable\r\n unicode: Observable\r\n\r\n code: Subscribable\r\n url: Subscribable\r\n\r\n static fromURL(url: string) {\r\n const match = unicodePattern.exec(url);\r\n\r\n if (match != undefined)\r\n return new EmojisPickerEmoji({ unicode: match[1] });\r\n }\r\n\r\n constructor(data: EmojisPickerEmojiConfig) {\r\n this.title = ko.observable(data.title ?? '');\r\n this.unicode = ko.observable(data.unicode);\r\n\r\n this.code = this.unicode.pluck(unicode => _(emojione.emojioneList).findKey(codes => _(codes).contains(unicode)));\r\n this.url = this.unicode.pluck(unicode => `${settings.emojioneIconsURL}/${unicode}.png`);\r\n }\r\n}","import Quill, { DeltaStatic, KeyboardStatic, RangeStatic, StringMap, SelectionChangeHandler, TextChangeHandler } from 'quill';\r\n\r\nimport 'quill/dist/quill.core.css';\r\nimport 'quill/dist/quill.snow.css';\r\nimport 'quill/dist/quill.bubble.css';\r\n\r\nexport {\r\n Quill,\r\n DeltaStatic,\r\n KeyboardStatic,\r\n RangeStatic,\r\n StringMap,\r\n SelectionChangeHandler,\r\n TextChangeHandler\r\n}","import { DOMHelpers } from 'helpers/dom';\r\nimport { SubscribableOrNullableValue } from 'knockout';\r\nimport { withEffects } from 'mixins/withEffects';\r\n\r\nexport interface AutofocusManagerConfig {\r\n enable?: SubscribableOrNullableValue\r\n focus: Action\r\n}\r\n\r\nconst $document = $(document);\r\nconst staticEffects = withEffects();\r\n\r\nconst actions = ko.observableArray();\r\nconst isDocumentBlurred = ko.observable(false);\r\n\r\nconst hasActions = actions.any();\r\n\r\nfunction checkDocumentFocus() {\r\n const hasActiveInput = $(document.activeElement).is('input, textarea, [contenteditable=\"true\"]');\r\n\r\n isDocumentBlurred(!hasActiveInput);\r\n}\r\n\r\nstaticEffects.register(hasActions => {\r\n if (hasActions) {\r\n $document.on('focusin focusout', checkDocumentFocus);\r\n checkDocumentFocus();\r\n\r\n return () => {\r\n $document.off('focusin focusout', checkDocumentFocus);\r\n isDocumentBlurred(false);\r\n }\r\n }\r\n}, [hasActions]);\r\n\r\nstaticEffects.register((actions, isDocumentBlurred) => {\r\n const focusFunc = _(actions).last();\r\n\r\n if (focusFunc != undefined && isDocumentBlurred) {\r\n return DOMHelpers.onNodeEvent(document, 'keydown', e => {\r\n if (!e.ctrlKey && !e.altKey)\r\n focusFunc();\r\n });\r\n }\r\n}, [actions, isDocumentBlurred]);\r\n\r\nexport default class AutofocusManager {\r\n private effects = withEffects();\r\n\r\n constructor(config: AutofocusManagerConfig) {\r\n const isEnabled = ko.flattenComputed(config.enable, true);\r\n const focusFunc = config.focus;\r\n\r\n this.effects.register(isEnabled => {\r\n if (isEnabled) {\r\n actions.push(focusFunc);\r\n\r\n return () => actions.remove((func:Action) => func == focusFunc);\r\n }\r\n }, [isEnabled]);\r\n }\r\n\r\n dispose() {\r\n this.effects.dispose();\r\n }\r\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".chat-editor{position:relative;display:flex;flex-direction:column;min-height:0}.chat-editor.chat-editor--with-background .chat-editor__body{background-color:#fff}.chat-editor.chat-editor--animated .chat-editor__body-inner{transition:padding 250ms ease-in-out}.chat-editor.chat-editor--animated .chat-editor__body-content{transition:padding 250ms ease-in-out}.chat-editor.chat-editor--animated .chat-editor__extras{transition:margin 250ms ease-in-out}.chat-editor.chat-editor--animated .chat-editor__quill .ql-editor{transition:padding 250ms ease-in-out}.chat-editor.chat-editor--theme-dashed .chat-editor__body{border:none;border-bottom:1px dashed #7a7a7a;border-radius:0}.chat-editor.chat-editor--noborder-theme .chat-editor__body{border:none;border-radius:0}.chat-editor.chat-editor--noborder-theme .chat-editor__quill .ql-editor.ql-blank:before{left:15px}.chat-editor.chat-editor--noborder-theme.chat-editor--compact.chat-editor--toolbar-top .chat-editor__quill .ql-editor,.chat-editor.chat-editor--noborder-theme.chat-editor--compact.chat-editor--toolbar-bottom .chat-editor__quill .ql-editor{padding:15px}.chat-editor.chat-editor--noborder-theme.chat-editor--toolbar-top .chat-editor__quill .ql-editor{padding:6px 15px 15px}.chat-editor.chat-editor--noborder-theme.chat-editor--toolbar-bottom .chat-editor__quill .ql-editor{padding:15px 15px 6px}.chat-editor.chat-editor--round-theme .chat-editor__body{border:none;border-radius:4px}.chat-editor.chat-editor--round-theme .chat-editor__quill .ql-editor.ql-blank:before{left:6px}.chat-editor.chat-editor--round-theme.chat-editor--compact.chat-editor--toolbar-top .chat-editor__quill .ql-editor,.chat-editor.chat-editor--round-theme.chat-editor--compact.chat-editor--toolbar-bottom .chat-editor__quill .ql-editor{padding:6px}.chat-editor.chat-editor--round-theme.chat-editor--toolbar-top .chat-editor__quill .ql-editor{padding:6px 6px 6px}.chat-editor.chat-editor--round-theme.chat-editor--toolbar-bottom .chat-editor__quill .ql-editor{padding:6px 6px 6px}.chat-editor.chat-editor--compact .chat-editor__body-content:after{border:none !important}.chat-editor.chat-editor--compact .chat-editor--toolbar-top .chat-editor__tools__left,.chat-editor.chat-editor--compact .chat-editor--toolbar-top .chat-editor__tools__right{top:2px}.chat-editor.chat-editor--compact .chat-editor--toolbar-bottom .chat-editor__tools__left,.chat-editor.chat-editor--compact .chat-editor--toolbar-bottom .chat-editor__tools__right{bottom:2px}.chat-editor.chat-editor--compact.chat-editor--toolbar-top .chat-editor__quill-wrapper,.chat-editor.chat-editor--compact.chat-editor--toolbar-bottom .chat-editor__quill-wrapper{padding:0}.chat-editor.chat-editor--compact.chat-editor--toolbar-top .chat-editor__quill .ql-editor,.chat-editor.chat-editor--compact.chat-editor--toolbar-bottom .chat-editor__quill .ql-editor{padding:4px 8px}.chat-editor.chat-editor--toolbar-top .chat-editor__body-content:after{content:\\\" \\\";position:absolute;top:0;left:5px;right:5px;border-top:1px solid #e0e0e0}.chat-editor.chat-editor--toolbar-top .chat-editor__quill-wrapper{padding:0 0 6px}.chat-editor.chat-editor--toolbar-top .chat-editor__quill .ql-editor{padding:6px 8px 4px}.chat-editor.chat-editor--toolbar-top .chat-editor__tools__left{top:1px;left:0}.chat-editor.chat-editor--toolbar-top .chat-editor__tools__right{top:1px;right:0}.chat-editor.chat-editor--toolbar-bottom .chat-editor__body-content:after{content:\\\" \\\";position:absolute;bottom:0;left:5px;right:5px;border-bottom:1px solid #e0e0e0}.chat-editor.chat-editor--toolbar-bottom .chat-editor__quill-wrapper{padding:6px 0 0}.chat-editor.chat-editor--toolbar-bottom .chat-editor__quill .ql-editor{padding:4px 8px 6px}.chat-editor.chat-editor--toolbar-bottom .chat-editor__tools__left{bottom:1px;left:0}.chat-editor.chat-editor--toolbar-bottom .chat-editor__tools__right{bottom:1px;right:0}.chat-editor__body{display:flex;flex-direction:column;min-height:0;border:1px solid #c6c6c6;border-radius:3px}.chat-editor__body-inner{display:flex;flex-direction:column;min-height:0;position:relative}.chat-editor__body-content{position:relative;overflow:auto}.chat-editor__external-content--has-content{margin:7px}.chat-editor__attachments{margin:7px}.chat-editor__quill-wrapper{display:flex;flex-direction:column;justify-content:center}.chat-editor__quill .ql-editor{font-family:\\\"Roboto\\\",sans-serif}.chat-editor__quill .ql-editor.ql-blank:before{left:8px;white-space:nowrap}.chat-editor__tools__left{position:absolute;display:flex;align-items:center}.chat-editor__tools__right{position:absolute}.chat-editor__tools{flex-shrink:0;display:flex;align-items:flex-end}.chat-editor__tools .tooltip-inner{white-space:nowrap}.chat-editor__tools__group{position:relative;display:flex;align-items:center;padding:3px 6px;animation-duration:250ms}.chat-editor__tools__group:after{position:absolute;top:50%;width:1px;height:65%;transform:translateY(-50%);background-color:#e0e0e0;content:\\\"\\\"}.chat-editor__tools__left .chat-editor__tools__group:after{right:0}.chat-editor__tools__right .chat-editor__tools__group:after{left:0}.chat-editor__tool{color:#7a7a7a;font-size:12px;border-radius:4px;background-color:rgba(92,162,221,0);transition:background-color 150ms ease-in-out,color 150ms ease-in-out;animation-duration:250ms}.chat-editor__tool .wcc-colorpicker,.chat-editor__tool .wcc-emojispicker,.chat-editor__tool .wcc-dropdown{display:flex}.chat-editor__tool .dropdown-menu{max-width:600px;max-height:calc(100vh - 210px);overflow:auto}.chat-editor__tool .dropdown-menu>li>a{text-overflow:ellipsis;overflow:hidden}.chat-editor__tool:hover:not(.chat-editor__tool--disabled){background-color:#e0e0e0}.chat-editor__tool--special:not(.chat-editor__tool--disabled):hover{background-color:#5ca2dd;color:#fff}.chat-editor__tool--active{color:#5ca2dd}.chat-editor__tool--disabled{opacity:.5}.chat-editor__tool--disabled .chat-editor__tool__icon{cursor:default}.chat-editor__tool__icon{position:relative;display:flex;justify-content:center;align-items:center;min-width:28px;height:26px;padding:5px;cursor:pointer}.chat-editor__tool__icon.fa-language{font-size:24px}.chat-editor__tool__icon.fa-angle-double-right,.chat-editor__tool__icon.fa-arrow-alt-to-bottom{font-size:18px}.chat-editor__tool__icon.fa-image{font-size:18px}.chat-editor__tool__icon.fa-clipboard-list{top:-1px;font-size:18px;padding:0}.chat-editor__tool__icon.fa-smile,.chat-editor__tool__icon.fa-at,.chat-editor__tool__icon.fa-pencil-ruler{font-size:16px}.chat-editor__tool__icon.fa-paper-plane{font-size:14px}.chat-editor__tool__icon.fa-underline{top:1px}.chat-editor__tool__icon.fa-paint-brush{font-size:14px}.chat-editor__tool__icon.fa-list-ol{font-size:13px}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;","// Module\nvar code = \"\";\n// Exports\nmodule.exports = code;","var utils = {\r\n /* generate a filename\r\n */\r\n generateFilename() {\r\n return btoa(String(Math.random() * 1e6) + String(+new Date())).replace('=', '');\r\n },\r\n /* detect the giving url is a image\r\n */\r\n urlIsImage(url, abortTimeout = 3000) {\r\n if (!this.validURL(url)) {\r\n return Promise.reject(false);\r\n }\r\n if (/\\.(jpeg|jpg|gif|png|webp|tiff|bmp)$/.test(url)) {\r\n return Promise.resolve(true);\r\n }\r\n return new Promise((resolve, reject) => {\r\n let timer = undefined;\r\n const img = new Image();\r\n img.onerror = img.onabort = () => {\r\n clearTimeout(timer);\r\n reject(false);\r\n };\r\n img.onload = () => {\r\n clearTimeout(timer);\r\n resolve(true);\r\n };\r\n timer = setTimeout(() => {\r\n img.src = '//!/an/invalid.jpg';\r\n reject(false);\r\n }, abortTimeout);\r\n img.src = url;\r\n });\r\n },\r\n /* check string is a valid url\r\n */\r\n validURL(str) {\r\n try {\r\n return Boolean(new URL(str));\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n },\r\n /* check the giving string is a html text\r\n */\r\n isRichText(clipboardDataItems) {\r\n let isHtml = false;\r\n Array.prototype.forEach.call(clipboardDataItems, (item) => {\r\n if (item.type.match(/^text\\/html$/i)) {\r\n isHtml = true;\r\n }\r\n });\r\n return isHtml;\r\n },\r\n /* resolve dataUrl to base64 string\r\n */\r\n resolveDataUrl(dataUrl) {\r\n let str = '';\r\n if (typeof dataUrl === 'string') {\r\n str = dataUrl;\r\n }\r\n else if (dataUrl instanceof ArrayBuffer) {\r\n str = this.arrayBufferToBase64Url(dataUrl);\r\n }\r\n return str;\r\n },\r\n /* generate array buffer from binary string\r\n */\r\n binaryStringToArrayBuffer(binary) {\r\n const len = binary.length;\r\n const buffer = new ArrayBuffer(len);\r\n const arr = new Uint8Array(buffer);\r\n let i = -1;\r\n while (++i < len)\r\n arr[i] = binary.charCodeAt(i);\r\n return buffer;\r\n },\r\n /* generate base64 string from array buffer\r\n */\r\n arrayBufferToBase64Url(arrayBuffer) {\r\n return btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));\r\n },\r\n /* copy text - make text store in the clipboard\r\n */\r\n copyText(content, target = document.body) {\r\n const element = document.createElement('textarea');\r\n const previouslyFocusedElement = document.activeElement;\r\n element.value = content;\r\n // Prevent keyboard from showing on mobile\r\n element.setAttribute('readonly', '');\r\n element.style.position = 'absolute';\r\n element.style.left = '-9999px';\r\n element.style.fontSize = '12pt'; // Prevent zooming on iOS\r\n const selection = document.getSelection();\r\n let originalRange = false;\r\n if (selection && selection.rangeCount > 0) {\r\n originalRange = selection.getRangeAt(0);\r\n }\r\n target.append(element);\r\n element.select();\r\n // Explicit selection workaround for iOS\r\n element.selectionStart = 0;\r\n element.selectionEnd = content.length;\r\n let isSuccess = false;\r\n try {\r\n isSuccess = document.execCommand('copy');\r\n }\r\n catch (_a) { }\r\n element.remove();\r\n if (selection && originalRange) {\r\n selection.removeAllRanges();\r\n selection.addRange(originalRange);\r\n }\r\n // Get the focus back on the previously focused element, if any\r\n if (previouslyFocusedElement) {\r\n previouslyFocusedElement.focus();\r\n }\r\n return isSuccess;\r\n },\r\n /* check the type of specify target\r\n */\r\n isType(target, type) {\r\n return Object.prototype.toString.call(target) === `[object ${type}]`;\r\n },\r\n};\n\nclass QuillImageData {\r\n constructor(dataUrl, type, name) {\r\n this.dataUrl = dataUrl;\r\n this.type = type;\r\n this.name = name || '';\r\n }\r\n}\r\nclass ImageData extends QuillImageData {\r\n constructor(dataUrl, type, name) {\r\n super(dataUrl, type, name);\r\n this.dataUrl = dataUrl;\r\n this.type = type;\r\n this.name = name || `${utils.generateFilename()}.${this.getSuffix()}`;\r\n }\r\n /* minify the image\r\n */\r\n minify(option) {\r\n return new Promise((resolve, reject) => {\r\n const maxWidth = option.maxWidth || 800;\r\n const maxHeight = option.maxHeight || 800;\r\n const quality = option.quality || 0.8;\r\n if (!this.dataUrl) {\r\n return reject({\r\n message: '[error] QuillImageDropAndPaste: Fail to minify the image, dataUrl should not be empty.',\r\n });\r\n }\r\n const image = new Image();\r\n image.onload = () => {\r\n const width = image.width;\r\n const height = image.height;\r\n if (width > height) {\r\n if (width > maxWidth) {\r\n image.height = (height * maxWidth) / width;\r\n image.width = maxWidth;\r\n }\r\n }\r\n else {\r\n if (height > maxHeight) {\r\n image.width = (width * maxHeight) / height;\r\n image.height = maxHeight;\r\n }\r\n }\r\n const canvas = document.createElement('canvas');\r\n canvas.width = image.width;\r\n canvas.height = image.height;\r\n const ctx = canvas.getContext('2d');\r\n if (ctx) {\r\n ctx.drawImage(image, 0, 0, image.width, image.height);\r\n const canvasType = this.type || 'image/png';\r\n const canvasDataUrl = canvas.toDataURL(canvasType, quality);\r\n resolve(new ImageData(canvasDataUrl, canvasType, this.name));\r\n }\r\n else {\r\n reject({\r\n message: '[error] QuillImageDropAndPaste: Fail to minify the image, create canvas context failure.',\r\n });\r\n }\r\n };\r\n image.src = utils.resolveDataUrl(this.dataUrl);\r\n });\r\n }\r\n /* convert blob to file\r\n */\r\n toFile(filename) {\r\n filename = filename || this.name;\r\n if (!window.File) {\r\n console.error('[error] QuillImageDropAndPaste: Your browser didnot support File API.');\r\n return null;\r\n }\r\n return new File([this.toBlob()], filename, { type: this.type });\r\n }\r\n /* convert dataURL to blob\r\n */\r\n toBlob() {\r\n const base64 = utils.resolveDataUrl(this.dataUrl).replace(/^[^,]+,/, '');\r\n const buff = utils.binaryStringToArrayBuffer(atob(base64));\r\n return this.createBlob([buff], { type: this.type });\r\n }\r\n /* create blob\r\n */\r\n createBlob(parts, properties) {\r\n if (!properties)\r\n properties = {};\r\n if (typeof properties === 'string')\r\n properties = { type: properties };\r\n try {\r\n return new Blob(parts, properties);\r\n }\r\n catch (e) {\r\n if (e.name !== 'TypeError')\r\n throw e;\r\n const Builder = 'BlobBuilder' in window\r\n ? window.BlobBuilder\r\n : 'MSBlobBuilder' in window\r\n ? window.MSBlobBuilder\r\n : 'MozBlobBuilder' in window\r\n ? window.MozBlobBuilder\r\n : window.WebKitBlobBuilder;\r\n const builder = new Builder();\r\n for (let i = 0; i < parts.length; i++)\r\n builder.append(parts[i]);\r\n return builder.getBlob(properties.type);\r\n }\r\n }\r\n getSuffix() {\r\n const matched = this.type.match(/^image\\/(\\w+)$/);\r\n const suffix = matched ? matched[1] : 'png';\r\n return suffix;\r\n }\r\n}\n\nclass QuillImageDropAndPaste {\r\n constructor(quill, option) {\r\n this.quill = quill;\r\n this.option = option;\r\n }\r\n}\r\nclass ImageDropAndPaste extends QuillImageDropAndPaste {\r\n constructor(quill, option) {\r\n super(quill, option);\r\n this.quill = quill;\r\n this.option = option;\r\n this.handleDrop = this.handleDrop.bind(this);\r\n this.handlePaste = this.handlePaste.bind(this);\r\n this.insert = this.insert.bind(this);\r\n this.quill.root.addEventListener('drop', this.handleDrop, false);\r\n this.quill.root.addEventListener('paste', this.handlePaste, false);\r\n }\r\n /* handle image drop event\r\n */\r\n handleDrop(e) {\r\n e.preventDefault();\r\n if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length) {\r\n if (document.caretRangeFromPoint) {\r\n const selection = document.getSelection();\r\n const range = document.caretRangeFromPoint(e.clientX, e.clientY);\r\n if (selection && range) {\r\n selection.setBaseAndExtent(range.startContainer, range.startOffset, range.startContainer, range.startOffset);\r\n }\r\n }\r\n this.readFiles(e.dataTransfer.files, (dataUrl, type = 'image/png', name) => {\r\n if (typeof this.option.handler === 'function') {\r\n this.option.handler.call(this, dataUrl, type, new ImageData(dataUrl, type, name));\r\n }\r\n else {\r\n this.insert.call(this, utils.resolveDataUrl(dataUrl), type);\r\n }\r\n }, e);\r\n }\r\n }\r\n /* handle image paste event\r\n */\r\n handlePaste(e) {\r\n if (e.clipboardData && e.clipboardData.items && e.clipboardData.items.length) {\r\n if (utils.isRichText(e.clipboardData.items))\r\n return;\r\n this.readFiles(e.clipboardData.items, (dataUrl, type = 'image/png') => {\r\n if (typeof this.option.handler === 'function') {\r\n this.option.handler.call(this, dataUrl, type, new ImageData(dataUrl, type));\r\n }\r\n else {\r\n this.insert(utils.resolveDataUrl(dataUrl), 'image');\r\n }\r\n }, e);\r\n }\r\n }\r\n /* read the files\r\n */\r\n readFiles(files, callback, e) {\r\n Array.prototype.forEach.call(files, (file) => {\r\n if (utils.isType(file, 'DataTransferItem')) {\r\n this.handleDataTransfer(file, callback, e);\r\n }\r\n else if (file instanceof File) {\r\n this.handleDroppedFile(file, callback, e);\r\n }\r\n });\r\n }\r\n /* handle the pasted data\r\n */\r\n handleDataTransfer(file, callback, e) {\r\n const that = this;\r\n const { type } = file;\r\n if (type.match(/^image\\/(gif|jpe?g|a?png|svg|webp|bmp)/i)) {\r\n e.preventDefault();\r\n const reader = new FileReader();\r\n reader.onload = (e) => {\r\n if (e.target && e.target.result) {\r\n callback(e.target.result, type);\r\n }\r\n };\r\n const blob = file.getAsFile ? file.getAsFile() : file;\r\n if (blob instanceof Blob)\r\n reader.readAsDataURL(blob);\r\n }\r\n else if (type.match(/^text\\/plain$/i)) {\r\n e.preventDefault();\r\n file.getAsString((s) => {\r\n utils\r\n .urlIsImage(s)\r\n .then(() => {\r\n that.insert(s, 'image');\r\n })\r\n .catch(() => {\r\n that.insert(s, 'text');\r\n });\r\n });\r\n }\r\n }\r\n /* handle the dropped data\r\n */\r\n handleDroppedFile(file, callback, e) {\r\n const { type, name = '' } = file;\r\n if (type.match(/^image\\/(gif|jpe?g|a?png|svg|webp|bmp)/i)) {\r\n e.preventDefault();\r\n const reader = new FileReader();\r\n reader.onload = (e) => {\r\n if (e.target && e.target.result) {\r\n callback(e.target.result, type, name);\r\n }\r\n };\r\n reader.readAsDataURL(file);\r\n }\r\n }\r\n /* insert into the editor\r\n */\r\n insert(content, type) {\r\n let index = (this.quill.getSelection(true) || {}).index;\r\n if (index === undefined || index < 0)\r\n index = this.quill.getLength();\r\n let _index;\r\n if (type === 'image') {\r\n _index = index + 1;\r\n this.quill.insertEmbed(index, type, content, 'user');\r\n }\r\n else if (type === 'text') {\r\n _index = index + content.length;\r\n this.quill.insertText(index, content, 'user');\r\n }\r\n setTimeout(() => {\r\n this.quill.setSelection(_index);\r\n });\r\n }\r\n}\r\nImageDropAndPaste.ImageData = ImageData;\r\nwindow.QuillImageDropAndPaste = ImageDropAndPaste;\r\nif ('Quill' in window) {\r\n window.Quill.register('modules/imageDropAndPaste', ImageDropAndPaste);\r\n}\n\nexport { ImageData, ImageDropAndPaste as default };\n"],"sourceRoot":""}