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J,EAAI1I,SAAS,IAAMmI,CAElD,IAEDlH,EACA0H,GAYD,OATqC,MAAlChH,EAAKQ,QAAQlD,QAAQ2J,WACvBnE,EAAWoE,KACVrP,EAAU2L,UAAU,CACnBtL,MAAO,IACPC,GAAI+I,KAKA,CACNV,QAASX,EACTiD,WAAYA,EACZ7J,QAAS6G,EAAcqH,MACvB9K,SAAU,SAAC/B,GAIV,IAAI8M,EAAcvH,EAAemC,aAAa,oBAC9C,QAAkB7I,GAAfiO,EAA0B,CAC5BhG,GAAgB,EAChB,IAAIiG,GAAM,IAAM/F,MAASC,UAGzB,GAF2BH,EAAe,IAAM,GAClB,EAAQC,EAAqB,IACP,CACnDA,EAAmBgG,EACnB,IAAIpO,EAAUqB,EAAEzB,OAAOyO,UACvB/M,SAASgN,SAAS,WAAY,CAACC,UAAW,CAACvO,QAAAA,EAASmO,YAAaA,IAClE,CACD,CACD,EAGF,CAGqBK,CAAO5H,EAAgBC,EAAeE,IAE1D,OAAOC,CAGR,C","sources":["webpack://midflip/./app/javascript/tiptap_word_count.ts","webpack://midflip/./app/javascript/prose_drop.js","webpack://midflip/./app/javascript/tiptap_midflip_preview.ts","webpack://midflip/./app/javascript/tiptap_did_change.ts","webpack://midflip/./app/javascript/tiptap_midflip.js"],"sourcesContent":["// I grabbed this from here: https://github.com/ueberdosis/tiptap/blob/develop/packages/extension-character-count/src/index.ts\n// and then I changed it because I want it to be based on word count and not character count.\n\n\nimport { Extension } from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\n\nexport interface WordCountOptions {\n /**\n * The maximum number of characters that should be allowed. Defaults to `0`.\n */\n limit: number | null | undefined\n /**\n * The mode by which the size is calculated. Defaults to 'textSize'.\n */\n id: string | null\n\n mode: 'textSize' | 'nodeSize'\n}\n\nexport interface WordCountStorage {\n /**\n * Get the number of characters for the current document.\n */\n characters: (options?: { node?: ProseMirrorNode; mode?: 'textSize' | 'nodeSize' }) => number\n\n /**\n * Get the number of words for the current document.\n */\n words: (options?: { node?: ProseMirrorNode }) => number\n}\n\nlet updateSize = (sz, span_id) => {\n\t//update the UI\n\tconsole.log(\"updated size!\")\n\tlet a = document.querySelector('#' + span_id)\n\ta.innerHTML = sz.toString()\n\ta = a.parentElement\n\tif(sz > 800) {\n\t\ta.classList.remove('at-eight-hundred')\n\t\ta.classList.remove('under-eight-hundred')\n\t\ta.classList.add('over-eight-hundred')\n\t} else if(sz == 800 ) {\n\t\ta.classList.add('at-eight-hundred')\n\t\ta.classList.remove('under-eight-hundred')\n\t\ta.classList.remove('over-eight-hundred')\n\t} else {\n\t\ta.classList.remove('at-eight-hundred')\n\t\ta.classList.add('under-eight-hundred')\n\t\ta.classList.remove('over-eight-hundred')\n\t}\n\n\t//Add send button for the champs\n\tlet el = document.querySelector(\"submitEditButton\")\n\t\n\tconsole.log(\"el\", el)\n\tif(el){\n\t\tel.classList.add(\"active\")\n\t}\n}\n\nexport const WordCount = Extension.create({\n name: 'wordCount',\n\n addOptions() {\n return {\n limit: null,\n\t id: null,\n mode: 'textSize',\n }\n },\n\n addStorage() {\n return {\n characters: () => 0,\n words: () => 0,\n }\n },\n\n onBeforeCreate() {\n this.storage.characters = options => {\n const node = options?.node || this.editor.state.doc\n const mode = options?.mode || this.options.mode\n\n if (mode === 'textSize') {\n const text = node.textBetween(0, node.content.size, undefined, ' ')\n\n return text.length\n }\n\n return node.nodeSize\n }\n\n this.storage.words = options => {\n const node = options?.node || this.editor.state.doc\n const text = node.textBetween(0, node.content.size, ' ', ' ')\n const words = text.split(' ').filter(word => word !== '')\n\n return words.length\n }\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: new PluginKey('wordCount'),\n filterTransaction: (transaction, state) => {\n\t\t console.log(\"wordCountPlugInDetected\")\n const limit = this.options.limit\n\t\t\t\n // Nothing has changed or no limit is defined. Ignore it.\n if (!transaction.docChanged || limit === 0 || limit === null || limit === undefined) {\n return true\n }\n\t\t \n const oldSize = this.storage.words({ node: state.doc })\n const newSize = this.storage.words({ node: transaction.doc })\n\n\t\t if(newSize != oldSize) {\n\t\t\tupdateSize(newSize, this.options.id)\n\t\t } \n\n\t\t return true\n\t\t}\n // // Everything is in the limit. Good.\n // if (newSize <= limit) {\n // return true\n // }\n\n // // The limit has already been exceeded but will be reduced.\n // if (oldSize > limit && newSize > limit && newSize <= oldSize) {\n // return true\n // }\n\n // // The limit has already been exceeded and will be increased further.\n // if (oldSize > limit && newSize > limit && newSize > oldSize) {\n // return false\n // }\n\n // const isPaste = transaction.getMeta('paste')\n\n // // Block all exceeding transactions that were not pasted.\n // if (!isPaste) {\n // return false\n // }\n\n // // For pasted content, we try to remove the exceeding content.\n\t\t// // const eight_hundro_char_count = null\n\t\t// // const node = options?.node || this.editor.state.doc\n \t// // const text = node.textBetween(0, node.content.size, ' ', ' ')\n \t// // const words = text.split(' ').filter(word => word !== '')\n\t\t// let node = transaction.doc\n\t\t// let text = node.textBetween(0, node.content.size, ' ', ' ')\n\t\t// let words = text.split(' ').filter(word => word !== '')\n\t\t// let first_8h = words.slice(0, limit).join().length\n\t\t// transaction.deleteRange(first_8h, text.length)\n\n // // In some situations, the limit will continue to be exceeded after trimming.\n // // This happens e.g. when truncating within a complex node (e.g. table)\n // // and ProseMirror has to close this node again.\n // // If this is the case, we prevent the transaction completely.\n // const updatedSize = this.storage.words({ node: transaction.doc })\n\t\t// updateSize(updatedSize, this.options.id)\n // return true\n // },\n }),\n ]\n },\n})","// import {\t\t\t\tExtension\t\t\t\t} from '@tiptap/core'\n// import {\t\t\tPlugin, PluginKey\t\t\t} from '@tiptap/pm/state'\n// import { mergeAttributes, Node, nodePasteRule\t} from '@tiptap/core'\nimport { Node } from '@tiptap/core'\n\nexport default Node.create({\n\tname: 'drop',\n\tinline: false,\n\tisolating: true,\n\tgroup: 'block',\n\tcontent: 'paragraph block*',\t\t//what can it have inside\n\tdraggable: true,\t\t\t\t\t//todo - make the things inside it NOT draggable.\n\tprops: {\n\t\tupdateAttributes: {\n\t\trequired: true,\n\t\t},\n\t},\n\taddAttributes() {\n\t\treturn {\n\t\t\t'data-midflip-drop': {default: true},\n\t\t\t'data-select-inside': {default: false},\n\t\t\t'style': {default: false},\n\t\t\t'class': {default: \"editorDrop editorDropClosed\"}\n\t\t}\n\t},\n\taddNodeView(){\n\t\t//https://prosemirror.net/docs/ref/#view.NodeView\n\t\treturn (({HTMLAttributes}) => {\n\t\t\t//dont do anything in here, not worth. use onUpdate onCreate and God.pray.\n\t\t\tlet top = document.createElement('div')\n\t\t\tfor(let k of Object.keys(HTMLAttributes)){\n\t\t\t\ttop.setAttribute(k, HTMLAttributes[k])\n\t\t\t}\n\t\t\treturn { dom: top, contentDOM: top}\n\t\t})\n\t},\n\tonUpdate({editor}){\n\t\tlet doc = editor.state.doc\n\t\tdoc.descendants(((node, pos, parent, index) => {\n\t\t\tif(node.type.name == this.name){\n\t\t\t\tif(node.childCount == 1 && node.textContent.trim() == ''){\n\t\t\t\t\tlet tr = editor.state.tr\n\t\t\t\t\ttr.deleteRange(pos, node.nodeSize + pos)\n\t\t\t\t\teditor.view.dispatch(tr)\n\t\t\t\t}\n\t\t\t}\n\t\t}).bind(this))\n\t},\n\t//how it is recognized when given html\n\tparseHTML(){\n\t\treturn [{tag: 'div', getAttrs: node => node.dataset.midflipDrop != undefined}]\n\t},\n\trenderHTML(inp){\n\t\treturn ['div', inp.HTMLAttributes, 0]\n\t},\n\t//the command used in our editor.js to create it. I think this points to toDOM and/or renderHTML\n\t//and then adds the content. Can move to a header here.\n\taddCommands() {\n\t\treturn {\n\t\t\tinsertDrop: (options) => async ({ commands }) => {\n\t\t\t\tcommands.insertContent({\n\t\t\t\t\ttype: this.name,\n\t\t\t\t\tattrs: {},\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{type: \"paragraph\"},\n\t\t\t\t\t\t{type: \"paragraph\"}\n\t\t\t\t\t]\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t},\n\tonCreate(inp) {\n\t\t// this bit has them autoclose on create\n\n\t\tlet {editor} = inp\n\t\t// console.log('onCreate', inp)\n\t\t//autoclose on editor instantiation\n\t\tlet {view, state} = editor\n\t\tlet {doc, selection} = state\n\t\tlet trans\n\n\t\tdoc.descendants(((node, pos, parent, index) => {\n\t\t\tif(node.type.name == this.name){\n\t\t\t\tif(!trans){trans = state.tr}\n\t\t\t\tlet dropEl = view.nodeDOM(pos)\n\t\t\t\tlet toggle_h = `${dropEl.children[0].clientHeight}px`\n\t\t\t\ttrans.setNodeAttribute(pos, 'style', `max-height:${toggle_h}; overflow: hidden;`)\n\t\t\t}\n\t\t}).bind(this))\n\n\t\tif(trans){view.dispatch(trans)}\n\t},\n\tonSelectionUpdate({editor}) {\n\t\t//work in the state and then only create a transaction\n\t\t//if absolutely needed, dont work with the transaction passed to this function\n\t\t//its cursed or something.\n\n\t\tlet {view, state} = editor\n\t\tlet {doc, selection} = state\n\t\tlet trans\n\n\t\tdoc.descendants(((node, pos, parent, index) => {\n\t\t\tif(node.type.name == this.name){\n\t\t\t\tlet elStart = pos\n\t\t\t\tlet elStop = pos + node.nodeSize\n\t\t\t\tlet inside = (selection.from >= elStart && selection.from <= elStop) || \n\t\t\t\t\t(selection.to >= elStart && selection.to <= elStop) ||\n\t\t\t\t\t(selection.from <= elStart && elStop <= selection.to)\n\n\t\t\t\tif(inside != node.attrs['data-select-inside']){\n\t\t\t\t\tlet dropEl = view.nodeDOM(pos)\n\t\t\t\t\tlet c = dropEl.children[0]\n\t\t\t\t\tif(c) {\n\t\t\t\t\t\tif(!trans){trans = state.tr}\n\t\t\t\t\t\ttrans.setNodeAttribute(pos, 'data-select-inside', inside)\n\t\t\t\t\t\tlet toggle_h = `${c.clientHeight}px`\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet style, cls\n\t\t\t\t\t\tif(inside){\n\t\t\t\t\t\t\t\tstyle = `transition: max-height 1s ease-in-out;`\n\t\t\t\t\t\t\t\tcls = 'editorDrop editorDropOpen'\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tstyle = `max-height:${toggle_h};overflow:hidden;transition: max-height 0.5s ease-in-out;`\n\t\t\t\t\t\t\t\tcls = 'editorDrop editorDropClosed'\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrans.setNodeAttribute(pos, 'class', cls)\n\t\t\t\t\t\ttrans.setNodeAttribute(pos, 'style', style)\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}).bind(this))\n\n\t\tif(trans){view.dispatch(trans)}\n\t}\n})","//so tbh this is my first time writing typescript, I am only using it because I am\n//basically trying to carbon clone this:\n//\thttps://github.com/ueberdosis/tiptap/blob/main/packages/extension-youtube/src/youtube.ts\n//and I only really understand a good 50% of whats happening\n\nimport { mergeAttributes, Node, nodePasteRule } from '@tiptap/core'\n\n// import { YOUTUBE_REGEX_GLOBAL } from './utils'\n\n\nexport interface MidFlipPreviewOptions {\n\tsrc: string,\n\t'data-controller': string\n}\n\ntype SetPreviewOptions = { src: string, 'data-controller': string}\n\ndeclare module '@tiptap/core' {\n interface Commands {\n midFlipPreview: {\n /**\n * Insert a youtube video\n */\n setMidflipPreview: (options: SetPreviewOptions) => ReturnType,\n }\n }\n}\n\nconst MidFlipPreview = Node.create({\n name: 'midflipPreview',\n\n addOptions() {\n return {src: '', 'data-controller': 'preview'}\n },\n\n inline() {\n return false // this.options.inline\n },\n\n group() {\n return 'block' // this.options.inline ? 'inline' : 'block'\n },\n\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: '',\n },\n\t 'data-controller': {\n\t\tdefault: 'preview'\n\t }\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-midflip-preview]',\n },\n ]\n },\n addCommands() {\n\treturn {\n insertPreview: (options: MidFlipPreviewOptions) => async ({ commands }) => {\n\t\tcommands.insertContent({\n\t\t\ttype: this.name,\n\t\t\tattrs: options,\n\t\t})\n\t\treturn\n },\n }\n },\n\n addPasteRules() {\n return []\n },\n\n\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes( { 'data-midflip-preview': '', src: this.options.src, 'data-controller': 'preview' }, HTMLAttributes )\n ]\n },\n})\n\nexport default MidFlipPreview","// I grabbed this from here: https://github.com/ueberdosis/tiptap/blob/develop/packages/extension-character-count/src/index.ts\r\n\r\nimport { Extension } from '@tiptap/core'\r\nimport { Plugin, PluginKey } from '@tiptap/pm/state'\r\n\r\nexport interface DidChangeOptions {}\r\n\r\nexport interface DidChangeStorage {}\r\n\r\nexport const DidChange = Extension.create({\r\n name: 'didChange',\r\n addProseMirrorPlugins() {\r\n return [\r\n new Plugin({\r\n key: new PluginKey('didChange'),\r\n filterTransaction: (transaction, state) => {\r\n // Nothing has changed or no limit is defined. Ignore it.\r\n if (!transaction.docChanged) {\r\n return true\r\n }\r\n //Add send button for the champs\r\n let el = document.querySelector(\"#submitEditButton\")\r\n if(el){\r\n el.classList.add(\"activeChanges\")\r\n }\r\n\t\t return true\r\n\t\t}\r\n }),\r\n ]\r\n },\r\n})","\timport { Editor } from '@tiptap/core'\n\n//extension dependencies:\n\timport Document from '@tiptap/extension-document'\n\timport Paragraph from '@tiptap/extension-paragraph'\n\timport Text from '@tiptap/extension-text'\n\timport ListItem from '@tiptap/extension-list-item'\n\t// import Suggestion from '@tiptap/suggestion'\t\t\t\t//<- technically a utility\n\n//html node extensions:\n\timport Blockquote from '@tiptap/extension-blockquote'\n\timport Heading from '@tiptap/extension-heading'\n\timport OrderedList from '@tiptap/extension-ordered-list' // requires list-item\n\timport BulletList from '@tiptap/extension-bullet-list'\n\timport CodeBlock from '@tiptap/extension-code-block'\n\timport Mention from '@tiptap/extension-mention'\t\t\t//Not Currently Implemented\n\timport Image from '@tiptap/extension-image'\t\t\t\t//Not Currently Implemented\n\timport Youtube from '@tiptap/extension-youtube'\t\t\t// https://www.youtube.com/watch?v=-z3RRwk2rdU\n\n//\"mark\" extensions:\n\timport Bold from '@tiptap/extension-bold'\n\timport Italic from '@tiptap/extension-italic'\n\t// import Strike from '@tiptap/extension-strike'\n\timport Link from '@tiptap/extension-link'\n\timport Superscript from '@tiptap/extension-superscript'\n\n//functional extensions:\n\t//we are not implementing gap-cursor because it seemed buggy when i tried it on the site\n\timport Dropcursor from '@tiptap/extension-dropcursor'\n\timport History from '@tiptap/extension-history'\n\timport Typography from '@tiptap/extension-typography'\n\timport Placeholder from '@tiptap/extension-placeholder'\n\timport { WordCount } from './tiptap_word_count.ts'\n\n//menu extensions\n\timport BubbleMenu from '@tiptap/extension-bubble-menu'\n\timport FloatingMenu from '@tiptap/extension-floating-menu'\n\n//menu extensions depend on...\n\timport tippy from 'tippy.js'\n//custom work\n\timport Drop from './prose_drop.js'\n\timport MidFlipPreview from './tiptap_midflip_preview.ts'\n\timport {DidChange} from './tiptap_did_change.ts'\n\t// import {TextAnimation} from './tiptap_text_animation'\n//___________________________________________________________ NO you can NOT paste images with your text\n// https://stackoverflow.com/questions/17976533/using-javascript-is-it-possible-to-upload-images-along-with-text-pasted-from-ot\n// Give up.\n//________________________________________________________________________________________________________\n\n\nconst CustomHeading = Heading.extend({\n\taddAttributes() {\n\t\treturn {\n\t\t\tlevel: {\n\t\t\t\tdefault: 1,\n\t\t\t\trendered: false,\n\t\t\t},\n\t\t\tid: {\n\t\t\t\tdefault: undefined,\n\t\t\t\trendered: true\n\t\t\t}\n\t\t}\n\t}\n})\n\n// import morphdom from 'morphdom'\n\nfunction common(editor_element, editor_finput, unit) {\n\t// console.log(unit)\n\tvar selected_index = 0\n\tvar the_items = []\n\n\tvar mentions_menu_id = unit.element.id + \"_mentions\"\n\tvar mentions_menu = document.getElementById(mentions_menu_id)\n\tvar mentions_popup = null\n\t\n\t//tippy dissapears any html we give it when we go to a new page, so we do a backup I suppose.\n\t//\t\tTried alternatives. Basically do this or replace tippy.\n\tvar bubble_menu\n\tvar bubble_menu_id = unit.element.id + \"_bubble_menu\"\n\t// console.log(bubble_menu_id, bubble_menu)\n\tif(!unit.element.dataset.bubbleMenu){\n\t\tbubble_menu = document.getElementById(bubble_menu_id)\n\t\tunit.element.dataset.bubbleMenu = bubble_menu.outerHTML\n\t} else {\n\t\tunit.element.insertAdjacentHTML('beforeend', unit.element.dataset.bubbleMenu)\n\t\tbubble_menu = document.getElementById(bubble_menu_id)\n\t}\n\n\t//same as above.\n\tvar floating_menu\n\tvar floating_menu_id = unit.element.id + \"_floating_menu\"\n\tif(!unit.element.dataset.floatingMenu){\n\t\tfloating_menu = document.getElementById(floating_menu_id)\n\t\tunit.element.dataset.floatingMenu = floating_menu.outerHTML\n\t} else {\n\t\tunit.element.insertAdjacentHTML('beforeend', unit.element.dataset.floatingMenu)\n\t\tfloating_menu = document.getElementById(floating_menu_id)\n\t}\n\n\tvar word_count_id = unit.element.id + \"_word_count\"\n\n\tvar placeholder = unit.element.dataset.placeholder\n\n\tvar update_count = 0\n\tvar last_backup_time = (new Date()).getTime()\n\n\t// let tripMenuMove = () => {\n\t// \tdocument.tripwire('/editor/menu_move', {new_index: selected_index, users: the_items, menu_id: get_mentions_menu_id()})\n\t// }\n\tlet rend = (props) => {\n\t\tlet inner_list = '
    '\n\t\tlet x\n\t\t//create the items in the list\n\t\tfor(var i in the_items) {\n\t\t\tx = the_items[i]\n\t\t\tif(i == selected_index) {\n\t\t\t\tinner_list = inner_list + \"
  1. \" + x + \"
  2. \"\n\t\t\t} else {\n\t\t\t\tinner_list = inner_list + \"
  3. \" + x + \"
  4. \"\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tinner_list += \"
\"\n\n\t\t//Add the html string into the DOM\n\t\tlet ma = mentions_menu\n\t\tma.innerHTML = inner_list\n\t\tma.classList.add(\"mentionsListCard\")\n\n\t\t//add an event to accept clicks of different items\n\t\tlet clicky = (event) => {\n\t\t\tlet index = event.currentTarget.getAttribute('data-ind')\n\t\t\tif(!(index == undefined)) {\n\t\t\t\tprops.command({id: the_items[index]}) //<- selects\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t}\n\n\t\tlet list_items = ma.children[0].children\n\t\t\n\t\tfor( let list_item of list_items) {\n\t\t\tlist_item.addEventListener(\"click\", clicky)\n\t\t}\n\n\t\tif(mentions_popup == null) {\n\t\t\tmentions_popup = tippy('body', {\n\t\t\t\tgetReferenceClientRect: props.clientRect,\n\t\t\t\tappendTo: () => document.body,\n\t\t\t\tcontent: mentions_menu,\n\t\t\t\tshowOnCreate: true,\n\t\t\t\tinteractive: true,\n\t\t\t\ttrigger: 'manual',\n\t\t\t\tplacement: 'bottom-start'\n\t\t\t})\n\t\t}\n\t}\n\tlet extensions = [\n\t\tDocument,\n\t\tParagraph, \n\t\tText,\n\t\tBlockquote,\n\t\tListItem,\n\t\t// Suggestion,\n\t\tOrderedList,\n\t\tBulletList,\n\t\tCodeBlock,\n\t\tMention.configure({\n\t\t\tHTMLAttributes: {\n\t\t\t\tclass: \"editor-mention\",\n\t\t\t\t'data-unit': 'Mention'\n\t\t\t},\n\t\t\tparseHTML() {\n\t\t\t\treturn [\n\t\t\t\t {\n\t\t\t\t\tgetAttrs: x => ( x.dataset.unit == 'Mention' )\n\t\t\t\t }\n\t\t\t\t]\n\t\t\t},\n\t\t\tsuggestion: {\n\t\t\t\tallowedPrefixes: null,\n\t\t\t\trenderLabel({ options, node }) {\n\t\t\t\t\treturn options.suggestion.char + node.attrs.id\n\t\t\t\t},\n\t\t\t\titems(stuff) { \n\t\t\t\t\tlet query = stuff.query\n\t\t\t\t\treturn new Promise(function(resolve, reject) {\n\t\t\t\t\t\tdocument.quick_xhr(\"/editor/user_lookup\", {query: query}).then( (json) => {\n\t\t\t\t\t\t\t\tselected_index = 0\n\t\t\t\t\t\t\t\tthe_items = json.username_list\n\t\t\t\t\t\t\t\tresolve(json.username_list)\n\t\t\t\t\t\t\t}, (e)=>{ reject(e) })\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\trender() {\n\t\t\t\t\tlet props\n\t\t\t\t\treturn {\n\t\t\t\t\t\tonExit: () => {\n\t\t\t\t\t\t\tmentions_menu.innerHTML = ''\n\t\t\t\t\t\t\tmentions_popup[0].destroy()\n\t\t\t\t\t\t\tmentions_popup = null\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonStart: (props2) => { \n\t\t\t\t\t\t\tprops = props2\n\t\t\t\t\t\t\trend(props)\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonUpdate: (props2) => {\t\n\t\t\t\t\t\t\tprops = props2\n\t\t\t\t\t\t\trend(props)\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonKeyDown(view_event_range) {\n\t\t\t\t\t\t\tlet event = view_event_range.event\n\t\t\t\t\t\t\tif(event.key == \"ArrowUp\") {\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tselected_index = selected_index - 1\n\t\t\t\t\t\t\t\tif( selected_index < 0 ){ selected_index = 0 }\n\t\t\t\t\t\t\t\trend(props)\n\t\t\t\t\t\t\t} else if (event.key == \"ArrowDown\") {\n\t\t\t\t\t\t\t\tselected_index = selected_index + 1\n\t\t\t\t\t\t\t\tif(selected_index >= the_items.length){ selected_index = the_items.length - 1 }\n\t\t\t\t\t\t\t\trend(props)\n\t\t\t\t\t\t\t} else if (event.key == \"Enter\") {\n\t\t\t\t\t\t\t\tprops.command({id: the_items[selected_index]})\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t}),\n\t\tImage.configure({\n\t\t\tHTMLAttributes: {\n\t\t\t\tclass: \"editor-image\"\n\t\t\t}\n\t\t}),\n\t\tYoutube.configure({\n\t\t\torigin: \"midflip.io\",\n\t\t\tmodestBranding: 'true',\n\t\t\tHTMLAttributes: {\n\t\t\t\tclass: \"editor-video\"\n\t\t\t}\n\t\t}),\n\t\tMidFlipPreview.configure({}),\n\t\tBold,\n\t\tItalic,\n\t\tCustomHeading.configure({\n\t\t\tlevels: [1,2,3],\n\t\t}),\n\t\tLink.configure({\n\t\t\tHTMLAttributes: {rel: null}\n\t\t}),\n\t\tSuperscript,\n\t\tDropcursor.configure({\n\t\t\t// color: '#ff0000',\n\t\t\twidth: 2,\n\t\t\tclass: \"editor-dropcursor\"\n\t\t}),\n\t\tHistory,\n\t\tTypography,\n\t\tPlaceholder.configure({\n\t\t\tplaceholder: placeholder,\n\t\t}),\n\t\tBubbleMenu.configure({\n\t\t\telement: bubble_menu,\n\t\t\ttippyOptions: {\n\t\t\t\tplacement: 'top-start', \n\t\t\t\tonShow: (instance) => { \n\t\t\t\t\tunit.refreshActive(bubble_menu)\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\t\tFloatingMenu.configure({\n\t\t\telement: floating_menu,\n\t\t\ttippyOptions: {\n\t\t\t\tplacement: 'top-start',\n\t\t\t\tonShow: (instance) => { \n\t\t\t\t\tunit.refreshActive(floating_menu)\n\t\t\t\t}, \n\t\t\t},\n\t\t\tshouldShow: ({ editor, view, state, oldState }) => {\n\t\t\t\t// show the floating within any paragraph\n\t\t\t\tlet sel = state.selection\n\t\t\t\tif(sel.to != sel.from){ return false }\n\n\t\t\t\tlet n = view.domAtPos(sel.head).node\n\t\t\t\t//bs checks\n\t\t\t\tif(!n){return false}\t\t\t//< this happens sometimes\n\t\t\t\tif(!n.children){return false}\t//< makes sure regular node\n\t\t\t\t//make sure line does not already \"have stuff\"\n\t\t\t\tlet a_kid = Array.from(n.children).find((z) => {z.nodeName != 'BR'})\n\t\t\t\tif(a_kid){return false}\n\t\t\t\tif(n.textContent){ return false }\n\t\t\t\t//make sure not in something dumb\n\t\t\t\tlet par = n.parentElement\n\t\t\t\tif(par.dataset.midflipDrop && par.children[0] == n ){return false}\n\t\t\t\treturn true\n\t\t\t},\n\t\t}),\n\t\tDidChange,\n\t\tDrop,\n\t]\n\n\tif(unit.element.dataset.wordCount != null) {\n\t\textensions.push(\n\t\t\tWordCount.configure({\n\t\t\t\tlimit: 800,\n\t\t\t\tid: word_count_id\n\t\t\t})\n\t\t)\n\t}\n\n\treturn {\n\t\telement: editor_element,\n\t\textensions: extensions,\n\t\tcontent: editor_finput.value, //<-\n\t\tonUpdate: (a) => {\n\t\t\t//dont update the input element here otherwise it does that allllll the timmmmmeeeeeeeeee and its annoyinnngggggggg\n\t\t\t//(and will prob break if writing something big)\n\t\t\t//do backups\n\t\t\tlet backup_type = editor_element.getAttribute('data-backup-type')\n\t\t\tif(backup_type != undefined) {\n\t\t\t\tupdate_count += 1\n\t\t\t\tlet dtn = ( new Date() ).getTime()\n\t\t\t\tlet stuff_has_happened = ( update_count % 45 == 0 )\n\t\t\t\tlet its_been_twenty_seconds = ( dtn - last_backup_time ) > 10000\n\t\t\t\tif (stuff_has_happened && its_been_twenty_seconds ) {\n\t\t\t\t\tlast_backup_time = dtn\n\t\t\t\t\tlet content = a.editor.getHTML()\n\t\t\t\t\tdocument.tripwire('/api/bup', {form_info: {content, backup_type: backup_type}})\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t}\n}\n\nexport default function tiptapinit(editor_element, editor_finput, small, unit) {\n\tlet ed = new Editor(common(editor_element, editor_finput, unit))\n\t// console.log(\"Initialized editor for \", editor_element, ed)\n\treturn ed\n\t// return false\n\n}"],"names":["WordCount","Extension","create","name","addOptions","limit","id","mode","addStorage","characters","words","onBeforeCreate","this","storage","options","node","editor","state","doc","textBetween","content","size","undefined","length","nodeSize","split","filter","word","addProseMirrorPlugins","Plugin","key","PluginKey","filterTransaction","transaction","console","log","docChanged","oldSize","newSize","sz","span_id","a","document","querySelector","innerHTML","toString","parentElement","classList","remove","add","el","updateSize","Node","inline","isolating","group","draggable","props","updateAttributes","required","addAttributes","default","addNodeView","HTMLAttributes","top","createElement","Object","keys","k","setAttribute","dom","contentDOM","onUpdate","descendants","pos","parent","index","type","childCount","textContent","trim","tr","deleteRange","view","dispatch","bind","parseHTML","tag","getAttrs","dataset","midflipDrop","renderHTML","inp","addCommands","insertDrop","commands","insertContent","attrs","onCreate","trans","selection","dropEl","nodeDOM","toggle_h","children","clientHeight","setNodeAttribute","onSelectionUpdate","elStart","elStop","inside","from","to","c","style","cls","MidFlipPreview","src","insertPreview","addPasteRules","mergeAttributes","DidChange","CustomHeading","Heading","extend","level","rendered","tiptapinit","editor_element","editor_finput","small","unit","ed","Editor","bubble_menu","floating_menu","selected_index","the_items","mentions_menu_id","element","mentions_menu","getElementById","mentions_popup","bubble_menu_id","bubbleMenu","insertAdjacentHTML","outerHTML","floating_menu_id","floatingMenu","word_count_id","placeholder","update_count","last_backup_time","Date","getTime","rend","x","inner_list","i","ma","clicky","event","currentTarget","getAttribute","command","preventDefault","list_items","addEventListener","tippy","getReferenceClientRect","clientRect","appendTo","body","showOnCreate","interactive","trigger","placement","extensions","Document","Paragraph","Text","Blockquote","ListItem","OrderedList","BulletList","CodeBlock","Mention","configure","class","suggestion","allowedPrefixes","renderLabel","char","items","stuff","query","Promise","resolve","reject","quick_xhr","then","json","username_list","e","render","onExit","destroy","onStart","props2","onKeyDown","view_event_range","Image","Youtube","origin","modestBranding","Bold","Italic","levels","Link","rel","Superscript","Dropcursor","width","History","Typography","Placeholder","BubbleMenu","tippyOptions","onShow","instance","refreshActive","FloatingMenu","shouldShow","sel","oldState","n","domAtPos","head","Array","find","z","nodeName","par","Drop","wordCount","push","value","backup_type","dtn","getHTML","tripwire","form_info","common"],"sourceRoot":""}