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,gBAE1BW,GACFM,EAAQxN,KAAKwE,KAAKC,QAAQ6H,kBAG5B,MAAMmB,EAAa,SAAgBtQ,EAAKA,EAAMD,EAAKI,SAAU,CAC3DoQ,MAAOF,EAAQG,KAAK,KACpB,kBAAyD,oBAA/BnJ,KAAKC,QAAQ+H,cAA+BhI,KAAKC,QAAQ+H,cAActP,GAAQsH,KAAKC,QAAQ+H,gBAExHG,EAAY3M,KAAKyN,EACnB,CAEA,OAAO,CAAK,IAEP,YAAqBzQ,EAAK2P,GAAY,KAIrD,E","sources":["webpack://ida-jandaya/./node_modules/tiptap-commands/dist/commands.esm.js","webpack://ida-jandaya/./node_modules/tiptap-extensions/dist/extensions.esm.js"],"sourcesContent":["\n /*!\n * tiptap-commands v1.17.0\n * (c) 2021 überdosis GbR (limited liability)\n * @license MIT\n */\n \nimport { setBlockType, lift, wrapIn } from 'prosemirror-commands';\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, setBlockType, splitBlock, splitBlockKeepMarks, toggleMark, wrapIn } from 'prosemirror-commands';\nimport { liftListItem, wrapInList } from 'prosemirror-schema-list';\nexport { addListNodes, liftListItem, sinkListItem, splitListItem, wrapInList } from 'prosemirror-schema-list';\nimport { InputRule } from 'prosemirror-inputrules';\nexport { textblockTypeInputRule, wrappingInputRule } from 'prosemirror-inputrules';\nimport { Plugin } from 'prosemirror-state';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { getMarkRange, nodeIsActive, findParentNode } from 'tiptap-utils';\n\nfunction insertText (text = '') {\n return (state, dispatch) => {\n const {\n $from\n } = state.selection;\n const {\n pos\n } = $from.pos;\n dispatch(state.tr.insertText(text, pos));\n return true;\n };\n}\n\nfunction getMarksBetween(start, end, state) {\n let marks = [];\n state.doc.nodesBetween(start, end, (node, pos) => {\n marks = [...marks, ...node.marks.map(mark => ({\n start: pos,\n end: pos + node.nodeSize,\n mark\n }))];\n });\n return marks;\n}\n\nfunction markInputRule (regexp, markType, getAttrs) {\n return new InputRule(regexp, (state, match, start, end) => {\n const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n const {\n tr\n } = state;\n const m = match.length - 1;\n let markEnd = end;\n let markStart = start;\n\n if (match[m]) {\n const matchStart = start + match[0].indexOf(match[m - 1]);\n const matchEnd = matchStart + match[m - 1].length - 1;\n const textStart = matchStart + match[m - 1].lastIndexOf(match[m]);\n const textEnd = textStart + match[m].length;\n const excludedMarks = getMarksBetween(start, end, state).filter(item => {\n const {\n excluded\n } = item.mark.type;\n return excluded.find(type => type.name === markType.name);\n }).filter(item => item.end > matchStart);\n\n if (excludedMarks.length) {\n return false;\n }\n\n if (textEnd < matchEnd) {\n tr.delete(textEnd, matchEnd);\n }\n\n if (textStart > matchStart) {\n tr.delete(matchStart, textStart);\n }\n\n markStart = matchStart;\n markEnd = markStart + match[m].length;\n }\n\n tr.addMark(markStart, markEnd, markType.create(attrs));\n tr.removeStoredMark(markType);\n return tr;\n });\n}\n\nfunction nodeInputRule (regexp, type, getAttrs) {\n return new InputRule(regexp, (state, match, start, end) => {\n const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n const {\n tr\n } = state;\n\n if (match[0]) {\n tr.replaceWith(start - 1, end, type.create(attrs));\n }\n\n return tr;\n });\n}\n\nfunction pasteRule (regexp, type, getAttrs) {\n const handler = fragment => {\n const nodes = [];\n fragment.forEach(child => {\n if (child.isText) {\n const {\n text\n } = child;\n let pos = 0;\n let match;\n\n do {\n match = regexp.exec(text);\n\n if (match) {\n const start = match.index;\n const end = start + match[0].length;\n const attrs = getAttrs instanceof Function ? getAttrs(match[0]) : getAttrs;\n\n if (start > 0) {\n nodes.push(child.cut(pos, start));\n }\n\n nodes.push(child.cut(start, end).mark(type.create(attrs).addToSet(child.marks)));\n pos = end;\n }\n } while (match);\n\n if (pos < text.length) {\n nodes.push(child.cut(pos));\n }\n } else {\n nodes.push(child.copy(handler(child.content)));\n }\n });\n return Fragment.fromArray(nodes);\n };\n\n return new Plugin({\n props: {\n transformPasted: slice => new Slice(handler(slice.content), slice.openStart, slice.openEnd)\n }\n });\n}\n\nfunction markPasteRule (regexp, type, getAttrs) {\n const handler = (fragment, parent) => {\n const nodes = [];\n fragment.forEach(child => {\n if (child.isText) {\n const {\n text,\n marks\n } = child;\n let pos = 0;\n let match;\n const isLink = !!marks.filter(x => x.type.name === 'link')[0]; // eslint-disable-next-line\n\n while (!isLink && (match = regexp.exec(text)) !== null) {\n if (parent && parent.type.allowsMarkType(type) && match[1]) {\n const start = match.index;\n const end = start + match[0].length;\n const textStart = start + match[0].indexOf(match[1]);\n const textEnd = textStart + match[1].length;\n const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs; // adding text before markdown to nodes\n\n if (start > 0) {\n nodes.push(child.cut(pos, start));\n } // adding the markdown part to nodes\n\n\n nodes.push(child.cut(textStart, textEnd).mark(type.create(attrs).addToSet(child.marks)));\n pos = end;\n }\n } // adding rest of text to nodes\n\n\n if (pos < text.length) {\n nodes.push(child.cut(pos));\n }\n } else {\n nodes.push(child.copy(handler(child.content, child)));\n }\n });\n return Fragment.fromArray(nodes);\n };\n\n return new Plugin({\n props: {\n transformPasted: slice => new Slice(handler(slice.content), slice.openStart, slice.openEnd)\n }\n });\n}\n\nfunction removeMark (type) {\n return (state, dispatch) => {\n const {\n tr,\n selection\n } = state;\n let {\n from,\n to\n } = selection;\n const {\n $from,\n empty\n } = selection;\n\n if (empty) {\n const range = getMarkRange($from, type);\n from = range.from;\n to = range.to;\n }\n\n tr.removeMark(from, to, type);\n return dispatch(tr);\n };\n}\n\nfunction replaceText (range = null, type, attrs = {}, fragment = Fragment.empty) {\n return (state, dispatch) => {\n const {\n $from,\n $to\n } = state.selection;\n const index = $from.index();\n const from = range ? range.from : $from.pos;\n const to = range ? range.to : $to.pos;\n\n if (!$from.parent.canReplaceWith(index, index, type)) {\n return false;\n }\n\n if (dispatch) {\n dispatch(state.tr.replaceWith(from, to, type.create(attrs, fragment)));\n }\n\n return true;\n };\n}\n\nfunction setInlineBlockType (type, attrs = {}) {\n return (state, dispatch) => {\n const {\n $from\n } = state.selection;\n const index = $from.index();\n\n if (!$from.parent.canReplaceWith(index, index, type)) {\n return false;\n }\n\n if (dispatch) {\n dispatch(state.tr.replaceSelectionWith(type.create(attrs)));\n }\n\n return true;\n };\n}\n\n// see https://github.com/ProseMirror/prosemirror-transform/blob/main/src/structure.js\n// Since this piece of code was \"borrowed\" from prosemirror, ESLint rules are ignored.\n\n/* eslint-disable max-len, no-plusplus, no-undef, eqeqeq */\n\nfunction canSplit(doc, pos, depth = 1, typesAfter) {\n const $pos = doc.resolve(pos);\n const base = $pos.depth - depth;\n const innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;\n\n for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n const node = $pos.node(d);\n const index = $pos.index(d);\n if (node.type.spec.isolating) return false;\n let rest = node.content.cutByIndex(index, node.childCount);\n const after = typesAfter && typesAfter[i] || node;\n if (after != node) rest = rest.replaceChild(0, after.type.create(after.attrs));\n /* Change starts from here */\n // if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest))\n // return false\n\n if (!node.canReplace(index + 1, node.childCount)) return false;\n /* Change ends here */\n }\n\n const index = $pos.indexAfter(base);\n const baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);\n} // this is a copy of splitListItem\n// see https://github.com/ProseMirror/prosemirror-schema-list/blob/main/src/schema-list.js\n\n\nfunction splitToDefaultListItem(itemType) {\n return function (state, dispatch) {\n const {\n $from,\n $to,\n node\n } = state.selection;\n if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;\n const grandParent = $from.node(-1);\n if (grandParent.type != itemType) return false;\n\n if ($from.parent.content.size == 0) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 2 || $from.node(-3).type != itemType || $from.index(-2) != $from.node(-2).childCount - 1) return false;\n\n if (dispatch) {\n let wrap = Fragment.empty;\n const keepItem = $from.index(-1) > 0; // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n\n for (let d = $from.depth - (keepItem ? 1 : 2); d >= $from.depth - 3; d--) wrap = Fragment.from($from.node(d).copy(wrap)); // Add a second list item with an empty default start node\n\n\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n const tr = state.tr.replace($from.before(keepItem ? null : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));\n tr.setSelection(state.selection.constructor.near(tr.doc.resolve($from.pos + (keepItem ? 3 : 2))));\n dispatch(tr.scrollIntoView());\n }\n\n return true;\n }\n\n const nextType = $to.pos == $from.end() ? grandParent.contentMatchAt($from.indexAfter(-1)).defaultType : null;\n const tr = state.tr.delete($from.pos, $to.pos);\n /* Change starts from here */\n // let types = nextType && [null, {type: nextType}]\n\n let types = nextType && [{\n type: itemType\n }, {\n type: nextType\n }];\n if (!types) types = [{\n type: itemType\n }, null];\n /* Change ends here */\n\n if (!canSplit(tr.doc, $from.pos, 2, types)) return false;\n if (dispatch) dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n return true;\n };\n}\n/* eslint-enable max-len, no-plusplus, no-undef, eqeqeq */\n\nfunction toggleBlockType (type, toggletype, attrs = {}) {\n return (state, dispatch, view) => {\n const isActive = nodeIsActive(state, type, attrs);\n\n if (isActive) {\n return setBlockType(toggletype)(state, dispatch, view);\n }\n\n return setBlockType(type, attrs)(state, dispatch, view);\n };\n}\n\nfunction isList(node, schema) {\n return node.type === schema.nodes.bullet_list || node.type === schema.nodes.ordered_list || node.type === schema.nodes.todo_list;\n}\n\nfunction toggleList(listType, itemType) {\n return (state, dispatch, view) => {\n const {\n schema,\n selection\n } = state;\n const {\n $from,\n $to\n } = selection;\n const range = $from.blockRange($to);\n\n if (!range) {\n return false;\n }\n\n const parentList = findParentNode(node => isList(node, schema))(selection);\n\n if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {\n if (parentList.node.type === listType) {\n return liftListItem(itemType)(state, dispatch, view);\n }\n\n if (isList(parentList.node, schema) && listType.validContent(parentList.node.content)) {\n const {\n tr\n } = state;\n tr.setNodeMarkup(parentList.pos, listType);\n\n if (dispatch) {\n dispatch(tr);\n }\n\n return false;\n }\n }\n\n return wrapInList(listType)(state, dispatch, view);\n };\n}\n\nfunction toggleWrap (type, attrs = {}) {\n return (state, dispatch, view) => {\n const isActive = nodeIsActive(state, type, attrs);\n\n if (isActive) {\n return lift(state, dispatch);\n }\n\n return wrapIn(type, attrs)(state, dispatch, view);\n };\n}\n\nfunction updateMark (type, attrs) {\n return (state, dispatch) => {\n const {\n tr,\n selection,\n doc\n } = state;\n const {\n ranges,\n empty\n } = selection;\n\n if (empty) {\n const {\n from,\n to\n } = getMarkRange(selection.$from, type);\n\n if (doc.rangeHasMark(from, to, type)) {\n tr.removeMark(from, to, type);\n }\n\n tr.addMark(from, to, type.create(attrs));\n } else {\n ranges.forEach(ref$1 => {\n const {\n $to,\n $from\n } = ref$1;\n\n if (doc.rangeHasMark($from.pos, $to.pos, type)) {\n tr.removeMark($from.pos, $to.pos, type);\n }\n\n tr.addMark($from.pos, $to.pos, type.create(attrs));\n });\n }\n\n return dispatch(tr);\n };\n}\n\nexport { insertText, markInputRule, markPasteRule, nodeInputRule, pasteRule, removeMark, replaceText, setInlineBlockType, splitToDefaultListItem, toggleBlockType, toggleList, toggleWrap, updateMark };\n","\n /*!\n * tiptap-extensions v1.35.1\n * (c) 2021 überdosis GbR (limited liability)\n * @license MIT\n */\n \nimport { Node, Plugin, PluginKey, Mark, Extension } from 'tiptap';\nimport { toggleWrap, wrappingInputRule, toggleList, toggleBlockType, setBlockType, textblockTypeInputRule, chainCommands, exitCode, nodeInputRule, splitListItem, sinkListItem, liftListItem, insertText, replaceText, splitToDefaultListItem, toggleMark, markInputRule, markPasteRule, updateMark, removeMark, pasteRule } from 'tiptap-commands';\nimport low from 'lowlight/lib/core';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\nimport { findBlockNodes, createTable, getMarkAttrs, nodeEqualsType } from 'tiptap-utils';\nimport { Fragment } from 'prosemirror-model';\nimport { Plugin as Plugin$1, PluginKey as PluginKey$1, TextSelection } from 'prosemirror-state';\nimport { tableNodes, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, deleteTable, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, setCellAttr, fixTables, goToNextCell, columnResizing, tableEditing } from 'prosemirror-tables';\nimport { Step } from 'prosemirror-transform';\nimport { sendableSteps, getVersion, receiveTransaction, collab } from 'prosemirror-collab';\nimport { history, undo, redo, undoDepth, redoDepth } from 'prosemirror-history';\n\nclass Blockquote extends Node {\n get name() {\n return 'blockquote';\n }\n\n get schema() {\n return {\n content: 'block*',\n group: 'block',\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'blockquote'\n }],\n toDOM: () => ['blockquote', 0]\n };\n }\n\n commands({\n type\n }) {\n return () => toggleWrap(type);\n }\n\n keys({\n type\n }) {\n return {\n 'Ctrl->': toggleWrap(type)\n };\n }\n\n inputRules({\n type\n }) {\n return [wrappingInputRule(/^\\s*>\\s$/, type)];\n }\n\n}\n\nclass BulletList extends Node {\n get name() {\n return 'bullet_list';\n }\n\n get schema() {\n return {\n content: 'list_item+',\n group: 'block',\n parseDOM: [{\n tag: 'ul'\n }],\n toDOM: () => ['ul', 0]\n };\n }\n\n commands({\n type,\n schema\n }) {\n return () => toggleList(type, schema.nodes.list_item);\n }\n\n keys({\n type,\n schema\n }) {\n return {\n 'Shift-Ctrl-8': toggleList(type, schema.nodes.list_item)\n };\n }\n\n inputRules({\n type\n }) {\n return [wrappingInputRule(/^\\s*([-+*])\\s$/, type)];\n }\n\n}\n\nclass CodeBlock extends Node {\n get name() {\n return 'code_block';\n }\n\n get schema() {\n return {\n content: 'text*',\n marks: '',\n group: 'block',\n code: true,\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'pre',\n preserveWhitespace: 'full'\n }],\n toDOM: () => ['pre', ['code', 0]]\n };\n }\n\n commands({\n type,\n schema\n }) {\n return () => toggleBlockType(type, schema.nodes.paragraph);\n }\n\n keys({\n type\n }) {\n return {\n 'Shift-Ctrl-\\\\': setBlockType(type)\n };\n }\n\n inputRules({\n type\n }) {\n return [textblockTypeInputRule(/^```$/, type)];\n }\n\n}\n\nfunction getDecorations({\n doc,\n name\n}) {\n const decorations = [];\n const blocks = findBlockNodes(doc).filter(item => item.node.type.name === name);\n\n const flatten = list => list.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);\n\n function parseNodes(nodes, className = []) {\n return nodes.map(node => {\n const classes = [...className, ...(node.properties ? node.properties.className : [])];\n\n if (node.children) {\n return parseNodes(node.children, classes);\n }\n\n return {\n text: node.value,\n classes\n };\n });\n }\n\n blocks.forEach(block => {\n let startPos = block.pos + 1;\n const nodes = low.highlightAuto(block.node.textContent).value;\n flatten(parseNodes(nodes)).map(node => {\n const from = startPos;\n const to = from + node.text.length;\n startPos = to;\n return { ...node,\n from,\n to\n };\n }).forEach(node => {\n const decoration = Decoration.inline(node.from, node.to, {\n class: node.classes.join(' ')\n });\n decorations.push(decoration);\n });\n });\n return DecorationSet.create(doc, decorations);\n}\n\nfunction HighlightPlugin({\n name\n}) {\n return new Plugin({\n name: new PluginKey('highlight'),\n state: {\n init: (_, {\n doc\n }) => getDecorations({\n doc,\n name\n }),\n apply: (transaction, decorationSet, oldState, newState) => {\n // TODO: find way to cache decorations\n // https://discuss.prosemirror.net/t/how-to-update-multiple-inline-decorations-on-node-change/1493\n const oldNodeName = oldState.selection.$head.parent.type.name;\n const newNodeName = newState.selection.$head.parent.type.name;\n const oldNodes = findBlockNodes(oldState.doc).filter(item => item.node.type.name === name);\n const newNodes = findBlockNodes(newState.doc).filter(item => item.node.type.name === name); // Apply decorations if selection includes named node, or transaction changes named node.\n\n if (transaction.docChanged && ([oldNodeName, newNodeName].includes(name) || newNodes.length !== oldNodes.length)) {\n return getDecorations({\n doc: transaction.doc,\n name\n });\n }\n\n return decorationSet.map(transaction.mapping, transaction.doc);\n }\n },\n props: {\n decorations(state) {\n return this.getState(state);\n }\n\n }\n });\n}\n\nclass CodeBlockHighlight extends Node {\n constructor(options = {}) {\n super(options);\n\n try {\n Object.entries(this.options.languages).forEach(([name, mapping]) => {\n low.registerLanguage(name, mapping);\n });\n } catch (err) {\n throw new Error('Invalid syntax highlight definitions: define at least one highlight.js language mapping');\n }\n }\n\n get name() {\n return 'code_block';\n }\n\n get defaultOptions() {\n return {\n languages: {}\n };\n }\n\n get schema() {\n return {\n content: 'text*',\n marks: '',\n group: 'block',\n code: true,\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'pre',\n preserveWhitespace: 'full'\n }],\n toDOM: () => ['pre', ['code', 0]]\n };\n }\n\n commands({\n type,\n schema\n }) {\n return () => toggleBlockType(type, schema.nodes.paragraph);\n }\n\n keys({\n type\n }) {\n return {\n 'Shift-Ctrl-\\\\': setBlockType(type)\n };\n }\n\n inputRules({\n type\n }) {\n return [textblockTypeInputRule(/^```$/, type)];\n }\n\n get plugins() {\n return [HighlightPlugin({\n name: this.name\n })];\n }\n\n}\n\nclass HardBreak extends Node {\n get name() {\n return 'hard_break';\n }\n\n get schema() {\n return {\n inline: true,\n group: 'inline',\n selectable: false,\n parseDOM: [{\n tag: 'br'\n }],\n toDOM: () => ['br']\n };\n }\n\n commands({\n type\n }) {\n return () => chainCommands(exitCode, (state, dispatch) => {\n dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView());\n return true;\n });\n }\n\n keys({\n type\n }) {\n const command = chainCommands(exitCode, (state, dispatch) => {\n dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView());\n return true;\n });\n return {\n 'Mod-Enter': command,\n 'Shift-Enter': command\n };\n }\n\n}\n\nclass Heading extends Node {\n get name() {\n return 'heading';\n }\n\n get defaultOptions() {\n return {\n levels: [1, 2, 3, 4, 5, 6]\n };\n }\n\n get schema() {\n return {\n attrs: {\n level: {\n default: 1\n }\n },\n content: 'inline*',\n group: 'block',\n defining: true,\n draggable: false,\n parseDOM: this.options.levels.map(level => ({\n tag: `h${level}`,\n attrs: {\n level\n }\n })),\n toDOM: node => [`h${node.attrs.level}`, 0]\n };\n }\n\n commands({\n type,\n schema\n }) {\n return attrs => toggleBlockType(type, schema.nodes.paragraph, attrs);\n }\n\n keys({\n type\n }) {\n return this.options.levels.reduce((items, level) => ({ ...items,\n ...{\n [`Shift-Ctrl-${level}`]: setBlockType(type, {\n level\n })\n }\n }), {});\n }\n\n inputRules({\n type\n }) {\n return this.options.levels.map(level => textblockTypeInputRule(new RegExp(`^(#{1,${level}})\\\\s$`), type, () => ({\n level\n })));\n }\n\n}\n\nclass HorizontalRule extends Node {\n get name() {\n return 'horizontal_rule';\n }\n\n get schema() {\n return {\n group: 'block',\n parseDOM: [{\n tag: 'hr'\n }],\n toDOM: () => ['hr']\n };\n }\n\n commands({\n type\n }) {\n return () => (state, dispatch) => dispatch(state.tr.replaceSelectionWith(type.create()));\n }\n\n inputRules({\n type\n }) {\n return [nodeInputRule(/^(?:---|___\\s|\\*\\*\\*\\s)$/, type)];\n }\n\n}\n\n/**\n * Matches following attributes in Markdown-typed image: [, alt, src, title]\n *\n * Example:\n * ![Lorem](image.jpg) -> [, \"Lorem\", \"image.jpg\"]\n * ![](image.jpg \"Ipsum\") -> [, \"\", \"image.jpg\", \"Ipsum\"]\n * ![Lorem](image.jpg \"Ipsum\") -> [, \"Lorem\", \"image.jpg\", \"Ipsum\"]\n */\n\nconst IMAGE_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\nclass Image extends Node {\n get name() {\n return 'image';\n }\n\n get schema() {\n return {\n inline: true,\n attrs: {\n src: {},\n alt: {\n default: null\n },\n title: {\n default: null\n }\n },\n group: 'inline',\n draggable: true,\n parseDOM: [{\n tag: 'img[src]',\n getAttrs: dom => ({\n src: dom.getAttribute('src'),\n title: dom.getAttribute('title'),\n alt: dom.getAttribute('alt')\n })\n }],\n toDOM: node => ['img', node.attrs]\n };\n }\n\n commands({\n type\n }) {\n return attrs => (state, dispatch) => {\n const {\n selection\n } = state;\n const position = selection.$cursor ? selection.$cursor.pos : selection.$to.pos;\n const node = type.create(attrs);\n const transaction = state.tr.insert(position, node);\n dispatch(transaction);\n };\n }\n\n inputRules({\n type\n }) {\n return [nodeInputRule(IMAGE_INPUT_REGEX, type, match => {\n const [, alt, src, title] = match;\n return {\n src,\n alt,\n title\n };\n })];\n }\n\n get plugins() {\n return [new Plugin({\n props: {\n handleDOMEvents: {\n drop(view, event) {\n const hasFiles = event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length;\n\n if (!hasFiles) {\n return;\n }\n\n const images = Array.from(event.dataTransfer.files).filter(file => /image/i.test(file.type));\n\n if (images.length === 0) {\n return;\n }\n\n event.preventDefault();\n const {\n schema\n } = view.state;\n const coordinates = view.posAtCoords({\n left: event.clientX,\n top: event.clientY\n });\n images.forEach(image => {\n const reader = new FileReader();\n\n reader.onload = readerEvent => {\n const node = schema.nodes.image.create({\n src: readerEvent.target.result\n });\n const transaction = view.state.tr.insert(coordinates.pos, node);\n view.dispatch(transaction);\n };\n\n reader.readAsDataURL(image);\n });\n }\n\n }\n }\n })];\n }\n\n}\n\nclass ListItem extends Node {\n get name() {\n return 'list_item';\n }\n\n get schema() {\n return {\n content: 'paragraph block*',\n defining: true,\n draggable: false,\n parseDOM: [{\n tag: 'li'\n }],\n toDOM: () => ['li', 0]\n };\n }\n\n keys({\n type\n }) {\n return {\n Enter: splitListItem(type),\n Tab: sinkListItem(type),\n 'Shift-Tab': liftListItem(type)\n };\n }\n\n}\n\nfunction getTextBetween(node, from, to, blockSeparator, inlineSeparator, leafText = '\\0') {\n let text = '';\n let blockSeparated = true;\n let inlineNode = null;\n node.content.nodesBetween(from, to, (innerNode, pos) => {\n if (innerNode.isText) {\n if (inlineNode) {\n inlineNode = null;\n return;\n }\n\n text += innerNode.text.slice(Math.max(from, pos) - pos, to - pos);\n blockSeparated = !blockSeparator;\n } else if (innerNode.isLeaf && leafText) {\n text += leafText;\n blockSeparated = !blockSeparator;\n } else if (innerNode.isInline && !innerNode.isLeaf) {\n text += inlineSeparator;\n\n if (innerNode.textContent) {\n text += innerNode.textContent;\n inlineNode = innerNode;\n }\n\n text += inlineSeparator;\n blockSeparated = !blockSeparated;\n } else if (!blockSeparated && innerNode.isBlock) {\n text += blockSeparator;\n blockSeparated = true;\n }\n }, 0);\n return text;\n} // Create a matcher that matches when a specific character is typed. Useful for @mentions and #tags.\n\n\nfunction triggerCharacter({\n char = '@',\n allowSpaces = false,\n startOfLine = false\n}) {\n return $position => {\n // cancel if top level node\n if ($position.depth <= 0) {\n return false;\n } // Matching expressions used for later\n\n\n const escapedChar = `\\\\${char}`;\n const suffix = new RegExp(`\\\\s${escapedChar}$`);\n const prefix = startOfLine ? '^' : '';\n const regexp = allowSpaces ? new RegExp(`${prefix}${escapedChar}.*?(?=\\\\s${escapedChar}|$)`, 'gm') : new RegExp(`${prefix}(?:^)?${escapedChar}[^\\\\s${escapedChar}]*`, 'gm'); // Lookup the boundaries of the current node\n\n const textFrom = $position.before();\n const textTo = $position.end();\n const text = getTextBetween($position.doc, textFrom, textTo, '\\0', '\\0');\n let match = regexp.exec(text);\n let position;\n\n while (match !== null) {\n // JavaScript doesn't have lookbehinds; this hacks a check that first character is \" \"\n // or the line beginning\n const matchPrefix = match.input.slice(Math.max(0, match.index - 1), match.index);\n\n if (/^[\\s\\0]?$/.test(matchPrefix)) {\n // The absolute position of the match in the document\n const from = match.index + $position.start();\n let to = from + match[0].length; // Edge case handling; if spaces are allowed and we're directly in between\n // two triggers\n\n if (allowSpaces && suffix.test(text.slice(to - 1, to + 1))) {\n match[0] += ' ';\n to += 1;\n } // If the $position is located within the matched substring, return that range\n\n\n if (from < $position.pos && to >= $position.pos) {\n position = {\n range: {\n from,\n to\n },\n query: match[0].slice(char.length),\n text: match[0]\n };\n }\n }\n\n match = regexp.exec(text);\n }\n\n return position;\n };\n}\n\nfunction SuggestionsPlugin({\n matcher = {\n char: '@',\n allowSpaces: false,\n startOfLine: false\n },\n appendText = null,\n suggestionClass = 'suggestion',\n command = () => false,\n items = [],\n onEnter = () => false,\n onChange = () => false,\n onExit = () => false,\n onKeyDown = () => false,\n onFilter = (searchItems, query) => {\n if (!query) {\n return searchItems;\n }\n\n return searchItems.filter(item => JSON.stringify(item).toLowerCase().includes(query.toLowerCase()));\n }\n}) {\n return new Plugin$1({\n key: new PluginKey$1('suggestions'),\n\n view() {\n return {\n update: async (view, prevState) => {\n const prev = this.key.getState(prevState);\n const next = this.key.getState(view.state); // See how the state changed\n\n const moved = prev.active && next.active && prev.range.from !== next.range.from;\n const started = !prev.active && next.active;\n const stopped = prev.active && !next.active;\n const changed = !started && !stopped && prev.query !== next.query;\n const handleStart = started || moved;\n const handleChange = changed && !moved;\n const handleExit = stopped || moved; // Cancel when suggestion isn't active\n\n if (!handleStart && !handleChange && !handleExit) {\n return;\n }\n\n const state = handleExit ? prev : next;\n const decorationNode = document.querySelector(`[data-decoration-id=\"${state.decorationId}\"]`); // build a virtual node for popper.js or tippy.js\n // this can be used for building popups without a DOM node\n\n const virtualNode = decorationNode ? {\n getBoundingClientRect() {\n return decorationNode.getBoundingClientRect();\n },\n\n clientWidth: decorationNode.clientWidth,\n clientHeight: decorationNode.clientHeight\n } : null;\n const props = {\n view,\n range: state.range,\n query: state.query,\n text: state.text,\n decorationNode,\n virtualNode,\n items: handleChange || handleStart ? await onFilter(Array.isArray(items) ? items : await items(), state.query) : [],\n command: ({\n range,\n attrs\n }) => {\n command({\n range,\n attrs,\n schema: view.state.schema\n })(view.state, view.dispatch, view);\n\n if (appendText) {\n insertText(appendText)(view.state, view.dispatch, view);\n }\n }\n }; // Trigger the hooks when necessary\n\n if (handleExit) {\n onExit(props);\n }\n\n if (handleChange) {\n onChange(props);\n }\n\n if (handleStart) {\n onEnter(props);\n }\n }\n };\n },\n\n state: {\n // Initialize the plugin's internal state.\n init() {\n return {\n active: false,\n range: {},\n query: null,\n text: null\n };\n },\n\n // Apply changes to the plugin state from a view transaction.\n apply(tr, prev) {\n const {\n selection\n } = tr;\n const next = { ...prev\n }; // We can only be suggesting if there is no selection\n\n if (selection.from === selection.to) {\n // Reset active state if we just left the previous suggestion range\n if (selection.from < prev.range.from || selection.from > prev.range.to) {\n next.active = false;\n } // Try to match against where our cursor currently is\n\n\n const $position = selection.$from;\n const match = triggerCharacter(matcher)($position);\n const decorationId = (Math.random() + 1).toString(36).substr(2, 5); // If we found a match, update the current state to show it\n\n if (match) {\n next.active = true;\n next.decorationId = prev.decorationId ? prev.decorationId : decorationId;\n next.range = match.range;\n next.query = match.query;\n next.text = match.text;\n } else {\n next.active = false;\n }\n } else {\n next.active = false;\n } // Make sure to empty the range if suggestion is inactive\n\n\n if (!next.active) {\n next.decorationId = null;\n next.range = {};\n next.query = null;\n next.text = null;\n }\n\n return next;\n }\n\n },\n props: {\n // Call the keydown hook if suggestion is active.\n handleKeyDown(view, event) {\n const {\n active,\n range\n } = this.getState(view.state);\n if (!active) return false;\n return onKeyDown({\n view,\n event,\n range\n });\n },\n\n // Setup decorator on the currently active suggestion.\n decorations(editorState) {\n const {\n active,\n range,\n decorationId\n } = this.getState(editorState);\n if (!active) return null;\n return DecorationSet.create(editorState.doc, [Decoration.inline(range.from, range.to, {\n nodeName: 'span',\n class: suggestionClass,\n 'data-decoration-id': decorationId\n })]);\n }\n\n }\n });\n}\n\nclass Mention extends Node {\n get name() {\n return 'mention';\n }\n\n get defaultOptions() {\n return {\n matcher: {\n char: '@',\n allowSpaces: false,\n startOfLine: false\n },\n mentionClass: 'mention',\n suggestionClass: 'mention-suggestion'\n };\n }\n\n getLabel(dom) {\n return dom.innerText.split(this.options.matcher.char).join('');\n }\n\n createFragment(schema, label) {\n return Fragment.fromJSON(schema, [{\n type: 'text',\n text: `${this.options.matcher.char}${label}`\n }]);\n }\n\n insertMention(range, attrs, schema) {\n const nodeType = schema.nodes[this.name];\n const nodeFragment = this.createFragment(schema, attrs.label);\n return replaceText(range, nodeType, attrs, nodeFragment);\n }\n\n get schema() {\n return {\n attrs: {\n id: {},\n label: {}\n },\n group: 'inline',\n inline: true,\n content: 'text*',\n selectable: false,\n atom: true,\n toDOM: node => ['span', {\n class: this.options.mentionClass,\n 'data-mention-id': node.attrs.id\n }, `${this.options.matcher.char}${node.attrs.label}`],\n parseDOM: [{\n tag: 'span[data-mention-id]',\n getAttrs: dom => {\n const id = dom.getAttribute('data-mention-id');\n const label = this.getLabel(dom);\n return {\n id,\n label\n };\n },\n getContent: (dom, schema) => {\n const label = this.getLabel(dom);\n return this.createFragment(schema, label);\n }\n }]\n };\n }\n\n commands({\n schema\n }) {\n return attrs => this.insertMention(null, attrs, schema);\n }\n\n get plugins() {\n return [SuggestionsPlugin({\n command: ({\n range,\n attrs,\n schema\n }) => this.insertMention(range, attrs, schema),\n appendText: ' ',\n matcher: this.options.matcher,\n items: this.options.items,\n onEnter: this.options.onEnter,\n onChange: this.options.onChange,\n onExit: this.options.onExit,\n onKeyDown: this.options.onKeyDown,\n onFilter: this.options.onFilter,\n suggestionClass: this.options.suggestionClass\n })];\n }\n\n}\n\nclass OrderedList extends Node {\n get name() {\n return 'ordered_list';\n }\n\n get schema() {\n return {\n attrs: {\n order: {\n default: 1\n }\n },\n content: 'list_item+',\n group: 'block',\n parseDOM: [{\n tag: 'ol',\n getAttrs: dom => ({\n order: dom.hasAttribute('start') ? +dom.getAttribute('start') : 1\n })\n }],\n toDOM: node => node.attrs.order === 1 ? ['ol', 0] : ['ol', {\n start: node.attrs.order\n }, 0]\n };\n }\n\n commands({\n type,\n schema\n }) {\n return () => toggleList(type, schema.nodes.list_item);\n }\n\n keys({\n type,\n schema\n }) {\n return {\n 'Shift-Ctrl-9': toggleList(type, schema.nodes.list_item)\n };\n }\n\n inputRules({\n type\n }) {\n return [wrappingInputRule(/^(\\d+)\\.\\s$/, type, match => ({\n order: +match[1]\n }), (match, node) => node.childCount + node.attrs.order === +match[1])];\n }\n\n}\n\nvar TableNodes = tableNodes({\n tableGroup: 'block',\n cellContent: 'block+',\n cellAttributes: {\n background: {\n default: null,\n\n getFromDOM(dom) {\n return dom.style.backgroundColor || null;\n },\n\n setDOMAttr(value, attrs) {\n if (value) {\n const style = {\n style: `${attrs.style || ''}background-color: ${value};`\n };\n Object.assign(attrs, style);\n }\n }\n\n }\n }\n});\n\nclass Table extends Node {\n get name() {\n return 'table';\n }\n\n get defaultOptions() {\n return {\n resizable: false\n };\n }\n\n get schema() {\n return TableNodes.table;\n }\n\n commands({\n schema\n }) {\n return {\n createTable: ({\n rowsCount,\n colsCount,\n withHeaderRow\n }) => (state, dispatch) => {\n const offset = state.tr.selection.anchor + 1;\n const nodes = createTable(schema, rowsCount, colsCount, withHeaderRow);\n const tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();\n const resolvedPos = tr.doc.resolve(offset);\n tr.setSelection(TextSelection.near(resolvedPos));\n dispatch(tr);\n },\n addColumnBefore: () => addColumnBefore,\n addColumnAfter: () => addColumnAfter,\n deleteColumn: () => deleteColumn,\n addRowBefore: () => addRowBefore,\n addRowAfter: () => addRowAfter,\n deleteRow: () => deleteRow,\n deleteTable: () => deleteTable,\n toggleCellMerge: () => (state, dispatch) => {\n if (mergeCells(state, dispatch)) {\n return;\n }\n\n splitCell(state, dispatch);\n },\n mergeCells: () => mergeCells,\n splitCell: () => splitCell,\n toggleHeaderColumn: () => toggleHeaderColumn,\n toggleHeaderRow: () => toggleHeaderRow,\n toggleHeaderCell: () => toggleHeaderCell,\n setCellAttr: ({\n name,\n value\n }) => setCellAttr(name, value),\n fixTables: () => fixTables\n };\n }\n\n keys() {\n return {\n Tab: goToNextCell(1),\n 'Shift-Tab': goToNextCell(-1)\n };\n }\n\n get plugins() {\n return [...(this.options.resizable ? [columnResizing()] : []), tableEditing()];\n }\n\n}\n\nclass TableHeader extends Node {\n get name() {\n return 'table_header';\n }\n\n get schema() {\n return TableNodes.table_header;\n }\n\n}\n\nclass TableCell extends Node {\n get name() {\n return 'table_cell';\n }\n\n get schema() {\n return TableNodes.table_cell;\n }\n\n}\n\nclass TableRow extends Node {\n get name() {\n return 'table_row';\n }\n\n get schema() {\n return TableNodes.table_row;\n }\n\n}\n\nclass TodoItem extends Node {\n get name() {\n return 'todo_item';\n }\n\n get defaultOptions() {\n return {\n nested: false\n };\n }\n\n get view() {\n return {\n props: ['node', 'updateAttrs', 'view'],\n methods: {\n onChange() {\n this.updateAttrs({\n done: !this.node.attrs.done\n });\n }\n\n },\n template: `\n
  • \n \n
    \n
  • \n `\n };\n }\n\n get schema() {\n return {\n attrs: {\n done: {\n default: false\n }\n },\n draggable: true,\n content: this.options.nested ? '(paragraph|todo_list)+' : 'paragraph+',\n toDOM: node => {\n const {\n done\n } = node.attrs;\n return ['li', {\n 'data-type': this.name,\n 'data-done': done.toString()\n }, ['span', {\n class: 'todo-checkbox',\n contenteditable: 'false'\n }], ['div', {\n class: 'todo-content'\n }, 0]];\n },\n parseDOM: [{\n priority: 51,\n tag: `[data-type=\"${this.name}\"]`,\n getAttrs: dom => ({\n done: dom.getAttribute('data-done') === 'true'\n })\n }]\n };\n }\n\n keys({\n type\n }) {\n return {\n Enter: splitToDefaultListItem(type),\n Tab: this.options.nested ? sinkListItem(type) : () => {},\n 'Shift-Tab': liftListItem(type)\n };\n }\n\n}\n\nclass TodoList extends Node {\n get name() {\n return 'todo_list';\n }\n\n get schema() {\n return {\n group: 'block',\n content: 'todo_item+',\n toDOM: () => ['ul', {\n 'data-type': this.name\n }, 0],\n parseDOM: [{\n priority: 51,\n tag: `[data-type=\"${this.name}\"]`\n }]\n };\n }\n\n commands({\n type,\n schema\n }) {\n return () => toggleList(type, schema.nodes.todo_item);\n }\n\n inputRules({\n type\n }) {\n return [wrappingInputRule(/^\\s*(\\[ \\])\\s$/, type)];\n }\n\n}\n\nclass Bold extends Mark {\n get name() {\n return 'bold';\n }\n\n get schema() {\n return {\n parseDOM: [{\n tag: 'strong'\n }, {\n tag: 'b',\n getAttrs: node => node.style.fontWeight !== 'normal' && null\n }, {\n style: 'font-weight',\n getAttrs: value => /^(bold(er)?|[5-9]\\d{2,})$/.test(value) && null\n }],\n toDOM: () => ['strong', 0]\n };\n }\n\n keys({\n type\n }) {\n return {\n 'Mod-b': toggleMark(type)\n };\n }\n\n commands({\n type\n }) {\n return () => toggleMark(type);\n }\n\n inputRules({\n type\n }) {\n return [markInputRule(/(?:\\*\\*|__)([^*_]+)(?:\\*\\*|__)$/, type)];\n }\n\n pasteRules({\n type\n }) {\n return [markPasteRule(/(?:\\*\\*|__)([^*_]+)(?:\\*\\*|__)/g, type)];\n }\n\n}\n\nclass Code extends Mark {\n get name() {\n return 'code';\n }\n\n get schema() {\n return {\n excludes: '_',\n parseDOM: [{\n tag: 'code'\n }],\n toDOM: () => ['code', 0]\n };\n }\n\n keys({\n type\n }) {\n return {\n 'Mod-`': toggleMark(type)\n };\n }\n\n commands({\n type\n }) {\n return () => toggleMark(type);\n }\n\n inputRules({\n type\n }) {\n return [markInputRule(/(?:`)([^`]+)(?:`)$/, type)];\n }\n\n pasteRules({\n type\n }) {\n return [markPasteRule(/(?:`)([^`]+)(?:`)/g, type)];\n }\n\n}\n\nclass Italic extends Mark {\n get name() {\n return 'italic';\n }\n\n get schema() {\n return {\n parseDOM: [{\n tag: 'i'\n }, {\n tag: 'em'\n }, {\n style: 'font-style=italic'\n }],\n toDOM: () => ['em', 0]\n };\n }\n\n keys({\n type\n }) {\n return {\n 'Mod-i': toggleMark(type)\n };\n }\n\n commands({\n type\n }) {\n return () => toggleMark(type);\n }\n\n inputRules({\n type\n }) {\n return [markInputRule(/(?:^|[^_])(_([^_]+)_)$/, type), markInputRule(/(?:^|[^*])(\\*([^*]+)\\*)$/, type)];\n }\n\n pasteRules({\n type\n }) {\n return [markPasteRule(/_([^_]+)_/g, type), markPasteRule(/\\*([^*]+)\\*/g, type)];\n }\n\n}\n\nclass Link extends Mark {\n get name() {\n return 'link';\n }\n\n get defaultOptions() {\n return {\n openOnClick: true,\n target: null\n };\n }\n\n get schema() {\n return {\n attrs: {\n href: {\n default: null\n },\n target: {\n default: null\n }\n },\n inclusive: false,\n parseDOM: [{\n tag: 'a[href]',\n getAttrs: dom => ({\n href: dom.getAttribute('href'),\n target: dom.getAttribute('target')\n })\n }],\n toDOM: node => ['a', { ...node.attrs,\n rel: 'noopener noreferrer nofollow',\n target: node.attrs.target || this.options.target\n }, 0]\n };\n }\n\n commands({\n type\n }) {\n return attrs => {\n if (attrs.href) {\n return updateMark(type, attrs);\n }\n\n return removeMark(type);\n };\n }\n\n pasteRules({\n type\n }) {\n return [pasteRule(/https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z]{2,}\\b([-a-zA-Z0-9@:%_+.~#?&//=,()!]*)/gi, type, url => ({\n href: url\n }))];\n }\n\n get plugins() {\n if (!this.options.openOnClick) {\n return [];\n }\n\n return [new Plugin({\n props: {\n handleClick: (view, pos, event) => {\n const {\n schema\n } = view.state;\n const attrs = getMarkAttrs(view.state, schema.marks.link);\n\n if (attrs.href && event.target instanceof HTMLAnchorElement) {\n event.stopPropagation();\n window.open(attrs.href, attrs.target);\n }\n }\n }\n })];\n }\n\n}\n\nclass Strike extends Mark {\n get name() {\n return 'strike';\n }\n\n get schema() {\n return {\n parseDOM: [{\n tag: 's'\n }, {\n tag: 'del'\n }, {\n tag: 'strike'\n }, {\n style: 'text-decoration',\n getAttrs: value => value === 'line-through'\n }],\n toDOM: () => ['s', 0]\n };\n }\n\n keys({\n type\n }) {\n return {\n 'Mod-d': toggleMark(type)\n };\n }\n\n commands({\n type\n }) {\n return () => toggleMark(type);\n }\n\n inputRules({\n type\n }) {\n return [markInputRule(/~([^~]+)~$/, type)];\n }\n\n pasteRules({\n type\n }) {\n return [markPasteRule(/~([^~]+)~/g, type)];\n }\n\n}\n\nclass Underline extends Mark {\n get name() {\n return 'underline';\n }\n\n get schema() {\n return {\n parseDOM: [{\n tag: 'u'\n }, {\n style: 'text-decoration',\n getAttrs: value => value === 'underline'\n }],\n toDOM: () => ['u', 0]\n };\n }\n\n keys({\n type\n }) {\n return {\n 'Mod-u': toggleMark(type)\n };\n }\n\n commands({\n type\n }) {\n return () => toggleMark(type);\n }\n\n}\n\nclass Collaboration extends Extension {\n get name() {\n return 'collaboration';\n }\n\n init() {\n this.getSendableSteps = this.debounce(state => {\n const sendable = sendableSteps(state);\n\n if (sendable) {\n this.options.onSendable({\n editor: this.editor,\n sendable: {\n version: sendable.version,\n steps: sendable.steps.map(step => step.toJSON()),\n clientID: sendable.clientID\n }\n });\n }\n }, this.options.debounce);\n this.editor.on('transaction', ({\n state\n }) => {\n this.getSendableSteps(state);\n });\n }\n\n get defaultOptions() {\n return {\n version: 0,\n clientID: Math.floor(Math.random() * 0xFFFFFFFF),\n debounce: 250,\n onSendable: () => {},\n update: ({\n steps,\n version\n }) => {\n const {\n state,\n view,\n schema\n } = this.editor;\n\n if (getVersion(state) > version) {\n return;\n }\n\n view.dispatch(receiveTransaction(state, steps.map(item => Step.fromJSON(schema, item.step)), steps.map(item => item.clientID)));\n }\n };\n }\n\n get plugins() {\n return [collab({\n version: this.options.version,\n clientID: this.options.clientID\n })];\n }\n\n debounce(fn, delay) {\n let timeout;\n return function (...args) {\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(() => {\n fn(...args);\n timeout = null;\n }, delay);\n };\n }\n\n}\n\nclass Focus extends Extension {\n get name() {\n return 'focus';\n }\n\n get defaultOptions() {\n return {\n className: 'has-focus',\n nested: false\n };\n }\n\n get plugins() {\n return [new Plugin({\n props: {\n decorations: ({\n doc,\n plugins,\n selection\n }) => {\n const editablePlugin = plugins.find(plugin => plugin.key.startsWith('editable$'));\n const editable = editablePlugin.props.editable();\n const active = editable && this.options.className;\n const {\n focused\n } = this.editor;\n const {\n anchor\n } = selection;\n const decorations = [];\n\n if (!active || !focused) {\n return false;\n }\n\n doc.descendants((node, pos) => {\n const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;\n\n if (hasAnchor && !node.isText) {\n const decoration = Decoration.node(pos, pos + node.nodeSize, {\n class: this.options.className\n });\n decorations.push(decoration);\n }\n\n return this.options.nested;\n });\n return DecorationSet.create(doc, decorations);\n }\n }\n })];\n }\n\n}\n\nclass History extends Extension {\n get name() {\n return 'history';\n }\n\n get defaultOptions() {\n return {\n depth: '',\n newGroupDelay: ''\n };\n }\n\n keys() {\n const keymap = {\n 'Mod-z': undo,\n 'Mod-y': redo,\n 'Shift-Mod-z': redo,\n // Russian language\n 'Mod-я': undo,\n 'Shift-Mod-я': redo\n };\n return keymap;\n }\n\n get plugins() {\n return [history({\n depth: this.options.depth,\n newGroupDelay: this.options.newGroupDelay\n })];\n }\n\n commands() {\n return {\n undo: () => undo,\n redo: () => redo,\n undoDepth: () => undoDepth,\n redoDepth: () => redoDepth\n };\n }\n\n}\n\nclass Placeholder extends Extension {\n get name() {\n return 'placeholder';\n }\n\n get defaultOptions() {\n return {\n emptyEditorClass: 'is-editor-empty',\n emptyNodeClass: 'is-empty',\n emptyNodeText: 'Write something …',\n showOnlyWhenEditable: true,\n showOnlyCurrent: true\n };\n }\n\n get plugins() {\n return [new Plugin({\n props: {\n decorations: ({\n doc,\n plugins,\n selection\n }) => {\n const editablePlugin = plugins.find(plugin => plugin.key.startsWith('editable$'));\n const editable = editablePlugin.props.editable();\n const active = editable || !this.options.showOnlyWhenEditable;\n const {\n anchor\n } = selection;\n const decorations = [];\n const isEditorEmpty = doc.textContent.length === 0;\n\n if (!active) {\n return false;\n }\n\n doc.descendants((node, pos) => {\n const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;\n const isNodeEmpty = node.content.size === 0;\n\n if ((hasAnchor || !this.options.showOnlyCurrent) && isNodeEmpty) {\n const classes = [this.options.emptyNodeClass];\n\n if (isEditorEmpty) {\n classes.push(this.options.emptyEditorClass);\n }\n\n const decoration = Decoration.node(pos, pos + node.nodeSize, {\n class: classes.join(' '),\n 'data-empty-text': typeof this.options.emptyNodeText === 'function' ? this.options.emptyNodeText(node) : this.options.emptyNodeText\n });\n decorations.push(decoration);\n }\n\n return false;\n });\n return DecorationSet.create(doc, decorations);\n }\n }\n })];\n }\n\n}\n\nclass Search extends Extension {\n constructor(options = {}) {\n super(options);\n this.results = [];\n this.searchTerm = null;\n this._updating = false;\n }\n\n get name() {\n return 'search';\n }\n\n get defaultOptions() {\n return {\n autoSelectNext: true,\n findClass: 'find',\n searching: false,\n caseSensitive: false,\n disableRegex: true,\n alwaysSearch: false\n };\n }\n\n commands() {\n return {\n find: attrs => this.find(attrs),\n replace: attrs => this.replace(attrs),\n replaceAll: attrs => this.replaceAll(attrs),\n clearSearch: () => this.clear()\n };\n }\n\n get findRegExp() {\n return RegExp(this.searchTerm, !this.options.caseSensitive ? 'gui' : 'gu');\n }\n\n get decorations() {\n return this.results.map(deco => Decoration.inline(deco.from, deco.to, {\n class: this.options.findClass\n }));\n }\n\n _search(doc) {\n this.results = [];\n const mergedTextNodes = [];\n let index = 0;\n\n if (!this.searchTerm) {\n return;\n }\n\n doc.descendants((node, pos) => {\n if (node.isText) {\n if (mergedTextNodes[index]) {\n mergedTextNodes[index] = {\n text: mergedTextNodes[index].text + node.text,\n pos: mergedTextNodes[index].pos\n };\n } else {\n mergedTextNodes[index] = {\n text: node.text,\n pos\n };\n }\n } else {\n index += 1;\n }\n });\n mergedTextNodes.forEach(({\n text,\n pos\n }) => {\n const search = this.findRegExp;\n let m; // eslint-disable-next-line no-cond-assign\n\n while (m = search.exec(text)) {\n if (m[0] === '') {\n break;\n }\n\n this.results.push({\n from: pos + m.index,\n to: pos + m.index + m[0].length\n });\n }\n });\n }\n\n replace(replace) {\n return (state, dispatch) => {\n const firstResult = this.results[0];\n\n if (!firstResult) {\n return;\n }\n\n const {\n from,\n to\n } = this.results[0];\n dispatch(state.tr.insertText(replace, from, to));\n this.editor.commands.find(this.searchTerm);\n };\n }\n\n rebaseNextResult(replace, index, lastOffset = 0) {\n const nextIndex = index + 1;\n\n if (!this.results[nextIndex]) {\n return null;\n }\n\n const {\n from: currentFrom,\n to: currentTo\n } = this.results[index];\n const offset = currentTo - currentFrom - replace.length + lastOffset;\n const {\n from,\n to\n } = this.results[nextIndex];\n this.results[nextIndex] = {\n to: to - offset,\n from: from - offset\n };\n return offset;\n }\n\n replaceAll(replace) {\n return ({\n tr\n }, dispatch) => {\n let offset;\n\n if (!this.results.length) {\n return;\n }\n\n this.results.forEach(({\n from,\n to\n }, index) => {\n tr.insertText(replace, from, to);\n offset = this.rebaseNextResult(replace, index, offset);\n });\n dispatch(tr);\n this.editor.commands.find(this.searchTerm);\n };\n }\n\n find(searchTerm) {\n return (state, dispatch) => {\n this.searchTerm = this.options.disableRegex ? searchTerm.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&') : searchTerm;\n this.updateView(state, dispatch);\n };\n }\n\n clear() {\n return (state, dispatch) => {\n this.searchTerm = null;\n this.updateView(state, dispatch);\n };\n }\n\n updateView({\n tr\n }, dispatch) {\n this._updating = true;\n dispatch(tr);\n this._updating = false;\n }\n\n createDeco(doc) {\n this._search(doc);\n\n return this.decorations ? DecorationSet.create(doc, this.decorations) : [];\n }\n\n get plugins() {\n return [new Plugin({\n state: {\n init() {\n return DecorationSet.empty;\n },\n\n apply: (tr, old) => {\n if (this._updating || this.options.searching || tr.docChanged && this.options.alwaysSearch) {\n return this.createDeco(tr.doc);\n }\n\n if (tr.docChanged) {\n return old.map(tr.mapping, tr.doc);\n }\n\n return old;\n }\n },\n props: {\n decorations(state) {\n return this.getState(state);\n }\n\n }\n })];\n }\n\n}\n\nclass TrailingNode extends Extension {\n get name() {\n return 'trailing_node';\n }\n\n get defaultOptions() {\n return {\n node: 'paragraph',\n notAfter: ['paragraph']\n };\n }\n\n get plugins() {\n const plugin = new PluginKey(this.name);\n const disabledNodes = Object.entries(this.editor.schema.nodes).map(([, value]) => value).filter(node => this.options.notAfter.includes(node.name));\n return [new Plugin({\n key: plugin,\n view: () => ({\n update: view => {\n const {\n state\n } = view;\n const insertNodeAtEnd = plugin.getState(state);\n\n if (!insertNodeAtEnd) {\n return;\n }\n\n const {\n doc,\n schema,\n tr\n } = state;\n const type = schema.nodes[this.options.node];\n const transaction = tr.insert(doc.content.size, type.create());\n view.dispatch(transaction);\n }\n }),\n state: {\n init: (_, state) => {\n const lastNode = state.tr.doc.lastChild;\n return !nodeEqualsType({\n node: lastNode,\n types: disabledNodes\n });\n },\n apply: (tr, value) => {\n if (!tr.docChanged) {\n return value;\n }\n\n const lastNode = tr.doc.lastChild;\n return !nodeEqualsType({\n node: lastNode,\n types: disabledNodes\n });\n }\n }\n })];\n }\n\n}\n\nexport { Blockquote, Bold, BulletList, Code, CodeBlock, CodeBlockHighlight, Collaboration, Focus, HardBreak, Heading, HighlightPlugin as Highlight, History, HorizontalRule, Image, Italic, Link, ListItem, Mention, OrderedList, Placeholder, Search, Strike, SuggestionsPlugin as Suggestions, Table, TableCell, TableHeader, TableRow, TodoItem, TodoList, TrailingNode, Underline };\n"],"names":["getMarksBetween","start","end","state","marks","doc","nodesBetween","node","pos","map","mark","nodeSize","markInputRule","regexp","markType","getAttrs","match","attrs","Function","tr","m","length","markEnd","markStart","matchStart","indexOf","matchEnd","textStart","lastIndexOf","textEnd","excludedMarks","filter","item","excluded","type","find","name","delete","addMark","create","removeStoredMark","nodeInputRule","replaceWith","pasteRule","handler","fragment","nodes","forEach","child","isText","text","exec","index","push","cut","addToSet","copy","content","props","transformPasted","slice","openStart","openEnd","markPasteRule","parent","isLink","x","allowsMarkType","removeMark","dispatch","selection","from","to","$from","empty","range","toggletype","view","isActive","isList","schema","bullet_list","ordered_list","todo_list","toggleList","listType","itemType","$to","blockRange","parentList","depth","validContent","setNodeMarkup","toggleWrap","updateMark","ranges","rangeHasMark","ref$1","Blockquote","group","defining","draggable","parseDOM","tag","toDOM","commands","keys","inputRules","BulletList","list_item","CodeBlock","code","preserveWhitespace","paragraph","HardBreak","inline","selectable","replaceSelectionWith","scrollIntoView","command","Heading","defaultOptions","levels","level","default","this","options","reduce","items","RegExp","HorizontalRule","IMAGE_INPUT_REGEX","Image","src","alt","title","dom","getAttribute","position","$cursor","transaction","insert","plugins","handleDOMEvents","drop","event","hasFiles","dataTransfer","files","images","Array","file","test","preventDefault","coordinates","posAtCoords","left","clientX","top","clientY","image","reader","FileReader","onload","readerEvent","target","result","readAsDataURL","ListItem","Enter","Tab","OrderedList","order","hasAttribute","childCount","TableNodes","tableGroup","cellContent","cellAttributes","background","getFromDOM","style","backgroundColor","setDOMAttr","value","Object","assign","Table","resizable","table","createTable","rowsCount","colsCount","withHeaderRow","offset","anchor","resolvedPos","resolve","setSelection","addColumnBefore","addColumnAfter","deleteColumn","addRowBefore","addRowAfter","deleteRow","deleteTable","toggleCellMerge","mergeCells","splitCell","toggleHeaderColumn","toggleHeaderRow","toggleHeaderCell","setCellAttr","fixTables","TableHeader","table_header","TableCell","table_cell","TableRow","table_row","TodoList","priority","todo_item","Bold","fontWeight","pasteRules","Code","excludes","Italic","Link","openOnClick","href","inclusive","rel","url","handleClick","link","HTMLAnchorElement","stopPropagation","window","open","Strike","Underline","History","newGroupDelay","keymap","undo","redo","undoDepth","redoDepth","Placeholder","emptyEditorClass","emptyNodeClass","emptyNodeText","showOnlyWhenEditable","showOnlyCurrent","decorations","editablePlugin","plugin","key","startsWith","editable","active","isEditorEmpty","textContent","descendants","hasAnchor","isNodeEmpty","size","classes","decoration","class","join"],"sourceRoot":""}