{"version":3,"file":"trix.umd.min.js","sources":["../src/trix/config/attachments.js","../src/trix/config/block_attributes.js","../src/trix/config/browser.js","../src/trix/config/lang.js","../src/trix/config/file_size_formatting.js","../src/trix/constants.js","../src/trix/core/helpers/extend.js","../src/trix/core/helpers/dom.js","../src/trix/config/input.js","../src/trix/config/key_names.js","../src/trix/config/parser.js","../src/trix/config/text_attributes.js","../src/trix/config/toolbar.js","../src/trix/config/undo.js","../src/trix/config/css.js","../src/trix/core/basic_object.js","../src/trix/core/utilities/utf16_string.js","../src/trix/core/object.js","../src/trix/core/helpers/arrays.js","../src/trix/core/helpers/bidi.js","../src/trix/core/helpers/config.js","../src/trix/core/helpers/custom_elements.js","../src/trix/core/helpers/events.js","../src/trix/core/helpers/functions.js","../src/trix/core/helpers/objects.js","../src/trix/core/helpers/ranges.js","../src/trix/observers/selection_change_observer.js","../src/trix/core/helpers/strings.js","../src/trix/core/collections/hash.js","../src/trix/core/collections/object_group.js","../src/trix/core/collections/object_map.js","../src/trix/core/collections/element_store.js","../src/trix/core/utilities/operation.js","../src/trix/views/object_view.js","../src/trix/models/html_sanitizer.js","../src/trix/views/attachment_view.js","../src/trix/views/previewable_attachment_view.js","../src/trix/views/piece_view.js","../src/trix/views/text_view.js","../src/trix/views/block_view.js","../src/trix/views/document_view.js","../src/trix/models/piece.js","../src/trix/operations/image_preload_operation.js","../src/trix/models/attachment.js","../src/trix/models/attachment_piece.js","../src/trix/models/string_piece.js","../src/trix/models/splittable_list.js","../src/trix/models/text.js","../src/trix/models/block.js","../src/trix/models/document.js","../src/trix/models/html_parser.js","../src/trix/core/serialization.js","../src/trix/models/managed_attachment.js","../src/trix/models/attachment_manager.js","../src/trix/models/line_break_insertion.js","../src/trix/models/composition.js","../src/trix/models/undo_manager.js","../src/trix/filters/filter.js","../src/trix/filters/attachment_gallery_filter.js","../src/trix/models/editor.js","../src/trix/models/location_mapper.js","../src/trix/models/point_mapper.js","../src/trix/models/selection_manager.js","../src/trix/controllers/attachment_editor_controller.js","../src/trix/controllers/composition_controller.js","../src/trix/controllers/controller.js","../src/trix/observers/mutation_observer.js","../src/trix/operations/file_verification_operation.js","../src/trix/models/flaky_android_keyboard_detector.js","../src/trix/controllers/input_controller.js","../src/trix/controllers/level_0_input_controller.js","../src/trix/controllers/level_2_input_controller.js","../src/trix/controllers/toolbar_controller.js","../src/trix/controllers/editor_controller.js","../src/trix/elements/trix_toolbar_element.js","../src/trix/elements/trix_editor_element.js","../src/trix/trix.js"],"sourcesContent":["export const attachmentSelector = \"[data-trix-attachment]\"\n\nconst attachments = {\n preview: {\n presentation: \"gallery\",\n caption: {\n name: true,\n size: true,\n },\n },\n file: {\n caption: {\n size: true,\n },\n },\n}\nexport default attachments\n","const attributes = {\n default: {\n tagName: \"div\",\n parse: false,\n },\n quote: {\n tagName: \"blockquote\",\n nestable: true,\n },\n heading1: {\n tagName: \"h1\",\n terminal: true,\n breakOnReturn: true,\n group: false,\n },\n code: {\n tagName: \"pre\",\n terminal: true,\n htmlAttributes: [ \"language\" ],\n text: {\n plaintext: true,\n },\n },\n bulletList: {\n tagName: \"ul\",\n parse: false,\n },\n bullet: {\n tagName: \"li\",\n listAttribute: \"bulletList\",\n group: false,\n nestable: true,\n test(element) {\n return tagName(element.parentNode) === attributes[this.listAttribute].tagName\n },\n },\n numberList: {\n tagName: \"ol\",\n parse: false,\n },\n number: {\n tagName: \"li\",\n listAttribute: \"numberList\",\n group: false,\n nestable: true,\n test(element) {\n return tagName(element.parentNode) === attributes[this.listAttribute].tagName\n },\n },\n attachmentGallery: {\n tagName: \"div\",\n exclusive: true,\n terminal: true,\n parse: false,\n group: false,\n },\n}\n\nconst tagName = (element) => element?.tagName?.toLowerCase()\n\nexport default attributes\n","const androidVersionMatch = navigator.userAgent.match(/android\\s([0-9]+.*Chrome)/i)\nconst androidVersion = androidVersionMatch && parseInt(androidVersionMatch[1])\n\nexport default {\n // Android emits composition events when moving the cursor through existing text\n // Introduced in Chrome 65: https://bugs.chromium.org/p/chromium/issues/detail?id=764439#c9\n composesExistingText: /Android.*Chrome/.test(navigator.userAgent),\n\n // Android 13, especially on Samsung keyboards, emits extra compositionend and beforeinput events\n // that can make the input handler lose the current selection or enter an infinite input -> render -> input\n // loop.\n recentAndroid: androidVersion && androidVersion > 12,\n samsungAndroid: androidVersion && navigator.userAgent.match(/Android.*SM-/),\n\n // IE 11 activates resizing handles on editable elements that have \"layout\"\n forcesObjectResizing: /Trident.*rv:11/.test(navigator.userAgent),\n // https://www.w3.org/TR/input-events-1/ + https://www.w3.org/TR/input-events-2/\n supportsInputEvents: typeof InputEvent !== \"undefined\" &&\n [ \"data\", \"getTargetRanges\", \"inputType\" ].every(prop => prop in InputEvent.prototype),\n}\n","export default {\n attachFiles: \"Attach Files\",\n bold: \"Bold\",\n bullets: \"Bullets\",\n byte: \"Byte\",\n bytes: \"Bytes\",\n captionPlaceholder: \"Add a caption…\",\n code: \"Code\",\n heading1: \"Heading\",\n indent: \"Increase Level\",\n italic: \"Italic\",\n link: \"Link\",\n numbers: \"Numbers\",\n outdent: \"Decrease Level\",\n quote: \"Quote\",\n redo: \"Redo\",\n remove: \"Remove\",\n strike: \"Strikethrough\",\n undo: \"Undo\",\n unlink: \"Unlink\",\n url: \"URL\",\n urlPlaceholder: \"Enter a URL…\",\n GB: \"GB\",\n KB: \"KB\",\n MB: \"MB\",\n PB: \"PB\",\n TB: \"TB\",\n}\n","/* eslint-disable\n no-case-declarations,\n*/\nimport lang from \"trix/config/lang\"\n\nconst sizes = [ lang.bytes, lang.KB, lang.MB, lang.GB, lang.TB, lang.PB ]\n\nexport default {\n prefix: \"IEC\",\n precision: 2,\n\n formatter(number) {\n switch (number) {\n case 0:\n return `0 ${lang.bytes}`\n case 1:\n return `1 ${lang.byte}`\n default:\n let base\n\n if (this.prefix === \"SI\") {\n base = 1000\n } else if (this.prefix === \"IEC\") {\n base = 1024\n }\n\n const exp = Math.floor(Math.log(number) / Math.log(base))\n const humanSize = number / Math.pow(base, exp)\n const string = humanSize.toFixed(this.precision)\n const withoutInsignificantZeros = string.replace(/0*$/, \"\").replace(/\\.$/, \"\")\n return `${withoutInsignificantZeros} ${sizes[exp]}`\n }\n },\n}\n","export const ZERO_WIDTH_SPACE = \"\\uFEFF\"\nexport const NON_BREAKING_SPACE = \"\\u00A0\"\nexport const OBJECT_REPLACEMENT_CHARACTER = \"\\uFFFC\"\n","export const extend = function(properties) {\n for (const key in properties) {\n const value = properties[key]\n this[key] = value\n }\n return this\n}\n","import blockAttributes from \"trix/config/block_attributes\"\nimport { ZERO_WIDTH_SPACE } from \"trix/constants\"\nimport { extend } from \"./extend\"\nimport { attachmentSelector } from \"trix/config/attachments\"\n\nconst html = document.documentElement\nconst match = html.matches\n\nexport const handleEvent = function(eventName, { onElement, matchingSelector, withCallback, inPhase, preventDefault, times } = {}) {\n const element = onElement ? onElement : html\n const selector = matchingSelector\n const useCapture = inPhase === \"capturing\"\n\n const handler = function(event) {\n if (times != null && --times === 0) {\n handler.destroy()\n }\n const target = findClosestElementFromNode(event.target, { matchingSelector: selector })\n if (target != null) {\n withCallback?.call(target, event, target)\n if (preventDefault) {\n event.preventDefault()\n }\n }\n }\n\n handler.destroy = () => element.removeEventListener(eventName, handler, useCapture)\n\n element.addEventListener(eventName, handler, useCapture)\n return handler\n}\n\nexport const handleEventOnce = function(eventName, options = {}) {\n options.times = 1\n return handleEvent(eventName, options)\n}\n\nexport const triggerEvent = function(eventName, { onElement, bubbles, cancelable, attributes } = {}) {\n const element = onElement != null ? onElement : html\n bubbles = bubbles !== false\n cancelable = cancelable !== false\n\n const event = document.createEvent(\"Events\")\n event.initEvent(eventName, bubbles, cancelable)\n if (attributes != null) {\n extend.call(event, attributes)\n }\n return element.dispatchEvent(event)\n}\n\nexport const elementMatchesSelector = function(element, selector) {\n if (element?.nodeType === 1) {\n return match.call(element, selector)\n }\n}\n\nexport const findClosestElementFromNode = function(node, { matchingSelector, untilNode } = {}) {\n while (node && node.nodeType !== Node.ELEMENT_NODE) {\n node = node.parentNode\n }\n if (node == null) {\n return\n }\n\n if (matchingSelector != null) {\n if (node.closest && untilNode == null) {\n return node.closest(matchingSelector)\n } else {\n while (node && node !== untilNode) {\n if (elementMatchesSelector(node, matchingSelector)) {\n return node\n }\n node = node.parentNode\n }\n }\n } else {\n return node\n }\n}\n\nexport const findInnerElement = function(element) {\n while (element?.firstElementChild) {\n element = element.firstElementChild\n }\n return element\n}\n\nexport const innerElementIsActive = (element) =>\n document.activeElement !== element && elementContainsNode(element, document.activeElement)\n\nexport const elementContainsNode = function(element, node) {\n if (!element || !node) {\n return\n }\n while (node) {\n if (node === element) {\n return true\n }\n node = node.parentNode\n }\n}\n\nexport const findNodeFromContainerAndOffset = function(container, offset) {\n if (!container) {\n return\n }\n if (container.nodeType === Node.TEXT_NODE) {\n return container\n } else if (offset === 0) {\n return container.firstChild != null ? container.firstChild : container\n } else {\n return container.childNodes.item(offset - 1)\n }\n}\n\nexport const findElementFromContainerAndOffset = function(container, offset) {\n const node = findNodeFromContainerAndOffset(container, offset)\n return findClosestElementFromNode(node)\n}\n\nexport const findChildIndexOfNode = function(node) {\n if (!node?.parentNode) {\n return\n }\n let childIndex = 0\n node = node.previousSibling\n while (node) {\n childIndex++\n node = node.previousSibling\n }\n return childIndex\n}\n\nexport const removeNode = (node) => node?.parentNode?.removeChild(node)\n\nexport const walkTree = function(tree, { onlyNodesOfType, usingFilter, expandEntityReferences } = {}) {\n const whatToShow = (() => {\n switch (onlyNodesOfType) {\n case \"element\":\n return NodeFilter.SHOW_ELEMENT\n case \"text\":\n return NodeFilter.SHOW_TEXT\n case \"comment\":\n return NodeFilter.SHOW_COMMENT\n default:\n return NodeFilter.SHOW_ALL\n }\n })()\n\n return document.createTreeWalker(\n tree,\n whatToShow,\n usingFilter != null ? usingFilter : null,\n expandEntityReferences === true\n )\n}\n\nexport const tagName = (element) => element?.tagName?.toLowerCase()\n\nexport const makeElement = function(tag, options = {}) {\n let key, value\n if (typeof tag === \"object\") {\n options = tag\n tag = options.tagName\n } else {\n options = { attributes: options }\n }\n\n const element = document.createElement(tag)\n\n if (options.editable != null) {\n if (options.attributes == null) {\n options.attributes = {}\n }\n options.attributes.contenteditable = options.editable\n }\n\n if (options.attributes) {\n for (key in options.attributes) {\n value = options.attributes[key]\n element.setAttribute(key, value)\n }\n }\n\n if (options.style) {\n for (key in options.style) {\n value = options.style[key]\n element.style[key] = value\n }\n }\n\n if (options.data) {\n for (key in options.data) {\n value = options.data[key]\n element.dataset[key] = value\n }\n }\n\n if (options.className) {\n options.className.split(\" \").forEach((className) => {\n element.classList.add(className)\n })\n }\n\n if (options.textContent) {\n element.textContent = options.textContent\n }\n\n if (options.childNodes) {\n [].concat(options.childNodes).forEach((childNode) => {\n element.appendChild(childNode)\n })\n }\n\n return element\n}\n\nlet blockTagNames = undefined\n\nexport const getBlockTagNames = function() {\n if (blockTagNames != null) {\n return blockTagNames\n }\n\n blockTagNames = []\n for (const key in blockAttributes) {\n const attributes = blockAttributes[key]\n if (attributes.tagName) {\n blockTagNames.push(attributes.tagName)\n }\n }\n\n return blockTagNames\n}\n\nexport const nodeIsBlockContainer = (node) => nodeIsBlockStartComment(node?.firstChild)\n\nexport const nodeProbablyIsBlockContainer = function(node) {\n return getBlockTagNames().includes(tagName(node)) && !getBlockTagNames().includes(tagName(node.firstChild))\n}\n\nexport const nodeIsBlockStart = function(node, { strict } = { strict: true }) {\n if (strict) {\n return nodeIsBlockStartComment(node)\n } else {\n return (\n nodeIsBlockStartComment(node) || !nodeIsBlockStartComment(node.firstChild) && nodeProbablyIsBlockContainer(node)\n )\n }\n}\n\nexport const nodeIsBlockStartComment = (node) => nodeIsCommentNode(node) && node?.data === \"block\"\n\nexport const nodeIsCommentNode = (node) => node?.nodeType === Node.COMMENT_NODE\n\nexport const nodeIsCursorTarget = function(node, { name } = {}) {\n if (!node) {\n return\n }\n if (nodeIsTextNode(node)) {\n if (node.data === ZERO_WIDTH_SPACE) {\n if (name) {\n return node.parentNode.dataset.trixCursorTarget === name\n } else {\n return true\n }\n }\n } else {\n return nodeIsCursorTarget(node.firstChild)\n }\n}\n\nexport const nodeIsAttachmentElement = (node) => elementMatchesSelector(node, attachmentSelector)\n\nexport const nodeIsEmptyTextNode = (node) => nodeIsTextNode(node) && node?.data === \"\"\n\nexport const nodeIsTextNode = (node) => node?.nodeType === Node.TEXT_NODE\n","import browser from \"trix/config/browser\"\nimport { makeElement, removeNode } from \"trix/core/helpers/dom\"\n\nconst input = {\n level2Enabled: true,\n\n getLevel() {\n if (this.level2Enabled && browser.supportsInputEvents) {\n return 2\n } else {\n return 0\n }\n },\n pickFiles(callback) {\n const input = makeElement(\"input\", { type: \"file\", multiple: true, hidden: true, id: this.fileInputId })\n\n input.addEventListener(\"change\", () => {\n callback(input.files)\n removeNode(input)\n })\n\n removeNode(document.getElementById(this.fileInputId))\n document.body.appendChild(input)\n input.click()\n }\n}\n\nexport default input\n","export default {\n 8: \"backspace\",\n 9: \"tab\",\n 13: \"return\",\n 27: \"escape\",\n 37: \"left\",\n 39: \"right\",\n 46: \"delete\",\n 68: \"d\",\n 72: \"h\",\n 79: \"o\",\n}\n","export default {\n removeBlankTableCells: false,\n tableCellSeparator: \" | \",\n tableRowSeparator: \"\\n\",\n}\n","import { attachmentSelector } from \"trix/config/attachments\"\n\nexport default {\n bold: {\n tagName: \"strong\",\n inheritable: true,\n parser(element) {\n const style = window.getComputedStyle(element)\n return style.fontWeight === \"bold\" || style.fontWeight >= 600\n },\n },\n italic: {\n tagName: \"em\",\n inheritable: true,\n parser(element) {\n const style = window.getComputedStyle(element)\n return style.fontStyle === \"italic\"\n },\n },\n href: {\n groupTagName: \"a\",\n parser(element) {\n const matchingSelector = `a:not(${attachmentSelector})`\n const link = element.closest(matchingSelector)\n if (link) {\n return link.getAttribute(\"href\")\n }\n },\n },\n strike: {\n tagName: \"del\",\n inheritable: true,\n },\n frozen: {\n style: { backgroundColor: \"highlight\" },\n },\n}\n","import lang from \"trix/config/lang\"\n\nexport default {\n getDefaultHTML() {\n return `
\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n\n \n \n \n\n \n\n \n \n \n \n
\n\n
\n
\n \n
\n
`\n },\n}\n","const undo = { interval: 5000 }\nexport default undo\n","export default {\n attachment: \"attachment\",\n attachmentCaption: \"attachment__caption\",\n attachmentCaptionEditor: \"attachment__caption-editor\",\n attachmentMetadata: \"attachment__metadata\",\n attachmentMetadataContainer: \"attachment__metadata-container\",\n attachmentName: \"attachment__name\",\n attachmentProgress: \"attachment__progress\",\n attachmentSize: \"attachment__size\",\n attachmentToolbar: \"attachment__toolbar\",\n attachmentGallery: \"attachment-gallery\",\n}\n","export default class BasicObject {\n static proxyMethod(expression) {\n const { name, toMethod, toProperty, optional } = parseProxyMethodExpression(expression)\n\n this.prototype[name] = function() {\n let subject\n let object\n\n if (toMethod) {\n if (optional) {\n object = this[toMethod]?.()\n } else {\n object = this[toMethod]()\n }\n } else if (toProperty) {\n object = this[toProperty]\n }\n\n if (optional) {\n subject = object?.[name]\n if (subject) {\n return apply.call(subject, object, arguments)\n }\n } else {\n subject = object[name]\n return apply.call(subject, object, arguments)\n }\n }\n }\n}\n\nconst parseProxyMethodExpression = function(expression) {\n const match = expression.match(proxyMethodExpressionPattern)\n if (!match) {\n throw new Error(`can't parse @proxyMethod expression: ${expression}`)\n }\n\n const args = { name: match[4] }\n\n if (match[2] != null) {\n args.toMethod = match[1]\n } else {\n args.toProperty = match[1]\n }\n\n if (match[3] != null) {\n args.optional = true\n }\n\n return args\n}\n\nconst { apply } = Function.prototype\n\nconst proxyMethodExpressionPattern = new RegExp(\"\\\n^\\\n(.+?)\\\n(\\\\(\\\\))?\\\n(\\\\?)?\\\n\\\\.\\\n(.+?)\\\n$\\\n\")\n","import BasicObject from \"trix/core/basic_object\"\n\nexport default class UTF16String extends BasicObject {\n static box(value = \"\") {\n if (value instanceof this) {\n return value\n } else {\n return this.fromUCS2String(value?.toString())\n }\n }\n\n static fromUCS2String(ucs2String) {\n return new this(ucs2String, ucs2decode(ucs2String))\n }\n\n static fromCodepoints(codepoints) {\n return new this(ucs2encode(codepoints), codepoints)\n }\n\n constructor(ucs2String, codepoints) {\n super(...arguments)\n this.ucs2String = ucs2String\n this.codepoints = codepoints\n this.length = this.codepoints.length\n this.ucs2Length = this.ucs2String.length\n }\n\n offsetToUCS2Offset(offset) {\n return ucs2encode(this.codepoints.slice(0, Math.max(0, offset))).length\n }\n\n offsetFromUCS2Offset(ucs2Offset) {\n return ucs2decode(this.ucs2String.slice(0, Math.max(0, ucs2Offset))).length\n }\n\n slice() {\n return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))\n }\n\n charAt(offset) {\n return this.slice(offset, offset + 1)\n }\n\n isEqualTo(value) {\n return this.constructor.box(value).ucs2String === this.ucs2String\n }\n\n toJSON() {\n return this.ucs2String\n }\n\n getCacheKey() {\n return this.ucs2String\n }\n\n toString() {\n return this.ucs2String\n }\n}\n\nconst hasArrayFrom = Array.from?.(\"\\ud83d\\udc7c\").length === 1\nconst hasStringCodePointAt = \" \".codePointAt?.(0) != null\nconst hasStringFromCodePoint = String.fromCodePoint?.(32, 128124) === \" \\ud83d\\udc7c\"\n\n// UCS-2 conversion helpers ported from Mathias Bynens' Punycode.js:\n// https://github.com/bestiejs/punycode.js#punycodeucs2\n\nlet ucs2decode, ucs2encode\n\n// Creates an array containing the numeric code points of each Unicode\n// character in the string. While JavaScript uses UCS-2 internally,\n// this function will convert a pair of surrogate halves (each of which\n// UCS-2 exposes as separate characters) into a single code point,\n// matching UTF-16.\nif (hasArrayFrom && hasStringCodePointAt) {\n ucs2decode = (string) => Array.from(string).map((char) => char.codePointAt(0))\n} else {\n ucs2decode = function(string) {\n const output = []\n let counter = 0\n const { length } = string\n\n while (counter < length) {\n let value = string.charCodeAt(counter++)\n if (0xd800 <= value && value <= 0xdbff && counter < length) {\n // high surrogate, and there is a next character\n const extra = string.charCodeAt(counter++)\n if ((extra & 0xfc00) === 0xdc00) {\n // low surrogate\n value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000\n } else {\n // unmatched surrogate; only append this code unit, in case the\n // next code unit is the high surrogate of a surrogate pair\n counter--\n }\n }\n output.push(value)\n }\n\n return output\n }\n}\n\n// Creates a string based on an array of numeric code points.\nif (hasStringFromCodePoint) {\n ucs2encode = (array) => String.fromCodePoint(...Array.from(array || []))\n} else {\n ucs2encode = function(array) {\n const characters = (() => {\n const result = []\n\n Array.from(array).forEach((value) => {\n let output = \"\"\n if (value > 0xffff) {\n value -= 0x10000\n output += String.fromCharCode(value >>> 10 & 0x3ff | 0xd800)\n value = 0xdc00 | value & 0x3ff\n }\n result.push(output + String.fromCharCode(value))\n })\n\n return result\n })()\n\n return characters.join(\"\")\n }\n}\n","import BasicObject from \"trix/core/basic_object\"\nimport UTF16String from \"trix/core/utilities/utf16_string\"\n\nlet id = 0\n\nexport default class TrixObject extends BasicObject {\n static fromJSONString(jsonString) {\n return this.fromJSON(JSON.parse(jsonString))\n }\n\n constructor() {\n super(...arguments)\n this.id = ++id\n }\n\n hasSameConstructorAs(object) {\n return this.constructor === object?.constructor\n }\n\n isEqualTo(object) {\n return this === object\n }\n\n inspect() {\n const parts = []\n const contents = this.contentsForInspection() || {}\n\n for (const key in contents) {\n const value = contents[key]\n parts.push(`${key}=${value}`)\n }\n\n return `#<${this.constructor.name}:${this.id}${parts.length ? ` ${parts.join(\", \")}` : \"\"}>`\n }\n\n contentsForInspection() {}\n\n toJSONString() {\n return JSON.stringify(this)\n }\n\n toUTF16String() {\n return UTF16String.box(this)\n }\n\n getCacheKey() {\n return this.id.toString()\n }\n}\n","/* eslint-disable\n id-length,\n*/\nexport const arraysAreEqual = function(a = [], b = []) {\n if (a.length !== b.length) {\n return false\n }\n for (let index = 0; index < a.length; index++) {\n const value = a[index]\n if (value !== b[index]) {\n return false\n }\n }\n return true\n}\n\nexport const arrayStartsWith = (a = [], b = []) => arraysAreEqual(a.slice(0, b.length), b)\n\nexport const spliceArray = function(array, ...args) {\n const result = array.slice(0)\n result.splice(...args)\n return result\n}\n\nexport const summarizeArrayChange = function(oldArray = [], newArray = []) {\n const added = []\n const removed = []\n\n const existingValues = new Set()\n\n oldArray.forEach((value) => {\n existingValues.add(value)\n })\n\n const currentValues = new Set()\n\n newArray.forEach((value) => {\n currentValues.add(value)\n if (!existingValues.has(value)) {\n added.push(value)\n }\n })\n\n oldArray.forEach((value) => {\n if (!currentValues.has(value)) {\n removed.push(value)\n }\n })\n\n return { added, removed }\n}\n","import { makeElement } from \"trix/core/helpers/dom\"\n\n// https://github.com/mathiasbynens/unicode-2.1.8/blob/master/Bidi_Class/Right_To_Left/regex.js\nconst RTL_PATTERN =\n /[\\u05BE\\u05C0\\u05C3\\u05D0-\\u05EA\\u05F0-\\u05F4\\u061B\\u061F\\u0621-\\u063A\\u0640-\\u064A\\u066D\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D5\\u06E5\\u06E6\\u200F\\u202B\\u202E\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE72\\uFE74\\uFE76-\\uFEFC]/\n\nexport const getDirection = (function() {\n const input = makeElement(\"input\", { dir: \"auto\", name: \"x\", dirName: \"x.dir\" })\n const textArea = makeElement(\"textarea\", { dir: \"auto\", name: \"y\", dirName: \"y.dir\" })\n const form = makeElement(\"form\")\n form.appendChild(input)\n form.appendChild(textArea)\n\n const supportsDirName = (function() {\n try {\n return new FormData(form).has(textArea.dirName)\n } catch (error) {\n return false\n }\n })()\n\n const supportsDirSelector = (function() {\n try {\n return input.matches(\":dir(ltr),:dir(rtl)\")\n } catch (error) {\n return false\n }\n })()\n\n if (supportsDirName) {\n return function(string) {\n textArea.value = string\n return new FormData(form).get(textArea.dirName)\n }\n } else if (supportsDirSelector) {\n return function(string) {\n input.value = string\n if (input.matches(\":dir(rtl)\")) {\n return \"rtl\"\n } else {\n return \"ltr\"\n }\n }\n } else {\n return function(string) {\n const char = string.trim().charAt(0)\n if (RTL_PATTERN.test(char)) {\n return \"rtl\"\n } else {\n return \"ltr\"\n }\n }\n }\n})()\n","import * as config from \"trix/config\"\n\nlet allAttributeNames = null\nlet blockAttributeNames = null\nlet textAttributeNames = null\nlet listAttributeNames = null\n\nexport const getAllAttributeNames = () => {\n if (!allAttributeNames) {\n allAttributeNames = getTextAttributeNames().concat(getBlockAttributeNames())\n }\n return allAttributeNames\n}\n\nexport const getBlockConfig = (attributeName) => config.blockAttributes[attributeName]\n\nexport const getBlockAttributeNames = () => {\n if (!blockAttributeNames) {\n blockAttributeNames = Object.keys(config.blockAttributes)\n }\n return blockAttributeNames\n}\n\nexport const getTextConfig = (attributeName) => config.textAttributes[attributeName]\n\nexport const getTextAttributeNames = () => {\n if (!textAttributeNames) {\n textAttributeNames = Object.keys(config.textAttributes)\n }\n return textAttributeNames\n}\n\nexport const getListAttributeNames = () => {\n if (!listAttributeNames) {\n listAttributeNames = []\n for (const key in config.blockAttributes) {\n const { listAttribute } = config.blockAttributes[key]\n if (listAttribute != null) {\n listAttributeNames.push(listAttribute)\n }\n }\n }\n return listAttributeNames\n}\n","/* eslint-disable\n*/\nexport const installDefaultCSSForTagName = function(tagName, defaultCSS) {\n const styleElement = insertStyleElementForTagName(tagName)\n styleElement.textContent = defaultCSS.replace(/%t/g, tagName)\n}\n\nconst insertStyleElementForTagName = function(tagName) {\n const element = document.createElement(\"style\")\n element.setAttribute(\"type\", \"text/css\")\n element.setAttribute(\"data-tag-name\", tagName.toLowerCase())\n const nonce = getCSPNonce()\n if (nonce) {\n element.setAttribute(\"nonce\", nonce)\n }\n document.head.insertBefore(element, document.head.firstChild)\n return element\n}\n\nconst getCSPNonce = function() {\n const element = getMetaElement(\"trix-csp-nonce\") || getMetaElement(\"csp-nonce\")\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n\nconst getMetaElement = (name) => document.head.querySelector(`meta[name=${name}]`)\n","const testTransferData = { \"application/x-trix-feature-detection\": \"test\" }\n\nexport const dataTransferIsPlainText = function(dataTransfer) {\n const text = dataTransfer.getData(\"text/plain\")\n const html = dataTransfer.getData(\"text/html\")\n\n if (text && html) {\n const { body } = new DOMParser().parseFromString(html, \"text/html\")\n if (body.textContent === text) {\n return !body.querySelector(\"*\")\n }\n } else {\n return text?.length\n }\n}\n\nexport const dataTransferIsMsOfficePaste = ({ dataTransfer }) => {\n return dataTransfer.types.includes(\"Files\") &&\n dataTransfer.types.includes(\"text/html\") &&\n dataTransfer.getData(\"text/html\").includes(\"urn:schemas-microsoft-com:office:office\")\n}\n\nexport const dataTransferIsWritable = function(dataTransfer) {\n if (!dataTransfer?.setData) return false\n\n for (const key in testTransferData) {\n const value = testTransferData[key]\n\n try {\n dataTransfer.setData(key, value)\n if (!dataTransfer.getData(key) === value) return false\n } catch (error) {\n return false\n }\n }\n return true\n}\n\nexport const keyEventIsKeyboardCommand = (function() {\n if (/Mac|^iP/.test(navigator.platform)) {\n return (event) => event.metaKey\n } else {\n return (event) => event.ctrlKey\n }\n})()\n","export const defer = (fn) => setTimeout(fn, 1)\n","/* eslint-disable\n id-length,\n*/\nexport const copyObject = function(object = {}) {\n const result = {}\n for (const key in object) {\n const value = object[key]\n result[key] = value\n }\n return result\n}\n\nexport const objectsAreEqual = function(a = {}, b = {}) {\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false\n }\n for (const key in a) {\n const value = a[key]\n if (value !== b[key]) {\n return false\n }\n }\n return true\n}\n","import { copyObject, objectsAreEqual } from \"trix/core/helpers/objects\"\n\nexport const normalizeRange = function(range) {\n if (range == null) return\n\n if (!Array.isArray(range)) {\n range = [ range, range ]\n }\n return [ copyValue(range[0]), copyValue(range[1] != null ? range[1] : range[0]) ]\n}\n\nexport const rangeIsCollapsed = function(range) {\n if (range == null) return\n\n const [ start, end ] = normalizeRange(range)\n return rangeValuesAreEqual(start, end)\n}\n\nexport const rangesAreEqual = function(leftRange, rightRange) {\n if (leftRange == null || rightRange == null) return\n\n const [ leftStart, leftEnd ] = normalizeRange(leftRange)\n const [ rightStart, rightEnd ] = normalizeRange(rightRange)\n return rangeValuesAreEqual(leftStart, rightStart) && rangeValuesAreEqual(leftEnd, rightEnd)\n}\n\nconst copyValue = function(value) {\n if (typeof value === \"number\") {\n return value\n } else {\n return copyObject(value)\n }\n}\n\nconst rangeValuesAreEqual = function(left, right) {\n if (typeof left === \"number\") {\n return left === right\n } else {\n return objectsAreEqual(left, right)\n }\n}\n","import BasicObject from \"trix/core/basic_object\"\n\nexport default class SelectionChangeObserver extends BasicObject {\n constructor() {\n super(...arguments)\n this.update = this.update.bind(this)\n this.selectionManagers = []\n }\n\n start() {\n if (!this.started) {\n this.started = true\n document.addEventListener(\"selectionchange\", this.update, true)\n }\n }\n\n stop() {\n if (this.started) {\n this.started = false\n return document.removeEventListener(\"selectionchange\", this.update, true)\n }\n }\n\n registerSelectionManager(selectionManager) {\n if (!this.selectionManagers.includes(selectionManager)) {\n this.selectionManagers.push(selectionManager)\n return this.start()\n }\n }\n\n unregisterSelectionManager(selectionManager) {\n this.selectionManagers = this.selectionManagers.filter((sm) => sm !== selectionManager)\n if (this.selectionManagers.length === 0) {\n return this.stop()\n }\n }\n\n notifySelectionManagersOfSelectionChange() {\n return this.selectionManagers.map((selectionManager) => selectionManager.selectionDidChange())\n }\n\n update() {\n this.notifySelectionManagersOfSelectionChange()\n }\n\n reset() {\n this.update()\n }\n}\n\nexport const selectionChangeObserver = new SelectionChangeObserver()\n\nexport const getDOMSelection = function() {\n const selection = window.getSelection()\n if (selection.rangeCount > 0) {\n return selection\n }\n}\n\nexport const getDOMRange = function() {\n const domRange = getDOMSelection()?.getRangeAt(0)\n if (domRange) {\n if (!domRangeIsPrivate(domRange)) {\n return domRange\n }\n }\n}\n\nexport const setDOMRange = function(domRange) {\n const selection = window.getSelection()\n selection.removeAllRanges()\n selection.addRange(domRange)\n return selectionChangeObserver.update()\n}\n\n// In Firefox, clicking certain elements changes the selection to a\n// private element used to draw its UI. Attempting to access properties of those\n// elements throws an error.\n// https://bugzilla.mozilla.org/show_bug.cgi?id=208427\nconst domRangeIsPrivate = (domRange) => nodeIsPrivate(domRange.startContainer) || nodeIsPrivate(domRange.endContainer)\n\nconst nodeIsPrivate = (node) => !Object.getPrototypeOf(node)\n","/* eslint-disable\n id-length,\n no-useless-escape,\n*/\nimport { NON_BREAKING_SPACE, ZERO_WIDTH_SPACE } from \"trix/constants\"\nimport UTF16String from \"trix/core/utilities/utf16_string\"\n\nexport const normalizeSpaces = (string) =>\n string.replace(new RegExp(`${ZERO_WIDTH_SPACE}`, \"g\"), \"\").replace(new RegExp(`${NON_BREAKING_SPACE}`, \"g\"), \" \")\n\nexport const normalizeNewlines = (string) => string.replace(/\\r\\n?/g, \"\\n\")\n\nexport const breakableWhitespacePattern = new RegExp(`[^\\\\S${NON_BREAKING_SPACE}]`)\n\nexport const squishBreakableWhitespace = (string) =>\n string\n // Replace all breakable whitespace characters with a space\n .replace(new RegExp(`${breakableWhitespacePattern.source}`, \"g\"), \" \")\n // Replace two or more spaces with a single space\n .replace(/\\ {2,}/g, \" \")\n\nexport const summarizeStringChange = function(oldString, newString) {\n let added, removed\n oldString = UTF16String.box(oldString)\n newString = UTF16String.box(newString)\n\n if (newString.length < oldString.length) {\n [ removed, added ] = utf16StringDifferences(oldString, newString)\n } else {\n [ added, removed ] = utf16StringDifferences(newString, oldString)\n }\n\n return { added, removed }\n}\n\nconst utf16StringDifferences = function(a, b) {\n if (a.isEqualTo(b)) {\n return [ \"\", \"\" ]\n }\n\n const diffA = utf16StringDifference(a, b)\n const { length } = diffA.utf16String\n\n let diffB\n\n if (length) {\n const { offset } = diffA\n const codepoints = a.codepoints.slice(0, offset).concat(a.codepoints.slice(offset + length))\n diffB = utf16StringDifference(b, UTF16String.fromCodepoints(codepoints))\n } else {\n diffB = utf16StringDifference(b, a)\n }\n\n return [ diffA.utf16String.toString(), diffB.utf16String.toString() ]\n}\n\nconst utf16StringDifference = function(a, b) {\n let leftIndex = 0\n let rightIndexA = a.length\n let rightIndexB = b.length\n\n while (leftIndex < rightIndexA && a.charAt(leftIndex).isEqualTo(b.charAt(leftIndex))) {\n leftIndex++\n }\n\n while (rightIndexA > leftIndex + 1 && a.charAt(rightIndexA - 1).isEqualTo(b.charAt(rightIndexB - 1))) {\n rightIndexA--\n rightIndexB--\n }\n\n return {\n utf16String: a.slice(leftIndex, rightIndexA),\n offset: leftIndex,\n }\n}\n","import TrixObject from \"trix/core/object\" // Don't override window.Object\nimport { arraysAreEqual } from \"trix/core/helpers\"\n\nexport default class Hash extends TrixObject {\n static fromCommonAttributesOfObjects(objects = []) {\n if (!objects.length) {\n return new this()\n }\n let hash = box(objects[0])\n let keys = hash.getKeys()\n\n objects.slice(1).forEach((object) => {\n keys = hash.getKeysCommonToHash(box(object))\n hash = hash.slice(keys)\n })\n\n return hash\n }\n\n static box(values) {\n return box(values)\n }\n\n constructor(values = {}) {\n super(...arguments)\n this.values = copy(values)\n }\n\n add(key, value) {\n return this.merge(object(key, value))\n }\n\n remove(key) {\n return new Hash(copy(this.values, key))\n }\n\n get(key) {\n return this.values[key]\n }\n\n has(key) {\n return key in this.values\n }\n\n merge(values) {\n return new Hash(merge(this.values, unbox(values)))\n }\n\n slice(keys) {\n const values = {}\n\n Array.from(keys).forEach((key) => {\n if (this.has(key)) {\n values[key] = this.values[key]\n }\n })\n\n return new Hash(values)\n }\n\n getKeys() {\n return Object.keys(this.values)\n }\n\n getKeysCommonToHash(hash) {\n hash = box(hash)\n return this.getKeys().filter((key) => this.values[key] === hash.values[key])\n }\n\n isEqualTo(values) {\n return arraysAreEqual(this.toArray(), box(values).toArray())\n }\n\n isEmpty() {\n return this.getKeys().length === 0\n }\n\n toArray() {\n if (!this.array) {\n const result = []\n for (const key in this.values) {\n const value = this.values[key]\n result.push(result.push(key, value))\n }\n this.array = result.slice(0)\n }\n\n return this.array\n }\n\n toObject() {\n return copy(this.values)\n }\n\n toJSON() {\n return this.toObject()\n }\n\n contentsForInspection() {\n return { values: JSON.stringify(this.values) }\n }\n}\n\nconst object = function(key, value) {\n const result = {}\n result[key] = value\n return result\n}\n\nconst merge = function(object, values) {\n const result = copy(object)\n for (const key in values) {\n const value = values[key]\n result[key] = value\n }\n return result\n}\n\nconst copy = function(object, keyToRemove) {\n const result = {}\n const sortedKeys = Object.keys(object).sort()\n\n sortedKeys.forEach((key) => {\n if (key !== keyToRemove) {\n result[key] = object[key]\n }\n })\n\n return result\n}\n\nconst box = function(object) {\n if (object instanceof Hash) {\n return object\n } else {\n return new Hash(object)\n }\n}\n\nconst unbox = function(object) {\n if (object instanceof Hash) {\n return object.values\n } else {\n return object\n }\n}\n","export default class ObjectGroup {\n static groupObjects(ungroupedObjects = [], { depth, asTree } = {}) {\n let group\n if (asTree) {\n if (depth == null) {\n depth = 0\n }\n }\n const objects = []\n\n Array.from(ungroupedObjects).forEach((object) => {\n if (group) {\n if (object.canBeGrouped?.(depth) && group[group.length - 1].canBeGroupedWith?.(object, depth)) {\n group.push(object)\n return\n } else {\n objects.push(new this(group, { depth, asTree }))\n group = null\n }\n }\n\n if (object.canBeGrouped?.(depth)) {\n group = [ object ]\n } else {\n objects.push(object)\n }\n })\n\n if (group) {\n objects.push(new this(group, { depth, asTree }))\n }\n return objects\n }\n\n constructor(objects = [], { depth, asTree }) {\n this.objects = objects\n if (asTree) {\n this.depth = depth\n this.objects = this.constructor.groupObjects(this.objects, { asTree, depth: this.depth + 1 })\n }\n }\n\n getObjects() {\n return this.objects\n }\n\n getDepth() {\n return this.depth\n }\n\n getCacheKey() {\n const keys = [ \"objectGroup\" ]\n Array.from(this.getObjects()).forEach((object) => {\n keys.push(object.getCacheKey())\n })\n return keys.join(\"/\")\n }\n}\n","import BasicObject from \"trix/core/basic_object\"\n\nexport default class ObjectMap extends BasicObject {\n constructor(objects = []) {\n super(...arguments)\n this.objects = {}\n\n Array.from(objects).forEach((object) => {\n const hash = JSON.stringify(object)\n if (this.objects[hash] == null) {\n this.objects[hash] = object\n }\n })\n }\n\n find(object) {\n const hash = JSON.stringify(object)\n return this.objects[hash]\n }\n}\n","export default class ElementStore {\n constructor(elements) {\n this.reset(elements)\n }\n\n add(element) {\n const key = getKey(element)\n this.elements[key] = element\n }\n\n remove(element) {\n const key = getKey(element)\n const value = this.elements[key]\n if (value) {\n delete this.elements[key]\n return value\n }\n }\n\n reset(elements = []) {\n this.elements = {}\n Array.from(elements).forEach((element) => {\n this.add(element)\n })\n return elements\n }\n}\n\nconst getKey = (element) => element.dataset.trixStoreKey\n","import BasicObject from \"trix/core/basic_object\"\n\nexport default class Operation extends BasicObject {\n isPerforming() {\n return this.performing === true\n }\n\n hasPerformed() {\n return this.performed === true\n }\n\n hasSucceeded() {\n return this.performed && this.succeeded\n }\n\n hasFailed() {\n return this.performed && !this.succeeded\n }\n\n getPromise() {\n if (!this.promise) {\n this.promise = new Promise((resolve, reject) => {\n this.performing = true\n return this.perform((succeeded, result) => {\n this.succeeded = succeeded\n this.performing = false\n this.performed = true\n\n if (this.succeeded) {\n resolve(result)\n } else {\n reject(result)\n }\n })\n })\n }\n\n return this.promise\n }\n\n perform(callback) {\n return callback(false)\n }\n\n release() {\n this.promise?.cancel?.()\n this.promise = null\n this.performing = null\n this.performed = null\n this.succeeded = null\n }\n}\n\nOperation.proxyMethod(\"getPromise().then\")\nOperation.proxyMethod(\"getPromise().catch\")\n","import BasicObject from \"trix/core/basic_object\"\nimport ObjectGroup from \"trix/core/collections/object_group\"\n\nexport default class ObjectView extends BasicObject {\n constructor(object, options = {}) {\n super(...arguments)\n this.object = object\n this.options = options\n this.childViews = []\n this.rootView = this\n }\n\n getNodes() {\n if (!this.nodes) { this.nodes = this.createNodes() }\n return this.nodes.map((node) => node.cloneNode(true))\n }\n\n invalidate() {\n this.nodes = null\n this.childViews = []\n return this.parentView?.invalidate()\n }\n\n invalidateViewForObject(object) {\n return this.findViewForObject(object)?.invalidate()\n }\n\n findOrCreateCachedChildView(viewClass, object, options) {\n let view = this.getCachedViewForObject(object)\n if (view) {\n this.recordChildView(view)\n } else {\n view = this.createChildView(...arguments)\n this.cacheViewForObject(view, object)\n }\n return view\n }\n\n createChildView(viewClass, object, options = {}) {\n if (object instanceof ObjectGroup) {\n options.viewClass = viewClass\n viewClass = ObjectGroupView\n }\n\n const view = new viewClass(object, options)\n return this.recordChildView(view)\n }\n\n recordChildView(view) {\n view.parentView = this\n view.rootView = this.rootView\n this.childViews.push(view)\n return view\n }\n\n getAllChildViews() {\n let views = []\n\n this.childViews.forEach((childView) => {\n views.push(childView)\n views = views.concat(childView.getAllChildViews())\n })\n\n return views\n }\n\n findElement() {\n return this.findElementForObject(this.object)\n }\n\n findElementForObject(object) {\n const id = object?.id\n if (id) {\n return this.rootView.element.querySelector(`[data-trix-id='${id}']`)\n }\n }\n\n findViewForObject(object) {\n for (const view of this.getAllChildViews()) {\n if (view.object === object) {\n return view\n }\n }\n }\n\n getViewCache() {\n if (this.rootView === this) {\n if (this.isViewCachingEnabled()) {\n if (!this.viewCache) { this.viewCache = {} }\n return this.viewCache\n }\n } else {\n return this.rootView.getViewCache()\n }\n }\n\n isViewCachingEnabled() {\n return this.shouldCacheViews !== false\n }\n\n enableViewCaching() {\n this.shouldCacheViews = true\n }\n\n disableViewCaching() {\n this.shouldCacheViews = false\n }\n\n getCachedViewForObject(object) {\n return this.getViewCache()?.[object.getCacheKey()]\n }\n\n cacheViewForObject(view, object) {\n const cache = this.getViewCache()\n if (cache) {\n cache[object.getCacheKey()] = view\n }\n }\n\n garbageCollectCachedViews() {\n const cache = this.getViewCache()\n if (cache) {\n const views = this.getAllChildViews().concat(this)\n const objectKeys = views.map((view) => view.object.getCacheKey())\n for (const key in cache) {\n if (!objectKeys.includes(key)) {\n delete cache[key]\n }\n }\n }\n }\n}\n\nexport class ObjectGroupView extends ObjectView {\n constructor() {\n super(...arguments)\n this.objectGroup = this.object\n this.viewClass = this.options.viewClass\n delete this.options.viewClass\n }\n\n getChildViews() {\n if (!this.childViews.length) {\n Array.from(this.objectGroup.getObjects()).forEach((object) => {\n this.findOrCreateCachedChildView(this.viewClass, object, this.options)\n })\n }\n return this.childViews\n }\n\n createNodes() {\n const element = this.createContainerElement()\n\n this.getChildViews().forEach((view) => {\n Array.from(view.getNodes()).forEach((node) => {\n element.appendChild(node)\n })\n })\n\n return [ element ]\n }\n\n createContainerElement(depth = this.objectGroup.getDepth()) {\n return this.getChildViews()[0].createContainerElement(depth)\n }\n}\n","import BasicObject from \"trix/core/basic_object\"\n\nimport { nodeIsAttachmentElement, removeNode, tagName, walkTree } from \"trix/core/helpers\"\n\nconst DEFAULT_ALLOWED_ATTRIBUTES = \"style href src width height language class\".split(\" \")\nconst DEFAULT_FORBIDDEN_PROTOCOLS = \"javascript:\".split(\" \")\nconst DEFAULT_FORBIDDEN_ELEMENTS = \"script iframe form noscript\".split(\" \")\n\nexport default class HTMLSanitizer extends BasicObject {\n static setHTML(element, html) {\n const sanitizedElement = new this(html).sanitize()\n const sanitizedHtml = sanitizedElement.getHTML ? sanitizedElement.getHTML() : sanitizedElement.outerHTML\n element.innerHTML = sanitizedHtml\n }\n\n static sanitize(html, options) {\n const sanitizer = new this(html, options)\n sanitizer.sanitize()\n return sanitizer\n }\n\n constructor(html, { allowedAttributes, forbiddenProtocols, forbiddenElements } = {}) {\n super(...arguments)\n this.allowedAttributes = allowedAttributes || DEFAULT_ALLOWED_ATTRIBUTES\n this.forbiddenProtocols = forbiddenProtocols || DEFAULT_FORBIDDEN_PROTOCOLS\n this.forbiddenElements = forbiddenElements || DEFAULT_FORBIDDEN_ELEMENTS\n this.body = createBodyElementForHTML(html)\n }\n\n sanitize() {\n this.sanitizeElements()\n return this.normalizeListElementNesting()\n }\n\n getHTML() {\n return this.body.innerHTML\n }\n\n getBody() {\n return this.body\n }\n\n // Private\n\n sanitizeElements() {\n const walker = walkTree(this.body)\n const nodesToRemove = []\n\n while (walker.nextNode()) {\n const node = walker.currentNode\n switch (node.nodeType) {\n case Node.ELEMENT_NODE:\n if (this.elementIsRemovable(node)) {\n nodesToRemove.push(node)\n } else {\n this.sanitizeElement(node)\n }\n break\n case Node.COMMENT_NODE:\n nodesToRemove.push(node)\n break\n }\n }\n\n nodesToRemove.forEach((node) => removeNode(node))\n\n return this.body\n }\n\n sanitizeElement(element) {\n if (element.hasAttribute(\"href\")) {\n if (this.forbiddenProtocols.includes(element.protocol)) {\n element.removeAttribute(\"href\")\n }\n }\n\n Array.from(element.attributes).forEach(({ name }) => {\n if (!this.allowedAttributes.includes(name) && name.indexOf(\"data-trix\") !== 0) {\n element.removeAttribute(name)\n }\n })\n\n return element\n }\n\n normalizeListElementNesting() {\n Array.from(this.body.querySelectorAll(\"ul,ol\")).forEach((listElement) => {\n const previousElement = listElement.previousElementSibling\n if (previousElement) {\n if (tagName(previousElement) === \"li\") {\n previousElement.appendChild(listElement)\n }\n }\n })\n\n return this.body\n }\n\n elementIsRemovable(element) {\n if (element?.nodeType !== Node.ELEMENT_NODE) return\n return this.elementIsForbidden(element) || this.elementIsntSerializable(element)\n }\n\n elementIsForbidden(element) {\n return this.forbiddenElements.includes(tagName(element))\n }\n\n elementIsntSerializable(element) {\n return element.getAttribute(\"data-trix-serialize\") === \"false\" && !nodeIsAttachmentElement(element)\n }\n}\n\nconst createBodyElementForHTML = function(html = \"\") {\n // Remove everything after \n html = html.replace(/<\\/html[^>]*>[^]*$/i, \"\")\n const doc = document.implementation.createHTMLDocument(\"\")\n doc.documentElement.innerHTML = html\n\n Array.from(doc.head.querySelectorAll(\"style\")).forEach((element) => {\n doc.body.appendChild(element)\n })\n\n return doc.body\n}\n","import * as config from \"trix/config\"\nimport { ZERO_WIDTH_SPACE } from \"trix/constants\"\nimport { copyObject, makeElement } from \"trix/core/helpers\"\nimport ObjectView from \"trix/views/object_view\"\nimport HTMLSanitizer from \"trix/models/html_sanitizer\"\n\nconst { css } = config\n\nexport default class AttachmentView extends ObjectView {\n constructor() {\n super(...arguments)\n this.attachment = this.object\n this.attachment.uploadProgressDelegate = this\n this.attachmentPiece = this.options.piece\n }\n\n createContentNodes() {\n return []\n }\n\n createNodes() {\n let innerElement\n const figure = innerElement = makeElement({\n tagName: \"figure\",\n className: this.getClassName(),\n data: this.getData(),\n editable: false,\n })\n\n const href = this.getHref()\n if (href) {\n innerElement = makeElement({ tagName: \"a\", editable: false, attributes: { href, tabindex: -1 } })\n figure.appendChild(innerElement)\n }\n\n if (this.attachment.hasContent()) {\n HTMLSanitizer.setHTML(innerElement, this.attachment.getContent())\n } else {\n this.createContentNodes().forEach((node) => {\n innerElement.appendChild(node)\n })\n }\n\n innerElement.appendChild(this.createCaptionElement())\n\n if (this.attachment.isPending()) {\n this.progressElement = makeElement({\n tagName: \"progress\",\n attributes: {\n class: css.attachmentProgress,\n value: this.attachment.getUploadProgress(),\n max: 100,\n },\n data: {\n trixMutable: true,\n trixStoreKey: [ \"progressElement\", this.attachment.id ].join(\"/\"),\n },\n })\n\n figure.appendChild(this.progressElement)\n }\n\n return [ createCursorTarget(\"left\"), figure, createCursorTarget(\"right\") ]\n }\n\n createCaptionElement() {\n const figcaption = makeElement({ tagName: \"figcaption\", className: css.attachmentCaption })\n const caption = this.attachmentPiece.getCaption()\n if (caption) {\n figcaption.classList.add(`${css.attachmentCaption}--edited`)\n figcaption.textContent = caption\n } else {\n let name, size\n const captionConfig = this.getCaptionConfig()\n if (captionConfig.name) {\n name = this.attachment.getFilename()\n }\n if (captionConfig.size) {\n size = this.attachment.getFormattedFilesize()\n }\n\n if (name) {\n const nameElement = makeElement({ tagName: \"span\", className: css.attachmentName, textContent: name })\n figcaption.appendChild(nameElement)\n }\n\n if (size) {\n if (name) {\n figcaption.appendChild(document.createTextNode(\" \"))\n }\n const sizeElement = makeElement({ tagName: \"span\", className: css.attachmentSize, textContent: size })\n figcaption.appendChild(sizeElement)\n }\n }\n\n return figcaption\n }\n\n getClassName() {\n const names = [ css.attachment, `${css.attachment}--${this.attachment.getType()}` ]\n const extension = this.attachment.getExtension()\n if (extension) {\n names.push(`${css.attachment}--${extension}`)\n }\n return names.join(\" \")\n }\n\n getData() {\n const data = {\n trixAttachment: JSON.stringify(this.attachment),\n trixContentType: this.attachment.getContentType(),\n trixId: this.attachment.id,\n }\n\n const { attributes } = this.attachmentPiece\n if (!attributes.isEmpty()) {\n data.trixAttributes = JSON.stringify(attributes)\n }\n\n if (this.attachment.isPending()) {\n data.trixSerialize = false\n }\n\n return data\n }\n\n getHref() {\n if (!htmlContainsTagName(this.attachment.getContent(), \"a\")) {\n return this.attachment.getHref()\n }\n }\n\n getCaptionConfig() {\n const type = this.attachment.getType()\n const captionConfig = copyObject(config.attachments[type]?.caption)\n if (type === \"file\") {\n captionConfig.name = true\n }\n return captionConfig\n }\n\n findProgressElement() {\n return this.findElement()?.querySelector(\"progress\")\n }\n\n // Attachment delegate\n\n attachmentDidChangeUploadProgress() {\n const value = this.attachment.getUploadProgress()\n const progressElement = this.findProgressElement()\n if (progressElement) {\n progressElement.value = value\n }\n }\n}\n\nconst createCursorTarget = (name) =>\n makeElement({\n tagName: \"span\",\n textContent: ZERO_WIDTH_SPACE,\n data: {\n trixCursorTarget: name,\n trixSerialize: false,\n },\n })\n\nconst htmlContainsTagName = function(html, tagName) {\n const div = makeElement(\"div\")\n HTMLSanitizer.setHTML(div, html || \"\")\n return div.querySelector(tagName)\n}\n","import * as config from \"trix/config\"\nimport { makeElement } from \"trix/core/helpers\"\n\nimport AttachmentView from \"trix/views/attachment_view\"\n\nexport default class PreviewableAttachmentView extends AttachmentView {\n constructor() {\n super(...arguments)\n this.attachment.previewDelegate = this\n }\n\n createContentNodes() {\n this.image = makeElement({\n tagName: \"img\",\n attributes: {\n src: \"\",\n },\n data: {\n trixMutable: true,\n },\n })\n\n this.refresh(this.image)\n return [ this.image ]\n }\n\n createCaptionElement() {\n const figcaption = super.createCaptionElement(...arguments)\n if (!figcaption.textContent) {\n figcaption.setAttribute(\"data-trix-placeholder\", config.lang.captionPlaceholder)\n }\n return figcaption\n }\n\n refresh(image) {\n if (!image) { image = this.findElement()?.querySelector(\"img\") }\n if (image) {\n return this.updateAttributesForImage(image)\n }\n }\n\n updateAttributesForImage(image) {\n const url = this.attachment.getURL()\n const previewURL = this.attachment.getPreviewURL()\n image.src = previewURL || url\n\n if (previewURL === url) {\n image.removeAttribute(\"data-trix-serialized-attributes\")\n } else {\n const serializedAttributes = JSON.stringify({ src: url })\n image.setAttribute(\"data-trix-serialized-attributes\", serializedAttributes)\n }\n\n const width = this.attachment.getWidth()\n const height = this.attachment.getHeight()\n\n if (width != null) {\n image.width = width\n }\n if (height != null) {\n image.height = height\n }\n\n const storeKey = [ \"imageElement\", this.attachment.id, image.src, image.width, image.height ].join(\"/\")\n image.dataset.trixStoreKey = storeKey\n }\n\n // Attachment delegate\n\n attachmentDidChangeAttributes() {\n this.refresh(this.image)\n return this.refresh()\n }\n}\n","/* eslint-disable\n no-useless-escape,\n no-var,\n*/\nimport { NON_BREAKING_SPACE } from \"trix/constants\"\n\nimport ObjectView from \"trix/views/object_view\"\nimport AttachmentView from \"trix/views/attachment_view\"\nimport PreviewableAttachmentView from \"trix/views/previewable_attachment_view\"\n\nimport { findInnerElement, getTextConfig, makeElement } from \"trix/core/helpers\"\n\nexport default class PieceView extends ObjectView {\n constructor() {\n super(...arguments)\n this.piece = this.object\n this.attributes = this.piece.getAttributes()\n this.textConfig = this.options.textConfig\n this.context = this.options.context\n\n if (this.piece.attachment) {\n this.attachment = this.piece.attachment\n } else {\n this.string = this.piece.toString()\n }\n }\n\n createNodes() {\n let nodes = this.attachment ? this.createAttachmentNodes() : this.createStringNodes()\n const element = this.createElement()\n if (element) {\n const innerElement = findInnerElement(element)\n Array.from(nodes).forEach((node) => {\n innerElement.appendChild(node)\n })\n nodes = [ element ]\n }\n return nodes\n }\n\n createAttachmentNodes() {\n const constructor = this.attachment.isPreviewable() ? PreviewableAttachmentView : AttachmentView\n\n const view = this.createChildView(constructor, this.piece.attachment, { piece: this.piece })\n return view.getNodes()\n }\n\n createStringNodes() {\n if (this.textConfig?.plaintext) {\n return [ document.createTextNode(this.string) ]\n } else {\n const nodes = []\n const iterable = this.string.split(\"\\n\")\n for (let index = 0; index < iterable.length; index++) {\n const substring = iterable[index]\n if (index > 0) {\n const element = makeElement(\"br\")\n nodes.push(element)\n }\n\n if (substring.length) {\n const node = document.createTextNode(this.preserveSpaces(substring))\n nodes.push(node)\n }\n }\n return nodes\n }\n }\n\n createElement() {\n let element, key, value\n const styles = {}\n\n for (key in this.attributes) {\n value = this.attributes[key]\n const config = getTextConfig(key)\n if (config) {\n if (config.tagName) {\n var innerElement\n const pendingElement = makeElement(config.tagName)\n\n if (innerElement) {\n innerElement.appendChild(pendingElement)\n innerElement = pendingElement\n } else {\n element = innerElement = pendingElement\n }\n }\n\n if (config.styleProperty) {\n styles[config.styleProperty] = value\n }\n\n if (config.style) {\n for (key in config.style) {\n value = config.style[key]\n styles[key] = value\n }\n }\n }\n }\n\n if (Object.keys(styles).length) {\n if (!element) { element = makeElement(\"span\") }\n for (key in styles) {\n value = styles[key]\n element.style[key] = value\n }\n }\n return element\n }\n\n createContainerElement() {\n for (const key in this.attributes) {\n const value = this.attributes[key]\n const config = getTextConfig(key)\n if (config) {\n if (config.groupTagName) {\n const attributes = {}\n attributes[key] = value\n return makeElement(config.groupTagName, attributes)\n }\n }\n }\n }\n\n preserveSpaces(string) {\n if (this.context.isLast) {\n string = string.replace(/\\ $/, NON_BREAKING_SPACE)\n }\n\n string = string\n .replace(/(\\S)\\ {3}(\\S)/g, `$1 ${NON_BREAKING_SPACE} $2`)\n .replace(/\\ {2}/g, `${NON_BREAKING_SPACE} `)\n .replace(/\\ {2}/g, ` ${NON_BREAKING_SPACE}`)\n\n if (this.context.isFirst || this.context.followsWhitespace) {\n string = string.replace(/^\\ /, NON_BREAKING_SPACE)\n }\n\n return string\n }\n}\n","/* eslint-disable\n no-var,\n*/\nimport ObjectView from \"trix/views/object_view\"\nimport ObjectGroup from \"trix/core/collections/object_group\"\nimport PieceView from \"trix/views/piece_view\"\n\nexport default class TextView extends ObjectView {\n constructor() {\n super(...arguments)\n this.text = this.object\n this.textConfig = this.options.textConfig\n }\n\n createNodes() {\n const nodes = []\n const pieces = ObjectGroup.groupObjects(this.getPieces())\n const lastIndex = pieces.length - 1\n\n for (let index = 0; index < pieces.length; index++) {\n const piece = pieces[index]\n const context = {}\n if (index === 0) {\n context.isFirst = true\n }\n if (index === lastIndex) {\n context.isLast = true\n }\n if (endsWithWhitespace(previousPiece)) {\n context.followsWhitespace = true\n }\n\n const view = this.findOrCreateCachedChildView(PieceView, piece, { textConfig: this.textConfig, context })\n nodes.push(...Array.from(view.getNodes() || []))\n\n var previousPiece = piece\n }\n return nodes\n }\n\n getPieces() {\n return Array.from(this.text.getPieces()).filter((piece) => !piece.hasAttribute(\"blockBreak\"))\n }\n}\n\nconst endsWithWhitespace = (piece) => /\\s$/.test(piece?.toString())\n","import * as config from \"trix/config\"\nimport ObjectView from \"trix/views/object_view\"\nimport TextView from \"trix/views/text_view\"\n\nimport { getBlockConfig, makeElement } from \"trix/core/helpers\"\nconst { css } = config\n\nexport default class BlockView extends ObjectView {\n constructor() {\n super(...arguments)\n this.block = this.object\n this.attributes = this.block.getAttributes()\n }\n\n createNodes() {\n const comment = document.createComment(\"block\")\n const nodes = [ comment ]\n if (this.block.isEmpty()) {\n nodes.push(makeElement(\"br\"))\n } else {\n const textConfig = getBlockConfig(this.block.getLastAttribute())?.text\n const textView = this.findOrCreateCachedChildView(TextView, this.block.text, { textConfig })\n nodes.push(...Array.from(textView.getNodes() || []))\n if (this.shouldAddExtraNewlineElement()) {\n nodes.push(makeElement(\"br\"))\n }\n }\n\n if (this.attributes.length) {\n return nodes\n } else {\n let attributes\n const { tagName } = config.blockAttributes.default\n if (this.block.isRTL()) {\n attributes = { dir: \"rtl\" }\n }\n\n const element = makeElement({ tagName, attributes })\n nodes.forEach((node) => element.appendChild(node))\n return [ element ]\n }\n }\n\n createContainerElement(depth) {\n const attributes = {}\n let className\n const attributeName = this.attributes[depth]\n\n const { tagName, htmlAttributes = [] } = getBlockConfig(attributeName)\n\n if (depth === 0 && this.block.isRTL()) {\n Object.assign(attributes, { dir: \"rtl\" })\n }\n\n if (attributeName === \"attachmentGallery\") {\n const size = this.block.getBlockBreakPosition()\n className = `${css.attachmentGallery} ${css.attachmentGallery}--${size}`\n }\n\n Object.entries(this.block.htmlAttributes).forEach(([ name, value ]) => {\n if (htmlAttributes.includes(name)) {\n attributes[name] = value\n }\n })\n\n return makeElement({ tagName, className, attributes })\n }\n\n // A single
at the end of a block element has no visual representation\n // so add an extra one.\n shouldAddExtraNewlineElement() {\n return /\\n\\n$/.test(this.block.toString())\n }\n}\n","import { makeElement } from \"trix/core/helpers\"\n\nimport ElementStore from \"trix/core/collections/element_store\"\nimport ObjectGroup from \"trix/core/collections/object_group\"\nimport ObjectView from \"trix/views/object_view\"\nimport BlockView from \"trix/views/block_view\"\n\nimport { defer } from \"trix/core/helpers\"\n\nexport default class DocumentView extends ObjectView {\n static render(document) {\n const element = makeElement(\"div\")\n const view = new this(document, { element })\n view.render()\n view.sync()\n return element\n }\n\n constructor() {\n super(...arguments)\n this.element = this.options.element\n this.elementStore = new ElementStore()\n this.setDocument(this.object)\n }\n\n setDocument(document) {\n if (!document.isEqualTo(this.document)) {\n this.document = this.object = document\n }\n }\n\n render() {\n this.childViews = []\n\n this.shadowElement = makeElement(\"div\")\n\n if (!this.document.isEmpty()) {\n const objects = ObjectGroup.groupObjects(this.document.getBlocks(), { asTree: true })\n\n Array.from(objects).forEach((object) => {\n const view = this.findOrCreateCachedChildView(BlockView, object)\n Array.from(view.getNodes()).map((node) => this.shadowElement.appendChild(node))\n })\n }\n }\n\n isSynced() {\n return elementsHaveEqualHTML(this.shadowElement, this.element)\n }\n\n sync() {\n const fragment = this.createDocumentFragmentForSync()\n while (this.element.lastChild) {\n this.element.removeChild(this.element.lastChild)\n }\n this.element.appendChild(fragment)\n return this.didSync()\n }\n\n // Private\n\n didSync() {\n this.elementStore.reset(findStoredElements(this.element))\n return defer(() => this.garbageCollectCachedViews())\n }\n\n createDocumentFragmentForSync() {\n const fragment = document.createDocumentFragment()\n\n Array.from(this.shadowElement.childNodes).forEach((node) => {\n fragment.appendChild(node.cloneNode(true))\n })\n\n Array.from(findStoredElements(fragment)).forEach((element) => {\n const storedElement = this.elementStore.remove(element)\n if (storedElement) {\n element.parentNode.replaceChild(storedElement, element)\n }\n })\n\n return fragment\n }\n}\n\nconst findStoredElements = (element) => element.querySelectorAll(\"[data-trix-store-key]\")\n\nconst elementsHaveEqualHTML = (element, otherElement) =>\n ignoreSpaces(element.innerHTML) === ignoreSpaces(otherElement.innerHTML)\n\nconst ignoreSpaces = (html) => html.replace(/ /g, \" \")\n","import TrixObject from \"trix/core/object\" // Don't override window.Object\nimport Hash from \"trix/core/collections/hash\"\n\nexport default class Piece extends TrixObject {\n static types = {}\n\n static registerType(type, constructor) {\n constructor.type = type\n this.types[type] = constructor\n }\n\n static fromJSON(pieceJSON) {\n const constructor = this.types[pieceJSON.type]\n if (constructor) {\n return constructor.fromJSON(pieceJSON)\n }\n }\n\n constructor(value, attributes = {}) {\n super(...arguments)\n this.attributes = Hash.box(attributes)\n }\n\n copyWithAttributes(attributes) {\n return new this.constructor(this.getValue(), attributes)\n }\n\n copyWithAdditionalAttributes(attributes) {\n return this.copyWithAttributes(this.attributes.merge(attributes))\n }\n\n copyWithoutAttribute(attribute) {\n return this.copyWithAttributes(this.attributes.remove(attribute))\n }\n\n copy() {\n return this.copyWithAttributes(this.attributes)\n }\n\n getAttribute(attribute) {\n return this.attributes.get(attribute)\n }\n\n getAttributesHash() {\n return this.attributes\n }\n\n getAttributes() {\n return this.attributes.toObject()\n }\n\n hasAttribute(attribute) {\n return this.attributes.has(attribute)\n }\n\n hasSameStringValueAsPiece(piece) {\n return piece && this.toString() === piece.toString()\n }\n\n hasSameAttributesAsPiece(piece) {\n return piece && (this.attributes === piece.attributes || this.attributes.isEqualTo(piece.attributes))\n }\n\n isBlockBreak() {\n return false\n }\n\n isEqualTo(piece) {\n return (\n super.isEqualTo(...arguments) ||\n this.hasSameConstructorAs(piece) &&\n this.hasSameStringValueAsPiece(piece) &&\n this.hasSameAttributesAsPiece(piece)\n )\n }\n\n isEmpty() {\n return this.length === 0\n }\n\n isSerializable() {\n return true\n }\n\n toJSON() {\n return {\n type: this.constructor.type,\n attributes: this.getAttributes(),\n }\n }\n\n contentsForInspection() {\n return {\n type: this.constructor.type,\n attributes: this.attributes.inspect(),\n }\n }\n\n // Grouping\n\n canBeGrouped() {\n return this.hasAttribute(\"href\")\n }\n\n canBeGroupedWith(piece) {\n return this.getAttribute(\"href\") === piece.getAttribute(\"href\")\n }\n\n // Splittable\n\n getLength() {\n return this.length\n }\n\n canBeConsolidatedWith(piece) {\n return false\n }\n}\n","import Operation from \"trix/core/utilities/operation\"\n\nexport default class ImagePreloadOperation extends Operation {\n constructor(url) {\n super(...arguments)\n this.url = url\n }\n\n perform(callback) {\n const image = new Image()\n\n image.onload = () => {\n image.width = this.width = image.naturalWidth\n image.height = this.height = image.naturalHeight\n return callback(true, image)\n }\n\n image.onerror = () => callback(false)\n\n image.src = this.url\n }\n}\n","import * as config from \"trix/config\"\nimport TrixObject from \"trix/core/object\" // Don't override window.Object\nimport Hash from \"trix/core/collections/hash\"\nimport ImagePreloadOperation from \"trix/operations/image_preload_operation\"\n\nexport default class Attachment extends TrixObject {\n static previewablePattern = /^image(\\/(gif|png|webp|jpe?g)|$)/\n\n static attachmentForFile(file) {\n const attributes = this.attributesForFile(file)\n const attachment = new this(attributes)\n attachment.setFile(file)\n return attachment\n }\n\n static attributesForFile(file) {\n return new Hash({\n filename: file.name,\n filesize: file.size,\n contentType: file.type,\n })\n }\n\n static fromJSON(attachmentJSON) {\n return new this(attachmentJSON)\n }\n\n constructor(attributes = {}) {\n super(attributes)\n this.releaseFile = this.releaseFile.bind(this)\n this.attributes = Hash.box(attributes)\n this.didChangeAttributes()\n }\n\n getAttribute(attribute) {\n return this.attributes.get(attribute)\n }\n\n hasAttribute(attribute) {\n return this.attributes.has(attribute)\n }\n\n getAttributes() {\n return this.attributes.toObject()\n }\n\n setAttributes(attributes = {}) {\n const newAttributes = this.attributes.merge(attributes)\n if (!this.attributes.isEqualTo(newAttributes)) {\n this.attributes = newAttributes\n this.didChangeAttributes()\n this.previewDelegate?.attachmentDidChangeAttributes?.(this)\n return this.delegate?.attachmentDidChangeAttributes?.(this)\n }\n }\n\n didChangeAttributes() {\n if (this.isPreviewable()) {\n return this.preloadURL()\n }\n }\n\n isPending() {\n return this.file != null && !(this.getURL() || this.getHref())\n }\n\n isPreviewable() {\n if (this.attributes.has(\"previewable\")) {\n return this.attributes.get(\"previewable\")\n } else {\n return Attachment.previewablePattern.test(this.getContentType())\n }\n }\n\n getType() {\n if (this.hasContent()) {\n return \"content\"\n } else if (this.isPreviewable()) {\n return \"preview\"\n } else {\n return \"file\"\n }\n }\n\n getURL() {\n return this.attributes.get(\"url\")\n }\n\n getHref() {\n return this.attributes.get(\"href\")\n }\n\n getFilename() {\n return this.attributes.get(\"filename\") || \"\"\n }\n\n getFilesize() {\n return this.attributes.get(\"filesize\")\n }\n\n getFormattedFilesize() {\n const filesize = this.attributes.get(\"filesize\")\n if (typeof filesize === \"number\") {\n return config.fileSize.formatter(filesize)\n } else {\n return \"\"\n }\n }\n\n getExtension() {\n return this.getFilename()\n .match(/\\.(\\w+)$/)?.[1]\n .toLowerCase()\n }\n\n getContentType() {\n return this.attributes.get(\"contentType\")\n }\n\n hasContent() {\n return this.attributes.has(\"content\")\n }\n\n getContent() {\n return this.attributes.get(\"content\")\n }\n\n getWidth() {\n return this.attributes.get(\"width\")\n }\n\n getHeight() {\n return this.attributes.get(\"height\")\n }\n\n getFile() {\n return this.file\n }\n\n setFile(file) {\n this.file = file\n if (this.isPreviewable()) {\n return this.preloadFile()\n }\n }\n\n releaseFile() {\n this.releasePreloadedFile()\n this.file = null\n }\n\n getUploadProgress() {\n return this.uploadProgress != null ? this.uploadProgress : 0\n }\n\n setUploadProgress(value) {\n if (this.uploadProgress !== value) {\n this.uploadProgress = value\n return this.uploadProgressDelegate?.attachmentDidChangeUploadProgress?.(this)\n }\n }\n\n toJSON() {\n return this.getAttributes()\n }\n\n getCacheKey() {\n return [ super.getCacheKey(...arguments), this.attributes.getCacheKey(), this.getPreviewURL() ].join(\"/\")\n }\n\n // Previewable\n\n getPreviewURL() {\n return this.previewURL || this.preloadingURL\n }\n\n setPreviewURL(url) {\n if (url !== this.getPreviewURL()) {\n this.previewURL = url\n this.previewDelegate?.attachmentDidChangeAttributes?.(this)\n return this.delegate?.attachmentDidChangePreviewURL?.(this)\n }\n }\n\n preloadURL() {\n return this.preload(this.getURL(), this.releaseFile)\n }\n\n preloadFile() {\n if (this.file) {\n this.fileObjectURL = URL.createObjectURL(this.file)\n return this.preload(this.fileObjectURL)\n }\n }\n\n releasePreloadedFile() {\n if (this.fileObjectURL) {\n URL.revokeObjectURL(this.fileObjectURL)\n this.fileObjectURL = null\n }\n }\n\n preload(url, callback) {\n if (url && url !== this.getPreviewURL()) {\n this.preloadingURL = url\n const operation = new ImagePreloadOperation(url)\n return operation\n .then(({ width, height }) => {\n if (!this.getWidth() || !this.getHeight()) {\n this.setAttributes({ width, height })\n }\n this.preloadingURL = null\n this.setPreviewURL(url)\n return callback?.()\n })\n .catch(() => {\n this.preloadingURL = null\n return callback?.()\n })\n }\n }\n}\n","import { OBJECT_REPLACEMENT_CHARACTER } from \"trix/constants\"\n\nimport Attachment from \"trix/models/attachment\"\nimport Piece from \"trix/models/piece\"\n\nexport default class AttachmentPiece extends Piece {\n static permittedAttributes = [ \"caption\", \"presentation\" ]\n\n static fromJSON(pieceJSON) {\n return new this(Attachment.fromJSON(pieceJSON.attachment), pieceJSON.attributes)\n }\n\n constructor(attachment) {\n super(...arguments)\n this.attachment = attachment\n this.length = 1\n this.ensureAttachmentExclusivelyHasAttribute(\"href\")\n if (!this.attachment.hasContent()) {\n this.removeProhibitedAttributes()\n }\n }\n\n ensureAttachmentExclusivelyHasAttribute(attribute) {\n if (this.hasAttribute(attribute)) {\n if (!this.attachment.hasAttribute(attribute)) {\n this.attachment.setAttributes(this.attributes.slice([ attribute ]))\n }\n this.attributes = this.attributes.remove(attribute)\n }\n }\n\n removeProhibitedAttributes() {\n const attributes = this.attributes.slice(AttachmentPiece.permittedAttributes)\n if (!attributes.isEqualTo(this.attributes)) {\n this.attributes = attributes\n }\n }\n\n getValue() {\n return this.attachment\n }\n\n isSerializable() {\n return !this.attachment.isPending()\n }\n\n getCaption() {\n return this.attributes.get(\"caption\") || \"\"\n }\n\n isEqualTo(piece) {\n return super.isEqualTo(piece) && this.attachment.id === piece?.attachment?.id\n }\n\n toString() {\n return OBJECT_REPLACEMENT_CHARACTER\n }\n\n toJSON() {\n const json = super.toJSON(...arguments)\n json.attachment = this.attachment\n return json\n }\n\n getCacheKey() {\n return [ super.getCacheKey(...arguments), this.attachment.getCacheKey() ].join(\"/\")\n }\n\n toConsole() {\n return JSON.stringify(this.toString())\n }\n}\n\nPiece.registerType(\"attachment\", AttachmentPiece)\n","import Piece from \"trix/models/piece\"\n\nimport { normalizeNewlines } from \"trix/core/helpers\"\n\nexport default class StringPiece extends Piece {\n static fromJSON(pieceJSON) {\n return new this(pieceJSON.string, pieceJSON.attributes)\n }\n\n constructor(string) {\n super(...arguments)\n this.string = normalizeNewlines(string)\n this.length = this.string.length\n }\n\n getValue() {\n return this.string\n }\n\n toString() {\n return this.string.toString()\n }\n\n isBlockBreak() {\n return this.toString() === \"\\n\" && this.getAttribute(\"blockBreak\") === true\n }\n\n toJSON() {\n const result = super.toJSON(...arguments)\n result.string = this.string\n return result\n }\n\n // Splittable\n\n canBeConsolidatedWith(piece) {\n return piece && this.hasSameConstructorAs(piece) && this.hasSameAttributesAsPiece(piece)\n }\n\n consolidateWith(piece) {\n return new this.constructor(this.toString() + piece.toString(), this.attributes)\n }\n\n splitAtOffset(offset) {\n let left, right\n if (offset === 0) {\n left = null\n right = this\n } else if (offset === this.length) {\n left = this\n right = null\n } else {\n left = new this.constructor(this.string.slice(0, offset), this.attributes)\n right = new this.constructor(this.string.slice(offset), this.attributes)\n }\n return [ left, right ]\n }\n\n toConsole() {\n let { string } = this\n if (string.length > 15) {\n string = string.slice(0, 14) + \"…\"\n }\n return JSON.stringify(string.toString())\n }\n}\n\nPiece.registerType(\"string\", StringPiece)\n","/* eslint-disable\n prefer-const,\n*/\nimport TrixObject from \"trix/core/object\" // Don't override window.Object\n\nimport { spliceArray } from \"trix/core/helpers\"\n\nexport default class SplittableList extends TrixObject {\n static box(objects) {\n if (objects instanceof this) {\n return objects\n } else {\n return new this(objects)\n }\n }\n\n constructor(objects = []) {\n super(...arguments)\n this.objects = objects.slice(0)\n this.length = this.objects.length\n }\n\n indexOf(object) {\n return this.objects.indexOf(object)\n }\n\n splice(...args) {\n return new this.constructor(spliceArray(this.objects, ...args))\n }\n\n eachObject(callback) {\n return this.objects.map((object, index) => callback(object, index))\n }\n\n insertObjectAtIndex(object, index) {\n return this.splice(index, 0, object)\n }\n\n insertSplittableListAtIndex(splittableList, index) {\n return this.splice(index, 0, ...splittableList.objects)\n }\n\n insertSplittableListAtPosition(splittableList, position) {\n const [ objects, index ] = this.splitObjectAtPosition(position)\n return new this.constructor(objects).insertSplittableListAtIndex(splittableList, index)\n }\n\n editObjectAtIndex(index, callback) {\n return this.replaceObjectAtIndex(callback(this.objects[index]), index)\n }\n\n replaceObjectAtIndex(object, index) {\n return this.splice(index, 1, object)\n }\n\n removeObjectAtIndex(index) {\n return this.splice(index, 1)\n }\n\n getObjectAtIndex(index) {\n return this.objects[index]\n }\n\n getSplittableListInRange(range) {\n const [ objects, leftIndex, rightIndex ] = this.splitObjectsAtRange(range)\n return new this.constructor(objects.slice(leftIndex, rightIndex + 1))\n }\n\n selectSplittableList(test) {\n const objects = this.objects.filter((object) => test(object))\n return new this.constructor(objects)\n }\n\n removeObjectsInRange(range) {\n const [ objects, leftIndex, rightIndex ] = this.splitObjectsAtRange(range)\n return new this.constructor(objects).splice(leftIndex, rightIndex - leftIndex + 1)\n }\n\n transformObjectsInRange(range, transform) {\n const [ objects, leftIndex, rightIndex ] = this.splitObjectsAtRange(range)\n const transformedObjects = objects.map((object, index) =>\n leftIndex <= index && index <= rightIndex ? transform(object) : object\n )\n return new this.constructor(transformedObjects)\n }\n\n splitObjectsAtRange(range) {\n let rightOuterIndex\n let [ objects, leftInnerIndex, offset ] = this.splitObjectAtPosition(startOfRange(range))\n ;[ objects, rightOuterIndex ] = new this.constructor(objects).splitObjectAtPosition(endOfRange(range) + offset)\n\n return [ objects, leftInnerIndex, rightOuterIndex - 1 ]\n }\n\n getObjectAtPosition(position) {\n const { index } = this.findIndexAndOffsetAtPosition(position)\n return this.objects[index]\n }\n\n splitObjectAtPosition(position) {\n let splitIndex, splitOffset\n const { index, offset } = this.findIndexAndOffsetAtPosition(position)\n const objects = this.objects.slice(0)\n if (index != null) {\n if (offset === 0) {\n splitIndex = index\n splitOffset = 0\n } else {\n const object = this.getObjectAtIndex(index)\n const [ leftObject, rightObject ] = object.splitAtOffset(offset)\n objects.splice(index, 1, leftObject, rightObject)\n splitIndex = index + 1\n splitOffset = leftObject.getLength() - offset\n }\n } else {\n splitIndex = objects.length\n splitOffset = 0\n }\n\n return [ objects, splitIndex, splitOffset ]\n }\n\n consolidate() {\n const objects = []\n let pendingObject = this.objects[0]\n\n this.objects.slice(1).forEach((object) => {\n if (pendingObject.canBeConsolidatedWith?.(object)) {\n pendingObject = pendingObject.consolidateWith(object)\n } else {\n objects.push(pendingObject)\n pendingObject = object\n }\n })\n\n if (pendingObject) {\n objects.push(pendingObject)\n }\n\n return new this.constructor(objects)\n }\n\n consolidateFromIndexToIndex(startIndex, endIndex) {\n const objects = this.objects.slice(0)\n const objectsInRange = objects.slice(startIndex, endIndex + 1)\n const consolidatedInRange = new this.constructor(objectsInRange).consolidate().toArray()\n return this.splice(startIndex, objectsInRange.length, ...consolidatedInRange)\n }\n\n findIndexAndOffsetAtPosition(position) {\n let index\n let currentPosition = 0\n for (index = 0; index < this.objects.length; index++) {\n const object = this.objects[index]\n const nextPosition = currentPosition + object.getLength()\n if (currentPosition <= position && position < nextPosition) {\n return { index, offset: position - currentPosition }\n }\n currentPosition = nextPosition\n }\n return { index: null, offset: null }\n }\n\n findPositionAtIndexAndOffset(index, offset) {\n let position = 0\n for (let currentIndex = 0; currentIndex < this.objects.length; currentIndex++) {\n const object = this.objects[currentIndex]\n if (currentIndex < index) {\n position += object.getLength()\n } else if (currentIndex === index) {\n position += offset\n break\n }\n }\n return position\n }\n\n getEndPosition() {\n if (this.endPosition == null) {\n this.endPosition = 0\n this.objects.forEach((object) => this.endPosition += object.getLength())\n }\n\n return this.endPosition\n }\n\n toString() {\n return this.objects.join(\"\")\n }\n\n toArray() {\n return this.objects.slice(0)\n }\n\n toJSON() {\n return this.toArray()\n }\n\n isEqualTo(splittableList) {\n return super.isEqualTo(...arguments) || objectArraysAreEqual(this.objects, splittableList?.objects)\n }\n\n contentsForInspection() {\n return {\n objects: `[${this.objects.map((object) => object.inspect()).join(\", \")}]`,\n }\n }\n}\n\nconst objectArraysAreEqual = function(left, right = []) {\n if (left.length !== right.length) {\n return false\n }\n let result = true\n for (let index = 0; index < left.length; index++) {\n const object = left[index]\n if (result && !object.isEqualTo(right[index])) {\n result = false\n }\n }\n return result\n}\n\nconst startOfRange = (range) => range[0]\n\nconst endOfRange = (range) => range[1]\n","import TrixObject from \"trix/core/object\" // Don't override window.Object\n\nimport { getDirection } from \"trix/core/helpers\"\n\nimport Piece from \"trix/models/piece\"\nimport AttachmentPiece from \"trix/models/attachment_piece\"\nimport StringPiece from \"trix/models/string_piece\"\nimport SplittableList from \"trix/models/splittable_list\"\n\nimport Hash from \"trix/core/collections/hash\"\n\nexport default class Text extends TrixObject {\n static textForAttachmentWithAttributes(attachment, attributes) {\n const piece = new AttachmentPiece(attachment, attributes)\n return new this([ piece ])\n }\n\n static textForStringWithAttributes(string, attributes) {\n const piece = new StringPiece(string, attributes)\n return new this([ piece ])\n }\n\n static fromJSON(textJSON) {\n const pieces = Array.from(textJSON).map((pieceJSON) => Piece.fromJSON(pieceJSON))\n return new this(pieces)\n }\n\n constructor(pieces = []) {\n super(...arguments)\n const notEmpty = pieces.filter((piece) => !piece.isEmpty())\n this.pieceList = new SplittableList(notEmpty)\n }\n\n copy() {\n return this.copyWithPieceList(this.pieceList)\n }\n\n copyWithPieceList(pieceList) {\n return new this.constructor(pieceList.consolidate().toArray())\n }\n\n copyUsingObjectMap(objectMap) {\n const pieces = this.getPieces().map((piece) => objectMap.find(piece) || piece)\n return new this.constructor(pieces)\n }\n\n appendText(text) {\n return this.insertTextAtPosition(text, this.getLength())\n }\n\n insertTextAtPosition(text, position) {\n return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(text.pieceList, position))\n }\n\n removeTextAtRange(range) {\n return this.copyWithPieceList(this.pieceList.removeObjectsInRange(range))\n }\n\n replaceTextAtRange(text, range) {\n return this.removeTextAtRange(range).insertTextAtPosition(text, range[0])\n }\n\n moveTextFromRangeToPosition(range, position) {\n if (range[0] <= position && position <= range[1]) return\n const text = this.getTextAtRange(range)\n const length = text.getLength()\n if (range[0] < position) {\n position -= length\n }\n return this.removeTextAtRange(range).insertTextAtPosition(text, position)\n }\n\n addAttributeAtRange(attribute, value, range) {\n const attributes = {}\n attributes[attribute] = value\n return this.addAttributesAtRange(attributes, range)\n }\n\n addAttributesAtRange(attributes, range) {\n return this.copyWithPieceList(\n this.pieceList.transformObjectsInRange(range, (piece) => piece.copyWithAdditionalAttributes(attributes))\n )\n }\n\n removeAttributeAtRange(attribute, range) {\n return this.copyWithPieceList(\n this.pieceList.transformObjectsInRange(range, (piece) => piece.copyWithoutAttribute(attribute))\n )\n }\n\n setAttributesAtRange(attributes, range) {\n return this.copyWithPieceList(\n this.pieceList.transformObjectsInRange(range, (piece) => piece.copyWithAttributes(attributes))\n )\n }\n\n getAttributesAtPosition(position) {\n return this.pieceList.getObjectAtPosition(position)?.getAttributes() || {}\n }\n\n getCommonAttributes() {\n const objects = Array.from(this.pieceList.toArray()).map((piece) => piece.getAttributes())\n return Hash.fromCommonAttributesOfObjects(objects).toObject()\n }\n\n getCommonAttributesAtRange(range) {\n return this.getTextAtRange(range).getCommonAttributes() || {}\n }\n\n getExpandedRangeForAttributeAtOffset(attributeName, offset) {\n let right\n let left = right = offset\n const length = this.getLength()\n\n while (left > 0 && this.getCommonAttributesAtRange([ left - 1, right ])[attributeName]) {\n left--\n }\n while (right < length && this.getCommonAttributesAtRange([ offset, right + 1 ])[attributeName]) {\n right++\n }\n\n return [ left, right ]\n }\n\n getTextAtRange(range) {\n return this.copyWithPieceList(this.pieceList.getSplittableListInRange(range))\n }\n\n getStringAtRange(range) {\n return this.pieceList.getSplittableListInRange(range).toString()\n }\n\n getStringAtPosition(position) {\n return this.getStringAtRange([ position, position + 1 ])\n }\n\n startsWithString(string) {\n return this.getStringAtRange([ 0, string.length ]) === string\n }\n\n endsWithString(string) {\n const length = this.getLength()\n return this.getStringAtRange([ length - string.length, length ]) === string\n }\n\n getAttachmentPieces() {\n return this.pieceList.toArray().filter((piece) => !!piece.attachment)\n }\n\n getAttachments() {\n return this.getAttachmentPieces().map((piece) => piece.attachment)\n }\n\n getAttachmentAndPositionById(attachmentId) {\n let position = 0\n for (const piece of this.pieceList.toArray()) {\n if (piece.attachment?.id === attachmentId) {\n return { attachment: piece.attachment, position }\n }\n position += piece.length\n }\n return { attachment: null, position: null }\n }\n\n getAttachmentById(attachmentId) {\n const { attachment } = this.getAttachmentAndPositionById(attachmentId)\n return attachment\n }\n\n getRangeOfAttachment(attachment) {\n const attachmentAndPosition = this.getAttachmentAndPositionById(attachment.id)\n const position = attachmentAndPosition.position\n attachment = attachmentAndPosition.attachment\n if (attachment) {\n return [ position, position + 1 ]\n }\n }\n\n updateAttributesForAttachment(attributes, attachment) {\n const range = this.getRangeOfAttachment(attachment)\n if (range) {\n return this.addAttributesAtRange(attributes, range)\n } else {\n return this\n }\n }\n\n getLength() {\n return this.pieceList.getEndPosition()\n }\n\n isEmpty() {\n return this.getLength() === 0\n }\n\n isEqualTo(text) {\n return super.isEqualTo(text) || text?.pieceList?.isEqualTo(this.pieceList)\n }\n\n isBlockBreak() {\n return this.getLength() === 1 && this.pieceList.getObjectAtIndex(0).isBlockBreak()\n }\n\n eachPiece(callback) {\n return this.pieceList.eachObject(callback)\n }\n\n getPieces() {\n return this.pieceList.toArray()\n }\n\n getPieceAtPosition(position) {\n return this.pieceList.getObjectAtPosition(position)\n }\n\n contentsForInspection() {\n return { pieceList: this.pieceList.inspect() }\n }\n\n toSerializableText() {\n const pieceList = this.pieceList.selectSplittableList((piece) => piece.isSerializable())\n return this.copyWithPieceList(pieceList)\n }\n\n toString() {\n return this.pieceList.toString()\n }\n\n toJSON() {\n return this.pieceList.toJSON()\n }\n\n toConsole() {\n return JSON.stringify(this.pieceList.toArray().map((piece) => JSON.parse(piece.toConsole())))\n }\n\n // BIDI\n\n getDirection() {\n return getDirection(this.toString())\n }\n\n isRTL() {\n return this.getDirection() === \"rtl\"\n }\n}\n","import TrixObject from \"trix/core/object\" // Don't override window.Object\nimport Text from \"trix/models/text\"\n\nimport {\n arraysAreEqual,\n getBlockConfig,\n getListAttributeNames,\n objectsAreEqual,\n spliceArray,\n} from \"trix/core/helpers\"\n\nexport default class Block extends TrixObject {\n static fromJSON(blockJSON) {\n const text = Text.fromJSON(blockJSON.text)\n return new this(text, blockJSON.attributes, blockJSON.htmlAttributes)\n }\n\n constructor(text, attributes, htmlAttributes) {\n super(...arguments)\n this.text = applyBlockBreakToText(text || new Text())\n this.attributes = attributes || []\n this.htmlAttributes = htmlAttributes || {}\n }\n\n isEmpty() {\n return this.text.isBlockBreak()\n }\n\n isEqualTo(block) {\n if (super.isEqualTo(block)) return true\n\n return this.text.isEqualTo(block?.text) && arraysAreEqual(this.attributes, block?.attributes) && objectsAreEqual(this.htmlAttributes, block?.htmlAttributes)\n }\n\n copyWithText(text) {\n return new Block(text, this.attributes, this.htmlAttributes)\n }\n\n copyWithoutText() {\n return this.copyWithText(null)\n }\n\n copyWithAttributes(attributes) {\n return new Block(this.text, attributes, this.htmlAttributes)\n }\n\n copyWithoutAttributes() {\n return this.copyWithAttributes(null)\n }\n\n copyUsingObjectMap(objectMap) {\n const mappedText = objectMap.find(this.text)\n if (mappedText) {\n return this.copyWithText(mappedText)\n } else {\n return this.copyWithText(this.text.copyUsingObjectMap(objectMap))\n }\n }\n\n addAttribute(attribute) {\n const attributes = this.attributes.concat(expandAttribute(attribute))\n return this.copyWithAttributes(attributes)\n }\n\n addHTMLAttribute(attribute, value) {\n const htmlAttributes = Object.assign({}, this.htmlAttributes, { [attribute]: value })\n return new Block(this.text, this.attributes, htmlAttributes)\n }\n\n removeAttribute(attribute) {\n const { listAttribute } = getBlockConfig(attribute)\n const attributes = removeLastValue(removeLastValue(this.attributes, attribute), listAttribute)\n return this.copyWithAttributes(attributes)\n }\n\n removeLastAttribute() {\n return this.removeAttribute(this.getLastAttribute())\n }\n\n getLastAttribute() {\n return getLastElement(this.attributes)\n }\n\n getAttributes() {\n return this.attributes.slice(0)\n }\n\n getAttributeLevel() {\n return this.attributes.length\n }\n\n getAttributeAtLevel(level) {\n return this.attributes[level - 1]\n }\n\n hasAttribute(attributeName) {\n return this.attributes.includes(attributeName)\n }\n\n hasAttributes() {\n return this.getAttributeLevel() > 0\n }\n\n getLastNestableAttribute() {\n return getLastElement(this.getNestableAttributes())\n }\n\n getNestableAttributes() {\n return this.attributes.filter((attribute) => getBlockConfig(attribute).nestable)\n }\n\n getNestingLevel() {\n return this.getNestableAttributes().length\n }\n\n decreaseNestingLevel() {\n const attribute = this.getLastNestableAttribute()\n if (attribute) {\n return this.removeAttribute(attribute)\n } else {\n return this\n }\n }\n\n increaseNestingLevel() {\n const attribute = this.getLastNestableAttribute()\n if (attribute) {\n const index = this.attributes.lastIndexOf(attribute)\n const attributes = spliceArray(this.attributes, index + 1, 0, ...expandAttribute(attribute))\n return this.copyWithAttributes(attributes)\n } else {\n return this\n }\n }\n\n getListItemAttributes() {\n return this.attributes.filter((attribute) => getBlockConfig(attribute).listAttribute)\n }\n\n isListItem() {\n return getBlockConfig(this.getLastAttribute())?.listAttribute\n }\n\n isTerminalBlock() {\n return getBlockConfig(this.getLastAttribute())?.terminal\n }\n\n breaksOnReturn() {\n return getBlockConfig(this.getLastAttribute())?.breakOnReturn\n }\n\n findLineBreakInDirectionFromPosition(direction, position) {\n const string = this.toString()\n let result\n switch (direction) {\n case \"forward\":\n result = string.indexOf(\"\\n\", position)\n break\n case \"backward\":\n result = string.slice(0, position).lastIndexOf(\"\\n\")\n }\n\n if (result !== -1) {\n return result\n }\n }\n\n contentsForInspection() {\n return {\n text: this.text.inspect(),\n attributes: this.attributes,\n }\n }\n\n toString() {\n return this.text.toString()\n }\n\n toJSON() {\n return {\n text: this.text,\n attributes: this.attributes,\n htmlAttributes: this.htmlAttributes,\n }\n }\n\n // BIDI\n\n getDirection() {\n return this.text.getDirection()\n }\n\n isRTL() {\n return this.text.isRTL()\n }\n\n // Splittable\n\n getLength() {\n return this.text.getLength()\n }\n\n canBeConsolidatedWith(block) {\n return !this.hasAttributes() && !block.hasAttributes() && this.getDirection() === block.getDirection()\n }\n\n consolidateWith(block) {\n const newlineText = Text.textForStringWithAttributes(\"\\n\")\n const text = this.getTextWithoutBlockBreak().appendText(newlineText)\n return this.copyWithText(text.appendText(block.text))\n }\n\n splitAtOffset(offset) {\n let left, right\n if (offset === 0) {\n left = null\n right = this\n } else if (offset === this.getLength()) {\n left = this\n right = null\n } else {\n left = this.copyWithText(this.text.getTextAtRange([ 0, offset ]))\n right = this.copyWithText(this.text.getTextAtRange([ offset, this.getLength() ]))\n }\n return [ left, right ]\n }\n\n getBlockBreakPosition() {\n return this.text.getLength() - 1\n }\n\n getTextWithoutBlockBreak() {\n if (textEndsInBlockBreak(this.text)) {\n return this.text.getTextAtRange([ 0, this.getBlockBreakPosition() ])\n } else {\n return this.text.copy()\n }\n }\n\n // Grouping\n\n canBeGrouped(depth) {\n return this.attributes[depth]\n }\n\n canBeGroupedWith(otherBlock, depth) {\n const otherAttributes = otherBlock.getAttributes()\n const otherAttribute = otherAttributes[depth]\n const attribute = this.attributes[depth]\n\n return (\n attribute === otherAttribute &&\n !(getBlockConfig(attribute).group === false && !getListAttributeNames().includes(otherAttributes[depth + 1])) &&\n (this.getDirection() === otherBlock.getDirection() || otherBlock.isEmpty())\n )\n }\n}\n\n// Block breaks\n\nconst applyBlockBreakToText = function(text) {\n text = unmarkExistingInnerBlockBreaksInText(text)\n text = addBlockBreakToText(text)\n return text\n}\n\nconst unmarkExistingInnerBlockBreaksInText = function(text) {\n let modified = false\n const pieces = text.getPieces()\n\n let innerPieces = pieces.slice(0, pieces.length - 1)\n const lastPiece = pieces[pieces.length - 1]\n\n if (!lastPiece) return text\n\n innerPieces = innerPieces.map((piece) => {\n if (piece.isBlockBreak()) {\n modified = true\n return unmarkBlockBreakPiece(piece)\n } else {\n return piece\n }\n })\n\n if (modified) {\n return new Text([ ...innerPieces, lastPiece ])\n } else {\n return text\n }\n}\n\nconst blockBreakText = Text.textForStringWithAttributes(\"\\n\", { blockBreak: true })\n\nconst addBlockBreakToText = function(text) {\n if (textEndsInBlockBreak(text)) {\n return text\n } else {\n return text.appendText(blockBreakText)\n }\n}\n\nconst textEndsInBlockBreak = function(text) {\n const length = text.getLength()\n if (length === 0) {\n return false\n }\n const endText = text.getTextAtRange([ length - 1, length ])\n return endText.isBlockBreak()\n}\n\nconst unmarkBlockBreakPiece = (piece) => piece.copyWithoutAttribute(\"blockBreak\")\n\n// Attributes\n\nconst expandAttribute = function(attribute) {\n const { listAttribute } = getBlockConfig(attribute)\n if (listAttribute) {\n return [ listAttribute, attribute ]\n } else {\n return [ attribute ]\n }\n}\n\n// Array helpers\n\nconst getLastElement = (array) => array.slice(-1)[0]\n\nconst removeLastValue = function(array, value) {\n const index = array.lastIndexOf(value)\n if (index === -1) {\n return array\n } else {\n return spliceArray(array, index, 1)\n }\n}\n","import * as config from \"trix/config\"\nimport TrixObject from \"trix/core/object\" // Don't override window.Object\n\nimport Text from \"trix/models/text\"\nimport Block from \"trix/models/block\"\nimport SplittableList from \"trix/models/splittable_list\"\nimport Hash from \"trix/core/collections/hash\"\nimport ObjectMap from \"trix/core/collections/object_map\"\n\nimport { arraysAreEqual, getBlockConfig, normalizeRange, rangeIsCollapsed } from \"trix/core/helpers\"\n\nexport default class Document extends TrixObject {\n static fromJSON(documentJSON) {\n const blocks = Array.from(documentJSON).map((blockJSON) => Block.fromJSON(blockJSON))\n return new this(blocks)\n }\n\n static fromString(string, textAttributes) {\n const text = Text.textForStringWithAttributes(string, textAttributes)\n return new this([ new Block(text) ])\n }\n\n constructor(blocks = []) {\n super(...arguments)\n if (blocks.length === 0) {\n blocks = [ new Block() ]\n }\n this.blockList = SplittableList.box(blocks)\n }\n\n isEmpty() {\n const block = this.getBlockAtIndex(0)\n return this.blockList.length === 1 && block.isEmpty() && !block.hasAttributes()\n }\n\n copy(options = {}) {\n const blocks = options.consolidateBlocks ? this.blockList.consolidate().toArray() : this.blockList.toArray()\n\n return new this.constructor(blocks)\n }\n\n copyUsingObjectsFromDocument(sourceDocument) {\n const objectMap = new ObjectMap(sourceDocument.getObjects())\n return this.copyUsingObjectMap(objectMap)\n }\n\n copyUsingObjectMap(objectMap) {\n const blocks = this.getBlocks().map((block) => {\n const mappedBlock = objectMap.find(block)\n return mappedBlock || block.copyUsingObjectMap(objectMap)\n })\n return new this.constructor(blocks)\n }\n\n copyWithBaseBlockAttributes(blockAttributes = []) {\n const blocks = this.getBlocks().map((block) => {\n const attributes = blockAttributes.concat(block.getAttributes())\n return block.copyWithAttributes(attributes)\n })\n\n return new this.constructor(blocks)\n }\n\n replaceBlock(oldBlock, newBlock) {\n const index = this.blockList.indexOf(oldBlock)\n if (index === -1) {\n return this\n }\n return new this.constructor(this.blockList.replaceObjectAtIndex(newBlock, index))\n }\n\n insertDocumentAtRange(document, range) {\n const { blockList } = document\n range = normalizeRange(range)\n let [ position ] = range\n const { index, offset } = this.locationFromPosition(position)\n\n let result = this\n const block = this.getBlockAtPosition(position)\n\n if (rangeIsCollapsed(range) && block.isEmpty() && !block.hasAttributes()) {\n result = new this.constructor(result.blockList.removeObjectAtIndex(index))\n } else if (block.getBlockBreakPosition() === offset) {\n position++\n }\n\n result = result.removeTextAtRange(range)\n return new this.constructor(result.blockList.insertSplittableListAtPosition(blockList, position))\n }\n\n mergeDocumentAtRange(document, range) {\n let formattedDocument, result\n range = normalizeRange(range)\n const [ startPosition ] = range\n const startLocation = this.locationFromPosition(startPosition)\n const blockAttributes = this.getBlockAtIndex(startLocation.index).getAttributes()\n const baseBlockAttributes = document.getBaseBlockAttributes()\n const trailingBlockAttributes = blockAttributes.slice(-baseBlockAttributes.length)\n\n if (arraysAreEqual(baseBlockAttributes, trailingBlockAttributes)) {\n const leadingBlockAttributes = blockAttributes.slice(0, -baseBlockAttributes.length)\n formattedDocument = document.copyWithBaseBlockAttributes(leadingBlockAttributes)\n } else {\n formattedDocument = document.copy({ consolidateBlocks: true }).copyWithBaseBlockAttributes(blockAttributes)\n }\n\n const blockCount = formattedDocument.getBlockCount()\n const firstBlock = formattedDocument.getBlockAtIndex(0)\n\n if (arraysAreEqual(blockAttributes, firstBlock.getAttributes())) {\n const firstText = firstBlock.getTextWithoutBlockBreak()\n result = this.insertTextAtRange(firstText, range)\n\n if (blockCount > 1) {\n formattedDocument = new this.constructor(formattedDocument.getBlocks().slice(1))\n const position = startPosition + firstText.getLength()\n result = result.insertDocumentAtRange(formattedDocument, position)\n }\n } else {\n result = this.insertDocumentAtRange(formattedDocument, range)\n }\n\n return result\n }\n\n insertTextAtRange(text, range) {\n range = normalizeRange(range)\n const [ startPosition ] = range\n const { index, offset } = this.locationFromPosition(startPosition)\n\n const document = this.removeTextAtRange(range)\n return new this.constructor(\n document.blockList.editObjectAtIndex(index, (block) =>\n block.copyWithText(block.text.insertTextAtPosition(text, offset))\n )\n )\n }\n\n removeTextAtRange(range) {\n let blocks\n range = normalizeRange(range)\n const [ leftPosition, rightPosition ] = range\n if (rangeIsCollapsed(range)) {\n return this\n }\n const [ leftLocation, rightLocation ] = Array.from(this.locationRangeFromRange(range))\n\n const leftIndex = leftLocation.index\n const leftOffset = leftLocation.offset\n const leftBlock = this.getBlockAtIndex(leftIndex)\n\n const rightIndex = rightLocation.index\n const rightOffset = rightLocation.offset\n const rightBlock = this.getBlockAtIndex(rightIndex)\n\n const removeRightNewline =\n rightPosition - leftPosition === 1 &&\n leftBlock.getBlockBreakPosition() === leftOffset &&\n rightBlock.getBlockBreakPosition() !== rightOffset &&\n rightBlock.text.getStringAtPosition(rightOffset) === \"\\n\"\n\n if (removeRightNewline) {\n blocks = this.blockList.editObjectAtIndex(rightIndex, (block) =>\n block.copyWithText(block.text.removeTextAtRange([ rightOffset, rightOffset + 1 ]))\n )\n } else {\n let block\n const leftText = leftBlock.text.getTextAtRange([ 0, leftOffset ])\n const rightText = rightBlock.text.getTextAtRange([ rightOffset, rightBlock.getLength() ])\n const text = leftText.appendText(rightText)\n\n const removingLeftBlock = leftIndex !== rightIndex && leftOffset === 0\n const useRightBlock = removingLeftBlock && leftBlock.getAttributeLevel() >= rightBlock.getAttributeLevel()\n\n if (useRightBlock) {\n block = rightBlock.copyWithText(text)\n } else {\n block = leftBlock.copyWithText(text)\n }\n\n const affectedBlockCount = rightIndex + 1 - leftIndex\n blocks = this.blockList.splice(leftIndex, affectedBlockCount, block)\n }\n\n return new this.constructor(blocks)\n }\n\n moveTextFromRangeToPosition(range, position) {\n let text\n range = normalizeRange(range)\n const [ startPosition, endPosition ] = range\n if (startPosition <= position && position <= endPosition) {\n return this\n }\n\n let document = this.getDocumentAtRange(range)\n let result = this.removeTextAtRange(range)\n\n const movingRightward = startPosition < position\n if (movingRightward) {\n position -= document.getLength()\n }\n\n const [ firstBlock, ...blocks ] = document.getBlocks()\n if (blocks.length === 0) {\n text = firstBlock.getTextWithoutBlockBreak()\n if (movingRightward) {\n position += 1\n }\n } else {\n text = firstBlock.text\n }\n\n result = result.insertTextAtRange(text, position)\n if (blocks.length === 0) {\n return result\n }\n\n document = new this.constructor(blocks)\n position += text.getLength()\n\n return result.insertDocumentAtRange(document, position)\n }\n\n addAttributeAtRange(attribute, value, range) {\n let { blockList } = this\n this.eachBlockAtRange(\n range,\n (block, textRange, index) =>\n blockList = blockList.editObjectAtIndex(index, function() {\n if (getBlockConfig(attribute)) {\n return block.addAttribute(attribute, value)\n } else {\n if (textRange[0] === textRange[1]) {\n return block\n } else {\n return block.copyWithText(block.text.addAttributeAtRange(attribute, value, textRange))\n }\n }\n })\n )\n return new this.constructor(blockList)\n }\n\n addAttribute(attribute, value) {\n let { blockList } = this\n this.eachBlock(\n (block, index) => blockList = blockList.editObjectAtIndex(index, () => block.addAttribute(attribute, value))\n )\n return new this.constructor(blockList)\n }\n\n removeAttributeAtRange(attribute, range) {\n let { blockList } = this\n this.eachBlockAtRange(range, function(block, textRange, index) {\n if (getBlockConfig(attribute)) {\n blockList = blockList.editObjectAtIndex(index, () => block.removeAttribute(attribute))\n } else if (textRange[0] !== textRange[1]) {\n blockList = blockList.editObjectAtIndex(index, () =>\n block.copyWithText(block.text.removeAttributeAtRange(attribute, textRange))\n )\n }\n })\n return new this.constructor(blockList)\n }\n\n updateAttributesForAttachment(attributes, attachment) {\n const range = this.getRangeOfAttachment(attachment)\n const [ startPosition ] = Array.from(range)\n const { index } = this.locationFromPosition(startPosition)\n const text = this.getTextAtIndex(index)\n\n return new this.constructor(\n this.blockList.editObjectAtIndex(index, (block) =>\n block.copyWithText(text.updateAttributesForAttachment(attributes, attachment))\n )\n )\n }\n\n removeAttributeForAttachment(attribute, attachment) {\n const range = this.getRangeOfAttachment(attachment)\n return this.removeAttributeAtRange(attribute, range)\n }\n\n setHTMLAttributeAtPosition(position, name, value) {\n const block = this.getBlockAtPosition(position)\n const updatedBlock = block.addHTMLAttribute(name, value)\n return this.replaceBlock(block, updatedBlock)\n }\n\n insertBlockBreakAtRange(range) {\n let blocks\n range = normalizeRange(range)\n const [ startPosition ] = range\n const { offset } = this.locationFromPosition(startPosition)\n\n const document = this.removeTextAtRange(range)\n if (offset === 0) {\n blocks = [ new Block() ]\n }\n return new this.constructor(\n document.blockList.insertSplittableListAtPosition(new SplittableList(blocks), startPosition)\n )\n }\n\n applyBlockAttributeAtRange(attributeName, value, range) {\n const expanded = this.expandRangeToLineBreaksAndSplitBlocks(range)\n let document = expanded.document\n range = expanded.range\n const blockConfig = getBlockConfig(attributeName)\n\n if (blockConfig.listAttribute) {\n document = document.removeLastListAttributeAtRange(range, { exceptAttributeName: attributeName })\n const converted = document.convertLineBreaksToBlockBreaksInRange(range)\n document = converted.document\n range = converted.range\n } else if (blockConfig.exclusive) {\n document = document.removeBlockAttributesAtRange(range)\n } else if (blockConfig.terminal) {\n document = document.removeLastTerminalAttributeAtRange(range)\n } else {\n document = document.consolidateBlocksAtRange(range)\n }\n\n return document.addAttributeAtRange(attributeName, value, range)\n }\n\n removeLastListAttributeAtRange(range, options = {}) {\n let { blockList } = this\n this.eachBlockAtRange(range, function(block, textRange, index) {\n const lastAttributeName = block.getLastAttribute()\n if (!lastAttributeName) {\n return\n }\n if (!getBlockConfig(lastAttributeName).listAttribute) {\n return\n }\n if (lastAttributeName === options.exceptAttributeName) {\n return\n }\n blockList = blockList.editObjectAtIndex(index, () => block.removeAttribute(lastAttributeName))\n })\n return new this.constructor(blockList)\n }\n\n removeLastTerminalAttributeAtRange(range) {\n let { blockList } = this\n this.eachBlockAtRange(range, function(block, textRange, index) {\n const lastAttributeName = block.getLastAttribute()\n if (!lastAttributeName) {\n return\n }\n if (!getBlockConfig(lastAttributeName).terminal) {\n return\n }\n blockList = blockList.editObjectAtIndex(index, () => block.removeAttribute(lastAttributeName))\n })\n return new this.constructor(blockList)\n }\n\n removeBlockAttributesAtRange(range) {\n let { blockList } = this\n this.eachBlockAtRange(range, function(block, textRange, index) {\n if (block.hasAttributes()) {\n blockList = blockList.editObjectAtIndex(index, () => block.copyWithoutAttributes())\n }\n })\n return new this.constructor(blockList)\n }\n\n expandRangeToLineBreaksAndSplitBlocks(range) {\n let position\n range = normalizeRange(range)\n let [ startPosition, endPosition ] = range\n const startLocation = this.locationFromPosition(startPosition)\n const endLocation = this.locationFromPosition(endPosition)\n let document = this\n\n const startBlock = document.getBlockAtIndex(startLocation.index)\n startLocation.offset = startBlock.findLineBreakInDirectionFromPosition(\"backward\", startLocation.offset)\n if (startLocation.offset != null) {\n position = document.positionFromLocation(startLocation)\n document = document.insertBlockBreakAtRange([ position, position + 1 ])\n endLocation.index += 1\n endLocation.offset -= document.getBlockAtIndex(startLocation.index).getLength()\n startLocation.index += 1\n }\n startLocation.offset = 0\n\n if (endLocation.offset === 0 && endLocation.index > startLocation.index) {\n endLocation.index -= 1\n endLocation.offset = document.getBlockAtIndex(endLocation.index).getBlockBreakPosition()\n } else {\n const endBlock = document.getBlockAtIndex(endLocation.index)\n if (endBlock.text.getStringAtRange([ endLocation.offset - 1, endLocation.offset ]) === \"\\n\") {\n endLocation.offset -= 1\n } else {\n endLocation.offset = endBlock.findLineBreakInDirectionFromPosition(\"forward\", endLocation.offset)\n }\n if (endLocation.offset !== endBlock.getBlockBreakPosition()) {\n position = document.positionFromLocation(endLocation)\n document = document.insertBlockBreakAtRange([ position, position + 1 ])\n }\n }\n\n startPosition = document.positionFromLocation(startLocation)\n endPosition = document.positionFromLocation(endLocation)\n range = normalizeRange([ startPosition, endPosition ])\n\n return { document, range }\n }\n\n convertLineBreaksToBlockBreaksInRange(range) {\n range = normalizeRange(range)\n let [ position ] = range\n const string = this.getStringAtRange(range).slice(0, -1)\n let document = this\n\n string.replace(/.*?\\n/g, function(match) {\n position += match.length\n document = document.insertBlockBreakAtRange([ position - 1, position ])\n })\n\n return { document, range }\n }\n\n consolidateBlocksAtRange(range) {\n range = normalizeRange(range)\n const [ startPosition, endPosition ] = range\n const startIndex = this.locationFromPosition(startPosition).index\n const endIndex = this.locationFromPosition(endPosition).index\n return new this.constructor(this.blockList.consolidateFromIndexToIndex(startIndex, endIndex))\n }\n\n getDocumentAtRange(range) {\n range = normalizeRange(range)\n const blocks = this.blockList.getSplittableListInRange(range).toArray()\n return new this.constructor(blocks)\n }\n\n getStringAtRange(range) {\n let endIndex\n const array = range = normalizeRange(range),\n endPosition = array[array.length - 1]\n if (endPosition !== this.getLength()) {\n endIndex = -1\n }\n return this.getDocumentAtRange(range).toString().slice(0, endIndex)\n }\n\n getBlockAtIndex(index) {\n return this.blockList.getObjectAtIndex(index)\n }\n\n getBlockAtPosition(position) {\n const { index } = this.locationFromPosition(position)\n return this.getBlockAtIndex(index)\n }\n\n getTextAtIndex(index) {\n return this.getBlockAtIndex(index)?.text\n }\n\n getTextAtPosition(position) {\n const { index } = this.locationFromPosition(position)\n return this.getTextAtIndex(index)\n }\n\n getPieceAtPosition(position) {\n const { index, offset } = this.locationFromPosition(position)\n return this.getTextAtIndex(index).getPieceAtPosition(offset)\n }\n\n getCharacterAtPosition(position) {\n const { index, offset } = this.locationFromPosition(position)\n return this.getTextAtIndex(index).getStringAtRange([ offset, offset + 1 ])\n }\n\n getLength() {\n return this.blockList.getEndPosition()\n }\n\n getBlocks() {\n return this.blockList.toArray()\n }\n\n getBlockCount() {\n return this.blockList.length\n }\n\n getEditCount() {\n return this.editCount\n }\n\n eachBlock(callback) {\n return this.blockList.eachObject(callback)\n }\n\n eachBlockAtRange(range, callback) {\n let block, textRange\n range = normalizeRange(range)\n const [ startPosition, endPosition ] = range\n const startLocation = this.locationFromPosition(startPosition)\n const endLocation = this.locationFromPosition(endPosition)\n\n if (startLocation.index === endLocation.index) {\n block = this.getBlockAtIndex(startLocation.index)\n textRange = [ startLocation.offset, endLocation.offset ]\n return callback(block, textRange, startLocation.index)\n } else {\n for (let index = startLocation.index; index <= endLocation.index; index++) {\n block = this.getBlockAtIndex(index)\n if (block) {\n switch (index) {\n case startLocation.index:\n textRange = [ startLocation.offset, block.text.getLength() ]\n break\n case endLocation.index:\n textRange = [ 0, endLocation.offset ]\n break\n default:\n textRange = [ 0, block.text.getLength() ]\n }\n callback(block, textRange, index)\n }\n }\n }\n }\n\n getCommonAttributesAtRange(range) {\n range = normalizeRange(range)\n const [ startPosition ] = range\n if (rangeIsCollapsed(range)) {\n return this.getCommonAttributesAtPosition(startPosition)\n } else {\n const textAttributes = []\n const blockAttributes = []\n\n this.eachBlockAtRange(range, function(block, textRange) {\n if (textRange[0] !== textRange[1]) {\n textAttributes.push(block.text.getCommonAttributesAtRange(textRange))\n return blockAttributes.push(attributesForBlock(block))\n }\n })\n\n return Hash.fromCommonAttributesOfObjects(textAttributes)\n .merge(Hash.fromCommonAttributesOfObjects(blockAttributes))\n .toObject()\n }\n }\n\n getCommonAttributesAtPosition(position) {\n let key, value\n const { index, offset } = this.locationFromPosition(position)\n const block = this.getBlockAtIndex(index)\n if (!block) {\n return {}\n }\n\n const commonAttributes = attributesForBlock(block)\n const attributes = block.text.getAttributesAtPosition(offset)\n const attributesLeft = block.text.getAttributesAtPosition(offset - 1)\n const inheritableAttributes = Object.keys(config.textAttributes).filter((key) => {\n return config.textAttributes[key].inheritable\n })\n\n for (key in attributesLeft) {\n value = attributesLeft[key]\n if (value === attributes[key] || inheritableAttributes.includes(key)) {\n commonAttributes[key] = value\n }\n }\n\n return commonAttributes\n }\n\n getRangeOfCommonAttributeAtPosition(attributeName, position) {\n const { index, offset } = this.locationFromPosition(position)\n const text = this.getTextAtIndex(index)\n const [ startOffset, endOffset ] = Array.from(text.getExpandedRangeForAttributeAtOffset(attributeName, offset))\n\n const start = this.positionFromLocation({ index, offset: startOffset })\n const end = this.positionFromLocation({ index, offset: endOffset })\n return normalizeRange([ start, end ])\n }\n\n getBaseBlockAttributes() {\n let baseBlockAttributes = this.getBlockAtIndex(0).getAttributes()\n\n for (let blockIndex = 1; blockIndex < this.getBlockCount(); blockIndex++) {\n const blockAttributes = this.getBlockAtIndex(blockIndex).getAttributes()\n const lastAttributeIndex = Math.min(baseBlockAttributes.length, blockAttributes.length)\n\n baseBlockAttributes = (() => {\n const result = []\n for (let index = 0; index < lastAttributeIndex; index++) {\n if (blockAttributes[index] !== baseBlockAttributes[index]) {\n break\n }\n result.push(blockAttributes[index])\n }\n return result\n })()\n }\n\n return baseBlockAttributes\n }\n\n getAttachmentById(attachmentId) {\n for (const attachment of this.getAttachments()) {\n if (attachment.id === attachmentId) {\n return attachment\n }\n }\n }\n\n getAttachmentPieces() {\n let attachmentPieces = []\n this.blockList.eachObject(({ text }) => attachmentPieces = attachmentPieces.concat(text.getAttachmentPieces()))\n return attachmentPieces\n }\n\n getAttachments() {\n return this.getAttachmentPieces().map((piece) => piece.attachment)\n }\n\n getRangeOfAttachment(attachment) {\n let position = 0\n const iterable = this.blockList.toArray()\n for (let index = 0; index < iterable.length; index++) {\n const { text } = iterable[index]\n const textRange = text.getRangeOfAttachment(attachment)\n if (textRange) {\n return normalizeRange([ position + textRange[0], position + textRange[1] ])\n }\n position += text.getLength()\n }\n }\n\n getLocationRangeOfAttachment(attachment) {\n const range = this.getRangeOfAttachment(attachment)\n return this.locationRangeFromRange(range)\n }\n\n getAttachmentPieceForAttachment(attachment) {\n for (const piece of this.getAttachmentPieces()) {\n if (piece.attachment === attachment) {\n return piece\n }\n }\n }\n\n findRangesForBlockAttribute(attributeName) {\n let position = 0\n const ranges = []\n\n this.getBlocks().forEach((block) => {\n const length = block.getLength()\n if (block.hasAttribute(attributeName)) {\n ranges.push([ position, position + length ])\n }\n position += length\n })\n\n return ranges\n }\n\n findRangesForTextAttribute(attributeName, { withValue } = {}) {\n let position = 0\n let range = []\n const ranges = []\n\n const match = function(piece) {\n if (withValue) {\n return piece.getAttribute(attributeName) === withValue\n } else {\n return piece.hasAttribute(attributeName)\n }\n }\n\n this.getPieces().forEach((piece) => {\n const length = piece.getLength()\n if (match(piece)) {\n if (range[1] === position) {\n range[1] = position + length\n } else {\n ranges.push(range = [ position, position + length ])\n }\n }\n position += length\n })\n\n return ranges\n }\n\n locationFromPosition(position) {\n const location = this.blockList.findIndexAndOffsetAtPosition(Math.max(0, position))\n if (location.index != null) {\n return location\n } else {\n const blocks = this.getBlocks()\n return { index: blocks.length - 1, offset: blocks[blocks.length - 1].getLength() }\n }\n }\n\n positionFromLocation(location) {\n return this.blockList.findPositionAtIndexAndOffset(location.index, location.offset)\n }\n\n locationRangeFromPosition(position) {\n return normalizeRange(this.locationFromPosition(position))\n }\n\n locationRangeFromRange(range) {\n range = normalizeRange(range)\n if (!range) return\n\n const [ startPosition, endPosition ] = Array.from(range)\n const startLocation = this.locationFromPosition(startPosition)\n const endLocation = this.locationFromPosition(endPosition)\n return normalizeRange([ startLocation, endLocation ])\n }\n\n rangeFromLocationRange(locationRange) {\n let rightPosition\n locationRange = normalizeRange(locationRange)\n const leftPosition = this.positionFromLocation(locationRange[0])\n if (!rangeIsCollapsed(locationRange)) {\n rightPosition = this.positionFromLocation(locationRange[1])\n }\n return normalizeRange([ leftPosition, rightPosition ])\n }\n\n isEqualTo(document) {\n return this.blockList.isEqualTo(document?.blockList)\n }\n\n getTexts() {\n return this.getBlocks().map((block) => block.text)\n }\n\n getPieces() {\n const pieces = []\n\n Array.from(this.getTexts()).forEach((text) => {\n pieces.push(...Array.from(text.getPieces() || []))\n })\n\n return pieces\n }\n\n getObjects() {\n return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())\n }\n\n toSerializableDocument() {\n const blocks = []\n this.blockList.eachObject((block) => blocks.push(block.copyWithText(block.text.toSerializableText())))\n return new this.constructor(blocks)\n }\n\n toString() {\n return this.blockList.toString()\n }\n\n toJSON() {\n return this.blockList.toJSON()\n }\n\n toConsole() {\n return JSON.stringify(this.blockList.toArray().map((block) => JSON.parse(block.text.toConsole())))\n }\n}\n\nconst attributesForBlock = function(block) {\n const attributes = {}\n const attributeName = block.getLastAttribute()\n if (attributeName) {\n attributes[attributeName] = true\n }\n return attributes\n}\n","/* eslint-disable\n no-case-declarations,\n no-irregular-whitespace,\n*/\nimport * as config from \"trix/config\"\nimport BasicObject from \"trix/core/basic_object\"\nimport Document from \"trix/models/document\"\nimport HTMLSanitizer from \"trix/models/html_sanitizer\"\n\nimport {\n arraysAreEqual,\n breakableWhitespacePattern,\n elementContainsNode,\n findClosestElementFromNode,\n getBlockTagNames,\n makeElement,\n nodeIsAttachmentElement,\n normalizeSpaces,\n removeNode,\n squishBreakableWhitespace,\n tagName,\n walkTree,\n} from \"trix/core/helpers\"\n\nconst pieceForString = (string, attributes = {}) => {\n const type = \"string\"\n string = normalizeSpaces(string)\n return { string, attributes, type }\n}\n\nconst pieceForAttachment = (attachment, attributes = {}) => {\n const type = \"attachment\"\n return { attachment, attributes, type }\n}\n\nconst blockForAttributes = (attributes = {}, htmlAttributes = {}) => {\n const text = []\n return { text, attributes, htmlAttributes }\n}\n\nconst parseTrixDataAttribute = (element, name) => {\n try {\n return JSON.parse(element.getAttribute(`data-trix-${name}`))\n } catch (error) {\n return {}\n }\n}\n\nconst getImageDimensions = (element) => {\n const width = element.getAttribute(\"width\")\n const height = element.getAttribute(\"height\")\n const dimensions = {}\n if (width) {\n dimensions.width = parseInt(width, 10)\n }\n if (height) {\n dimensions.height = parseInt(height, 10)\n }\n return dimensions\n}\n\nexport default class HTMLParser extends BasicObject {\n static parse(html, options) {\n const parser = new this(html, options)\n parser.parse()\n return parser\n }\n\n constructor(html, { referenceElement } = {}) {\n super(...arguments)\n this.html = html\n this.referenceElement = referenceElement\n this.blocks = []\n this.blockElements = []\n this.processedElements = []\n }\n\n getDocument() {\n return Document.fromJSON(this.blocks)\n }\n\n // HTML parsing\n\n parse() {\n try {\n this.createHiddenContainer()\n HTMLSanitizer.setHTML(this.containerElement, this.html)\n const walker = walkTree(this.containerElement, { usingFilter: nodeFilter })\n while (walker.nextNode()) {\n this.processNode(walker.currentNode)\n }\n return this.translateBlockElementMarginsToNewlines()\n } finally {\n this.removeHiddenContainer()\n }\n }\n\n createHiddenContainer() {\n if (this.referenceElement) {\n this.containerElement = this.referenceElement.cloneNode(false)\n this.containerElement.removeAttribute(\"id\")\n this.containerElement.setAttribute(\"data-trix-internal\", \"\")\n this.containerElement.style.display = \"none\"\n return this.referenceElement.parentNode.insertBefore(this.containerElement, this.referenceElement.nextSibling)\n } else {\n this.containerElement = makeElement({ tagName: \"div\", style: { display: \"none\" } })\n return document.body.appendChild(this.containerElement)\n }\n }\n\n removeHiddenContainer() {\n return removeNode(this.containerElement)\n }\n\n processNode(node) {\n switch (node.nodeType) {\n case Node.TEXT_NODE:\n if (!this.isInsignificantTextNode(node)) {\n this.appendBlockForTextNode(node)\n return this.processTextNode(node)\n }\n break\n case Node.ELEMENT_NODE:\n this.appendBlockForElement(node)\n return this.processElement(node)\n }\n }\n\n appendBlockForTextNode(node) {\n const element = node.parentNode\n if (element === this.currentBlockElement && this.isBlockElement(node.previousSibling)) {\n return this.appendStringWithAttributes(\"\\n\")\n } else if (element === this.containerElement || this.isBlockElement(element)) {\n const attributes = this.getBlockAttributes(element)\n const htmlAttributes = this.getBlockHTMLAttributes(element)\n if (!arraysAreEqual(attributes, this.currentBlock?.attributes)) {\n this.currentBlock = this.appendBlockForAttributesWithElement(attributes, element, htmlAttributes)\n this.currentBlockElement = element\n }\n }\n }\n\n appendBlockForElement(element) {\n const elementIsBlockElement = this.isBlockElement(element)\n const currentBlockContainsElement = elementContainsNode(this.currentBlockElement, element)\n\n if (elementIsBlockElement && !this.isBlockElement(element.firstChild)) {\n if (!this.isInsignificantTextNode(element.firstChild) || !this.isBlockElement(element.firstElementChild)) {\n const attributes = this.getBlockAttributes(element)\n const htmlAttributes = this.getBlockHTMLAttributes(element)\n if (element.firstChild) {\n if (!(currentBlockContainsElement && arraysAreEqual(attributes, this.currentBlock.attributes))) {\n this.currentBlock = this.appendBlockForAttributesWithElement(attributes, element, htmlAttributes)\n this.currentBlockElement = element\n } else {\n return this.appendStringWithAttributes(\"\\n\")\n }\n }\n }\n } else if (this.currentBlockElement && !currentBlockContainsElement && !elementIsBlockElement) {\n const parentBlockElement = this.findParentBlockElement(element)\n if (parentBlockElement) {\n return this.appendBlockForElement(parentBlockElement)\n } else {\n this.currentBlock = this.appendEmptyBlock()\n this.currentBlockElement = null\n }\n }\n }\n\n findParentBlockElement(element) {\n let { parentElement } = element\n while (parentElement && parentElement !== this.containerElement) {\n if (this.isBlockElement(parentElement) && this.blockElements.includes(parentElement)) {\n return parentElement\n } else {\n parentElement = parentElement.parentElement\n }\n }\n return null\n }\n\n processTextNode(node) {\n let string = node.data\n if (!elementCanDisplayPreformattedText(node.parentNode)) {\n string = squishBreakableWhitespace(string)\n if (stringEndsWithWhitespace(node.previousSibling?.textContent)) {\n string = leftTrimBreakableWhitespace(string)\n }\n }\n return this.appendStringWithAttributes(string, this.getTextAttributes(node.parentNode))\n }\n\n processElement(element) {\n let attributes\n if (nodeIsAttachmentElement(element)) {\n attributes = parseTrixDataAttribute(element, \"attachment\")\n if (Object.keys(attributes).length) {\n const textAttributes = this.getTextAttributes(element)\n this.appendAttachmentWithAttributes(attributes, textAttributes)\n // We have everything we need so avoid processing inner nodes\n element.innerHTML = \"\"\n }\n return this.processedElements.push(element)\n } else {\n switch (tagName(element)) {\n case \"br\":\n if (!this.isExtraBR(element) && !this.isBlockElement(element.nextSibling)) {\n this.appendStringWithAttributes(\"\\n\", this.getTextAttributes(element))\n }\n return this.processedElements.push(element)\n case \"img\":\n attributes = { url: element.getAttribute(\"src\"), contentType: \"image\" }\n const object = getImageDimensions(element)\n for (const key in object) {\n const value = object[key]\n attributes[key] = value\n }\n this.appendAttachmentWithAttributes(attributes, this.getTextAttributes(element))\n return this.processedElements.push(element)\n case \"tr\":\n if (this.needsTableSeparator(element)) {\n return this.appendStringWithAttributes(config.parser.tableRowSeparator)\n }\n break\n case \"td\":\n if (this.needsTableSeparator(element)) {\n return this.appendStringWithAttributes(config.parser.tableCellSeparator)\n }\n break\n }\n }\n }\n\n // Document construction\n\n appendBlockForAttributesWithElement(attributes, element, htmlAttributes = {}) {\n this.blockElements.push(element)\n const block = blockForAttributes(attributes, htmlAttributes)\n this.blocks.push(block)\n return block\n }\n\n appendEmptyBlock() {\n return this.appendBlockForAttributesWithElement([], null)\n }\n\n appendStringWithAttributes(string, attributes) {\n return this.appendPiece(pieceForString(string, attributes))\n }\n\n appendAttachmentWithAttributes(attachment, attributes) {\n return this.appendPiece(pieceForAttachment(attachment, attributes))\n }\n\n appendPiece(piece) {\n if (this.blocks.length === 0) {\n this.appendEmptyBlock()\n }\n return this.blocks[this.blocks.length - 1].text.push(piece)\n }\n\n appendStringToTextAtIndex(string, index) {\n const { text } = this.blocks[index]\n const piece = text[text.length - 1]\n\n if (piece?.type === \"string\") {\n piece.string += string\n } else {\n return text.push(pieceForString(string))\n }\n }\n\n prependStringToTextAtIndex(string, index) {\n const { text } = this.blocks[index]\n const piece = text[0]\n\n if (piece?.type === \"string\") {\n piece.string = string + piece.string\n } else {\n return text.unshift(pieceForString(string))\n }\n }\n\n // Attribute parsing\n\n getTextAttributes(element) {\n let value\n const attributes = {}\n for (const attribute in config.textAttributes) {\n const configAttr = config.textAttributes[attribute]\n if (\n configAttr.tagName &&\n findClosestElementFromNode(element, {\n matchingSelector: configAttr.tagName,\n untilNode: this.containerElement,\n })\n ) {\n attributes[attribute] = true\n } else if (configAttr.parser) {\n value = configAttr.parser(element)\n if (value) {\n let attributeInheritedFromBlock = false\n for (const blockElement of this.findBlockElementAncestors(element)) {\n if (configAttr.parser(blockElement) === value) {\n attributeInheritedFromBlock = true\n break\n }\n }\n if (!attributeInheritedFromBlock) {\n attributes[attribute] = value\n }\n }\n } else if (configAttr.styleProperty) {\n value = element.style[configAttr.styleProperty]\n if (value) {\n attributes[attribute] = value\n }\n }\n }\n\n if (nodeIsAttachmentElement(element)) {\n const object = parseTrixDataAttribute(element, \"attributes\")\n for (const key in object) {\n value = object[key]\n attributes[key] = value\n }\n }\n\n return attributes\n }\n\n getBlockAttributes(element) {\n const attributes = []\n while (element && element !== this.containerElement) {\n for (const attribute in config.blockAttributes) {\n const attrConfig = config.blockAttributes[attribute]\n if (attrConfig.parse !== false) {\n if (tagName(element) === attrConfig.tagName) {\n if (attrConfig.test?.(element) || !attrConfig.test) {\n attributes.push(attribute)\n if (attrConfig.listAttribute) {\n attributes.push(attrConfig.listAttribute)\n }\n }\n }\n }\n }\n element = element.parentNode\n }\n return attributes.reverse()\n }\n\n getBlockHTMLAttributes(element) {\n const attributes = {}\n const blockConfig = Object.values(config.blockAttributes).find(settings => settings.tagName === tagName(element))\n const allowedAttributes = blockConfig?.htmlAttributes || []\n\n allowedAttributes.forEach((attribute) => {\n if (element.hasAttribute(attribute)) {\n attributes[attribute] = element.getAttribute(attribute)\n }\n })\n\n return attributes\n }\n\n findBlockElementAncestors(element) {\n const ancestors = []\n while (element && element !== this.containerElement) {\n const tag = tagName(element)\n if (getBlockTagNames().includes(tag)) {\n ancestors.push(element)\n }\n element = element.parentNode\n }\n return ancestors\n }\n\n // Element inspection\n\n isBlockElement(element) {\n if (element?.nodeType !== Node.ELEMENT_NODE) return\n if (nodeIsAttachmentElement(element)) return\n if (findClosestElementFromNode(element, { matchingSelector: \"td\", untilNode: this.containerElement })) return\n\n return getBlockTagNames().includes(tagName(element)) ||\n window.getComputedStyle(element).display === \"block\"\n }\n\n isInsignificantTextNode(node) {\n if (node?.nodeType !== Node.TEXT_NODE) return\n if (!stringIsAllBreakableWhitespace(node.data)) return\n const { parentNode, previousSibling, nextSibling } = node\n if (nodeEndsWithNonWhitespace(parentNode.previousSibling) && !this.isBlockElement(parentNode.previousSibling)) return\n if (elementCanDisplayPreformattedText(parentNode)) return\n return !previousSibling || this.isBlockElement(previousSibling) || !nextSibling || this.isBlockElement(nextSibling)\n }\n\n isExtraBR(element) {\n return tagName(element) === \"br\" && this.isBlockElement(element.parentNode) && element.parentNode.lastChild === element\n }\n\n needsTableSeparator(element) {\n if (config.parser.removeBlankTableCells) {\n const content = element.previousSibling?.textContent\n return content && /\\S/.test(content)\n } else {\n return element.previousSibling\n }\n }\n\n // Margin translation\n\n translateBlockElementMarginsToNewlines() {\n const defaultMargin = this.getMarginOfDefaultBlockElement()\n\n for (let index = 0; index < this.blocks.length; index++) {\n const margin = this.getMarginOfBlockElementAtIndex(index)\n if (margin) {\n if (margin.top > defaultMargin.top * 2) {\n this.prependStringToTextAtIndex(\"\\n\", index)\n }\n\n if (margin.bottom > defaultMargin.bottom * 2) {\n this.appendStringToTextAtIndex(\"\\n\", index)\n }\n }\n }\n }\n\n getMarginOfBlockElementAtIndex(index) {\n const element = this.blockElements[index]\n if (element) {\n if (element.textContent) {\n if (!getBlockTagNames().includes(tagName(element)) && !this.processedElements.includes(element)) {\n return getBlockElementMargin(element)\n }\n }\n }\n }\n\n getMarginOfDefaultBlockElement() {\n const element = makeElement(config.blockAttributes.default.tagName)\n this.containerElement.appendChild(element)\n return getBlockElementMargin(element)\n }\n}\n\n// Helpers\n\nconst elementCanDisplayPreformattedText = function(element) {\n const { whiteSpace } = window.getComputedStyle(element)\n return [ \"pre\", \"pre-wrap\", \"pre-line\" ].includes(whiteSpace)\n}\n\nconst nodeEndsWithNonWhitespace = (node) => node && !stringEndsWithWhitespace(node.textContent)\n\nconst getBlockElementMargin = function(element) {\n const style = window.getComputedStyle(element)\n if (style.display === \"block\") {\n return { top: parseInt(style.marginTop), bottom: parseInt(style.marginBottom) }\n }\n}\n\nconst nodeFilter = function(node) {\n if (tagName(node) === \"style\") {\n return NodeFilter.FILTER_REJECT\n } else {\n return NodeFilter.FILTER_ACCEPT\n }\n}\n\n// Whitespace\n\nconst leftTrimBreakableWhitespace = (string) => string.replace(new RegExp(`^${breakableWhitespacePattern.source}+`), \"\")\n\nconst stringIsAllBreakableWhitespace = (string) => new RegExp(`^${breakableWhitespacePattern.source}*$`).test(string)\n\nconst stringEndsWithWhitespace = (string) => /\\s$/.test(string)\n","/* eslint-disable\n no-empty,\n*/\nimport { removeNode } from \"trix/core/helpers\"\n\nimport DocumentView from \"trix/views/document_view\"\nimport Document from \"trix/models/document\"\nimport HTMLParser from \"trix/models/html_parser\"\n\nconst unserializableElementSelector = \"[data-trix-serialize=false]\"\nconst unserializableAttributeNames = [\n \"contenteditable\",\n \"data-trix-id\",\n \"data-trix-store-key\",\n \"data-trix-mutable\",\n \"data-trix-placeholder\",\n \"tabindex\",\n]\nconst serializedAttributesAttribute = \"data-trix-serialized-attributes\"\nconst serializedAttributesSelector = `[${serializedAttributesAttribute}]`\n\nconst blockCommentPattern = new RegExp(\"\", \"g\")\n\nconst serializers = {\n \"application/json\": function(serializable) {\n let document\n if (serializable instanceof Document) {\n document = serializable\n } else if (serializable instanceof HTMLElement) {\n document = HTMLParser.parse(serializable.innerHTML).getDocument()\n } else {\n throw new Error(\"unserializable object\")\n }\n\n return document.toSerializableDocument().toJSONString()\n },\n\n \"text/html\": function(serializable) {\n let element\n if (serializable instanceof Document) {\n element = DocumentView.render(serializable)\n } else if (serializable instanceof HTMLElement) {\n element = serializable.cloneNode(true)\n } else {\n throw new Error(\"unserializable object\")\n }\n\n // Remove unserializable elements\n Array.from(element.querySelectorAll(unserializableElementSelector)).forEach((el) => {\n removeNode(el)\n })\n\n // Remove unserializable attributes\n unserializableAttributeNames.forEach((attribute) => {\n Array.from(element.querySelectorAll(`[${attribute}]`)).forEach((el) => {\n el.removeAttribute(attribute)\n })\n })\n\n // Rewrite elements with serialized attribute overrides\n Array.from(element.querySelectorAll(serializedAttributesSelector)).forEach((el) => {\n try {\n const attributes = JSON.parse(el.getAttribute(serializedAttributesAttribute))\n el.removeAttribute(serializedAttributesAttribute)\n for (const name in attributes) {\n const value = attributes[name]\n el.setAttribute(name, value)\n }\n } catch (error) {}\n })\n\n return element.innerHTML.replace(blockCommentPattern, \"\")\n },\n}\n\nconst deserializers = {\n \"application/json\": function(string) {\n return Document.fromJSONString(string)\n },\n\n \"text/html\": function(string) {\n return HTMLParser.parse(string).getDocument()\n },\n}\n\nexport const serializeToContentType = function(serializable, contentType) {\n const serializer = serializers[contentType]\n if (serializer) {\n return serializer(serializable)\n } else {\n throw new Error(`unknown content type: ${contentType}`)\n }\n}\n\nexport const deserializeFromContentType = function(string, contentType) {\n const deserializer = deserializers[contentType]\n if (deserializer) {\n return deserializer(string)\n } else {\n throw new Error(`unknown content type: ${contentType}`)\n }\n}\n","import \"trix/models/attachment\"\nimport BasicObject from \"trix/core/basic_object\"\n\nexport default class ManagedAttachment extends BasicObject {\n constructor(attachmentManager, attachment) {\n super(...arguments)\n this.attachmentManager = attachmentManager\n this.attachment = attachment\n this.id = this.attachment.id\n this.file = this.attachment.file\n }\n\n remove() {\n return this.attachmentManager.requestRemovalOfAttachment(this.attachment)\n }\n}\n\nManagedAttachment.proxyMethod(\"attachment.getAttribute\")\nManagedAttachment.proxyMethod(\"attachment.hasAttribute\")\nManagedAttachment.proxyMethod(\"attachment.setAttribute\")\nManagedAttachment.proxyMethod(\"attachment.getAttributes\")\nManagedAttachment.proxyMethod(\"attachment.setAttributes\")\nManagedAttachment.proxyMethod(\"attachment.isPending\")\nManagedAttachment.proxyMethod(\"attachment.isPreviewable\")\nManagedAttachment.proxyMethod(\"attachment.getURL\")\nManagedAttachment.proxyMethod(\"attachment.getHref\")\nManagedAttachment.proxyMethod(\"attachment.getFilename\")\nManagedAttachment.proxyMethod(\"attachment.getFilesize\")\nManagedAttachment.proxyMethod(\"attachment.getFormattedFilesize\")\nManagedAttachment.proxyMethod(\"attachment.getExtension\")\nManagedAttachment.proxyMethod(\"attachment.getContentType\")\nManagedAttachment.proxyMethod(\"attachment.getFile\")\nManagedAttachment.proxyMethod(\"attachment.setFile\")\nManagedAttachment.proxyMethod(\"attachment.releaseFile\")\nManagedAttachment.proxyMethod(\"attachment.getUploadProgress\")\nManagedAttachment.proxyMethod(\"attachment.setUploadProgress\")\n\n","import ManagedAttachment from \"trix/models/managed_attachment\"\nimport BasicObject from \"trix/core/basic_object\"\n\nexport default class AttachmentManager extends BasicObject {\n constructor(attachments = []) {\n super(...arguments)\n this.managedAttachments = {}\n Array.from(attachments).forEach((attachment) => {\n this.manageAttachment(attachment)\n })\n }\n\n getAttachments() {\n const result = []\n for (const id in this.managedAttachments) {\n const attachment = this.managedAttachments[id]\n result.push(attachment)\n }\n return result\n }\n\n manageAttachment(attachment) {\n if (!this.managedAttachments[attachment.id]) {\n this.managedAttachments[attachment.id] = new ManagedAttachment(this, attachment)\n }\n return this.managedAttachments[attachment.id]\n }\n\n attachmentIsManaged(attachment) {\n return attachment.id in this.managedAttachments\n }\n\n requestRemovalOfAttachment(attachment) {\n if (this.attachmentIsManaged(attachment)) {\n return this.delegate?.attachmentManagerDidRequestRemovalOfAttachment?.(attachment)\n }\n }\n\n unmanageAttachment(attachment) {\n const managedAttachment = this.managedAttachments[attachment.id]\n delete this.managedAttachments[attachment.id]\n return managedAttachment\n }\n}\n","export default class LineBreakInsertion {\n constructor(composition) {\n this.composition = composition\n this.document = this.composition.document\n const selectedRange = this.composition.getSelectedRange()\n this.startPosition = selectedRange[0]\n this.endPosition = selectedRange[1]\n\n this.startLocation = this.document.locationFromPosition(this.startPosition)\n this.endLocation = this.document.locationFromPosition(this.endPosition)\n\n this.block = this.document.getBlockAtIndex(this.endLocation.index)\n this.breaksOnReturn = this.block.breaksOnReturn()\n this.previousCharacter = this.block.text.getStringAtPosition(this.endLocation.offset - 1)\n this.nextCharacter = this.block.text.getStringAtPosition(this.endLocation.offset)\n }\n\n shouldInsertBlockBreak() {\n if (this.block.hasAttributes() && this.block.isListItem() && !this.block.isEmpty()) {\n return this.startLocation.offset !== 0\n } else {\n return this.breaksOnReturn && this.nextCharacter !== \"\\n\"\n }\n }\n\n shouldBreakFormattedBlock() {\n return (\n this.block.hasAttributes() &&\n !this.block.isListItem() &&\n (this.breaksOnReturn && this.nextCharacter === \"\\n\" || this.previousCharacter === \"\\n\")\n )\n }\n\n shouldDecreaseListLevel() {\n return this.block.hasAttributes() && this.block.isListItem() && this.block.isEmpty()\n }\n\n shouldPrependListItem() {\n return this.block.isListItem() && this.startLocation.offset === 0 && !this.block.isEmpty()\n }\n\n shouldRemoveLastBlockAttribute() {\n return this.block.hasAttributes() && !this.block.isListItem() && this.block.isEmpty()\n }\n}\n","import * as config from \"trix/config\"\nimport { OBJECT_REPLACEMENT_CHARACTER } from \"trix/constants\"\n\nimport BasicObject from \"trix/core/basic_object\"\nimport Text from \"trix/models/text\"\nimport Block from \"trix/models/block\"\nimport Attachment from \"trix/models/attachment\"\nimport Document from \"trix/models/document\"\nimport HTMLParser from \"trix/models/html_parser\"\nimport LineBreakInsertion from \"trix/models/line_break_insertion\"\n\nimport {\n arrayStartsWith,\n extend,\n getAllAttributeNames,\n getBlockConfig,\n getTextConfig,\n normalizeRange,\n objectsAreEqual,\n rangeIsCollapsed,\n rangesAreEqual,\n summarizeArrayChange,\n} from \"trix/core/helpers\"\n\nconst PLACEHOLDER = \" \"\n\nexport default class Composition extends BasicObject {\n constructor() {\n super(...arguments)\n this.document = new Document()\n this.attachments = []\n this.currentAttributes = {}\n this.revision = 0\n }\n\n setDocument(document) {\n if (!document.isEqualTo(this.document)) {\n this.document = document\n this.refreshAttachments()\n this.revision++\n return this.delegate?.compositionDidChangeDocument?.(document)\n }\n }\n\n // Snapshots\n\n getSnapshot() {\n return {\n document: this.document,\n selectedRange: this.getSelectedRange(),\n }\n }\n\n loadSnapshot({ document, selectedRange }) {\n this.delegate?.compositionWillLoadSnapshot?.()\n this.setDocument(document != null ? document : new Document())\n this.setSelection(selectedRange != null ? selectedRange : [ 0, 0 ])\n return this.delegate?.compositionDidLoadSnapshot?.()\n }\n\n // Responder protocol\n\n insertText(text, { updatePosition } = { updatePosition: true }) {\n const selectedRange = this.getSelectedRange()\n this.setDocument(this.document.insertTextAtRange(text, selectedRange))\n\n const startPosition = selectedRange[0]\n const endPosition = startPosition + text.getLength()\n\n if (updatePosition) {\n this.setSelection(endPosition)\n }\n return this.notifyDelegateOfInsertionAtRange([ startPosition, endPosition ])\n }\n\n insertBlock(block = new Block()) {\n const document = new Document([ block ])\n return this.insertDocument(document)\n }\n\n insertDocument(document = new Document()) {\n const selectedRange = this.getSelectedRange()\n this.setDocument(this.document.insertDocumentAtRange(document, selectedRange))\n\n const startPosition = selectedRange[0]\n const endPosition = startPosition + document.getLength()\n\n this.setSelection(endPosition)\n return this.notifyDelegateOfInsertionAtRange([ startPosition, endPosition ])\n }\n\n insertString(string, options) {\n const attributes = this.getCurrentTextAttributes()\n const text = Text.textForStringWithAttributes(string, attributes)\n return this.insertText(text, options)\n }\n\n insertBlockBreak() {\n const selectedRange = this.getSelectedRange()\n this.setDocument(this.document.insertBlockBreakAtRange(selectedRange))\n\n const startPosition = selectedRange[0]\n const endPosition = startPosition + 1\n\n this.setSelection(endPosition)\n return this.notifyDelegateOfInsertionAtRange([ startPosition, endPosition ])\n }\n\n insertLineBreak() {\n const insertion = new LineBreakInsertion(this)\n\n if (insertion.shouldDecreaseListLevel()) {\n this.decreaseListLevel()\n return this.setSelection(insertion.startPosition)\n } else if (insertion.shouldPrependListItem()) {\n const document = new Document([ insertion.block.copyWithoutText() ])\n return this.insertDocument(document)\n } else if (insertion.shouldInsertBlockBreak()) {\n return this.insertBlockBreak()\n } else if (insertion.shouldRemoveLastBlockAttribute()) {\n return this.removeLastBlockAttribute()\n } else if (insertion.shouldBreakFormattedBlock()) {\n return this.breakFormattedBlock(insertion)\n } else {\n return this.insertString(\"\\n\")\n }\n }\n\n insertHTML(html) {\n const document = HTMLParser.parse(html).getDocument()\n const selectedRange = this.getSelectedRange()\n\n this.setDocument(this.document.mergeDocumentAtRange(document, selectedRange))\n\n const startPosition = selectedRange[0]\n const endPosition = startPosition + document.getLength() - 1\n\n this.setSelection(endPosition)\n return this.notifyDelegateOfInsertionAtRange([ startPosition, endPosition ])\n }\n\n replaceHTML(html) {\n const document = HTMLParser.parse(html).getDocument().copyUsingObjectsFromDocument(this.document)\n const locationRange = this.getLocationRange({ strict: false })\n const selectedRange = this.document.rangeFromLocationRange(locationRange)\n this.setDocument(document)\n return this.setSelection(selectedRange)\n }\n\n insertFile(file) {\n return this.insertFiles([ file ])\n }\n\n insertFiles(files) {\n const attachments = []\n\n Array.from(files).forEach((file) => {\n if (this.delegate?.compositionShouldAcceptFile(file)) {\n const attachment = Attachment.attachmentForFile(file)\n attachments.push(attachment)\n }\n })\n\n return this.insertAttachments(attachments)\n }\n\n insertAttachment(attachment) {\n return this.insertAttachments([ attachment ])\n }\n\n insertAttachments(attachments) {\n let text = new Text()\n\n Array.from(attachments).forEach((attachment) => {\n const type = attachment.getType()\n const presentation = config.attachments[type]?.presentation\n\n const attributes = this.getCurrentTextAttributes()\n if (presentation) {\n attributes.presentation = presentation\n }\n\n const attachmentText = Text.textForAttachmentWithAttributes(attachment, attributes)\n text = text.appendText(attachmentText)\n })\n\n return this.insertText(text)\n }\n\n shouldManageDeletingInDirection(direction) {\n const locationRange = this.getLocationRange()\n if (rangeIsCollapsed(locationRange)) {\n if (direction === \"backward\" && locationRange[0].offset === 0) {\n return true\n }\n if (this.shouldManageMovingCursorInDirection(direction)) {\n return true\n }\n } else {\n if (locationRange[0].index !== locationRange[1].index) {\n return true\n }\n }\n return false\n }\n\n deleteInDirection(direction, { length } = {}) {\n let attachment, deletingIntoPreviousBlock, selectionSpansBlocks\n const locationRange = this.getLocationRange()\n let range = this.getSelectedRange()\n const selectionIsCollapsed = rangeIsCollapsed(range)\n\n if (selectionIsCollapsed) {\n deletingIntoPreviousBlock = direction === \"backward\" && locationRange[0].offset === 0\n } else {\n selectionSpansBlocks = locationRange[0].index !== locationRange[1].index\n }\n\n if (deletingIntoPreviousBlock) {\n if (this.canDecreaseBlockAttributeLevel()) {\n const block = this.getBlock()\n\n if (block.isListItem()) {\n this.decreaseListLevel()\n } else {\n this.decreaseBlockAttributeLevel()\n }\n\n this.setSelection(range[0])\n if (block.isEmpty()) {\n return false\n }\n }\n }\n\n if (selectionIsCollapsed) {\n range = this.getExpandedRangeInDirection(direction, { length })\n if (direction === \"backward\") {\n attachment = this.getAttachmentAtRange(range)\n }\n }\n\n if (attachment) {\n this.editAttachment(attachment)\n return false\n } else {\n this.setDocument(this.document.removeTextAtRange(range))\n this.setSelection(range[0])\n if (deletingIntoPreviousBlock || selectionSpansBlocks) {\n return false\n }\n }\n }\n\n moveTextFromRange(range) {\n const [ position ] = Array.from(this.getSelectedRange())\n this.setDocument(this.document.moveTextFromRangeToPosition(range, position))\n return this.setSelection(position)\n }\n\n removeAttachment(attachment) {\n const range = this.document.getRangeOfAttachment(attachment)\n if (range) {\n this.stopEditingAttachment()\n this.setDocument(this.document.removeTextAtRange(range))\n return this.setSelection(range[0])\n }\n }\n\n removeLastBlockAttribute() {\n const [ startPosition, endPosition ] = Array.from(this.getSelectedRange())\n const block = this.document.getBlockAtPosition(endPosition)\n this.removeCurrentAttribute(block.getLastAttribute())\n return this.setSelection(startPosition)\n }\n\n insertPlaceholder() {\n this.placeholderPosition = this.getPosition()\n return this.insertString(PLACEHOLDER)\n }\n\n selectPlaceholder() {\n if (this.placeholderPosition != null) {\n this.setSelectedRange([ this.placeholderPosition, this.placeholderPosition + PLACEHOLDER.length ])\n return this.getSelectedRange()\n }\n }\n\n forgetPlaceholder() {\n this.placeholderPosition = null\n }\n\n // Current attributes\n\n hasCurrentAttribute(attributeName) {\n const value = this.currentAttributes[attributeName]\n return value != null && value !== false\n }\n\n toggleCurrentAttribute(attributeName) {\n const value = !this.currentAttributes[attributeName]\n if (value) {\n return this.setCurrentAttribute(attributeName, value)\n } else {\n return this.removeCurrentAttribute(attributeName)\n }\n }\n\n canSetCurrentAttribute(attributeName) {\n if (getBlockConfig(attributeName)) {\n return this.canSetCurrentBlockAttribute(attributeName)\n } else {\n return this.canSetCurrentTextAttribute(attributeName)\n }\n }\n\n canSetCurrentTextAttribute(attributeName) {\n const document = this.getSelectedDocument()\n if (!document) return\n for (const attachment of Array.from(document.getAttachments())) {\n if (!attachment.hasContent()) {\n return false\n }\n }\n return true\n }\n\n canSetCurrentBlockAttribute(attributeName) {\n const block = this.getBlock()\n if (!block) return\n return !block.isTerminalBlock()\n }\n\n setCurrentAttribute(attributeName, value) {\n if (getBlockConfig(attributeName)) {\n return this.setBlockAttribute(attributeName, value)\n } else {\n this.setTextAttribute(attributeName, value)\n this.currentAttributes[attributeName] = value\n return this.notifyDelegateOfCurrentAttributesChange()\n }\n }\n\n setHTMLAtributeAtPosition(position, attributeName, value) {\n const block = this.document.getBlockAtPosition(position)\n const allowedHTMLAttributes = getBlockConfig(block.getLastAttribute())?.htmlAttributes\n\n if (block && allowedHTMLAttributes?.includes(attributeName)) {\n const newDocument = this.document.setHTMLAttributeAtPosition(position, attributeName, value)\n this.setDocument(newDocument)\n }\n }\n\n setTextAttribute(attributeName, value) {\n const selectedRange = this.getSelectedRange()\n if (!selectedRange) return\n\n const [ startPosition, endPosition ] = Array.from(selectedRange)\n if (startPosition === endPosition) {\n if (attributeName === \"href\") {\n const text = Text.textForStringWithAttributes(value, { href: value })\n return this.insertText(text)\n }\n } else {\n return this.setDocument(this.document.addAttributeAtRange(attributeName, value, selectedRange))\n }\n }\n\n setBlockAttribute(attributeName, value) {\n const selectedRange = this.getSelectedRange()\n if (this.canSetCurrentAttribute(attributeName)) {\n this.setDocument(this.document.applyBlockAttributeAtRange(attributeName, value, selectedRange))\n return this.setSelection(selectedRange)\n }\n }\n\n removeCurrentAttribute(attributeName) {\n if (getBlockConfig(attributeName)) {\n this.removeBlockAttribute(attributeName)\n return this.updateCurrentAttributes()\n } else {\n this.removeTextAttribute(attributeName)\n delete this.currentAttributes[attributeName]\n return this.notifyDelegateOfCurrentAttributesChange()\n }\n }\n\n removeTextAttribute(attributeName) {\n const selectedRange = this.getSelectedRange()\n if (!selectedRange) return\n return this.setDocument(this.document.removeAttributeAtRange(attributeName, selectedRange))\n }\n\n removeBlockAttribute(attributeName) {\n const selectedRange = this.getSelectedRange()\n if (!selectedRange) return\n return this.setDocument(this.document.removeAttributeAtRange(attributeName, selectedRange))\n }\n\n canDecreaseNestingLevel() {\n return this.getBlock()?.getNestingLevel() > 0\n }\n\n canIncreaseNestingLevel() {\n const block = this.getBlock()\n if (!block) return\n if (getBlockConfig(block.getLastNestableAttribute())?.listAttribute) {\n const previousBlock = this.getPreviousBlock()\n if (previousBlock) {\n return arrayStartsWith(previousBlock.getListItemAttributes(), block.getListItemAttributes())\n }\n } else {\n return block.getNestingLevel() > 0\n }\n }\n\n decreaseNestingLevel() {\n const block = this.getBlock()\n if (!block) return\n return this.setDocument(this.document.replaceBlock(block, block.decreaseNestingLevel()))\n }\n\n increaseNestingLevel() {\n const block = this.getBlock()\n if (!block) return\n return this.setDocument(this.document.replaceBlock(block, block.increaseNestingLevel()))\n }\n\n canDecreaseBlockAttributeLevel() {\n return this.getBlock()?.getAttributeLevel() > 0\n }\n\n decreaseBlockAttributeLevel() {\n const attribute = this.getBlock()?.getLastAttribute()\n if (attribute) {\n return this.removeCurrentAttribute(attribute)\n }\n }\n\n decreaseListLevel() {\n let [ startPosition ] = Array.from(this.getSelectedRange())\n const { index } = this.document.locationFromPosition(startPosition)\n let endIndex = index\n const attributeLevel = this.getBlock().getAttributeLevel()\n\n let block = this.document.getBlockAtIndex(endIndex + 1)\n while (block) {\n if (!block.isListItem() || block.getAttributeLevel() <= attributeLevel) {\n break\n }\n endIndex++\n block = this.document.getBlockAtIndex(endIndex + 1)\n }\n\n startPosition = this.document.positionFromLocation({ index, offset: 0 })\n const endPosition = this.document.positionFromLocation({ index: endIndex, offset: 0 })\n return this.setDocument(this.document.removeLastListAttributeAtRange([ startPosition, endPosition ]))\n }\n\n updateCurrentAttributes() {\n const selectedRange = this.getSelectedRange({ ignoreLock: true })\n if (selectedRange) {\n const currentAttributes = this.document.getCommonAttributesAtRange(selectedRange)\n\n Array.from(getAllAttributeNames()).forEach((attributeName) => {\n if (!currentAttributes[attributeName]) {\n if (!this.canSetCurrentAttribute(attributeName)) {\n currentAttributes[attributeName] = false\n }\n }\n })\n\n if (!objectsAreEqual(currentAttributes, this.currentAttributes)) {\n this.currentAttributes = currentAttributes\n return this.notifyDelegateOfCurrentAttributesChange()\n }\n }\n }\n\n getCurrentAttributes() {\n return extend.call({}, this.currentAttributes)\n }\n\n getCurrentTextAttributes() {\n const attributes = {}\n for (const key in this.currentAttributes) {\n const value = this.currentAttributes[key]\n if (value !== false) {\n if (getTextConfig(key)) {\n attributes[key] = value\n }\n }\n }\n return attributes\n }\n\n // Selection freezing\n\n freezeSelection() {\n return this.setCurrentAttribute(\"frozen\", true)\n }\n\n thawSelection() {\n return this.removeCurrentAttribute(\"frozen\")\n }\n\n hasFrozenSelection() {\n return this.hasCurrentAttribute(\"frozen\")\n }\n\n setSelection(selectedRange) {\n const locationRange = this.document.locationRangeFromRange(selectedRange)\n return this.delegate?.compositionDidRequestChangingSelectionToLocationRange(locationRange)\n }\n\n getSelectedRange() {\n const locationRange = this.getLocationRange()\n if (locationRange) {\n return this.document.rangeFromLocationRange(locationRange)\n }\n }\n\n setSelectedRange(selectedRange) {\n const locationRange = this.document.locationRangeFromRange(selectedRange)\n return this.getSelectionManager().setLocationRange(locationRange)\n }\n\n getPosition() {\n const locationRange = this.getLocationRange()\n if (locationRange) {\n return this.document.positionFromLocation(locationRange[0])\n }\n }\n\n getLocationRange(options) {\n if (this.targetLocationRange) {\n return this.targetLocationRange\n } else {\n return this.getSelectionManager().getLocationRange(options) || normalizeRange({ index: 0, offset: 0 })\n }\n }\n\n withTargetLocationRange(locationRange, fn) {\n let result\n this.targetLocationRange = locationRange\n try {\n result = fn()\n } finally {\n this.targetLocationRange = null\n }\n return result\n }\n\n withTargetRange(range, fn) {\n const locationRange = this.document.locationRangeFromRange(range)\n return this.withTargetLocationRange(locationRange, fn)\n }\n\n withTargetDOMRange(domRange, fn) {\n const locationRange = this.createLocationRangeFromDOMRange(domRange, { strict: false })\n return this.withTargetLocationRange(locationRange, fn)\n }\n\n getExpandedRangeInDirection(direction, { length } = {}) {\n let [ startPosition, endPosition ] = Array.from(this.getSelectedRange())\n if (direction === \"backward\") {\n if (length) {\n startPosition -= length\n } else {\n startPosition = this.translateUTF16PositionFromOffset(startPosition, -1)\n }\n } else {\n if (length) {\n endPosition += length\n } else {\n endPosition = this.translateUTF16PositionFromOffset(endPosition, 1)\n }\n }\n return normalizeRange([ startPosition, endPosition ])\n }\n\n shouldManageMovingCursorInDirection(direction) {\n if (this.editingAttachment) {\n return true\n }\n const range = this.getExpandedRangeInDirection(direction)\n return this.getAttachmentAtRange(range) != null\n }\n\n moveCursorInDirection(direction) {\n let canEditAttachment, range\n if (this.editingAttachment) {\n range = this.document.getRangeOfAttachment(this.editingAttachment)\n } else {\n const selectedRange = this.getSelectedRange()\n range = this.getExpandedRangeInDirection(direction)\n canEditAttachment = !rangesAreEqual(selectedRange, range)\n }\n\n if (direction === \"backward\") {\n this.setSelectedRange(range[0])\n } else {\n this.setSelectedRange(range[1])\n }\n\n if (canEditAttachment) {\n const attachment = this.getAttachmentAtRange(range)\n if (attachment) {\n return this.editAttachment(attachment)\n }\n }\n }\n\n expandSelectionInDirection(direction, { length } = {}) {\n const range = this.getExpandedRangeInDirection(direction, { length })\n return this.setSelectedRange(range)\n }\n\n expandSelectionForEditing() {\n if (this.hasCurrentAttribute(\"href\")) {\n return this.expandSelectionAroundCommonAttribute(\"href\")\n }\n }\n\n expandSelectionAroundCommonAttribute(attributeName) {\n const position = this.getPosition()\n const range = this.document.getRangeOfCommonAttributeAtPosition(attributeName, position)\n return this.setSelectedRange(range)\n }\n\n selectionContainsAttachments() {\n return this.getSelectedAttachments()?.length > 0\n }\n\n selectionIsInCursorTarget() {\n return this.editingAttachment || this.positionIsCursorTarget(this.getPosition())\n }\n\n positionIsCursorTarget(position) {\n const location = this.document.locationFromPosition(position)\n if (location) {\n return this.locationIsCursorTarget(location)\n }\n }\n\n positionIsBlockBreak(position) {\n return this.document.getPieceAtPosition(position)?.isBlockBreak()\n }\n\n getSelectedDocument() {\n const selectedRange = this.getSelectedRange()\n if (selectedRange) {\n return this.document.getDocumentAtRange(selectedRange)\n }\n }\n\n getSelectedAttachments() {\n return this.getSelectedDocument()?.getAttachments()\n }\n\n // Attachments\n\n getAttachments() {\n return this.attachments.slice(0)\n }\n\n refreshAttachments() {\n const attachments = this.document.getAttachments()\n const { added, removed } = summarizeArrayChange(this.attachments, attachments)\n this.attachments = attachments\n\n Array.from(removed).forEach((attachment) => {\n attachment.delegate = null\n this.delegate?.compositionDidRemoveAttachment?.(attachment)\n })\n\n return (() => {\n const result = []\n\n Array.from(added).forEach((attachment) => {\n attachment.delegate = this\n result.push(this.delegate?.compositionDidAddAttachment?.(attachment))\n })\n\n return result\n })()\n }\n\n // Attachment delegate\n\n attachmentDidChangeAttributes(attachment) {\n this.revision++\n return this.delegate?.compositionDidEditAttachment?.(attachment)\n }\n\n attachmentDidChangePreviewURL(attachment) {\n this.revision++\n return this.delegate?.compositionDidChangeAttachmentPreviewURL?.(attachment)\n }\n\n // Attachment editing\n\n editAttachment(attachment, options) {\n if (attachment === this.editingAttachment) return\n this.stopEditingAttachment()\n this.editingAttachment = attachment\n return this.delegate?.compositionDidStartEditingAttachment?.(this.editingAttachment, options)\n }\n\n stopEditingAttachment() {\n if (!this.editingAttachment) return\n this.delegate?.compositionDidStopEditingAttachment?.(this.editingAttachment)\n this.editingAttachment = null\n }\n\n updateAttributesForAttachment(attributes, attachment) {\n return this.setDocument(this.document.updateAttributesForAttachment(attributes, attachment))\n }\n\n removeAttributeForAttachment(attribute, attachment) {\n return this.setDocument(this.document.removeAttributeForAttachment(attribute, attachment))\n }\n\n // Private\n\n breakFormattedBlock(insertion) {\n let { document } = insertion\n const { block } = insertion\n let position = insertion.startPosition\n let range = [ position - 1, position ]\n\n if (block.getBlockBreakPosition() === insertion.startLocation.offset) {\n if (block.breaksOnReturn() && insertion.nextCharacter === \"\\n\") {\n position += 1\n } else {\n document = document.removeTextAtRange(range)\n }\n range = [ position, position ]\n } else if (insertion.nextCharacter === \"\\n\") {\n if (insertion.previousCharacter === \"\\n\") {\n range = [ position - 1, position + 1 ]\n } else {\n range = [ position, position + 1 ]\n position += 1\n }\n } else if (insertion.startLocation.offset - 1 !== 0) {\n position += 1\n }\n\n const newDocument = new Document([ block.removeLastAttribute().copyWithoutText() ])\n this.setDocument(document.insertDocumentAtRange(newDocument, range))\n return this.setSelection(position)\n }\n\n getPreviousBlock() {\n const locationRange = this.getLocationRange()\n if (locationRange) {\n const { index } = locationRange[0]\n if (index > 0) {\n return this.document.getBlockAtIndex(index - 1)\n }\n }\n }\n\n getBlock() {\n const locationRange = this.getLocationRange()\n if (locationRange) {\n return this.document.getBlockAtIndex(locationRange[0].index)\n }\n }\n\n getAttachmentAtRange(range) {\n const document = this.document.getDocumentAtRange(range)\n if (document.toString() === `${OBJECT_REPLACEMENT_CHARACTER}\\n`) {\n return document.getAttachments()[0]\n }\n }\n\n notifyDelegateOfCurrentAttributesChange() {\n return this.delegate?.compositionDidChangeCurrentAttributes?.(this.currentAttributes)\n }\n\n notifyDelegateOfInsertionAtRange(range) {\n return this.delegate?.compositionDidPerformInsertionAtRange?.(range)\n }\n\n translateUTF16PositionFromOffset(position, offset) {\n const utf16string = this.document.toUTF16String()\n const utf16position = utf16string.offsetFromUCS2Offset(position)\n return utf16string.offsetToUCS2Offset(utf16position + offset)\n }\n}\n\nComposition.proxyMethod(\"getSelectionManager().getPointRange\")\nComposition.proxyMethod(\"getSelectionManager().setLocationRangeFromPointRange\")\nComposition.proxyMethod(\"getSelectionManager().createLocationRangeFromDOMRange\")\nComposition.proxyMethod(\"getSelectionManager().locationIsCursorTarget\")\nComposition.proxyMethod(\"getSelectionManager().selectionIsExpanded\")\nComposition.proxyMethod(\"delegate?.getSelectionManager\")\n","import BasicObject from \"trix/core/basic_object\"\n\nexport default class UndoManager extends BasicObject {\n constructor(composition) {\n super(...arguments)\n this.composition = composition\n this.undoEntries = []\n this.redoEntries = []\n }\n\n recordUndoEntry(description, { context, consolidatable } = {}) {\n const previousEntry = this.undoEntries.slice(-1)[0]\n\n if (!consolidatable || !entryHasDescriptionAndContext(previousEntry, description, context)) {\n const undoEntry = this.createEntry({ description, context })\n this.undoEntries.push(undoEntry)\n this.redoEntries = []\n }\n }\n\n undo() {\n const undoEntry = this.undoEntries.pop()\n if (undoEntry) {\n const redoEntry = this.createEntry(undoEntry)\n this.redoEntries.push(redoEntry)\n return this.composition.loadSnapshot(undoEntry.snapshot)\n }\n }\n\n redo() {\n const redoEntry = this.redoEntries.pop()\n if (redoEntry) {\n const undoEntry = this.createEntry(redoEntry)\n this.undoEntries.push(undoEntry)\n return this.composition.loadSnapshot(redoEntry.snapshot)\n }\n }\n\n canUndo() {\n return this.undoEntries.length > 0\n }\n\n canRedo() {\n return this.redoEntries.length > 0\n }\n\n // Private\n\n createEntry({ description, context } = {}) {\n return {\n description: description?.toString(),\n context: JSON.stringify(context),\n snapshot: this.composition.getSnapshot(),\n }\n }\n}\n\nconst entryHasDescriptionAndContext = (entry, description, context) =>\n entry?.description === description?.toString() && entry?.context === JSON.stringify(context)\n","const BLOCK_ATTRIBUTE_NAME = \"attachmentGallery\"\nconst TEXT_ATTRIBUTE_NAME = \"presentation\"\nconst TEXT_ATTRIBUTE_VALUE = \"gallery\"\n\nexport default class Filter {\n constructor(snapshot) {\n this.document = snapshot.document\n this.selectedRange = snapshot.selectedRange\n }\n\n perform() {\n this.removeBlockAttribute()\n return this.applyBlockAttribute()\n }\n\n getSnapshot() {\n return { document: this.document, selectedRange: this.selectedRange }\n }\n\n // Private\n\n removeBlockAttribute() {\n return this.findRangesOfBlocks().map((range) => this.document = this.document.removeAttributeAtRange(BLOCK_ATTRIBUTE_NAME, range))\n }\n\n applyBlockAttribute() {\n let offset = 0\n\n this.findRangesOfPieces().forEach((range) => {\n if (range[1] - range[0] > 1) {\n range[0] += offset\n range[1] += offset\n\n if (this.document.getCharacterAtPosition(range[1]) !== \"\\n\") {\n this.document = this.document.insertBlockBreakAtRange(range[1])\n if (range[1] < this.selectedRange[1]) {\n this.moveSelectedRangeForward()\n }\n range[1]++\n offset++\n }\n\n if (range[0] !== 0) {\n if (this.document.getCharacterAtPosition(range[0] - 1) !== \"\\n\") {\n this.document = this.document.insertBlockBreakAtRange(range[0])\n if (range[0] < this.selectedRange[0]) {\n this.moveSelectedRangeForward()\n }\n range[0]++\n offset++\n }\n }\n\n this.document = this.document.applyBlockAttributeAtRange(BLOCK_ATTRIBUTE_NAME, true, range)\n }\n })\n }\n\n findRangesOfBlocks() {\n return this.document.findRangesForBlockAttribute(BLOCK_ATTRIBUTE_NAME)\n }\n\n findRangesOfPieces() {\n return this.document.findRangesForTextAttribute(TEXT_ATTRIBUTE_NAME, { withValue: TEXT_ATTRIBUTE_VALUE })\n }\n\n moveSelectedRangeForward() {\n this.selectedRange[0] += 1\n this.selectedRange[1] += 1\n }\n}\n","import Filter from \"./filter\"\n\nexport const attachmentGalleryFilter = function(snapshot) {\n const filter = new Filter(snapshot)\n filter.perform()\n return filter.getSnapshot()\n}\n\n","import Document from \"trix/models/document\"\nimport HTMLParser from \"trix/models/html_parser\"\n\nimport UndoManager from \"trix/models/undo_manager\"\nimport { attachmentGalleryFilter } from \"trix/filters/attachment_gallery_filter\"\nconst DEFAULT_FILTERS = [ attachmentGalleryFilter ]\n\nexport default class Editor {\n constructor(composition, selectionManager, element) {\n this.insertFiles = this.insertFiles.bind(this)\n this.composition = composition\n this.selectionManager = selectionManager\n this.element = element\n this.undoManager = new UndoManager(this.composition)\n this.filters = DEFAULT_FILTERS.slice(0)\n }\n\n loadDocument(document) {\n return this.loadSnapshot({ document, selectedRange: [ 0, 0 ] })\n }\n\n loadHTML(html = \"\") {\n const document = HTMLParser.parse(html, { referenceElement: this.element }).getDocument()\n return this.loadDocument(document)\n }\n\n loadJSON({ document, selectedRange }) {\n document = Document.fromJSON(document)\n return this.loadSnapshot({ document, selectedRange })\n }\n\n loadSnapshot(snapshot) {\n this.undoManager = new UndoManager(this.composition)\n return this.composition.loadSnapshot(snapshot)\n }\n\n getDocument() {\n return this.composition.document\n }\n\n getSelectedDocument() {\n return this.composition.getSelectedDocument()\n }\n\n getSnapshot() {\n return this.composition.getSnapshot()\n }\n\n toJSON() {\n return this.getSnapshot()\n }\n\n // Document manipulation\n\n deleteInDirection(direction) {\n return this.composition.deleteInDirection(direction)\n }\n\n insertAttachment(attachment) {\n return this.composition.insertAttachment(attachment)\n }\n\n insertAttachments(attachments) {\n return this.composition.insertAttachments(attachments)\n }\n\n insertDocument(document) {\n return this.composition.insertDocument(document)\n }\n\n insertFile(file) {\n return this.composition.insertFile(file)\n }\n\n insertFiles(files) {\n return this.composition.insertFiles(files)\n }\n\n insertHTML(html) {\n return this.composition.insertHTML(html)\n }\n\n insertString(string) {\n return this.composition.insertString(string)\n }\n\n insertText(text) {\n return this.composition.insertText(text)\n }\n\n insertLineBreak() {\n return this.composition.insertLineBreak()\n }\n\n // Selection\n\n getSelectedRange() {\n return this.composition.getSelectedRange()\n }\n\n getPosition() {\n return this.composition.getPosition()\n }\n\n getClientRectAtPosition(position) {\n const locationRange = this.getDocument().locationRangeFromRange([ position, position + 1 ])\n return this.selectionManager.getClientRectAtLocationRange(locationRange)\n }\n\n expandSelectionInDirection(direction) {\n return this.composition.expandSelectionInDirection(direction)\n }\n\n moveCursorInDirection(direction) {\n return this.composition.moveCursorInDirection(direction)\n }\n\n setSelectedRange(selectedRange) {\n return this.composition.setSelectedRange(selectedRange)\n }\n\n // Attributes\n\n activateAttribute(name, value = true) {\n return this.composition.setCurrentAttribute(name, value)\n }\n\n attributeIsActive(name) {\n return this.composition.hasCurrentAttribute(name)\n }\n\n canActivateAttribute(name) {\n return this.composition.canSetCurrentAttribute(name)\n }\n\n deactivateAttribute(name) {\n return this.composition.removeCurrentAttribute(name)\n }\n\n // HTML attributes\n setHTMLAtributeAtPosition(position, name, value) {\n this.composition.setHTMLAtributeAtPosition(position, name, value)\n }\n\n // Nesting level\n\n canDecreaseNestingLevel() {\n return this.composition.canDecreaseNestingLevel()\n }\n\n canIncreaseNestingLevel() {\n return this.composition.canIncreaseNestingLevel()\n }\n\n decreaseNestingLevel() {\n if (this.canDecreaseNestingLevel()) {\n return this.composition.decreaseNestingLevel()\n }\n }\n\n increaseNestingLevel() {\n if (this.canIncreaseNestingLevel()) {\n return this.composition.increaseNestingLevel()\n }\n }\n\n // Undo/redo\n\n canRedo() {\n return this.undoManager.canRedo()\n }\n\n canUndo() {\n return this.undoManager.canUndo()\n }\n\n recordUndoEntry(description, { context, consolidatable } = {}) {\n return this.undoManager.recordUndoEntry(description, { context, consolidatable })\n }\n\n redo() {\n if (this.canRedo()) {\n return this.undoManager.redo()\n }\n }\n\n undo() {\n if (this.canUndo()) {\n return this.undoManager.undo()\n }\n }\n}\n","/* eslint-disable\n no-var,\n prefer-const,\n*/\nimport {\n elementContainsNode,\n findChildIndexOfNode,\n nodeIsAttachmentElement,\n nodeIsBlockContainer,\n nodeIsBlockStart,\n nodeIsBlockStartComment,\n nodeIsCursorTarget,\n nodeIsEmptyTextNode,\n nodeIsTextNode,\n tagName,\n walkTree,\n} from \"trix/core/helpers\"\n\nexport default class LocationMapper {\n constructor(element) {\n this.element = element\n }\n\n findLocationFromContainerAndOffset(container, offset, { strict } = { strict: true }) {\n let childIndex = 0\n let foundBlock = false\n const location = { index: 0, offset: 0 }\n const attachmentElement = this.findAttachmentElementParentForNode(container)\n\n if (attachmentElement) {\n container = attachmentElement.parentNode\n offset = findChildIndexOfNode(attachmentElement)\n }\n\n const walker = walkTree(this.element, { usingFilter: rejectAttachmentContents })\n\n while (walker.nextNode()) {\n const node = walker.currentNode\n\n if (node === container && nodeIsTextNode(container)) {\n if (!nodeIsCursorTarget(node)) {\n location.offset += offset\n }\n break\n } else {\n if (node.parentNode === container) {\n if (childIndex++ === offset) {\n break\n }\n } else if (!elementContainsNode(container, node)) {\n if (childIndex > 0) {\n break\n }\n }\n\n if (nodeIsBlockStart(node, { strict })) {\n if (foundBlock) {\n location.index++\n }\n location.offset = 0\n foundBlock = true\n } else {\n location.offset += nodeLength(node)\n }\n }\n }\n\n return location\n }\n\n findContainerAndOffsetFromLocation(location) {\n let container, offset\n if (location.index === 0 && location.offset === 0) {\n container = this.element\n offset = 0\n\n while (container.firstChild) {\n container = container.firstChild\n if (nodeIsBlockContainer(container)) {\n offset = 1\n break\n }\n }\n\n return [ container, offset ]\n }\n\n let [ node, nodeOffset ] = this.findNodeAndOffsetFromLocation(location)\n if (!node) return\n\n if (nodeIsTextNode(node)) {\n if (nodeLength(node) === 0) {\n container = node.parentNode.parentNode\n offset = findChildIndexOfNode(node.parentNode)\n if (nodeIsCursorTarget(node, { name: \"right\" })) {\n offset++\n }\n } else {\n container = node\n offset = location.offset - nodeOffset\n }\n } else {\n container = node.parentNode\n\n if (!nodeIsBlockStart(node.previousSibling)) {\n if (!nodeIsBlockContainer(container)) {\n while (node === container.lastChild) {\n node = container\n container = container.parentNode\n if (nodeIsBlockContainer(container)) {\n break\n }\n }\n }\n }\n\n offset = findChildIndexOfNode(node)\n if (location.offset !== 0) {\n offset++\n }\n }\n\n return [ container, offset ]\n }\n\n findNodeAndOffsetFromLocation(location) {\n let node, nodeOffset\n let offset = 0\n\n for (const currentNode of this.getSignificantNodesForIndex(location.index)) {\n const length = nodeLength(currentNode)\n\n if (location.offset <= offset + length) {\n if (nodeIsTextNode(currentNode)) {\n node = currentNode\n nodeOffset = offset\n if (location.offset === nodeOffset && nodeIsCursorTarget(node)) {\n break\n }\n } else if (!node) {\n node = currentNode\n nodeOffset = offset\n }\n }\n\n offset += length\n if (offset > location.offset) {\n break\n }\n }\n\n return [ node, nodeOffset ]\n }\n\n // Private\n\n findAttachmentElementParentForNode(node) {\n while (node && node !== this.element) {\n if (nodeIsAttachmentElement(node)) {\n return node\n }\n node = node.parentNode\n }\n }\n\n getSignificantNodesForIndex(index) {\n const nodes = []\n const walker = walkTree(this.element, { usingFilter: acceptSignificantNodes })\n let recordingNodes = false\n\n while (walker.nextNode()) {\n const node = walker.currentNode\n if (nodeIsBlockStartComment(node)) {\n var blockIndex\n if (blockIndex != null) {\n blockIndex++\n } else {\n blockIndex = 0\n }\n\n if (blockIndex === index) {\n recordingNodes = true\n } else if (recordingNodes) {\n break\n }\n } else if (recordingNodes) {\n nodes.push(node)\n }\n }\n\n return nodes\n }\n}\n\nconst nodeLength = function(node) {\n if (node.nodeType === Node.TEXT_NODE) {\n if (nodeIsCursorTarget(node)) {\n return 0\n } else {\n const string = node.textContent\n return string.length\n }\n } else if (tagName(node) === \"br\" || nodeIsAttachmentElement(node)) {\n return 1\n } else {\n return 0\n }\n}\n\nconst acceptSignificantNodes = function(node) {\n if (rejectEmptyTextNodes(node) === NodeFilter.FILTER_ACCEPT) {\n return rejectAttachmentContents(node)\n } else {\n return NodeFilter.FILTER_REJECT\n }\n}\n\nconst rejectEmptyTextNodes = function(node) {\n if (nodeIsEmptyTextNode(node)) {\n return NodeFilter.FILTER_REJECT\n } else {\n return NodeFilter.FILTER_ACCEPT\n }\n}\n\nconst rejectAttachmentContents = function(node) {\n if (nodeIsAttachmentElement(node.parentNode)) {\n return NodeFilter.FILTER_REJECT\n } else {\n return NodeFilter.FILTER_ACCEPT\n }\n}\n","/* eslint-disable\n id-length,\n no-empty,\n*/\nimport { getDOMRange, setDOMRange } from \"trix/core/helpers\"\n\nexport default class PointMapper {\n createDOMRangeFromPoint({ x, y }) {\n let domRange\n if (document.caretPositionFromPoint) {\n const { offsetNode, offset } = document.caretPositionFromPoint(x, y)\n domRange = document.createRange()\n domRange.setStart(offsetNode, offset)\n return domRange\n } else if (document.caretRangeFromPoint) {\n return document.caretRangeFromPoint(x, y)\n } else if (document.body.createTextRange) {\n const originalDOMRange = getDOMRange()\n try {\n // IE 11 throws \"Unspecified error\" when using moveToPoint\n // during a drag-and-drop operation.\n const textRange = document.body.createTextRange()\n textRange.moveToPoint(x, y)\n textRange.select()\n } catch (error) {}\n domRange = getDOMRange()\n setDOMRange(originalDOMRange)\n return domRange\n }\n }\n\n getClientRectsForDOMRange(domRange) {\n const array = Array.from(domRange.getClientRects())\n const start = array[0]\n const end = array[array.length - 1]\n\n return [ start, end ]\n }\n}\n","/* eslint-disable\n*/\nimport BasicObject from \"trix/core/basic_object\"\n\nimport LocationMapper from \"trix/models/location_mapper\"\nimport PointMapper from \"trix/models/point_mapper\"\n\nimport {\n elementContainsNode,\n getDOMRange,\n getDOMSelection,\n handleEvent,\n innerElementIsActive,\n nodeIsCursorTarget,\n normalizeRange,\n rangeIsCollapsed,\n rangesAreEqual,\n setDOMRange,\n} from \"trix/core/helpers\"\n\nexport default class SelectionManager extends BasicObject {\n constructor(element) {\n super(...arguments)\n this.didMouseDown = this.didMouseDown.bind(this)\n this.selectionDidChange = this.selectionDidChange.bind(this)\n this.element = element\n this.locationMapper = new LocationMapper(this.element)\n this.pointMapper = new PointMapper()\n this.lockCount = 0\n handleEvent(\"mousedown\", { onElement: this.element, withCallback: this.didMouseDown })\n }\n\n getLocationRange(options = {}) {\n if (options.strict === false) {\n return this.createLocationRangeFromDOMRange(getDOMRange())\n } else if (options.ignoreLock) {\n return this.currentLocationRange\n } else if (this.lockedLocationRange) {\n return this.lockedLocationRange\n } else {\n return this.currentLocationRange\n }\n }\n\n setLocationRange(locationRange) {\n if (this.lockedLocationRange) return\n locationRange = normalizeRange(locationRange)\n\n const domRange = this.createDOMRangeFromLocationRange(locationRange)\n if (domRange) {\n setDOMRange(domRange)\n this.updateCurrentLocationRange(locationRange)\n }\n }\n\n setLocationRangeFromPointRange(pointRange) {\n pointRange = normalizeRange(pointRange)\n const startLocation = this.getLocationAtPoint(pointRange[0])\n const endLocation = this.getLocationAtPoint(pointRange[1])\n this.setLocationRange([ startLocation, endLocation ])\n }\n\n getClientRectAtLocationRange(locationRange) {\n const domRange = this.createDOMRangeFromLocationRange(locationRange)\n if (domRange) {\n return this.getClientRectsForDOMRange(domRange)[1]\n }\n }\n\n locationIsCursorTarget(location) {\n const node = Array.from(this.findNodeAndOffsetFromLocation(location))[0]\n return nodeIsCursorTarget(node)\n }\n\n lock() {\n if (this.lockCount++ === 0) {\n this.updateCurrentLocationRange()\n this.lockedLocationRange = this.getLocationRange()\n }\n }\n\n unlock() {\n if (--this.lockCount === 0) {\n const { lockedLocationRange } = this\n this.lockedLocationRange = null\n if (lockedLocationRange != null) {\n return this.setLocationRange(lockedLocationRange)\n }\n }\n }\n\n clearSelection() {\n return getDOMSelection()?.removeAllRanges()\n }\n\n selectionIsCollapsed() {\n return getDOMRange()?.collapsed === true\n }\n\n selectionIsExpanded() {\n return !this.selectionIsCollapsed()\n }\n\n createLocationRangeFromDOMRange(domRange, options) {\n if (domRange == null || !this.domRangeWithinElement(domRange)) return\n\n const start = this.findLocationFromContainerAndOffset(domRange.startContainer, domRange.startOffset, options)\n if (!start) return\n\n const end = domRange.collapsed\n ? undefined\n : this.findLocationFromContainerAndOffset(domRange.endContainer, domRange.endOffset, options)\n\n return normalizeRange([ start, end ])\n }\n\n didMouseDown() {\n return this.pauseTemporarily()\n }\n\n pauseTemporarily() {\n let resumeHandlers\n this.paused = true\n\n const resume = () => {\n this.paused = false\n clearTimeout(resumeTimeout)\n\n Array.from(resumeHandlers).forEach((handler) => {\n handler.destroy()\n })\n\n if (elementContainsNode(document, this.element)) {\n return this.selectionDidChange()\n }\n }\n\n const resumeTimeout = setTimeout(resume, 200)\n\n resumeHandlers = [ \"mousemove\", \"keydown\" ].map((eventName) =>\n handleEvent(eventName, { onElement: document, withCallback: resume })\n )\n }\n\n selectionDidChange() {\n if (!this.paused && !innerElementIsActive(this.element)) {\n return this.updateCurrentLocationRange()\n }\n }\n\n updateCurrentLocationRange(locationRange) {\n if (locationRange != null ? locationRange : locationRange = this.createLocationRangeFromDOMRange(getDOMRange())) {\n if (!rangesAreEqual(locationRange, this.currentLocationRange)) {\n this.currentLocationRange = locationRange\n return this.delegate?.locationRangeDidChange?.(this.currentLocationRange.slice(0))\n }\n }\n }\n\n createDOMRangeFromLocationRange(locationRange) {\n const rangeStart = this.findContainerAndOffsetFromLocation(locationRange[0])\n const rangeEnd = rangeIsCollapsed(locationRange)\n ? rangeStart\n : this.findContainerAndOffsetFromLocation(locationRange[1]) || rangeStart\n\n if (rangeStart != null && rangeEnd != null) {\n const domRange = document.createRange()\n domRange.setStart(...Array.from(rangeStart || []))\n domRange.setEnd(...Array.from(rangeEnd || []))\n return domRange\n }\n }\n\n getLocationAtPoint(point) {\n const domRange = this.createDOMRangeFromPoint(point)\n if (domRange) {\n return this.createLocationRangeFromDOMRange(domRange)?.[0]\n }\n }\n\n domRangeWithinElement(domRange) {\n if (domRange.collapsed) {\n return elementContainsNode(this.element, domRange.startContainer)\n } else {\n return (\n elementContainsNode(this.element, domRange.startContainer) &&\n elementContainsNode(this.element, domRange.endContainer)\n )\n }\n }\n}\n\nSelectionManager.proxyMethod(\"locationMapper.findLocationFromContainerAndOffset\")\nSelectionManager.proxyMethod(\"locationMapper.findContainerAndOffsetFromLocation\")\nSelectionManager.proxyMethod(\"locationMapper.findNodeAndOffsetFromLocation\")\nSelectionManager.proxyMethod(\"pointMapper.createDOMRangeFromPoint\")\nSelectionManager.proxyMethod(\"pointMapper.getClientRectsForDOMRange\")\n\n","import { removeNode } from \"trix/core/helpers\"\n\nimport * as config from \"trix/config\"\nimport BasicObject from \"trix/core/basic_object\"\n\nimport { defer, handleEvent, makeElement, tagName, triggerEvent } from \"trix/core/helpers\"\nconst { lang, css, keyNames } = config\n\nconst undoable = function(fn) {\n return function() {\n const commands = fn.apply(this, arguments)\n commands.do()\n if (!this.undos) {\n this.undos = []\n }\n this.undos.push(commands.undo)\n }\n}\n\nexport default class AttachmentEditorController extends BasicObject {\n constructor(attachmentPiece, element, container, options = {}) {\n super(...arguments)\n this.didClickToolbar = this.didClickToolbar.bind(this)\n this.didClickActionButton = this.didClickActionButton.bind(this)\n this.didKeyDownCaption = this.didKeyDownCaption.bind(this)\n this.didInputCaption = this.didInputCaption.bind(this)\n this.didChangeCaption = this.didChangeCaption.bind(this)\n this.didBlurCaption = this.didBlurCaption.bind(this)\n this.attachmentPiece = attachmentPiece\n this.element = element\n this.container = container\n this.options = options\n this.attachment = this.attachmentPiece.attachment\n if (tagName(this.element) === \"a\") {\n this.element = this.element.firstChild\n }\n this.install()\n }\n\n install() {\n this.makeElementMutable()\n this.addToolbar()\n if (this.attachment.isPreviewable()) {\n this.installCaptionEditor()\n }\n }\n\n uninstall() {\n let undo = this.undos.pop()\n this.savePendingCaption()\n while (undo) {\n undo()\n undo = this.undos.pop()\n }\n this.delegate?.didUninstallAttachmentEditor(this)\n }\n\n // Private\n\n savePendingCaption() {\n if (this.pendingCaption != null) {\n const caption = this.pendingCaption\n this.pendingCaption = null\n if (caption) {\n this.delegate?.attachmentEditorDidRequestUpdatingAttributesForAttachment?.({ caption }, this.attachment)\n } else {\n this.delegate?.attachmentEditorDidRequestRemovingAttributeForAttachment?.(\"caption\", this.attachment)\n }\n }\n }\n\n // Installing and uninstalling\n\n makeElementMutable = undoable(() => {\n return {\n do: () => {\n this.element.dataset.trixMutable = true\n },\n undo: () => delete this.element.dataset.trixMutable,\n }\n })\n\n addToolbar = undoable(() => {\n //
\n //
\n // \n // \n // \n //
\n //
\n const element = makeElement({\n tagName: \"div\",\n className: css.attachmentToolbar,\n data: { trixMutable: true },\n childNodes: makeElement({\n tagName: \"div\",\n className: \"trix-button-row\",\n childNodes: makeElement({\n tagName: \"span\",\n className: \"trix-button-group trix-button-group--actions\",\n childNodes: makeElement({\n tagName: \"button\",\n className: \"trix-button trix-button--remove\",\n textContent: lang.remove,\n attributes: { title: lang.remove },\n data: { trixAction: \"remove\" },\n }),\n }),\n }),\n })\n\n if (this.attachment.isPreviewable()) {\n //
\n // \n // #{name}\n // #{size}\n // \n //
\n element.appendChild(\n makeElement({\n tagName: \"div\",\n className: css.attachmentMetadataContainer,\n childNodes: makeElement({\n tagName: \"span\",\n className: css.attachmentMetadata,\n childNodes: [\n makeElement({\n tagName: \"span\",\n className: css.attachmentName,\n textContent: this.attachment.getFilename(),\n attributes: { title: this.attachment.getFilename() },\n }),\n makeElement({\n tagName: \"span\",\n className: css.attachmentSize,\n textContent: this.attachment.getFormattedFilesize(),\n }),\n ],\n }),\n })\n )\n }\n\n handleEvent(\"click\", { onElement: element, withCallback: this.didClickToolbar })\n handleEvent(\"click\", {\n onElement: element,\n matchingSelector: \"[data-trix-action]\",\n withCallback: this.didClickActionButton,\n })\n\n triggerEvent(\"trix-attachment-before-toolbar\", { onElement: this.element, attributes: { toolbar: element, attachment: this.attachment } })\n\n return {\n do: () => this.element.appendChild(element),\n undo: () => removeNode(element),\n }\n })\n\n installCaptionEditor = undoable(() => {\n const textarea = makeElement({\n tagName: \"textarea\",\n className: css.attachmentCaptionEditor,\n attributes: { placeholder: lang.captionPlaceholder },\n data: { trixMutable: true },\n })\n textarea.value = this.attachmentPiece.getCaption()\n\n const textareaClone = textarea.cloneNode()\n textareaClone.classList.add(\"trix-autoresize-clone\")\n textareaClone.tabIndex = -1\n\n const autoresize = function() {\n textareaClone.value = textarea.value\n textarea.style.height = textareaClone.scrollHeight + \"px\"\n }\n\n handleEvent(\"input\", { onElement: textarea, withCallback: autoresize })\n handleEvent(\"input\", { onElement: textarea, withCallback: this.didInputCaption })\n handleEvent(\"keydown\", { onElement: textarea, withCallback: this.didKeyDownCaption })\n handleEvent(\"change\", { onElement: textarea, withCallback: this.didChangeCaption })\n handleEvent(\"blur\", { onElement: textarea, withCallback: this.didBlurCaption })\n\n const figcaption = this.element.querySelector(\"figcaption\")\n const editingFigcaption = figcaption.cloneNode()\n\n return {\n do: () => {\n figcaption.style.display = \"none\"\n editingFigcaption.appendChild(textarea)\n editingFigcaption.appendChild(textareaClone)\n editingFigcaption.classList.add(`${css.attachmentCaption}--editing`)\n figcaption.parentElement.insertBefore(editingFigcaption, figcaption)\n autoresize()\n if (this.options.editCaption) {\n return defer(() => textarea.focus())\n }\n },\n undo() {\n removeNode(editingFigcaption)\n figcaption.style.display = null\n },\n }\n })\n\n // Event handlers\n\n didClickToolbar(event) {\n event.preventDefault()\n return event.stopPropagation()\n }\n\n didClickActionButton(event) {\n const action = event.target.getAttribute(\"data-trix-action\")\n switch (action) {\n case \"remove\":\n return this.delegate?.attachmentEditorDidRequestRemovalOfAttachment(this.attachment)\n }\n }\n\n didKeyDownCaption(event) {\n if (keyNames[event.keyCode] === \"return\") {\n event.preventDefault()\n this.savePendingCaption()\n return this.delegate?.attachmentEditorDidRequestDeselectingAttachment?.(this.attachment)\n }\n }\n\n didInputCaption(event) {\n this.pendingCaption = event.target.value.replace(/\\s/g, \" \").trim()\n }\n\n didChangeCaption(event) {\n return this.savePendingCaption()\n }\n\n didBlurCaption(event) {\n return this.savePendingCaption()\n }\n}\n","import BasicObject from \"trix/core/basic_object\"\nimport DocumentView from \"trix/views/document_view\"\nimport AttachmentEditorController from \"trix/controllers/attachment_editor_controller\"\n\nimport { defer, findClosestElementFromNode, handleEvent, innerElementIsActive } from \"trix/core/helpers\"\nimport { attachmentSelector } from \"trix/config/attachments\"\n\nexport default class CompositionController extends BasicObject {\n constructor(element, composition) {\n super(...arguments)\n this.didFocus = this.didFocus.bind(this)\n this.didBlur = this.didBlur.bind(this)\n this.didClickAttachment = this.didClickAttachment.bind(this)\n\n this.element = element\n this.composition = composition\n this.documentView = new DocumentView(this.composition.document, { element: this.element })\n\n handleEvent(\"focus\", { onElement: this.element, withCallback: this.didFocus })\n handleEvent(\"blur\", { onElement: this.element, withCallback: this.didBlur })\n handleEvent(\"click\", {\n onElement: this.element,\n matchingSelector: \"a[contenteditable=false]\",\n preventDefault: true,\n })\n handleEvent(\"mousedown\", {\n onElement: this.element,\n matchingSelector: attachmentSelector,\n withCallback: this.didClickAttachment,\n })\n handleEvent(\"click\", { onElement: this.element, matchingSelector: `a${attachmentSelector}`, preventDefault: true })\n }\n\n didFocus(event) {\n const perform = () => {\n if (!this.focused) {\n this.focused = true\n return this.delegate?.compositionControllerDidFocus?.()\n }\n }\n\n return this.blurPromise?.then(perform) || perform()\n }\n\n didBlur(event) {\n this.blurPromise = new Promise((resolve) => {\n return defer(() => {\n if (!innerElementIsActive(this.element)) {\n this.focused = null\n this.delegate?.compositionControllerDidBlur?.()\n }\n this.blurPromise = null\n return resolve()\n })\n })\n }\n\n didClickAttachment(event, target) {\n const attachment = this.findAttachmentForElement(target)\n const editCaption = !!findClosestElementFromNode(event.target, { matchingSelector: \"figcaption\" })\n return this.delegate?.compositionControllerDidSelectAttachment?.(attachment, { editCaption })\n }\n\n getSerializableElement() {\n if (this.isEditingAttachment()) {\n return this.documentView.shadowElement\n } else {\n return this.element\n }\n }\n\n render() {\n if (this.revision !== this.composition.revision) {\n this.documentView.setDocument(this.composition.document)\n this.documentView.render()\n this.revision = this.composition.revision\n }\n\n if (this.canSyncDocumentView() && !this.documentView.isSynced()) {\n this.delegate?.compositionControllerWillSyncDocumentView?.()\n this.documentView.sync()\n this.delegate?.compositionControllerDidSyncDocumentView?.()\n }\n\n return this.delegate?.compositionControllerDidRender?.()\n }\n\n rerenderViewForObject(object) {\n this.invalidateViewForObject(object)\n return this.render()\n }\n\n invalidateViewForObject(object) {\n return this.documentView.invalidateViewForObject(object)\n }\n\n isViewCachingEnabled() {\n return this.documentView.isViewCachingEnabled()\n }\n\n enableViewCaching() {\n return this.documentView.enableViewCaching()\n }\n\n disableViewCaching() {\n return this.documentView.disableViewCaching()\n }\n\n refreshViewCache() {\n return this.documentView.garbageCollectCachedViews()\n }\n\n // Attachment editor management\n\n isEditingAttachment() {\n return !!this.attachmentEditor\n }\n\n installAttachmentEditorForAttachment(attachment, options) {\n if (this.attachmentEditor?.attachment === attachment) return\n const element = this.documentView.findElementForObject(attachment)\n if (!element) return\n\n this.uninstallAttachmentEditor()\n const attachmentPiece = this.composition.document.getAttachmentPieceForAttachment(attachment)\n this.attachmentEditor = new AttachmentEditorController(attachmentPiece, element, this.element, options)\n this.attachmentEditor.delegate = this\n }\n\n uninstallAttachmentEditor() {\n return this.attachmentEditor?.uninstall()\n }\n\n // Attachment controller delegate\n\n didUninstallAttachmentEditor() {\n this.attachmentEditor = null\n return this.render()\n }\n\n attachmentEditorDidRequestUpdatingAttributesForAttachment(attributes, attachment) {\n this.delegate?.compositionControllerWillUpdateAttachment?.(attachment)\n return this.composition.updateAttributesForAttachment(attributes, attachment)\n }\n\n attachmentEditorDidRequestRemovingAttributeForAttachment(attribute, attachment) {\n this.delegate?.compositionControllerWillUpdateAttachment?.(attachment)\n return this.composition.removeAttributeForAttachment(attribute, attachment)\n }\n\n attachmentEditorDidRequestRemovalOfAttachment(attachment) {\n return this.delegate?.compositionControllerDidRequestRemovalOfAttachment?.(attachment)\n }\n\n attachmentEditorDidRequestDeselectingAttachment(attachment) {\n return this.delegate?.compositionControllerDidRequestDeselectingAttachment?.(attachment)\n }\n\n // Private\n\n canSyncDocumentView() {\n return !this.isEditingAttachment()\n }\n\n findAttachmentForElement(element) {\n return this.composition.document.getAttachmentById(parseInt(element.dataset.trixId, 10))\n }\n}\n","import \"trix/views/object_view\"\nimport BasicObject from \"trix/core/basic_object\"\n\nexport default class Controller extends BasicObject {}\n","import BasicObject from \"trix/core/basic_object\"\n\nimport {\n findClosestElementFromNode,\n nodeIsBlockStartComment,\n nodeIsEmptyTextNode,\n normalizeSpaces,\n summarizeStringChange,\n tagName,\n} from \"trix/core/helpers\"\n\nconst mutableAttributeName = \"data-trix-mutable\"\nconst mutableSelector = `[${mutableAttributeName}]`\n\nconst options = {\n attributes: true,\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n subtree: true,\n}\n\nexport default class MutationObserver extends BasicObject {\n constructor(element) {\n super(element)\n this.didMutate = this.didMutate.bind(this)\n this.element = element\n this.observer = new window.MutationObserver(this.didMutate)\n this.start()\n }\n\n start() {\n this.reset()\n return this.observer.observe(this.element, options)\n }\n\n stop() {\n return this.observer.disconnect()\n }\n\n didMutate(mutations) {\n this.mutations.push(...Array.from(this.findSignificantMutations(mutations) || []))\n\n if (this.mutations.length) {\n this.delegate?.elementDidMutate?.(this.getMutationSummary())\n return this.reset()\n }\n }\n\n // Private\n\n reset() {\n this.mutations = []\n }\n\n findSignificantMutations(mutations) {\n return mutations.filter((mutation) => {\n return this.mutationIsSignificant(mutation)\n })\n }\n\n mutationIsSignificant(mutation) {\n if (this.nodeIsMutable(mutation.target)) {\n return false\n }\n for (const node of Array.from(this.nodesModifiedByMutation(mutation))) {\n if (this.nodeIsSignificant(node)) return true\n }\n return false\n }\n\n nodeIsSignificant(node) {\n return node !== this.element && !this.nodeIsMutable(node) && !nodeIsEmptyTextNode(node)\n }\n\n nodeIsMutable(node) {\n return findClosestElementFromNode(node, { matchingSelector: mutableSelector })\n }\n\n nodesModifiedByMutation(mutation) {\n const nodes = []\n switch (mutation.type) {\n case \"attributes\":\n if (mutation.attributeName !== mutableAttributeName) {\n nodes.push(mutation.target)\n }\n break\n case \"characterData\":\n // Changes to text nodes should consider the parent element\n nodes.push(mutation.target.parentNode)\n nodes.push(mutation.target)\n break\n case \"childList\":\n // Consider each added or removed node\n nodes.push(...Array.from(mutation.addedNodes || []))\n nodes.push(...Array.from(mutation.removedNodes || []))\n break\n }\n return nodes\n }\n\n getMutationSummary() {\n return this.getTextMutationSummary()\n }\n\n getTextMutationSummary() {\n const { additions, deletions } = this.getTextChangesFromCharacterData()\n const textChanges = this.getTextChangesFromChildList()\n\n Array.from(textChanges.additions).forEach((addition) => {\n if (!Array.from(additions).includes(addition)) {\n additions.push(addition)\n }\n })\n\n deletions.push(...Array.from(textChanges.deletions || []))\n\n const summary = {}\n\n const added = additions.join(\"\")\n if (added) {\n summary.textAdded = added\n }\n\n const deleted = deletions.join(\"\")\n if (deleted) {\n summary.textDeleted = deleted\n }\n\n return summary\n }\n\n getMutationsByType(type) {\n return Array.from(this.mutations).filter((mutation) => mutation.type === type)\n }\n\n getTextChangesFromChildList() {\n let textAdded, textRemoved\n const addedNodes = []\n const removedNodes = []\n\n Array.from(this.getMutationsByType(\"childList\")).forEach((mutation) => {\n addedNodes.push(...Array.from(mutation.addedNodes || []))\n removedNodes.push(...Array.from(mutation.removedNodes || []))\n })\n\n const singleBlockCommentRemoved =\n addedNodes.length === 0 && removedNodes.length === 1 && nodeIsBlockStartComment(removedNodes[0])\n\n if (singleBlockCommentRemoved) {\n textAdded = []\n textRemoved = [ \"\\n\" ]\n } else {\n textAdded = getTextForNodes(addedNodes)\n textRemoved = getTextForNodes(removedNodes)\n }\n\n const additions = textAdded.filter((text, index) => text !== textRemoved[index]).map(normalizeSpaces)\n const deletions = textRemoved.filter((text, index) => text !== textAdded[index]).map(normalizeSpaces)\n\n return { additions, deletions }\n }\n\n getTextChangesFromCharacterData() {\n let added, removed\n const characterMutations = this.getMutationsByType(\"characterData\")\n\n if (characterMutations.length) {\n const startMutation = characterMutations[0],\n endMutation = characterMutations[characterMutations.length - 1]\n\n const oldString = normalizeSpaces(startMutation.oldValue)\n const newString = normalizeSpaces(endMutation.target.data)\n const summarized = summarizeStringChange(oldString, newString)\n added = summarized.added\n removed = summarized.removed\n }\n\n return {\n additions: added ? [ added ] : [],\n deletions: removed ? [ removed ] : [],\n }\n }\n}\n\nconst getTextForNodes = function(nodes = []) {\n const text = []\n for (const node of Array.from(nodes)) {\n switch (node.nodeType) {\n case Node.TEXT_NODE:\n text.push(node.data)\n break\n case Node.ELEMENT_NODE:\n if (tagName(node) === \"br\") {\n text.push(\"\\n\")\n } else {\n text.push(...Array.from(getTextForNodes(node.childNodes) || []))\n }\n break\n }\n }\n return text\n}\n","/* eslint-disable\n no-empty,\n*/\nimport Operation from \"trix/core/utilities/operation\"\n\nexport default class FileVerificationOperation extends Operation {\n constructor(file) {\n super(...arguments)\n this.file = file\n }\n\n perform(callback) {\n const reader = new FileReader()\n\n reader.onerror = () => callback(false)\n\n reader.onload = () => {\n reader.onerror = null\n try {\n reader.abort()\n } catch (error) {}\n return callback(true, this.file)\n }\n\n return reader.readAsArrayBuffer(this.file)\n }\n}\n","import * as config from \"trix/config\"\nimport { NON_BREAKING_SPACE, OBJECT_REPLACEMENT_CHARACTER, ZERO_WIDTH_SPACE } from \"trix/constants\"\n\n// Each software keyboard on Android emits its own set of events and some of them can be buggy.\n// This class detects when some buggy events are being emitted and lets know the input controller\n// that they should be ignored.\nexport default class FlakyAndroidKeyboardDetector {\n constructor(element) {\n this.element = element\n }\n\n shouldIgnore(event) {\n if (!config.browser.samsungAndroid) return false\n\n this.previousEvent = this.event\n this.event = event\n\n this.checkSamsungKeyboardBuggyModeStart()\n this.checkSamsungKeyboardBuggyModeEnd()\n\n return this.buggyMode\n }\n\n // private\n\n // The Samsung keyboard on Android can enter a buggy state in which it emits a flurry of confused events that,\n // if processed, corrupts the editor. The buggy mode always starts with an insertText event, right after a\n // keydown event with for an \"Unidentified\" key, with the same text as the editor element, except for a few\n // extra whitespace, or exotic utf8, characters.\n checkSamsungKeyboardBuggyModeStart() {\n if (this.insertingLongTextAfterUnidentifiedChar() && differsInWhitespace(this.element.innerText, this.event.data)) {\n this.buggyMode = true\n this.event.preventDefault()\n }\n }\n\n // The flurry of buggy events are always insertText. If we see any other type, it means it's over.\n checkSamsungKeyboardBuggyModeEnd() {\n if (this.buggyMode && this.event.inputType !== \"insertText\") {\n this.buggyMode = false\n }\n }\n\n insertingLongTextAfterUnidentifiedChar() {\n return this.isBeforeInputInsertText() && this.previousEventWasUnidentifiedKeydown() && this.event.data?.length > 50\n }\n\n isBeforeInputInsertText() {\n return this.event.type === \"beforeinput\" && this.event.inputType === \"insertText\"\n }\n\n previousEventWasUnidentifiedKeydown() {\n return this.previousEvent?.type === \"keydown\" && this.previousEvent?.key === \"Unidentified\"\n }\n}\n\nconst differsInWhitespace = (text1, text2) => {\n return normalize(text1) === normalize(text2)\n}\n\nconst whiteSpaceNormalizerRegexp = new RegExp(`(${OBJECT_REPLACEMENT_CHARACTER}|${ZERO_WIDTH_SPACE}|${NON_BREAKING_SPACE}|\\\\s)+`, \"g\")\nconst normalize = (text) => text.replace(whiteSpaceNormalizerRegexp, \" \").trim()\n","import BasicObject from \"trix/core/basic_object\"\nimport MutationObserver from \"trix/observers/mutation_observer\"\nimport FileVerificationOperation from \"trix/operations/file_verification_operation\"\nimport FlakyAndroidKeyboardDetector from \"../models/flaky_android_keyboard_detector\"\n\nimport { handleEvent, innerElementIsActive } from \"trix/core/helpers\"\n\nexport default class InputController extends BasicObject {\n\n static events = {}\n\n constructor(element) {\n super(...arguments)\n this.element = element\n this.mutationObserver = new MutationObserver(this.element)\n this.mutationObserver.delegate = this\n this.flakyKeyboardDetector = new FlakyAndroidKeyboardDetector(this.element)\n for (const eventName in this.constructor.events) {\n handleEvent(eventName, { onElement: this.element, withCallback: this.handlerFor(eventName) })\n }\n }\n\n elementDidMutate(mutationSummary) {}\n\n editorWillSyncDocumentView() {\n return this.mutationObserver.stop()\n }\n\n editorDidSyncDocumentView() {\n return this.mutationObserver.start()\n }\n\n requestRender() {\n return this.delegate?.inputControllerDidRequestRender?.()\n }\n\n requestReparse() {\n this.delegate?.inputControllerDidRequestReparse?.()\n return this.requestRender()\n }\n\n attachFiles(files) {\n const operations = Array.from(files).map((file) => new FileVerificationOperation(file))\n return Promise.all(operations).then((files) => {\n this.handleInput(function() {\n this.delegate?.inputControllerWillAttachFiles()\n this.responder?.insertFiles(files)\n return this.requestRender()\n })\n })\n }\n\n // Private\n\n handlerFor(eventName) {\n return (event) => {\n if (!event.defaultPrevented) {\n this.handleInput(() => {\n if (!innerElementIsActive(this.element)) {\n if (this.flakyKeyboardDetector.shouldIgnore(event)) return\n\n this.eventName = eventName\n this.constructor.events[eventName].call(this, event)\n }\n })\n }\n }\n }\n\n handleInput(callback) {\n try {\n this.delegate?.inputControllerWillHandleInput()\n callback.call(this)\n } finally {\n this.delegate?.inputControllerDidHandleInput()\n }\n }\n\n createLinkHTML(href, text) {\n const link = document.createElement(\"a\")\n link.href = href\n link.textContent = text ? text : href\n return link.outerHTML\n }\n}\n\n","import * as config from \"trix/config\"\nimport UTF16String from \"trix/core/utilities/utf16_string\"\nimport BasicObject from \"trix/core/basic_object\"\nimport InputController from \"trix/controllers/input_controller\"\nimport DocumentView from \"trix/views/document_view\"\nimport Document from \"trix/models/document\"\n\nimport {\n dataTransferIsPlainText,\n dataTransferIsWritable,\n keyEventIsKeyboardCommand,\n makeElement,\n objectsAreEqual,\n removeNode,\n squishBreakableWhitespace,\n} from \"trix/core/helpers\"\n\nimport { selectionChangeObserver } from \"trix/observers/selection_change_observer\"\n\nconst { browser, keyNames } = config\nlet pastedFileCount = 0\n\nexport default class Level0InputController extends InputController {\n\n static events = {\n keydown(event) {\n if (!this.isComposing()) {\n this.resetInputSummary()\n }\n this.inputSummary.didInput = true\n\n const keyName = keyNames[event.keyCode]\n if (keyName) {\n let context = this.keys\n\n ;[ \"ctrl\", \"alt\", \"shift\", \"meta\" ].forEach((modifier) => {\n if (event[`${modifier}Key`]) {\n if (modifier === \"ctrl\") {\n modifier = \"control\"\n }\n context = context?.[modifier]\n }\n })\n\n if (context?.[keyName] != null) {\n this.setInputSummary({ keyName })\n selectionChangeObserver.reset()\n context[keyName].call(this, event)\n }\n }\n\n if (keyEventIsKeyboardCommand(event)) {\n const character = String.fromCharCode(event.keyCode).toLowerCase()\n if (character) {\n const keys = [ \"alt\", \"shift\" ].map((modifier) => {\n if (event[`${modifier}Key`]) {\n return modifier\n }\n }).filter(key => key)\n keys.push(character)\n if (this.delegate?.inputControllerDidReceiveKeyboardCommand(keys)) {\n event.preventDefault()\n }\n }\n }\n },\n\n keypress(event) {\n if (this.inputSummary.eventName != null) return\n if (event.metaKey) return\n if (event.ctrlKey && !event.altKey) return\n\n const string = stringFromKeyEvent(event)\n if (string) {\n this.delegate?.inputControllerWillPerformTyping()\n this.responder?.insertString(string)\n return this.setInputSummary({ textAdded: string, didDelete: this.selectionIsExpanded() })\n }\n },\n\n textInput(event) {\n // Handle autocapitalization\n const { data } = event\n const { textAdded } = this.inputSummary\n if (textAdded && textAdded !== data && textAdded.toUpperCase() === data) {\n const range = this.getSelectedRange()\n this.setSelectedRange([ range[0], range[1] + textAdded.length ])\n this.responder?.insertString(data)\n this.setInputSummary({ textAdded: data })\n return this.setSelectedRange(range)\n }\n },\n\n dragenter(event) {\n event.preventDefault()\n },\n\n dragstart(event) {\n this.serializeSelectionToDataTransfer(event.dataTransfer)\n this.draggedRange = this.getSelectedRange()\n return this.delegate?.inputControllerDidStartDrag?.()\n },\n\n dragover(event) {\n if (this.draggedRange || this.canAcceptDataTransfer(event.dataTransfer)) {\n event.preventDefault()\n const draggingPoint = { x: event.clientX, y: event.clientY }\n if (!objectsAreEqual(draggingPoint, this.draggingPoint)) {\n this.draggingPoint = draggingPoint\n return this.delegate?.inputControllerDidReceiveDragOverPoint?.(this.draggingPoint)\n }\n }\n },\n\n dragend(event) {\n this.delegate?.inputControllerDidCancelDrag?.()\n this.draggedRange = null\n this.draggingPoint = null\n },\n\n drop(event) {\n event.preventDefault()\n const files = event.dataTransfer?.files\n const documentJSON = event.dataTransfer.getData(\"application/x-trix-document\")\n\n const point = { x: event.clientX, y: event.clientY }\n this.responder?.setLocationRangeFromPointRange(point)\n\n if (files?.length) {\n this.attachFiles(files)\n } else if (this.draggedRange) {\n this.delegate?.inputControllerWillMoveText()\n this.responder?.moveTextFromRange(this.draggedRange)\n this.draggedRange = null\n this.requestRender()\n } else if (documentJSON) {\n const document = Document.fromJSONString(documentJSON)\n this.responder?.insertDocument(document)\n this.requestRender()\n }\n\n this.draggedRange = null\n this.draggingPoint = null\n },\n\n cut(event) {\n if (this.responder?.selectionIsExpanded()) {\n if (this.serializeSelectionToDataTransfer(event.clipboardData)) {\n event.preventDefault()\n }\n\n this.delegate?.inputControllerWillCutText()\n this.deleteInDirection(\"backward\")\n if (event.defaultPrevented) {\n return this.requestRender()\n }\n }\n },\n\n copy(event) {\n if (this.responder?.selectionIsExpanded()) {\n if (this.serializeSelectionToDataTransfer(event.clipboardData)) {\n event.preventDefault()\n }\n }\n },\n\n paste(event) {\n const clipboard = event.clipboardData || event.testClipboardData\n const paste = { clipboard }\n\n if (!clipboard || pasteEventIsCrippledSafariHTMLPaste(event)) {\n this.getPastedHTMLUsingHiddenElement((html) => {\n paste.type = \"text/html\"\n paste.html = html\n this.delegate?.inputControllerWillPaste(paste)\n this.responder?.insertHTML(paste.html)\n this.requestRender()\n return this.delegate?.inputControllerDidPaste(paste)\n })\n return\n }\n\n const href = clipboard.getData(\"URL\")\n const html = clipboard.getData(\"text/html\")\n const name = clipboard.getData(\"public.url-name\")\n\n if (href) {\n let string\n paste.type = \"text/html\"\n if (name) {\n string = squishBreakableWhitespace(name).trim()\n } else {\n string = href\n }\n paste.html = this.createLinkHTML(href, string)\n this.delegate?.inputControllerWillPaste(paste)\n this.setInputSummary({ textAdded: string, didDelete: this.selectionIsExpanded() })\n this.responder?.insertHTML(paste.html)\n this.requestRender()\n this.delegate?.inputControllerDidPaste(paste)\n } else if (dataTransferIsPlainText(clipboard)) {\n paste.type = \"text/plain\"\n paste.string = clipboard.getData(\"text/plain\")\n this.delegate?.inputControllerWillPaste(paste)\n this.setInputSummary({ textAdded: paste.string, didDelete: this.selectionIsExpanded() })\n this.responder?.insertString(paste.string)\n this.requestRender()\n this.delegate?.inputControllerDidPaste(paste)\n } else if (html) {\n paste.type = \"text/html\"\n paste.html = html\n this.delegate?.inputControllerWillPaste(paste)\n this.responder?.insertHTML(paste.html)\n this.requestRender()\n this.delegate?.inputControllerDidPaste(paste)\n } else if (Array.from(clipboard.types).includes(\"Files\")) {\n const file = clipboard.items?.[0]?.getAsFile?.()\n if (file) {\n const extension = extensionForFile(file)\n if (!file.name && extension) {\n file.name = `pasted-file-${++pastedFileCount}.${extension}`\n }\n paste.type = \"File\"\n paste.file = file\n this.delegate?.inputControllerWillAttachFiles()\n this.responder?.insertFile(paste.file)\n this.requestRender()\n this.delegate?.inputControllerDidPaste(paste)\n }\n }\n\n event.preventDefault()\n },\n\n compositionstart(event) {\n return this.getCompositionInput().start(event.data)\n },\n\n compositionupdate(event) {\n return this.getCompositionInput().update(event.data)\n },\n\n compositionend(event) {\n return this.getCompositionInput().end(event.data)\n },\n\n beforeinput(event) {\n this.inputSummary.didInput = true\n },\n\n input(event) {\n this.inputSummary.didInput = true\n return event.stopPropagation()\n },\n }\n\n static keys = {\n backspace(event) {\n this.delegate?.inputControllerWillPerformTyping()\n return this.deleteInDirection(\"backward\", event)\n },\n\n delete(event) {\n this.delegate?.inputControllerWillPerformTyping()\n return this.deleteInDirection(\"forward\", event)\n },\n\n return(event) {\n this.setInputSummary({ preferDocument: true })\n this.delegate?.inputControllerWillPerformTyping()\n return this.responder?.insertLineBreak()\n },\n\n tab(event) {\n if (this.responder?.canIncreaseNestingLevel()) {\n this.responder?.increaseNestingLevel()\n this.requestRender()\n event.preventDefault()\n }\n },\n\n left(event) {\n if (this.selectionIsInCursorTarget()) {\n event.preventDefault()\n return this.responder?.moveCursorInDirection(\"backward\")\n }\n },\n\n right(event) {\n if (this.selectionIsInCursorTarget()) {\n event.preventDefault()\n return this.responder?.moveCursorInDirection(\"forward\")\n }\n },\n\n control: {\n d(event) {\n this.delegate?.inputControllerWillPerformTyping()\n return this.deleteInDirection(\"forward\", event)\n },\n\n h(event) {\n this.delegate?.inputControllerWillPerformTyping()\n return this.deleteInDirection(\"backward\", event)\n },\n\n o(event) {\n event.preventDefault()\n this.delegate?.inputControllerWillPerformTyping()\n this.responder?.insertString(\"\\n\", { updatePosition: false })\n return this.requestRender()\n },\n },\n\n shift: {\n return(event) {\n this.delegate?.inputControllerWillPerformTyping()\n this.responder?.insertString(\"\\n\")\n this.requestRender()\n event.preventDefault()\n },\n\n tab(event) {\n if (this.responder?.canDecreaseNestingLevel()) {\n this.responder?.decreaseNestingLevel()\n this.requestRender()\n event.preventDefault()\n }\n },\n\n left(event) {\n if (this.selectionIsInCursorTarget()) {\n event.preventDefault()\n return this.expandSelectionInDirection(\"backward\")\n }\n },\n\n right(event) {\n if (this.selectionIsInCursorTarget()) {\n event.preventDefault()\n return this.expandSelectionInDirection(\"forward\")\n }\n },\n },\n\n alt: {\n backspace(event) {\n this.setInputSummary({ preferDocument: false })\n return this.delegate?.inputControllerWillPerformTyping()\n },\n },\n\n meta: {\n backspace(event) {\n this.setInputSummary({ preferDocument: false })\n return this.delegate?.inputControllerWillPerformTyping()\n },\n },\n }\n\n constructor() {\n super(...arguments)\n this.resetInputSummary()\n }\n\n setInputSummary(summary = {}) {\n this.inputSummary.eventName = this.eventName\n for (const key in summary) {\n const value = summary[key]\n this.inputSummary[key] = value\n }\n return this.inputSummary\n }\n\n resetInputSummary() {\n this.inputSummary = {}\n }\n\n reset() {\n this.resetInputSummary()\n return selectionChangeObserver.reset()\n }\n\n // Mutation observer delegate\n\n elementDidMutate(mutationSummary) {\n if (this.isComposing()) {\n return this.delegate?.inputControllerDidAllowUnhandledInput?.()\n } else {\n return this.handleInput(function() {\n if (this.mutationIsSignificant(mutationSummary)) {\n if (this.mutationIsExpected(mutationSummary)) {\n this.requestRender()\n } else {\n this.requestReparse()\n }\n }\n return this.reset()\n })\n }\n }\n\n mutationIsExpected({ textAdded, textDeleted }) {\n if (this.inputSummary.preferDocument) {\n return true\n }\n\n const mutationAdditionMatchesSummary =\n textAdded != null ? textAdded === this.inputSummary.textAdded : !this.inputSummary.textAdded\n const mutationDeletionMatchesSummary =\n textDeleted != null ? this.inputSummary.didDelete : !this.inputSummary.didDelete\n\n const unexpectedNewlineAddition = [ \"\\n\", \" \\n\" ].includes(textAdded) && !mutationAdditionMatchesSummary\n const unexpectedNewlineDeletion = textDeleted === \"\\n\" && !mutationDeletionMatchesSummary\n const singleUnexpectedNewline =\n unexpectedNewlineAddition && !unexpectedNewlineDeletion ||\n unexpectedNewlineDeletion && !unexpectedNewlineAddition\n\n if (singleUnexpectedNewline) {\n const range = this.getSelectedRange()\n if (range) {\n const offset = unexpectedNewlineAddition ? textAdded.replace(/\\n$/, \"\").length || -1 : textAdded?.length || 1\n if (this.responder?.positionIsBlockBreak(range[1] + offset)) {\n return true\n }\n }\n }\n\n return mutationAdditionMatchesSummary && mutationDeletionMatchesSummary\n }\n\n mutationIsSignificant(mutationSummary) {\n const textChanged = Object.keys(mutationSummary).length > 0\n const composedEmptyString = this.compositionInput?.getEndData() === \"\"\n return textChanged || !composedEmptyString\n }\n\n // Private\n\n getCompositionInput() {\n if (this.isComposing()) {\n return this.compositionInput\n } else {\n this.compositionInput = new CompositionInput(this)\n }\n }\n\n isComposing() {\n return this.compositionInput && !this.compositionInput.isEnded()\n }\n\n deleteInDirection(direction, event) {\n if (this.responder?.deleteInDirection(direction) === false) {\n if (event) {\n event.preventDefault()\n return this.requestRender()\n }\n } else {\n return this.setInputSummary({ didDelete: true })\n }\n }\n\n serializeSelectionToDataTransfer(dataTransfer) {\n if (!dataTransferIsWritable(dataTransfer)) return\n const document = this.responder?.getSelectedDocument().toSerializableDocument()\n\n dataTransfer.setData(\"application/x-trix-document\", JSON.stringify(document))\n dataTransfer.setData(\"text/html\", DocumentView.render(document).innerHTML)\n dataTransfer.setData(\"text/plain\", document.toString().replace(/\\n$/, \"\"))\n return true\n }\n\n canAcceptDataTransfer(dataTransfer) {\n const types = {}\n Array.from(dataTransfer?.types || []).forEach((type) => {\n types[type] = true\n })\n return types.Files || types[\"application/x-trix-document\"] || types[\"text/html\"] || types[\"text/plain\"]\n }\n\n getPastedHTMLUsingHiddenElement(callback) {\n const selectedRange = this.getSelectedRange()\n\n const style = {\n position: \"absolute\",\n left: `${window.pageXOffset}px`,\n top: `${window.pageYOffset}px`,\n opacity: 0,\n }\n\n const element = makeElement({ style, tagName: \"div\", editable: true })\n document.body.appendChild(element)\n element.focus()\n\n return requestAnimationFrame(() => {\n const html = element.innerHTML\n removeNode(element)\n this.setSelectedRange(selectedRange)\n return callback(html)\n })\n }\n}\n\nLevel0InputController.proxyMethod(\"responder?.getSelectedRange\")\nLevel0InputController.proxyMethod(\"responder?.setSelectedRange\")\nLevel0InputController.proxyMethod(\"responder?.expandSelectionInDirection\")\nLevel0InputController.proxyMethod(\"responder?.selectionIsInCursorTarget\")\nLevel0InputController.proxyMethod(\"responder?.selectionIsExpanded\")\n\nconst extensionForFile = (file) => file.type?.match(/\\/(\\w+)$/)?.[1]\n\nconst hasStringCodePointAt = !!\" \".codePointAt?.(0)\n\nconst stringFromKeyEvent = function(event) {\n if (event.key && hasStringCodePointAt && event.key.codePointAt(0) === event.keyCode) {\n return event.key\n } else {\n let code\n if (event.which === null) {\n code = event.keyCode\n } else if (event.which !== 0 && event.charCode !== 0) {\n code = event.charCode\n }\n\n if (code != null && keyNames[code] !== \"escape\") {\n return UTF16String.fromCodepoints([ code ]).toString()\n }\n }\n}\n\nconst pasteEventIsCrippledSafariHTMLPaste = function(event) {\n const paste = event.clipboardData\n if (paste) {\n if (paste.types.includes(\"text/html\")) {\n // Answer is yes if there's any possibility of Paste and Match Style in Safari,\n // which is nearly impossible to detect confidently: https://bugs.webkit.org/show_bug.cgi?id=174165\n for (const type of paste.types) {\n const hasPasteboardFlavor = /^CorePasteboardFlavorType/.test(type)\n const hasReadableDynamicData = /^dyn\\./.test(type) && paste.getData(type)\n const mightBePasteAndMatchStyle = hasPasteboardFlavor || hasReadableDynamicData\n if (mightBePasteAndMatchStyle) {\n return true\n }\n }\n return false\n } else {\n const isExternalHTMLPaste = paste.types.includes(\"com.apple.webarchive\")\n const isExternalRichTextPaste = paste.types.includes(\"com.apple.flat-rtfd\")\n return isExternalHTMLPaste || isExternalRichTextPaste\n }\n }\n}\n\nclass CompositionInput extends BasicObject {\n constructor(inputController) {\n super(...arguments)\n this.inputController = inputController\n this.responder = this.inputController.responder\n this.delegate = this.inputController.delegate\n this.inputSummary = this.inputController.inputSummary\n this.data = {}\n }\n\n start(data) {\n this.data.start = data\n\n if (this.isSignificant()) {\n if (this.inputSummary.eventName === \"keypress\" && this.inputSummary.textAdded) {\n this.responder?.deleteInDirection(\"left\")\n }\n\n if (!this.selectionIsExpanded()) {\n this.insertPlaceholder()\n this.requestRender()\n }\n\n this.range = this.responder?.getSelectedRange()\n }\n }\n\n update(data) {\n this.data.update = data\n\n if (this.isSignificant()) {\n const range = this.selectPlaceholder()\n if (range) {\n this.forgetPlaceholder()\n this.range = range\n }\n }\n }\n\n end(data) {\n this.data.end = data\n\n if (this.isSignificant()) {\n this.forgetPlaceholder()\n\n if (this.canApplyToDocument()) {\n this.setInputSummary({ preferDocument: true, didInput: false })\n this.delegate?.inputControllerWillPerformTyping()\n this.responder?.setSelectedRange(this.range)\n this.responder?.insertString(this.data.end)\n return this.responder?.setSelectedRange(this.range[0] + this.data.end.length)\n } else if (this.data.start != null || this.data.update != null) {\n this.requestReparse()\n return this.inputController.reset()\n }\n } else {\n return this.inputController.reset()\n }\n }\n\n getEndData() {\n return this.data.end\n }\n\n isEnded() {\n return this.getEndData() != null\n }\n\n isSignificant() {\n if (browser.composesExistingText) {\n return this.inputSummary.didInput\n } else {\n return true\n }\n }\n\n // Private\n\n canApplyToDocument() {\n return this.data.start?.length === 0 && this.data.end?.length > 0 && this.range\n }\n}\n\nCompositionInput.proxyMethod(\"inputController.setInputSummary\")\nCompositionInput.proxyMethod(\"inputController.requestRender\")\nCompositionInput.proxyMethod(\"inputController.requestReparse\")\nCompositionInput.proxyMethod(\"responder?.selectionIsExpanded\")\nCompositionInput.proxyMethod(\"responder?.insertPlaceholder\")\nCompositionInput.proxyMethod(\"responder?.selectPlaceholder\")\nCompositionInput.proxyMethod(\"responder?.forgetPlaceholder\")\n","import { getAllAttributeNames, squishBreakableWhitespace } from \"trix/core/helpers\"\nimport InputController from \"trix/controllers/input_controller\"\nimport * as config from \"trix/config\"\n\nimport { dataTransferIsMsOfficePaste, dataTransferIsPlainText, keyEventIsKeyboardCommand, objectsAreEqual } from \"trix/core/helpers\"\n\nimport { selectionChangeObserver } from \"trix/observers/selection_change_observer\"\n\nexport default class Level2InputController extends InputController {\n constructor(...args) {\n super(...args)\n this.render = this.render.bind(this)\n }\n\n static events = {\n keydown(event) {\n if (keyEventIsKeyboardCommand(event)) {\n const command = keyboardCommandFromKeyEvent(event)\n if (this.delegate?.inputControllerDidReceiveKeyboardCommand(command)) {\n event.preventDefault()\n }\n } else {\n let name = event.key\n if (event.altKey) {\n name += \"+Alt\"\n }\n if (event.shiftKey) {\n name += \"+Shift\"\n }\n const handler = this.constructor.keys[name]\n if (handler) {\n return this.withEvent(event, handler)\n }\n }\n },\n\n // Handle paste event to work around beforeinput.insertFromPaste browser bugs.\n // Safe to remove each condition once fixed upstream.\n paste(event) {\n // https://bugs.webkit.org/show_bug.cgi?id=194921\n let paste\n const href = event.clipboardData?.getData(\"URL\")\n if (pasteEventHasFilesOnly(event)) {\n event.preventDefault()\n return this.attachFiles(event.clipboardData.files)\n\n // https://bugs.chromium.org/p/chromium/issues/detail?id=934448\n } else if (pasteEventHasPlainTextOnly(event)) {\n event.preventDefault()\n paste = {\n type: \"text/plain\",\n string: event.clipboardData.getData(\"text/plain\"),\n }\n this.delegate?.inputControllerWillPaste(paste)\n this.responder?.insertString(paste.string)\n this.render()\n return this.delegate?.inputControllerDidPaste(paste)\n\n // https://bugs.webkit.org/show_bug.cgi?id=196702\n } else if (href) {\n event.preventDefault()\n paste = {\n type: \"text/html\",\n html: this.createLinkHTML(href),\n }\n this.delegate?.inputControllerWillPaste(paste)\n this.responder?.insertHTML(paste.html)\n this.render()\n return this.delegate?.inputControllerDidPaste(paste)\n }\n },\n\n beforeinput(event) {\n const handler = this.constructor.inputTypes[event.inputType]\n\n if (handler) {\n this.withEvent(event, handler)\n this.scheduleRender()\n }\n },\n\n input(event) {\n selectionChangeObserver.reset()\n },\n\n dragstart(event) {\n if (this.responder?.selectionContainsAttachments()) {\n event.dataTransfer.setData(\"application/x-trix-dragging\", true)\n\n this.dragging = {\n range: this.responder?.getSelectedRange(),\n point: pointFromEvent(event),\n }\n }\n },\n\n dragenter(event) {\n if (dragEventHasFiles(event)) {\n event.preventDefault()\n }\n },\n\n dragover(event) {\n if (this.dragging) {\n event.preventDefault()\n const point = pointFromEvent(event)\n if (!objectsAreEqual(point, this.dragging.point)) {\n this.dragging.point = point\n return this.responder?.setLocationRangeFromPointRange(point)\n }\n } else if (dragEventHasFiles(event)) {\n event.preventDefault()\n }\n },\n\n drop(event) {\n if (this.dragging) {\n event.preventDefault()\n this.delegate?.inputControllerWillMoveText()\n this.responder?.moveTextFromRange(this.dragging.range)\n this.dragging = null\n return this.scheduleRender()\n } else if (dragEventHasFiles(event)) {\n event.preventDefault()\n const point = pointFromEvent(event)\n this.responder?.setLocationRangeFromPointRange(point)\n return this.attachFiles(event.dataTransfer.files)\n }\n },\n\n dragend() {\n if (this.dragging) {\n this.responder?.setSelectedRange(this.dragging.range)\n this.dragging = null\n }\n },\n\n compositionend(event) {\n if (this.composing) {\n this.composing = false\n if (!config.browser.recentAndroid) this.scheduleRender()\n }\n },\n }\n\n static keys = {\n ArrowLeft() {\n if (this.responder?.shouldManageMovingCursorInDirection(\"backward\")) {\n this.event.preventDefault()\n return this.responder?.moveCursorInDirection(\"backward\")\n }\n },\n\n ArrowRight() {\n if (this.responder?.shouldManageMovingCursorInDirection(\"forward\")) {\n this.event.preventDefault()\n return this.responder?.moveCursorInDirection(\"forward\")\n }\n },\n\n Backspace() {\n if (this.responder?.shouldManageDeletingInDirection(\"backward\")) {\n this.event.preventDefault()\n this.delegate?.inputControllerWillPerformTyping()\n this.responder?.deleteInDirection(\"backward\")\n return this.render()\n }\n },\n\n Tab() {\n if (this.responder?.canIncreaseNestingLevel()) {\n this.event.preventDefault()\n this.responder?.increaseNestingLevel()\n return this.render()\n }\n },\n\n \"Tab+Shift\"() {\n if (this.responder?.canDecreaseNestingLevel()) {\n this.event.preventDefault()\n this.responder?.decreaseNestingLevel()\n return this.render()\n }\n },\n }\n\n static inputTypes = {\n deleteByComposition() {\n return this.deleteInDirection(\"backward\", { recordUndoEntry: false })\n },\n\n deleteByCut() {\n return this.deleteInDirection(\"backward\")\n },\n\n deleteByDrag() {\n this.event.preventDefault()\n return this.withTargetDOMRange(function() {\n this.deleteByDragRange = this.responder?.getSelectedRange()\n })\n },\n\n deleteCompositionText() {\n return this.deleteInDirection(\"backward\", { recordUndoEntry: false })\n },\n\n deleteContent() {\n return this.deleteInDirection(\"backward\")\n },\n\n deleteContentBackward() {\n return this.deleteInDirection(\"backward\")\n },\n\n deleteContentForward() {\n return this.deleteInDirection(\"forward\")\n },\n\n deleteEntireSoftLine() {\n return this.deleteInDirection(\"forward\")\n },\n\n deleteHardLineBackward() {\n return this.deleteInDirection(\"backward\")\n },\n\n deleteHardLineForward() {\n return this.deleteInDirection(\"forward\")\n },\n\n deleteSoftLineBackward() {\n return this.deleteInDirection(\"backward\")\n },\n\n deleteSoftLineForward() {\n return this.deleteInDirection(\"forward\")\n },\n\n deleteWordBackward() {\n return this.deleteInDirection(\"backward\")\n },\n\n deleteWordForward() {\n return this.deleteInDirection(\"forward\")\n },\n\n formatBackColor() {\n return this.activateAttributeIfSupported(\"backgroundColor\", this.event.data)\n },\n\n formatBold() {\n return this.toggleAttributeIfSupported(\"bold\")\n },\n\n formatFontColor() {\n return this.activateAttributeIfSupported(\"color\", this.event.data)\n },\n\n formatFontName() {\n return this.activateAttributeIfSupported(\"font\", this.event.data)\n },\n\n formatIndent() {\n if (this.responder?.canIncreaseNestingLevel()) {\n return this.withTargetDOMRange(function() {\n return this.responder?.increaseNestingLevel()\n })\n }\n },\n\n formatItalic() {\n return this.toggleAttributeIfSupported(\"italic\")\n },\n\n formatJustifyCenter() {\n return this.toggleAttributeIfSupported(\"justifyCenter\")\n },\n\n formatJustifyFull() {\n return this.toggleAttributeIfSupported(\"justifyFull\")\n },\n\n formatJustifyLeft() {\n return this.toggleAttributeIfSupported(\"justifyLeft\")\n },\n\n formatJustifyRight() {\n return this.toggleAttributeIfSupported(\"justifyRight\")\n },\n\n formatOutdent() {\n if (this.responder?.canDecreaseNestingLevel()) {\n return this.withTargetDOMRange(function() {\n return this.responder?.decreaseNestingLevel()\n })\n }\n },\n\n formatRemove() {\n this.withTargetDOMRange(function() {\n for (const attributeName in this.responder?.getCurrentAttributes()) {\n this.responder?.removeCurrentAttribute(attributeName)\n }\n })\n },\n\n formatSetBlockTextDirection() {\n return this.activateAttributeIfSupported(\"blockDir\", this.event.data)\n },\n\n formatSetInlineTextDirection() {\n return this.activateAttributeIfSupported(\"textDir\", this.event.data)\n },\n\n formatStrikeThrough() {\n return this.toggleAttributeIfSupported(\"strike\")\n },\n\n formatSubscript() {\n return this.toggleAttributeIfSupported(\"sub\")\n },\n\n formatSuperscript() {\n return this.toggleAttributeIfSupported(\"sup\")\n },\n\n formatUnderline() {\n return this.toggleAttributeIfSupported(\"underline\")\n },\n\n historyRedo() {\n return this.delegate?.inputControllerWillPerformRedo()\n },\n\n historyUndo() {\n return this.delegate?.inputControllerWillPerformUndo()\n },\n\n insertCompositionText() {\n this.composing = true\n return this.insertString(this.event.data)\n },\n\n insertFromComposition() {\n this.composing = false\n return this.insertString(this.event.data)\n },\n\n insertFromDrop() {\n const range = this.deleteByDragRange\n if (range) {\n this.deleteByDragRange = null\n this.delegate?.inputControllerWillMoveText()\n return this.withTargetDOMRange(function() {\n return this.responder?.moveTextFromRange(range)\n })\n }\n },\n\n insertFromPaste() {\n const { dataTransfer } = this.event\n const paste = { dataTransfer }\n\n const href = dataTransfer.getData(\"URL\")\n const html = dataTransfer.getData(\"text/html\")\n\n if (href) {\n let string\n this.event.preventDefault()\n paste.type = \"text/html\"\n const name = dataTransfer.getData(\"public.url-name\")\n if (name) {\n string = squishBreakableWhitespace(name).trim()\n } else {\n string = href\n }\n paste.html = this.createLinkHTML(href, string)\n this.delegate?.inputControllerWillPaste(paste)\n this.withTargetDOMRange(function() {\n return this.responder?.insertHTML(paste.html)\n })\n this.afterRender = () => {\n return this.delegate?.inputControllerDidPaste(paste)\n }\n } else if (dataTransferIsPlainText(dataTransfer)) {\n paste.type = \"text/plain\"\n paste.string = dataTransfer.getData(\"text/plain\")\n this.delegate?.inputControllerWillPaste(paste)\n this.withTargetDOMRange(function() {\n return this.responder?.insertString(paste.string)\n })\n\n this.afterRender = () => {\n return this.delegate?.inputControllerDidPaste(paste)\n }\n } else if (processableFilePaste(this.event)) {\n paste.type = \"File\"\n paste.file = dataTransfer.files[0]\n this.delegate?.inputControllerWillPaste(paste)\n this.withTargetDOMRange(function() {\n return this.responder?.insertFile(paste.file)\n })\n\n this.afterRender = () => {\n return this.delegate?.inputControllerDidPaste(paste)\n }\n } else if (html) {\n this.event.preventDefault()\n paste.type = \"text/html\"\n paste.html = html\n this.delegate?.inputControllerWillPaste(paste)\n this.withTargetDOMRange(function() {\n return this.responder?.insertHTML(paste.html)\n })\n this.afterRender = () => {\n return this.delegate?.inputControllerDidPaste(paste)\n }\n }\n },\n\n insertFromYank() {\n return this.insertString(this.event.data)\n },\n\n insertLineBreak() {\n return this.insertString(\"\\n\")\n },\n\n insertLink() {\n return this.activateAttributeIfSupported(\"href\", this.event.data)\n },\n\n insertOrderedList() {\n return this.toggleAttributeIfSupported(\"number\")\n },\n\n insertParagraph() {\n this.delegate?.inputControllerWillPerformTyping()\n return this.withTargetDOMRange(function() {\n return this.responder?.insertLineBreak()\n })\n },\n\n insertReplacementText() {\n const replacement = this.event.dataTransfer.getData(\"text/plain\")\n const domRange = this.event.getTargetRanges()[0]\n\n this.withTargetDOMRange(domRange, () => {\n this.insertString(replacement, { updatePosition: false })\n })\n },\n\n insertText() {\n return this.insertString(this.event.data || this.event.dataTransfer?.getData(\"text/plain\"))\n },\n\n insertTranspose() {\n return this.insertString(this.event.data)\n },\n\n insertUnorderedList() {\n return this.toggleAttributeIfSupported(\"bullet\")\n },\n }\n\n elementDidMutate() {\n if (this.scheduledRender) {\n if (this.composing) {\n return this.delegate?.inputControllerDidAllowUnhandledInput?.()\n }\n } else {\n return this.reparse()\n }\n }\n\n scheduleRender() {\n return this.scheduledRender ? this.scheduledRender : this.scheduledRender = requestAnimationFrame(this.render)\n }\n\n render() {\n cancelAnimationFrame(this.scheduledRender)\n this.scheduledRender = null\n if (!this.composing) {\n this.delegate?.render()\n }\n this.afterRender?.()\n this.afterRender = null\n }\n\n reparse() {\n return this.delegate?.reparse()\n }\n\n // Responder helpers\n\n insertString(string = \"\", options) {\n this.delegate?.inputControllerWillPerformTyping()\n return this.withTargetDOMRange(function() {\n return this.responder?.insertString(string, options)\n })\n }\n\n toggleAttributeIfSupported(attributeName) {\n if (getAllAttributeNames().includes(attributeName)) {\n this.delegate?.inputControllerWillPerformFormatting(attributeName)\n return this.withTargetDOMRange(function() {\n return this.responder?.toggleCurrentAttribute(attributeName)\n })\n }\n }\n\n activateAttributeIfSupported(attributeName, value) {\n if (getAllAttributeNames().includes(attributeName)) {\n this.delegate?.inputControllerWillPerformFormatting(attributeName)\n return this.withTargetDOMRange(function() {\n return this.responder?.setCurrentAttribute(attributeName, value)\n })\n }\n }\n\n deleteInDirection(direction, { recordUndoEntry } = { recordUndoEntry: true }) {\n if (recordUndoEntry) {\n this.delegate?.inputControllerWillPerformTyping()\n }\n const perform = () => this.responder?.deleteInDirection(direction)\n const domRange = this.getTargetDOMRange({ minLength: this.composing ? 1 : 2 })\n if (domRange) {\n return this.withTargetDOMRange(domRange, perform)\n } else {\n return perform()\n }\n }\n\n // Selection helpers\n\n withTargetDOMRange(domRange, fn) {\n if (typeof domRange === \"function\") {\n fn = domRange\n domRange = this.getTargetDOMRange()\n }\n if (domRange) {\n return this.responder?.withTargetDOMRange(domRange, fn.bind(this))\n } else {\n selectionChangeObserver.reset()\n return fn.call(this)\n }\n }\n\n getTargetDOMRange({ minLength } = { minLength: 0 }) {\n const targetRanges = this.event.getTargetRanges?.()\n if (targetRanges) {\n if (targetRanges.length) {\n const domRange = staticRangeToRange(targetRanges[0])\n if (minLength === 0 || domRange.toString().length >= minLength) {\n return domRange\n }\n }\n }\n }\n\n withEvent(event, fn) {\n let result\n this.event = event\n try {\n result = fn.call(this)\n } finally {\n this.event = null\n }\n return result\n }\n}\n\nconst staticRangeToRange = function(staticRange) {\n const range = document.createRange()\n range.setStart(staticRange.startContainer, staticRange.startOffset)\n range.setEnd(staticRange.endContainer, staticRange.endOffset)\n return range\n}\n\n// Event helpers\n\nconst dragEventHasFiles = (event) => Array.from(event.dataTransfer?.types || []).includes(\"Files\")\n\nconst processableFilePaste = (event) => {\n // Paste events that only have files are handled by the paste event handler,\n // to work around Safari not supporting beforeinput.insertFromPaste for files.\n\n // MS Office text pastes include a file with a screenshot of the text, but we should\n // handle them as text pastes.\n return event.dataTransfer.files?.[0] && !pasteEventHasFilesOnly(event) && !dataTransferIsMsOfficePaste(event)\n}\n\nconst pasteEventHasFilesOnly = function(event) {\n const clipboard = event.clipboardData\n if (clipboard) {\n const fileTypes = Array.from(clipboard.types).filter((type) => type.match(/file/i)) // \"Files\", \"application/x-moz-file\"\n return fileTypes.length === clipboard.types.length && clipboard.files.length >= 1\n }\n}\n\nconst pasteEventHasPlainTextOnly = function(event) {\n const clipboard = event.clipboardData\n if (clipboard) {\n return clipboard.types.includes(\"text/plain\") && clipboard.types.length === 1\n }\n}\n\nconst keyboardCommandFromKeyEvent = function(event) {\n const command = []\n if (event.altKey) {\n command.push(\"alt\")\n }\n if (event.shiftKey) {\n command.push(\"shift\")\n }\n command.push(event.key)\n return command\n}\n\nconst pointFromEvent = (event) => ({\n x: event.clientX,\n y: event.clientY,\n})\n","import BasicObject from \"trix/core/basic_object\"\n\nimport { findClosestElementFromNode, handleEvent, triggerEvent } from \"trix/core/helpers\"\n\nconst attributeButtonSelector = \"[data-trix-attribute]\"\nconst actionButtonSelector = \"[data-trix-action]\"\nconst toolbarButtonSelector = `${attributeButtonSelector}, ${actionButtonSelector}`\nconst dialogSelector = \"[data-trix-dialog]\"\nconst activeDialogSelector = `${dialogSelector}[data-trix-active]`\nconst dialogButtonSelector = `${dialogSelector} [data-trix-method]`\nconst dialogInputSelector = `${dialogSelector} [data-trix-input]`\nconst getInputForDialog = (element, attributeName) => {\n if (!attributeName) { attributeName = getAttributeName(element) }\n return element.querySelector(`[data-trix-input][name='${attributeName}']`)\n}\nconst getActionName = (element) => element.getAttribute(\"data-trix-action\")\nconst getAttributeName = (element) => {\n return element.getAttribute(\"data-trix-attribute\") || element.getAttribute(\"data-trix-dialog-attribute\")\n}\nconst getDialogName = (element) => element.getAttribute(\"data-trix-dialog\")\n\nexport default class ToolbarController extends BasicObject {\n constructor(element) {\n super(element)\n this.didClickActionButton = this.didClickActionButton.bind(this)\n this.didClickAttributeButton = this.didClickAttributeButton.bind(this)\n this.didClickDialogButton = this.didClickDialogButton.bind(this)\n this.didKeyDownDialogInput = this.didKeyDownDialogInput.bind(this)\n this.element = element\n this.attributes = {}\n this.actions = {}\n this.resetDialogInputs()\n\n handleEvent(\"mousedown\", {\n onElement: this.element,\n matchingSelector: actionButtonSelector,\n withCallback: this.didClickActionButton,\n })\n handleEvent(\"mousedown\", {\n onElement: this.element,\n matchingSelector: attributeButtonSelector,\n withCallback: this.didClickAttributeButton,\n })\n handleEvent(\"click\", { onElement: this.element, matchingSelector: toolbarButtonSelector, preventDefault: true })\n handleEvent(\"click\", {\n onElement: this.element,\n matchingSelector: dialogButtonSelector,\n withCallback: this.didClickDialogButton,\n })\n handleEvent(\"keydown\", {\n onElement: this.element,\n matchingSelector: dialogInputSelector,\n withCallback: this.didKeyDownDialogInput,\n })\n }\n\n // Event handlers\n\n didClickActionButton(event, element) {\n this.delegate?.toolbarDidClickButton()\n event.preventDefault()\n const actionName = getActionName(element)\n\n if (this.getDialog(actionName)) {\n return this.toggleDialog(actionName)\n } else {\n return this.delegate?.toolbarDidInvokeAction(actionName, element)\n }\n }\n\n didClickAttributeButton(event, element) {\n this.delegate?.toolbarDidClickButton()\n event.preventDefault()\n const attributeName = getAttributeName(element)\n\n if (this.getDialog(attributeName)) {\n this.toggleDialog(attributeName)\n } else {\n this.delegate?.toolbarDidToggleAttribute(attributeName)\n }\n\n return this.refreshAttributeButtons()\n }\n\n didClickDialogButton(event, element) {\n const dialogElement = findClosestElementFromNode(element, { matchingSelector: dialogSelector })\n const method = element.getAttribute(\"data-trix-method\")\n return this[method].call(this, dialogElement)\n }\n\n didKeyDownDialogInput(event, element) {\n if (event.keyCode === 13) {\n // Enter key\n event.preventDefault()\n const attribute = element.getAttribute(\"name\")\n const dialog = this.getDialog(attribute)\n this.setAttribute(dialog)\n }\n if (event.keyCode === 27) {\n // Escape key\n event.preventDefault()\n return this.hideDialog()\n }\n }\n\n // Action buttons\n\n updateActions(actions) {\n this.actions = actions\n return this.refreshActionButtons()\n }\n\n refreshActionButtons() {\n return this.eachActionButton((element, actionName) => {\n element.disabled = this.actions[actionName] === false\n })\n }\n\n eachActionButton(callback) {\n return Array.from(this.element.querySelectorAll(actionButtonSelector)).map((element) =>\n callback(element, getActionName(element))\n )\n }\n\n // Attribute buttons\n\n updateAttributes(attributes) {\n this.attributes = attributes\n return this.refreshAttributeButtons()\n }\n\n refreshAttributeButtons() {\n return this.eachAttributeButton((element, attributeName) => {\n element.disabled = this.attributes[attributeName] === false\n if (this.attributes[attributeName] || this.dialogIsVisible(attributeName)) {\n element.setAttribute(\"data-trix-active\", \"\")\n return element.classList.add(\"trix-active\")\n } else {\n element.removeAttribute(\"data-trix-active\")\n return element.classList.remove(\"trix-active\")\n }\n })\n }\n\n eachAttributeButton(callback) {\n return Array.from(this.element.querySelectorAll(attributeButtonSelector)).map((element) =>\n callback(element, getAttributeName(element))\n )\n }\n\n applyKeyboardCommand(keys) {\n const keyString = JSON.stringify(keys.sort())\n for (const button of Array.from(this.element.querySelectorAll(\"[data-trix-key]\"))) {\n const buttonKeys = button.getAttribute(\"data-trix-key\").split(\"+\")\n const buttonKeyString = JSON.stringify(buttonKeys.sort())\n if (buttonKeyString === keyString) {\n triggerEvent(\"mousedown\", { onElement: button })\n return true\n }\n }\n return false\n }\n\n // Dialogs\n\n dialogIsVisible(dialogName) {\n const element = this.getDialog(dialogName)\n if (element) {\n return element.hasAttribute(\"data-trix-active\")\n }\n }\n\n toggleDialog(dialogName) {\n if (this.dialogIsVisible(dialogName)) {\n return this.hideDialog()\n } else {\n return this.showDialog(dialogName)\n }\n }\n\n showDialog(dialogName) {\n this.hideDialog()\n this.delegate?.toolbarWillShowDialog()\n\n const element = this.getDialog(dialogName)\n element.setAttribute(\"data-trix-active\", \"\")\n element.classList.add(\"trix-active\")\n\n Array.from(element.querySelectorAll(\"input[disabled]\")).forEach((disabledInput) => {\n disabledInput.removeAttribute(\"disabled\")\n })\n\n const attributeName = getAttributeName(element)\n if (attributeName) {\n const input = getInputForDialog(element, dialogName)\n if (input) {\n input.value = this.attributes[attributeName] || \"\"\n input.select()\n }\n }\n\n return this.delegate?.toolbarDidShowDialog(dialogName)\n }\n\n setAttribute(dialogElement) {\n const attributeName = getAttributeName(dialogElement)\n const input = getInputForDialog(dialogElement, attributeName)\n if (input.willValidate && !input.checkValidity()) {\n input.setAttribute(\"data-trix-validate\", \"\")\n input.classList.add(\"trix-validate\")\n return input.focus()\n } else {\n this.delegate?.toolbarDidUpdateAttribute(attributeName, input.value)\n return this.hideDialog()\n }\n }\n\n removeAttribute(dialogElement) {\n const attributeName = getAttributeName(dialogElement)\n this.delegate?.toolbarDidRemoveAttribute(attributeName)\n return this.hideDialog()\n }\n\n hideDialog() {\n const element = this.element.querySelector(activeDialogSelector)\n if (element) {\n element.removeAttribute(\"data-trix-active\")\n element.classList.remove(\"trix-active\")\n this.resetDialogInputs()\n return this.delegate?.toolbarDidHideDialog(getDialogName(element))\n }\n }\n\n resetDialogInputs() {\n Array.from(this.element.querySelectorAll(dialogInputSelector)).forEach((input) => {\n input.setAttribute(\"disabled\", \"disabled\")\n input.removeAttribute(\"data-trix-validate\")\n input.classList.remove(\"trix-validate\")\n })\n }\n\n getDialog(dialogName) {\n return this.element.querySelector(`[data-trix-dialog=${dialogName}]`)\n }\n}\n","/* eslint-disable\n id-length,\n*/\nimport * as config from \"trix/config\"\n\nimport { serializeToContentType } from \"trix/core/serialization\"\n\nimport Controller from \"trix/controllers/controller\"\nimport Level0InputController from \"trix/controllers/level_0_input_controller\"\nimport Level2InputController from \"trix/controllers/level_2_input_controller\"\nimport CompositionController from \"trix/controllers/composition_controller\"\nimport ToolbarController from \"trix/controllers/toolbar_controller\"\nimport Composition from \"trix/models/composition\"\nimport Editor from \"trix/models/editor\"\nimport AttachmentManager from \"trix/models/attachment_manager\"\nimport SelectionManager from \"trix/models/selection_manager\"\n\nimport { getBlockConfig, objectsAreEqual, rangeIsCollapsed, rangesAreEqual } from \"trix/core/helpers\"\nimport { selectionChangeObserver } from \"trix/observers/selection_change_observer\"\n\nconst snapshotsAreEqual = (a, b) => rangesAreEqual(a.selectedRange, b.selectedRange) && a.document.isEqualTo(b.document)\n\nexport default class EditorController extends Controller {\n static actions = {\n undo: {\n test() {\n return this.editor.canUndo()\n },\n perform() {\n return this.editor.undo()\n },\n },\n redo: {\n test() {\n return this.editor.canRedo()\n },\n perform() {\n return this.editor.redo()\n },\n },\n link: {\n test() {\n return this.editor.canActivateAttribute(\"href\")\n },\n },\n increaseNestingLevel: {\n test() {\n return this.editor.canIncreaseNestingLevel()\n },\n perform() {\n return this.editor.increaseNestingLevel() && this.render()\n },\n },\n decreaseNestingLevel: {\n test() {\n return this.editor.canDecreaseNestingLevel()\n },\n perform() {\n return this.editor.decreaseNestingLevel() && this.render()\n },\n },\n attachFiles: {\n test() {\n return true\n },\n perform() {\n return config.input.pickFiles(this.editor.insertFiles)\n },\n },\n }\n\n constructor({ editorElement, document, html }) {\n super(...arguments)\n this.editorElement = editorElement\n this.selectionManager = new SelectionManager(this.editorElement)\n this.selectionManager.delegate = this\n\n this.composition = new Composition()\n this.composition.delegate = this\n\n this.attachmentManager = new AttachmentManager(this.composition.getAttachments())\n this.attachmentManager.delegate = this\n\n this.inputController =\n config.input.getLevel() === 2\n ? new Level2InputController(this.editorElement)\n : new Level0InputController(this.editorElement)\n\n this.inputController.delegate = this\n this.inputController.responder = this.composition\n\n this.compositionController = new CompositionController(this.editorElement, this.composition)\n this.compositionController.delegate = this\n\n this.toolbarController = new ToolbarController(this.editorElement.toolbarElement)\n this.toolbarController.delegate = this\n\n this.editor = new Editor(this.composition, this.selectionManager, this.editorElement)\n if (document) {\n this.editor.loadDocument(document)\n } else {\n this.editor.loadHTML(html)\n }\n }\n\n registerSelectionManager() {\n return selectionChangeObserver.registerSelectionManager(this.selectionManager)\n }\n\n unregisterSelectionManager() {\n return selectionChangeObserver.unregisterSelectionManager(this.selectionManager)\n }\n\n render() {\n return this.compositionController.render()\n }\n\n reparse() {\n return this.composition.replaceHTML(this.editorElement.innerHTML)\n }\n\n // Composition delegate\n\n compositionDidChangeDocument(document) {\n this.notifyEditorElement(\"document-change\")\n if (!this.handlingInput) {\n return this.render()\n }\n }\n\n compositionDidChangeCurrentAttributes(currentAttributes) {\n this.currentAttributes = currentAttributes\n this.toolbarController.updateAttributes(this.currentAttributes)\n this.updateCurrentActions()\n return this.notifyEditorElement(\"attributes-change\", { attributes: this.currentAttributes })\n }\n\n compositionDidPerformInsertionAtRange(range) {\n if (this.pasting) {\n this.pastedRange = range\n }\n }\n\n compositionShouldAcceptFile(file) {\n return this.notifyEditorElement(\"file-accept\", { file })\n }\n\n compositionDidAddAttachment(attachment) {\n const managedAttachment = this.attachmentManager.manageAttachment(attachment)\n return this.notifyEditorElement(\"attachment-add\", { attachment: managedAttachment })\n }\n\n compositionDidEditAttachment(attachment) {\n this.compositionController.rerenderViewForObject(attachment)\n const managedAttachment = this.attachmentManager.manageAttachment(attachment)\n this.notifyEditorElement(\"attachment-edit\", { attachment: managedAttachment })\n return this.notifyEditorElement(\"change\")\n }\n\n compositionDidChangeAttachmentPreviewURL(attachment) {\n this.compositionController.invalidateViewForObject(attachment)\n return this.notifyEditorElement(\"change\")\n }\n\n compositionDidRemoveAttachment(attachment) {\n const managedAttachment = this.attachmentManager.unmanageAttachment(attachment)\n return this.notifyEditorElement(\"attachment-remove\", { attachment: managedAttachment })\n }\n\n compositionDidStartEditingAttachment(attachment, options) {\n this.attachmentLocationRange = this.composition.document.getLocationRangeOfAttachment(attachment)\n this.compositionController.installAttachmentEditorForAttachment(attachment, options)\n return this.selectionManager.setLocationRange(this.attachmentLocationRange)\n }\n\n compositionDidStopEditingAttachment(attachment) {\n this.compositionController.uninstallAttachmentEditor()\n this.attachmentLocationRange = null\n }\n\n compositionDidRequestChangingSelectionToLocationRange(locationRange) {\n if (this.loadingSnapshot && !this.isFocused()) return\n this.requestedLocationRange = locationRange\n this.compositionRevisionWhenLocationRangeRequested = this.composition.revision\n if (!this.handlingInput) {\n return this.render()\n }\n }\n\n compositionWillLoadSnapshot() {\n this.loadingSnapshot = true\n }\n\n compositionDidLoadSnapshot() {\n this.compositionController.refreshViewCache()\n this.render()\n this.loadingSnapshot = false\n }\n\n getSelectionManager() {\n return this.selectionManager\n }\n\n // Attachment manager delegate\n\n attachmentManagerDidRequestRemovalOfAttachment(attachment) {\n return this.removeAttachment(attachment)\n }\n\n // Document controller delegate\n\n compositionControllerWillSyncDocumentView() {\n this.inputController.editorWillSyncDocumentView()\n this.selectionManager.lock()\n return this.selectionManager.clearSelection()\n }\n\n compositionControllerDidSyncDocumentView() {\n this.inputController.editorDidSyncDocumentView()\n this.selectionManager.unlock()\n this.updateCurrentActions()\n return this.notifyEditorElement(\"sync\")\n }\n\n compositionControllerDidRender() {\n if (this.requestedLocationRange) {\n if (this.compositionRevisionWhenLocationRangeRequested === this.composition.revision) {\n this.selectionManager.setLocationRange(this.requestedLocationRange)\n }\n this.requestedLocationRange = null\n this.compositionRevisionWhenLocationRangeRequested = null\n }\n\n if (this.renderedCompositionRevision !== this.composition.revision) {\n this.runEditorFilters()\n this.composition.updateCurrentAttributes()\n this.notifyEditorElement(\"render\")\n }\n\n this.renderedCompositionRevision = this.composition.revision\n }\n\n compositionControllerDidFocus() {\n if (this.isFocusedInvisibly()) {\n this.setLocationRange({ index: 0, offset: 0 })\n }\n this.toolbarController.hideDialog()\n return this.notifyEditorElement(\"focus\")\n }\n\n compositionControllerDidBlur() {\n return this.notifyEditorElement(\"blur\")\n }\n\n compositionControllerDidSelectAttachment(attachment, options) {\n this.toolbarController.hideDialog()\n return this.composition.editAttachment(attachment, options)\n }\n\n compositionControllerDidRequestDeselectingAttachment(attachment) {\n const locationRange = this.attachmentLocationRange || this.composition.document.getLocationRangeOfAttachment(attachment)\n return this.selectionManager.setLocationRange(locationRange[1])\n }\n\n compositionControllerWillUpdateAttachment(attachment) {\n return this.editor.recordUndoEntry(\"Edit Attachment\", { context: attachment.id, consolidatable: true })\n }\n\n compositionControllerDidRequestRemovalOfAttachment(attachment) {\n return this.removeAttachment(attachment)\n }\n\n // Input controller delegate\n\n inputControllerWillHandleInput() {\n this.handlingInput = true\n this.requestedRender = false\n }\n\n inputControllerDidRequestRender() {\n this.requestedRender = true\n }\n\n inputControllerDidHandleInput() {\n this.handlingInput = false\n if (this.requestedRender) {\n this.requestedRender = false\n return this.render()\n }\n }\n\n inputControllerDidAllowUnhandledInput() {\n return this.notifyEditorElement(\"change\")\n }\n\n inputControllerDidRequestReparse() {\n return this.reparse()\n }\n\n inputControllerWillPerformTyping() {\n return this.recordTypingUndoEntry()\n }\n\n inputControllerWillPerformFormatting(attributeName) {\n return this.recordFormattingUndoEntry(attributeName)\n }\n\n inputControllerWillCutText() {\n return this.editor.recordUndoEntry(\"Cut\")\n }\n\n inputControllerWillPaste(paste) {\n this.editor.recordUndoEntry(\"Paste\")\n this.pasting = true\n return this.notifyEditorElement(\"before-paste\", { paste })\n }\n\n inputControllerDidPaste(paste) {\n paste.range = this.pastedRange\n this.pastedRange = null\n this.pasting = null\n return this.notifyEditorElement(\"paste\", { paste })\n }\n\n inputControllerWillMoveText() {\n return this.editor.recordUndoEntry(\"Move\")\n }\n\n inputControllerWillAttachFiles() {\n return this.editor.recordUndoEntry(\"Drop Files\")\n }\n\n inputControllerWillPerformUndo() {\n return this.editor.undo()\n }\n\n inputControllerWillPerformRedo() {\n return this.editor.redo()\n }\n\n inputControllerDidReceiveKeyboardCommand(keys) {\n return this.toolbarController.applyKeyboardCommand(keys)\n }\n\n inputControllerDidStartDrag() {\n this.locationRangeBeforeDrag = this.selectionManager.getLocationRange()\n }\n\n inputControllerDidReceiveDragOverPoint(point) {\n return this.selectionManager.setLocationRangeFromPointRange(point)\n }\n\n inputControllerDidCancelDrag() {\n this.selectionManager.setLocationRange(this.locationRangeBeforeDrag)\n this.locationRangeBeforeDrag = null\n }\n\n // Selection manager delegate\n\n locationRangeDidChange(locationRange) {\n this.composition.updateCurrentAttributes()\n this.updateCurrentActions()\n if (this.attachmentLocationRange && !rangesAreEqual(this.attachmentLocationRange, locationRange)) {\n this.composition.stopEditingAttachment()\n }\n return this.notifyEditorElement(\"selection-change\")\n }\n\n // Toolbar controller delegate\n\n toolbarDidClickButton() {\n if (!this.getLocationRange()) {\n return this.setLocationRange({ index: 0, offset: 0 })\n }\n }\n\n toolbarDidInvokeAction(actionName, invokingElement) {\n return this.invokeAction(actionName, invokingElement)\n }\n\n toolbarDidToggleAttribute(attributeName) {\n this.recordFormattingUndoEntry(attributeName)\n this.composition.toggleCurrentAttribute(attributeName)\n this.render()\n if (!this.selectionFrozen) {\n return this.editorElement.focus()\n }\n }\n\n toolbarDidUpdateAttribute(attributeName, value) {\n this.recordFormattingUndoEntry(attributeName)\n this.composition.setCurrentAttribute(attributeName, value)\n this.render()\n if (!this.selectionFrozen) {\n return this.editorElement.focus()\n }\n }\n\n toolbarDidRemoveAttribute(attributeName) {\n this.recordFormattingUndoEntry(attributeName)\n this.composition.removeCurrentAttribute(attributeName)\n this.render()\n if (!this.selectionFrozen) {\n return this.editorElement.focus()\n }\n }\n\n toolbarWillShowDialog(dialogElement) {\n this.composition.expandSelectionForEditing()\n return this.freezeSelection()\n }\n\n toolbarDidShowDialog(dialogName) {\n return this.notifyEditorElement(\"toolbar-dialog-show\", { dialogName })\n }\n\n toolbarDidHideDialog(dialogName) {\n this.thawSelection()\n this.editorElement.focus()\n return this.notifyEditorElement(\"toolbar-dialog-hide\", { dialogName })\n }\n\n // Selection\n\n freezeSelection() {\n if (!this.selectionFrozen) {\n this.selectionManager.lock()\n this.composition.freezeSelection()\n this.selectionFrozen = true\n return this.render()\n }\n }\n\n thawSelection() {\n if (this.selectionFrozen) {\n this.composition.thawSelection()\n this.selectionManager.unlock()\n this.selectionFrozen = false\n return this.render()\n }\n }\n\n canInvokeAction(actionName) {\n if (this.actionIsExternal(actionName)) {\n return true\n } else {\n return !!this.actions[actionName]?.test?.call(this)\n }\n }\n\n invokeAction(actionName, invokingElement) {\n if (this.actionIsExternal(actionName)) {\n return this.notifyEditorElement(\"action-invoke\", { actionName, invokingElement })\n } else {\n return this.actions[actionName]?.perform?.call(this)\n }\n }\n\n actionIsExternal(actionName) {\n return /^x-./.test(actionName)\n }\n\n getCurrentActions() {\n const result = {}\n for (const actionName in this.actions) {\n result[actionName] = this.canInvokeAction(actionName)\n }\n return result\n }\n\n updateCurrentActions() {\n const currentActions = this.getCurrentActions()\n if (!objectsAreEqual(currentActions, this.currentActions)) {\n this.currentActions = currentActions\n this.toolbarController.updateActions(this.currentActions)\n return this.notifyEditorElement(\"actions-change\", { actions: this.currentActions })\n }\n }\n\n // Editor filters\n\n runEditorFilters() {\n let snapshot = this.composition.getSnapshot()\n\n Array.from(this.editor.filters).forEach((filter) => {\n const { document, selectedRange } = snapshot\n snapshot = filter.call(this.editor, snapshot) || {}\n if (!snapshot.document) {\n snapshot.document = document\n }\n if (!snapshot.selectedRange) {\n snapshot.selectedRange = selectedRange\n }\n })\n\n if (!snapshotsAreEqual(snapshot, this.composition.getSnapshot())) {\n return this.composition.loadSnapshot(snapshot)\n }\n }\n\n // Private\n\n updateInputElement() {\n const element = this.compositionController.getSerializableElement()\n const value = serializeToContentType(element, \"text/html\")\n return this.editorElement.setInputElementValue(value)\n }\n\n notifyEditorElement(message, data) {\n switch (message) {\n case \"document-change\":\n this.documentChangedSinceLastRender = true\n break\n case \"render\":\n if (this.documentChangedSinceLastRender) {\n this.documentChangedSinceLastRender = false\n this.notifyEditorElement(\"change\")\n }\n break\n case \"change\":\n case \"attachment-add\":\n case \"attachment-edit\":\n case \"attachment-remove\":\n this.updateInputElement()\n break\n }\n\n return this.editorElement.notify(message, data)\n }\n\n removeAttachment(attachment) {\n this.editor.recordUndoEntry(\"Delete Attachment\")\n this.composition.removeAttachment(attachment)\n return this.render()\n }\n\n recordFormattingUndoEntry(attributeName) {\n const blockConfig = getBlockConfig(attributeName)\n const locationRange = this.selectionManager.getLocationRange()\n if (blockConfig || !rangeIsCollapsed(locationRange)) {\n return this.editor.recordUndoEntry(\"Formatting\", { context: this.getUndoContext(), consolidatable: true })\n }\n }\n\n recordTypingUndoEntry() {\n return this.editor.recordUndoEntry(\"Typing\", {\n context: this.getUndoContext(this.currentAttributes),\n consolidatable: true,\n })\n }\n\n getUndoContext(...context) {\n return [ this.getLocationContext(), this.getTimeContext(), ...Array.from(context) ]\n }\n\n getLocationContext() {\n const locationRange = this.selectionManager.getLocationRange()\n if (rangeIsCollapsed(locationRange)) {\n return locationRange[0].index\n } else {\n return locationRange\n }\n }\n\n getTimeContext() {\n if (config.undo.interval > 0) {\n return Math.floor(new Date().getTime() / config.undo.interval)\n } else {\n return 0\n }\n }\n\n isFocused() {\n return this.editorElement === this.editorElement.ownerDocument?.activeElement\n }\n\n // Detect \"Cursor disappears sporadically\" Firefox bug.\n // - https://bugzilla.mozilla.org/show_bug.cgi?id=226301\n isFocusedInvisibly() {\n return this.isFocused() && !this.getLocationRange()\n }\n\n get actions() {\n return this.constructor.actions\n }\n}\n\nEditorController.proxyMethod(\"getSelectionManager().setLocationRange\")\nEditorController.proxyMethod(\"getSelectionManager().getLocationRange\")\n","import * as config from \"trix/config\"\n\nimport { installDefaultCSSForTagName } from \"trix/core/helpers\"\n\ninstallDefaultCSSForTagName(\"trix-toolbar\", `\\\n%t {\n display: block;\n}\n\n%t {\n white-space: nowrap;\n}\n\n%t [data-trix-dialog] {\n display: none;\n}\n\n%t [data-trix-dialog][data-trix-active] {\n display: block;\n}\n\n%t [data-trix-dialog] [data-trix-validate]:invalid {\n background-color: #ffdddd;\n}`)\n\nexport default class TrixToolbarElement extends HTMLElement {\n\n // Element lifecycle\n\n connectedCallback() {\n if (this.innerHTML === \"\") {\n this.innerHTML = config.toolbar.getDefaultHTML()\n }\n }\n}\n","import * as config from \"trix/config\"\n\nimport {\n findClosestElementFromNode,\n handleEvent,\n handleEventOnce,\n installDefaultCSSForTagName,\n makeElement,\n triggerEvent,\n} from \"trix/core/helpers\"\n\nimport { attachmentSelector } from \"trix/config/attachments\"\nimport EditorController from \"trix/controllers/editor_controller\"\nimport \"trix/elements/trix_toolbar_element\"\n\nlet id = 0\n\n// Contenteditable support helpers\n\nconst autofocus = function(element) {\n if (!document.querySelector(\":focus\")) {\n if (element.hasAttribute(\"autofocus\") && document.querySelector(\"[autofocus]\") === element) {\n return element.focus()\n }\n }\n}\n\nconst makeEditable = function(element) {\n if (element.hasAttribute(\"contenteditable\")) {\n return\n }\n element.setAttribute(\"contenteditable\", \"\")\n return handleEventOnce(\"focus\", {\n onElement: element,\n withCallback() {\n return configureContentEditable(element)\n },\n })\n}\n\nconst configureContentEditable = function(element) {\n disableObjectResizing(element)\n return setDefaultParagraphSeparator(element)\n}\n\nconst disableObjectResizing = function(element) {\n if (document.queryCommandSupported?.(\"enableObjectResizing\")) {\n document.execCommand(\"enableObjectResizing\", false, false)\n return handleEvent(\"mscontrolselect\", { onElement: element, preventDefault: true })\n }\n}\n\nconst setDefaultParagraphSeparator = function(element) {\n if (document.queryCommandSupported?.(\"DefaultParagraphSeparator\")) {\n const { tagName } = config.blockAttributes.default\n if ([ \"div\", \"p\" ].includes(tagName)) {\n return document.execCommand(\"DefaultParagraphSeparator\", false, tagName)\n }\n }\n}\n\n// Accessibility helpers\n\nconst addAccessibilityRole = function(element) {\n if (element.hasAttribute(\"role\")) {\n return\n }\n return element.setAttribute(\"role\", \"textbox\")\n}\n\nconst ensureAriaLabel = function(element) {\n if (element.hasAttribute(\"aria-label\") || element.hasAttribute(\"aria-labelledby\")) {\n return\n }\n\n const update = function() {\n const texts = Array.from(element.labels).map((label) => {\n if (!label.contains(element)) return label.textContent\n }).filter(text => text)\n\n const text = texts.join(\" \")\n if (text) {\n return element.setAttribute(\"aria-label\", text)\n } else {\n return element.removeAttribute(\"aria-label\")\n }\n }\n update()\n return handleEvent(\"focus\", { onElement: element, withCallback: update })\n}\n\n// Style\n\nconst cursorTargetStyles = (function() {\n if (config.browser.forcesObjectResizing) {\n return {\n display: \"inline\",\n width: \"auto\",\n }\n } else {\n return {\n display: \"inline-block\",\n width: \"1px\",\n }\n }\n})()\n\ninstallDefaultCSSForTagName(\"trix-editor\", `\\\n%t {\n display: block;\n}\n\n%t:empty::before {\n content: attr(placeholder);\n color: graytext;\n cursor: text;\n pointer-events: none;\n white-space: pre-line;\n}\n\n%t a[contenteditable=false] {\n cursor: text;\n}\n\n%t img {\n max-width: 100%;\n height: auto;\n}\n\n%t ${attachmentSelector} figcaption textarea {\n resize: none;\n}\n\n%t ${attachmentSelector} figcaption textarea.trix-autoresize-clone {\n position: absolute;\n left: -9999px;\n max-height: 0px;\n}\n\n%t ${attachmentSelector} figcaption[data-trix-placeholder]:empty::before {\n content: attr(data-trix-placeholder);\n color: graytext;\n}\n\n%t [data-trix-cursor-target] {\n display: ${cursorTargetStyles.display} !important;\n width: ${cursorTargetStyles.width} !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n}\n\n%t [data-trix-cursor-target=left] {\n vertical-align: top !important;\n margin-left: -1px !important;\n}\n\n%t [data-trix-cursor-target=right] {\n vertical-align: bottom !important;\n margin-right: -1px !important;\n}`)\n\nexport default class TrixEditorElement extends HTMLElement {\n\n // Properties\n\n get trixId() {\n if (this.hasAttribute(\"trix-id\")) {\n return this.getAttribute(\"trix-id\")\n } else {\n this.setAttribute(\"trix-id\", ++id)\n return this.trixId\n }\n }\n\n get labels() {\n const labels = []\n if (this.id && this.ownerDocument) {\n labels.push(...Array.from(this.ownerDocument.querySelectorAll(`label[for='${this.id}']`) || []))\n }\n\n const label = findClosestElementFromNode(this, { matchingSelector: \"label\" })\n if (label) {\n if ([ this, null ].includes(label.control)) {\n labels.push(label)\n }\n }\n\n return labels\n }\n\n get toolbarElement() {\n if (this.hasAttribute(\"toolbar\")) {\n return this.ownerDocument?.getElementById(this.getAttribute(\"toolbar\"))\n } else if (this.parentNode) {\n const toolbarId = `trix-toolbar-${this.trixId}`\n this.setAttribute(\"toolbar\", toolbarId)\n const element = makeElement(\"trix-toolbar\", { id: toolbarId })\n this.parentNode.insertBefore(element, this)\n return element\n } else {\n return undefined\n }\n }\n\n get form() {\n return this.inputElement?.form\n }\n\n get inputElement() {\n if (this.hasAttribute(\"input\")) {\n return this.ownerDocument?.getElementById(this.getAttribute(\"input\"))\n } else if (this.parentNode) {\n const inputId = `trix-input-${this.trixId}`\n this.setAttribute(\"input\", inputId)\n const element = makeElement(\"input\", { type: \"hidden\", id: inputId })\n this.parentNode.insertBefore(element, this.nextElementSibling)\n return element\n } else {\n return undefined\n }\n }\n\n get editor() {\n return this.editorController?.editor\n }\n\n get name() {\n return this.inputElement?.name\n }\n\n get value() {\n return this.inputElement?.value\n }\n\n set value(defaultValue) {\n this.defaultValue = defaultValue\n this.editor?.loadHTML(this.defaultValue)\n }\n\n // Controller delegate methods\n\n notify(message, data) {\n if (this.editorController) {\n return triggerEvent(`trix-${message}`, { onElement: this, attributes: data })\n }\n }\n\n setInputElementValue(value) {\n if (this.inputElement) {\n this.inputElement.value = value\n }\n }\n\n // Element lifecycle\n\n connectedCallback() {\n if (!this.hasAttribute(\"data-trix-internal\")) {\n makeEditable(this)\n addAccessibilityRole(this)\n ensureAriaLabel(this)\n\n if (!this.editorController) {\n triggerEvent(\"trix-before-initialize\", { onElement: this })\n this.editorController = new EditorController({\n editorElement: this,\n html: this.defaultValue = this.value,\n })\n requestAnimationFrame(() => triggerEvent(\"trix-initialize\", { onElement: this }))\n }\n this.editorController.registerSelectionManager()\n this.registerResetListener()\n this.registerClickListener()\n autofocus(this)\n }\n }\n\n disconnectedCallback() {\n this.editorController?.unregisterSelectionManager()\n this.unregisterResetListener()\n return this.unregisterClickListener()\n }\n\n // Form support\n\n registerResetListener() {\n this.resetListener = this.resetBubbled.bind(this)\n return window.addEventListener(\"reset\", this.resetListener, false)\n }\n\n unregisterResetListener() {\n return window.removeEventListener(\"reset\", this.resetListener, false)\n }\n\n registerClickListener() {\n this.clickListener = this.clickBubbled.bind(this)\n return window.addEventListener(\"click\", this.clickListener, false)\n }\n\n unregisterClickListener() {\n return window.removeEventListener(\"click\", this.clickListener, false)\n }\n\n resetBubbled(event) {\n if (event.defaultPrevented) return\n if (event.target !== this.form) return\n return this.reset()\n }\n\n clickBubbled(event) {\n if (event.defaultPrevented) return\n if (this.contains(event.target)) return\n\n const label = findClosestElementFromNode(event.target, { matchingSelector: \"label\" })\n if (!label) return\n\n if (!Array.from(this.labels).includes(label)) return\n\n return this.focus()\n }\n\n reset() {\n this.value = this.defaultValue\n }\n}\n","import { version } from \"../../package.json\"\n\nimport * as config from \"trix/config\"\nimport * as core from \"trix/core\"\nimport * as models from \"trix/models\"\nimport * as views from \"trix/views\"\nimport * as controllers from \"trix/controllers\"\nimport * as observers from \"trix/observers\"\nimport * as operations from \"trix/operations\"\nimport * as elements from \"trix/elements\"\nimport * as filters from \"trix/filters\"\n\nconst Trix = {\n VERSION: version,\n config,\n core,\n models,\n views,\n controllers,\n observers,\n operations,\n elements,\n filters\n}\n\n// Expose models under the Trix constant for compatibility with v1\nObject.assign(Trix, models)\n\nfunction start() {\n if (!customElements.get(\"trix-toolbar\")) {\n customElements.define(\"trix-toolbar\", elements.TrixToolbarElement)\n }\n\n if (!customElements.get(\"trix-editor\")) {\n customElements.define(\"trix-editor\", elements.TrixEditorElement)\n }\n}\n\nwindow.Trix = Trix\nsetTimeout(start, 0)\n\nexport default Trix\n"],"names":["attachmentSelector","attachments","preview","presentation","caption","name","size","file","attributes","default","tagName","parse","quote","nestable","heading1","terminal","breakOnReturn","group","code","htmlAttributes","text","plaintext","bulletList","bullet","listAttribute","test","element","parentNode","this","numberList","number","attachmentGallery","exclusive","_element$tagName","toLowerCase","androidVersionMatch","navigator","userAgent","match","androidVersion","parseInt","browser$1","composesExistingText","recentAndroid","samsungAndroid","forcesObjectResizing","supportsInputEvents","InputEvent","every","prop","prototype","lang$1","attachFiles","bold","bullets","byte","bytes","captionPlaceholder","indent","italic","link","numbers","outdent","redo","remove","strike","undo","unlink","url","urlPlaceholder","GB","KB","MB","PB","TB","sizes","lang","file_size_formatting","prefix","precision","formatter","concat","base","exp","Math","floor","log","withoutInsignificantZeros","pow","toFixed","replace","ZERO_WIDTH_SPACE","NON_BREAKING_SPACE","extend","properties","key","value","html","document","documentElement","matches","handleEvent","eventName","onElement","matchingSelector","withCallback","inPhase","preventDefault","times","arguments","length","undefined","selector","useCapture","handler","event","destroy","target","findClosestElementFromNode","call","removeEventListener","addEventListener","triggerEvent","bubbles","cancelable","createEvent","initEvent","dispatchEvent","elementMatchesSelector","nodeType","node","untilNode","Node","ELEMENT_NODE","closest","innerElementIsActive","activeElement","elementContainsNode","findChildIndexOfNode","_node","childIndex","previousSibling","removeNode","_node$parentNode","removeChild","walkTree","tree","onlyNodesOfType","usingFilter","expandEntityReferences","whatToShow","NodeFilter","SHOW_ELEMENT","SHOW_TEXT","SHOW_COMMENT","SHOW_ALL","createTreeWalker","makeElement","tag","options","createElement","editable","contenteditable","setAttribute","style","data","dataset","className","split","forEach","classList","add","textContent","childNodes","childNode","appendChild","blockTagNames","getBlockTagNames","blockAttributes","push","nodeIsBlockContainer","nodeIsBlockStartComment","firstChild","nodeIsBlockStart","strict","includes","nodeProbablyIsBlockContainer","nodeIsCommentNode","COMMENT_NODE","nodeIsCursorTarget","nodeIsTextNode","trixCursorTarget","nodeIsAttachmentElement","nodeIsEmptyTextNode","TEXT_NODE","input","level2Enabled","getLevel","browser","pickFiles","callback","type","multiple","hidden","id","fileInputId","files","getElementById","body","click","parser","removeBlankTableCells","tableCellSeparator","tableRowSeparator","text_attributes","inheritable","window","getComputedStyle","fontWeight","fontStyle","href","groupTagName","getAttribute","frozen","backgroundColor","toolbar","getDefaultHTML","interval","attachment","attachmentCaption","attachmentCaptionEditor","attachmentMetadata","attachmentMetadataContainer","attachmentName","attachmentProgress","attachmentSize","attachmentToolbar","BasicObject","proxyMethod","expression","toMethod","toProperty","optional","parseProxyMethodExpression","subject","object","_this$toMethod","_object","apply","proxyMethodExpressionPattern","Error","args","Function","RegExp","UTF16String","box","fromUCS2String","toString","ucs2String","ucs2decode","fromCodepoints","codepoints","ucs2encode","constructor","super","ucs2Length","offsetToUCS2Offset","offset","slice","max","offsetFromUCS2Offset","ucs2Offset","charAt","isEqualTo","toJSON","getCacheKey","hasArrayFrom","_Array$from","Array","from","hasStringCodePointAt","_$codePointAt","codePointAt","hasStringFromCodePoint","_String$fromCodePoint","String","fromCodePoint","string","map","char","output","counter","charCodeAt","extra","array","result","fromCharCode","join","TrixObject","fromJSONString","jsonString","fromJSON","JSON","hasSameConstructorAs","inspect","parts","contents","contentsForInspection","toJSONString","stringify","toUTF16String","arraysAreEqual","a","b","index","spliceArray","_len","_key","splice","RTL_PATTERN","getDirection","dir","dirName","textArea","form","supportsDirName","FormData","has","error","supportsDirSelector","get","trim","allAttributeNames","blockAttributeNames","textAttributeNames","listAttributeNames","getAllAttributeNames","getTextAttributeNames","getBlockAttributeNames","getBlockConfig","attributeName","config","Object","keys","getTextConfig","installDefaultCSSForTagName","defaultCSS","insertStyleElementForTagName","nonce","getCSPNonce","head","insertBefore","getMetaElement","querySelector","testTransferData","dataTransferIsPlainText","dataTransfer","getData","DOMParser","parseFromString","keyEventIsKeyboardCommand","platform","metaKey","ctrlKey","defer","fn","setTimeout","copyObject","objectsAreEqual","normalizeRange","range","isArray","copyValue","rangeIsCollapsed","start","end","rangeValuesAreEqual","rangesAreEqual","leftRange","rightRange","leftStart","leftEnd","rightStart","rightEnd","left","right","SelectionChangeObserver","update","bind","selectionManagers","started","stop","registerSelectionManager","selectionManager","unregisterSelectionManager","filter","sm","notifySelectionManagersOfSelectionChange","selectionDidChange","reset","selectionChangeObserver","getDOMSelection","selection","getSelection","rangeCount","getDOMRange","_getDOMSelection","domRange","getRangeAt","domRangeIsPrivate","setDOMRange","removeAllRanges","addRange","nodeIsPrivate","startContainer","endContainer","getPrototypeOf","normalizeSpaces","breakableWhitespacePattern","squishBreakableWhitespace","source","utf16StringDifferences","diffA","utf16StringDifference","utf16String","diffB","leftIndex","rightIndexA","rightIndexB","Hash","fromCommonAttributesOfObjects","objects","hash","getKeys","getKeysCommonToHash","values","copy","merge","unbox","toArray","isEmpty","toObject","keyToRemove","sort","ObjectGroup","groupObjects","ungroupedObjects","depth","asTree","_object$canBeGrouped2","_object$canBeGrouped","_group$canBeGroupedWi","_group","canBeGrouped","canBeGroupedWith","getObjects","getDepth","ObjectMap","find","ElementStore","elements","getKey","trixStoreKey","Operation","isPerforming","performing","hasPerformed","performed","hasSucceeded","succeeded","hasFailed","getPromise","promise","Promise","resolve","reject","perform","release","_this$promise","_this$promise$cancel","cancel","ObjectView","childViews","rootView","getNodes","nodes","createNodes","cloneNode","invalidate","_this$parentView","parentView","invalidateViewForObject","_this$findViewForObje","findViewForObject","findOrCreateCachedChildView","viewClass","view","getCachedViewForObject","recordChildView","createChildView","cacheViewForObject","ObjectGroupView","getAllChildViews","views","childView","findElement","findElementForObject","getViewCache","isViewCachingEnabled","viewCache","shouldCacheViews","enableViewCaching","disableViewCaching","_this$getViewCache","cache","garbageCollectCachedViews","objectKeys","objectGroup","getChildViews","createContainerElement","DEFAULT_ALLOWED_ATTRIBUTES","DEFAULT_FORBIDDEN_PROTOCOLS","DEFAULT_FORBIDDEN_ELEMENTS","HTMLSanitizer","setHTML","sanitizedElement","sanitize","sanitizedHtml","getHTML","outerHTML","innerHTML","sanitizer","allowedAttributes","forbiddenProtocols","forbiddenElements","createBodyElementForHTML","sanitizeElements","normalizeListElementNesting","getBody","walker","nodesToRemove","nextNode","currentNode","elementIsRemovable","sanitizeElement","hasAttribute","protocol","removeAttribute","_ref","indexOf","querySelectorAll","listElement","previousElement","previousElementSibling","elementIsForbidden","elementIsntSerializable","doc","implementation","createHTMLDocument","css","AttachmentView","uploadProgressDelegate","attachmentPiece","piece","createContentNodes","innerElement","figure","getClassName","getHref","tabindex","hasContent","getContent","createCaptionElement","isPending","progressElement","class","getUploadProgress","trixMutable","createCursorTarget","figcaption","getCaption","captionConfig","getCaptionConfig","getFilename","getFormattedFilesize","nameElement","createTextNode","sizeElement","names","getType","extension","getExtension","trixAttachment","trixContentType","getContentType","trixId","trixAttributes","trixSerialize","htmlContainsTagName","_config$attachments$t","findProgressElement","_this$findElement","attachmentDidChangeUploadProgress","div","PreviewableAttachmentView","previewDelegate","image","src","refresh","updateAttributesForImage","getURL","previewURL","getPreviewURL","serializedAttributes","width","getWidth","height","getHeight","storeKey","attachmentDidChangeAttributes","PieceView","getAttributes","textConfig","context","createAttachmentNodes","createStringNodes","_element","firstElementChild","findInnerElement","isPreviewable","_this$textConfig","iterable","substring","preserveSpaces","styles","pendingElement","styleProperty","isLast","isFirst","followsWhitespace","TextView","pieces","getPieces","lastIndex","endsWithWhitespace","previousPiece","BlockView","block","createComment","_getBlockConfig","getLastAttribute","textView","shouldAddExtraNewlineElement","isRTL","assign","getBlockBreakPosition","entries","DocumentView","render","sync","elementStore","setDocument","shadowElement","getBlocks","isSynced","elementsHaveEqualHTML","fragment","createDocumentFragmentForSync","lastChild","didSync","findStoredElements","createDocumentFragment","storedElement","replaceChild","otherElement","ignoreSpaces","Piece","registerType","types","pieceJSON","copyWithAttributes","getValue","copyWithAdditionalAttributes","copyWithoutAttribute","attribute","getAttributesHash","hasSameStringValueAsPiece","hasSameAttributesAsPiece","isBlockBreak","isSerializable","getLength","canBeConsolidatedWith","_defineProperty","ImagePreloadOperation","Image","onload","naturalWidth","naturalHeight","onerror","Attachment","attachmentForFile","attributesForFile","setFile","filename","filesize","contentType","attachmentJSON","releaseFile","didChangeAttributes","setAttributes","newAttributes","_this$previewDelegate","_this$previewDelegate2","_this$delegate","_this$delegate$attach","delegate","preloadURL","previewablePattern","getFilesize","_this$getFilename$mat","getFile","preloadFile","releasePreloadedFile","uploadProgress","setUploadProgress","_this$uploadProgressD","_this$uploadProgressD2","preloadingURL","setPreviewURL","_this$previewDelegate3","_this$previewDelegate4","_this$delegate2","_this$delegate2$attac","attachmentDidChangePreviewURL","preload","fileObjectURL","URL","createObjectURL","revokeObjectURL","then","catch","AttachmentPiece","ensureAttachmentExclusivelyHasAttribute","removeProhibitedAttributes","permittedAttributes","_piece$attachment","json","toConsole","StringPiece","normalizeNewlines","consolidateWith","splitAtOffset","SplittableList","eachObject","insertObjectAtIndex","insertSplittableListAtIndex","splittableList","insertSplittableListAtPosition","position","splitObjectAtPosition","editObjectAtIndex","replaceObjectAtIndex","removeObjectAtIndex","getObjectAtIndex","getSplittableListInRange","rightIndex","splitObjectsAtRange","selectSplittableList","removeObjectsInRange","transformObjectsInRange","transform","transformedObjects","rightOuterIndex","leftInnerIndex","startOfRange","endOfRange","getObjectAtPosition","findIndexAndOffsetAtPosition","splitIndex","splitOffset","leftObject","rightObject","consolidate","pendingObject","_pendingObject$canBeC","_pendingObject","consolidateFromIndexToIndex","startIndex","endIndex","objectsInRange","consolidatedInRange","currentPosition","nextPosition","findPositionAtIndexAndOffset","currentIndex","getEndPosition","endPosition","objectArraysAreEqual","Text","textForAttachmentWithAttributes","textForStringWithAttributes","textJSON","notEmpty","pieceList","copyWithPieceList","copyUsingObjectMap","objectMap","appendText","insertTextAtPosition","removeTextAtRange","replaceTextAtRange","moveTextFromRangeToPosition","getTextAtRange","addAttributeAtRange","addAttributesAtRange","removeAttributeAtRange","setAttributesAtRange","getAttributesAtPosition","_this$pieceList$getOb","getCommonAttributes","getCommonAttributesAtRange","getExpandedRangeForAttributeAtOffset","getStringAtRange","getStringAtPosition","startsWithString","endsWithString","getAttachmentPieces","getAttachments","getAttachmentAndPositionById","attachmentId","getAttachmentById","getRangeOfAttachment","attachmentAndPosition","updateAttributesForAttachment","_text$pieceList","eachPiece","getPieceAtPosition","toSerializableText","Block","blockJSON","applyBlockBreakToText","copyWithText","copyWithoutText","copyWithoutAttributes","mappedText","addAttribute","expandAttribute","addHTMLAttribute","removeLastValue","removeLastAttribute","getLastElement","getAttributeLevel","getAttributeAtLevel","level","hasAttributes","getLastNestableAttribute","getNestableAttributes","getNestingLevel","decreaseNestingLevel","increaseNestingLevel","lastIndexOf","getListItemAttributes","isListItem","isTerminalBlock","_getBlockConfig2","breaksOnReturn","_getBlockConfig3","findLineBreakInDirectionFromPosition","direction","newlineText","getTextWithoutBlockBreak","textEndsInBlockBreak","otherBlock","otherAttributes","otherAttribute","getListAttributeNames","unmarkExistingInnerBlockBreaksInText","addBlockBreakToText","modified","innerPieces","lastPiece","unmarkBlockBreakPiece","blockBreakText","blockBreak","Document","documentJSON","fromString","textAttributes","blocks","blockList","getBlockAtIndex","consolidateBlocks","copyUsingObjectsFromDocument","sourceDocument","copyWithBaseBlockAttributes","replaceBlock","oldBlock","newBlock","insertDocumentAtRange","locationFromPosition","getBlockAtPosition","mergeDocumentAtRange","formattedDocument","startPosition","startLocation","baseBlockAttributes","getBaseBlockAttributes","trailingBlockAttributes","leadingBlockAttributes","blockCount","getBlockCount","firstBlock","firstText","insertTextAtRange","leftPosition","rightPosition","leftLocation","rightLocation","locationRangeFromRange","leftOffset","leftBlock","rightOffset","rightBlock","leftText","rightText","affectedBlockCount","getDocumentAtRange","movingRightward","eachBlockAtRange","textRange","eachBlock","getTextAtIndex","removeAttributeForAttachment","setHTMLAttributeAtPosition","updatedBlock","insertBlockBreakAtRange","applyBlockAttributeAtRange","expanded","expandRangeToLineBreaksAndSplitBlocks","blockConfig","removeLastListAttributeAtRange","exceptAttributeName","converted","convertLineBreaksToBlockBreaksInRange","removeBlockAttributesAtRange","removeLastTerminalAttributeAtRange","consolidateBlocksAtRange","lastAttributeName","endLocation","startBlock","positionFromLocation","endBlock","_this$getBlockAtIndex","getTextAtPosition","getCharacterAtPosition","getEditCount","editCount","getCommonAttributesAtPosition","attributesForBlock","commonAttributes","attributesLeft","inheritableAttributes","getRangeOfCommonAttributeAtPosition","startOffset","endOffset","blockIndex","lastAttributeIndex","min","attachmentPieces","getLocationRangeOfAttachment","getAttachmentPieceForAttachment","findRangesForBlockAttribute","ranges","findRangesForTextAttribute","withValue","location","locationRangeFromPosition","rangeFromLocationRange","locationRange","getTexts","toSerializableDocument","pieceForString","parseTrixDataAttribute","HTMLParser","referenceElement","blockElements","processedElements","getDocument","createHiddenContainer","containerElement","nodeFilter","processNode","translateBlockElementMarginsToNewlines","removeHiddenContainer","display","nextSibling","isInsignificantTextNode","appendBlockForTextNode","processTextNode","appendBlockForElement","processElement","currentBlockElement","isBlockElement","appendStringWithAttributes","_this$currentBlock","getBlockAttributes","getBlockHTMLAttributes","currentBlock","appendBlockForAttributesWithElement","elementIsBlockElement","currentBlockContainsElement","parentBlockElement","findParentBlockElement","appendEmptyBlock","parentElement","_node$previousSibling","elementCanDisplayPreformattedText","stringEndsWithWhitespace","leftTrimBreakableWhitespace","getTextAttributes","appendAttachmentWithAttributes","isExtraBR","dimensions","getImageDimensions","needsTableSeparator","blockForAttributes","appendPiece","pieceForAttachment","appendStringToTextAtIndex","prependStringToTextAtIndex","unshift","configAttr","attributeInheritedFromBlock","blockElement","findBlockElementAncestors","attrConfig","_attrConfig$test","reverse","settings","ancestors","stringIsAllBreakableWhitespace","nodeEndsWithNonWhitespace","_element$previousSibl","content","defaultMargin","getMarginOfDefaultBlockElement","margin","getMarginOfBlockElementAtIndex","top","bottom","getBlockElementMargin","whiteSpace","marginTop","marginBottom","FILTER_REJECT","FILTER_ACCEPT","unserializableAttributeNames","serializedAttributesAttribute","serializedAttributesSelector","blockCommentPattern","serializers","serializable","HTMLElement","el","ManagedAttachment","attachmentManager","requestRemovalOfAttachment","AttachmentManager","managedAttachments","manageAttachment","attachmentIsManaged","attachmentManagerDidRequestRemovalOfAttachment","unmanageAttachment","managedAttachment","LineBreakInsertion","composition","selectedRange","getSelectedRange","previousCharacter","nextCharacter","shouldInsertBlockBreak","shouldBreakFormattedBlock","shouldDecreaseListLevel","shouldPrependListItem","shouldRemoveLastBlockAttribute","Composition","currentAttributes","revision","_this$delegate$compos","refreshAttachments","compositionDidChangeDocument","getSnapshot","loadSnapshot","_this$delegate2$compo","_this$delegate3","_this$delegate3$compo","compositionWillLoadSnapshot","setSelection","compositionDidLoadSnapshot","insertText","updatePosition","notifyDelegateOfInsertionAtRange","insertBlock","insertDocument","insertString","getCurrentTextAttributes","insertBlockBreak","insertLineBreak","insertion","decreaseListLevel","removeLastBlockAttribute","breakFormattedBlock","insertHTML","replaceHTML","getLocationRange","insertFile","insertFiles","_this$delegate4","compositionShouldAcceptFile","insertAttachments","insertAttachment","attachmentText","shouldManageDeletingInDirection","shouldManageMovingCursorInDirection","deleteInDirection","deletingIntoPreviousBlock","selectionSpansBlocks","selectionIsCollapsed","canDecreaseBlockAttributeLevel","getBlock","decreaseBlockAttributeLevel","getExpandedRangeInDirection","getAttachmentAtRange","editAttachment","moveTextFromRange","removeAttachment","stopEditingAttachment","removeCurrentAttribute","insertPlaceholder","placeholderPosition","getPosition","selectPlaceholder","setSelectedRange","PLACEHOLDER","forgetPlaceholder","hasCurrentAttribute","toggleCurrentAttribute","setCurrentAttribute","canSetCurrentAttribute","canSetCurrentBlockAttribute","canSetCurrentTextAttribute","getSelectedDocument","setBlockAttribute","setTextAttribute","notifyDelegateOfCurrentAttributesChange","setHTMLAtributeAtPosition","allowedHTMLAttributes","newDocument","removeBlockAttribute","updateCurrentAttributes","removeTextAttribute","canDecreaseNestingLevel","_this$getBlock","canIncreaseNestingLevel","previousBlock","getPreviousBlock","arrayStartsWith","_this$getBlock2","_this$getBlock3","attributeLevel","ignoreLock","getCurrentAttributes","freezeSelection","thawSelection","hasFrozenSelection","_this$delegate5","compositionDidRequestChangingSelectionToLocationRange","getSelectionManager","setLocationRange","targetLocationRange","withTargetLocationRange","withTargetRange","withTargetDOMRange","createLocationRangeFromDOMRange","translateUTF16PositionFromOffset","editingAttachment","moveCursorInDirection","canEditAttachment","expandSelectionInDirection","expandSelectionForEditing","expandSelectionAroundCommonAttribute","selectionContainsAttachments","_this$getSelectedAtta","getSelectedAttachments","selectionIsInCursorTarget","positionIsCursorTarget","locationIsCursorTarget","positionIsBlockBreak","_this$document$getPie","_this$getSelectedDocu","added","removed","oldArray","newArray","existingValues","Set","currentValues","summarizeArrayChange","_this$delegate6","_this$delegate6$compo","compositionDidRemoveAttachment","_this$delegate7","_this$delegate7$compo","compositionDidAddAttachment","_this$delegate8","_this$delegate8$compo","compositionDidEditAttachment","_this$delegate9","_this$delegate9$compo","compositionDidChangeAttachmentPreviewURL","_this$delegate10","_this$delegate10$comp","compositionDidStartEditingAttachment","_this$delegate11","_this$delegate11$comp","compositionDidStopEditingAttachment","_this$delegate12","_this$delegate12$comp","compositionDidChangeCurrentAttributes","_this$delegate13","_this$delegate13$comp","compositionDidPerformInsertionAtRange","utf16string","utf16position","UndoManager","undoEntries","redoEntries","recordUndoEntry","description","consolidatable","previousEntry","entryHasDescriptionAndContext","undoEntry","createEntry","pop","redoEntry","snapshot","canUndo","canRedo","entry","BLOCK_ATTRIBUTE_NAME","Filter","applyBlockAttribute","findRangesOfBlocks","findRangesOfPieces","moveSelectedRangeForward","attachmentGalleryFilter","DEFAULT_FILTERS","Editor","undoManager","filters","loadDocument","loadHTML","loadJSON","getClientRectAtPosition","getClientRectAtLocationRange","activateAttribute","attributeIsActive","canActivateAttribute","deactivateAttribute","LocationMapper","findLocationFromContainerAndOffset","container","foundBlock","attachmentElement","findAttachmentElementParentForNode","rejectAttachmentContents","nodeLength","findContainerAndOffsetFromLocation","nodeOffset","findNodeAndOffsetFromLocation","getSignificantNodesForIndex","acceptSignificantNodes","recordingNodes","rejectEmptyTextNodes","PointMapper","createDOMRangeFromPoint","x","y","caretPositionFromPoint","offsetNode","createRange","setStart","caretRangeFromPoint","createTextRange","originalDOMRange","moveToPoint","select","getClientRectsForDOMRange","getClientRects","SelectionManager","didMouseDown","locationMapper","pointMapper","lockCount","currentLocationRange","lockedLocationRange","createDOMRangeFromLocationRange","updateCurrentLocationRange","setLocationRangeFromPointRange","pointRange","getLocationAtPoint","lock","unlock","clearSelection","_getDOMRange","collapsed","selectionIsExpanded","domRangeWithinElement","pauseTemporarily","resumeHandlers","paused","resume","clearTimeout","resumeTimeout","_this$delegate$locati","locationRangeDidChange","rangeStart","rangeEnd","setEnd","point","_this$createLocationR","keyNames","undoable","commands","do","undos","AttachmentEditorController","title","trixAction","didClickToolbar","didClickActionButton","textarea","placeholder","textareaClone","tabIndex","autoresize","scrollHeight","didInputCaption","didKeyDownCaption","didChangeCaption","didBlurCaption","editingFigcaption","editCaption","focus","install","makeElementMutable","addToolbar","installCaptionEditor","uninstall","savePendingCaption","didUninstallAttachmentEditor","pendingCaption","_this$delegate3$attac","attachmentEditorDidRequestUpdatingAttributesForAttachment","attachmentEditorDidRequestRemovingAttributeForAttachment","stopPropagation","attachmentEditorDidRequestRemovalOfAttachment","_this$delegate5$attac","keyCode","attachmentEditorDidRequestDeselectingAttachment","CompositionController","didFocus","didBlur","didClickAttachment","documentView","_this$blurPromise","focused","compositionControllerDidFocus","blurPromise","compositionControllerDidBlur","findAttachmentForElement","compositionControllerDidSelectAttachment","getSerializableElement","isEditingAttachment","_this$delegate4$compo","_this$delegate5$compo","canSyncDocumentView","compositionControllerWillSyncDocumentView","compositionControllerDidSyncDocumentView","compositionControllerDidRender","rerenderViewForObject","refreshViewCache","attachmentEditor","installAttachmentEditorForAttachment","_this$attachmentEdito","uninstallAttachmentEditor","_this$attachmentEdito2","compositionControllerWillUpdateAttachment","compositionControllerDidRequestRemovalOfAttachment","compositionControllerDidRequestDeselectingAttachment","Controller","mutableAttributeName","mutableSelector","childList","characterData","characterDataOldValue","subtree","MutationObserver","didMutate","observer","observe","disconnect","mutations","_this$delegate$elemen","findSignificantMutations","elementDidMutate","getMutationSummary","mutation","mutationIsSignificant","nodeIsMutable","nodesModifiedByMutation","nodeIsSignificant","addedNodes","removedNodes","getTextMutationSummary","additions","deletions","getTextChangesFromCharacterData","textChanges","getTextChangesFromChildList","addition","summary","textAdded","deleted","textDeleted","getMutationsByType","textRemoved","getTextForNodes","characterMutations","startMutation","endMutation","summarized","oldString","newString","summarizeStringChange","oldValue","FileVerificationOperation","reader","FileReader","abort","readAsArrayBuffer","FlakyAndroidKeyboardDetector","shouldIgnore","previousEvent","checkSamsungKeyboardBuggyModeStart","checkSamsungKeyboardBuggyModeEnd","buggyMode","insertingLongTextAfterUnidentifiedChar","differsInWhitespace","innerText","inputType","_this$event$data","isBeforeInputInsertText","previousEventWasUnidentifiedKeydown","_this$previousEvent","_this$previousEvent2","text1","text2","normalize","whiteSpaceNormalizerRegexp","InputController","mutationObserver","flakyKeyboardDetector","events","handlerFor","mutationSummary","editorWillSyncDocumentView","editorDidSyncDocumentView","requestRender","_this$delegate$inputC","inputControllerDidRequestRender","requestReparse","_this$delegate2$input","inputControllerDidRequestReparse","operations","all","handleInput","_this$responder","inputControllerWillAttachFiles","responder","defaultPrevented","inputControllerWillHandleInput","inputControllerDidHandleInput","createLinkHTML","pastedFileCount","Level0InputController","resetInputSummary","setInputSummary","inputSummary","isComposing","inputControllerDidAllowUnhandledInput","mutationIsExpected","preferDocument","mutationAdditionMatchesSummary","mutationDeletionMatchesSummary","didDelete","unexpectedNewlineAddition","unexpectedNewlineDeletion","_this$compositionInpu","textChanged","composedEmptyString","compositionInput","getEndData","getCompositionInput","CompositionInput","isEnded","_this$responder2","serializeSelectionToDataTransfer","_this$responder3","setData","dataTransferIsWritable","canAcceptDataTransfer","Files","getPastedHTMLUsingHiddenElement","pageXOffset","pageYOffset","opacity","requestAnimationFrame","keydown","didInput","keyName","_context2","modifier","_context","character","inputControllerDidReceiveKeyboardCommand","keypress","altKey","stringFromKeyEvent","_this$responder9","inputControllerWillPerformTyping","textInput","toUpperCase","_this$responder10","dragenter","dragstart","_this$delegate5$input","draggedRange","inputControllerDidStartDrag","dragover","draggingPoint","clientX","clientY","_this$delegate6$input","inputControllerDidReceiveDragOverPoint","dragend","_this$delegate7$input","inputControllerDidCancelDrag","drop","_event$dataTransfer","_this$responder11","_this$responder12","inputControllerWillMoveText","_this$responder13","cut","_this$responder14","clipboardData","inputControllerWillCutText","_this$responder15","paste","clipboard","testClipboardData","pasteEventIsCrippledSafariHTMLPaste","_this$responder16","inputControllerWillPaste","inputControllerDidPaste","_this$responder17","_this$delegate14","_this$responder18","_this$delegate15","_this$delegate16","_this$responder19","_this$delegate17","_clipboard$items","_clipboard$items$getA","items","getAsFile","_this$delegate18","_this$responder20","_this$delegate19","extensionForFile","compositionstart","compositionupdate","compositionend","beforeinput","backspace","_this$delegate20","delete","_this$delegate21","return","_this$delegate22","_this$responder21","tab","_this$responder22","_this$responder23","_this$responder24","_this$responder25","control","d","_this$delegate23","h","_this$delegate24","o","_this$delegate25","_this$responder26","shift","_this$delegate26","_this$responder27","_this$responder28","_this$responder29","alt","_this$delegate27","meta","_this$delegate28","_file$type","which","charCode","hasPasteboardFlavor","hasReadableDynamicData","isExternalHTMLPaste","isExternalRichTextPaste","inputController","isSignificant","_this$responder5","_this$responder4","canApplyToDocument","_this$responder6","_this$responder7","_this$responder8","_this$data$start","_this$data$end","Level2InputController","scheduledRender","composing","reparse","scheduleRender","_this$afterRender","cancelAnimationFrame","afterRender","toggleAttributeIfSupported","inputControllerWillPerformFormatting","activateAttributeIfSupported","getTargetDOMRange","minLength","_this$event$getTarget","_this$event","targetRanges","getTargetRanges","staticRangeToRange","withEvent","command","keyboardCommandFromKeyEvent","shiftKey","_event$clipboardData","pasteEventHasFilesOnly","pasteEventHasPlainTextOnly","inputTypes","dragging","pointFromEvent","dragEventHasFiles","ArrowLeft","ArrowRight","Backspace","Tab","deleteByComposition","deleteByCut","deleteByDrag","deleteByDragRange","deleteCompositionText","deleteContent","deleteContentBackward","deleteContentForward","deleteEntireSoftLine","deleteHardLineBackward","deleteHardLineForward","deleteSoftLineBackward","deleteSoftLineForward","deleteWordBackward","deleteWordForward","formatBackColor","formatBold","formatFontColor","formatFontName","formatIndent","formatItalic","formatJustifyCenter","formatJustifyFull","formatJustifyLeft","formatJustifyRight","formatOutdent","formatRemove","_this$responder30","formatSetBlockTextDirection","formatSetInlineTextDirection","formatStrikeThrough","formatSubscript","formatSuperscript","formatUnderline","historyRedo","inputControllerWillPerformRedo","historyUndo","inputControllerWillPerformUndo","insertCompositionText","insertFromComposition","insertFromDrop","_this$responder31","insertFromPaste","_this$responder32","_this$responder33","processableFilePaste","_this$responder34","_this$responder35","insertFromYank","insertLink","insertOrderedList","insertParagraph","_this$responder36","insertReplacementText","replacement","_this$event$dataTrans","insertTranspose","insertUnorderedList","staticRange","_event$dataTransfer$f","dataTransferIsMsOfficePaste","attributeButtonSelector","actionButtonSelector","toolbarButtonSelector","dialogSelector","activeDialogSelector","dialogButtonSelector","dialogInputSelector","getInputForDialog","getAttributeName","getActionName","ToolbarController","didClickAttributeButton","didClickDialogButton","didKeyDownDialogInput","actions","resetDialogInputs","toolbarDidClickButton","actionName","getDialog","toggleDialog","toolbarDidInvokeAction","toolbarDidToggleAttribute","refreshAttributeButtons","dialogElement","dialog","hideDialog","updateActions","refreshActionButtons","eachActionButton","disabled","updateAttributes","eachAttributeButton","dialogIsVisible","applyKeyboardCommand","keyString","button","buttonKeys","dialogName","showDialog","toolbarWillShowDialog","disabledInput","toolbarDidShowDialog","willValidate","checkValidity","toolbarDidUpdateAttribute","toolbarDidRemoveAttribute","toolbarDidHideDialog","getDialogName","EditorController","editorElement","compositionController","toolbarController","toolbarElement","editor","notifyEditorElement","handlingInput","updateCurrentActions","pasting","pastedRange","attachmentLocationRange","loadingSnapshot","isFocused","requestedLocationRange","compositionRevisionWhenLocationRangeRequested","renderedCompositionRevision","runEditorFilters","isFocusedInvisibly","requestedRender","recordTypingUndoEntry","recordFormattingUndoEntry","locationRangeBeforeDrag","invokingElement","invokeAction","selectionFrozen","canInvokeAction","actionIsExternal","_this$actions$actionN","_this$actions$actionN2","getCurrentActions","currentActions","snapshotsAreEqual","updateInputElement","serializer","serializeToContentType","setInputElementValue","message","documentChangedSinceLastRender","notify","getUndoContext","getLocationContext","getTimeContext","Date","getTime","_this$editorElement$o","ownerDocument","TrixToolbarElement","connectedCallback","makeEditable","handleEventOnce","configureContentEditable","disableObjectResizing","setDefaultParagraphSeparator","_document$queryComman","_document","queryCommandSupported","execCommand","_document$queryComman2","_document2","cursorTargetStyles","TrixEditorElement","labels","label","_this$ownerDocument","toolbarId","_this$inputElement","inputElement","_this$ownerDocument2","inputId","nextElementSibling","_this$editorControlle","editorController","_this$inputElement2","_this$inputElement3","defaultValue","_this$editor","addAccessibilityRole","texts","contains","ensureAriaLabel","registerResetListener","registerClickListener","autofocus","disconnectedCallback","_this$editorControlle2","unregisterResetListener","unregisterClickListener","resetListener","resetBubbled","clickListener","clickBubbled","Trix","VERSION","version","core","models","controllers","observers","customElements","define"],"mappings":";;;;mPAAO,MAAMA,EAAqB,yBAE5BC,EAAc,CAClBC,QAAS,CACPC,aAAc,UACdC,QAAS,CACPC,MAAM,EACNC,MAAM,IAGVC,KAAM,CACJH,QAAS,CACPE,MAAM,KCZNE,EAAa,CACjBC,QAAS,CACPC,QAAS,MACTC,OAAO,GAETC,MAAO,CACLF,QAAS,aACTG,UAAU,GAEZC,SAAU,CACRJ,QAAS,KACTK,UAAU,EACVC,eAAe,EACfC,OAAO,GAETC,KAAM,CACJR,QAAS,MACTK,UAAU,EACVI,eAAgB,CAAE,YAClBC,KAAM,CACJC,WAAW,IAGfC,WAAY,CACVZ,QAAS,KACTC,OAAO,GAETY,OAAQ,CACNb,QAAS,KACTc,cAAe,aACfP,OAAO,EACPJ,UAAU,EACVY,IAAAA,CAAKC,GACH,OAAOhB,EAAQgB,EAAQC,cAAgBnB,EAAWoB,KAAKJ,eAAed,OACxE,GAEFmB,WAAY,CACVnB,QAAS,KACTC,OAAO,GAETmB,OAAQ,CACNpB,QAAS,KACTc,cAAe,aACfP,OAAO,EACPJ,UAAU,EACVY,IAAAA,CAAKC,GACH,OAAOhB,EAAQgB,EAAQC,cAAgBnB,EAAWoB,KAAKJ,eAAed,OACxE,GAEFqB,kBAAmB,CACjBrB,QAAS,MACTsB,WAAW,EACXjB,UAAU,EACVJ,OAAO,EACPM,OAAO,IAILP,EAAWgB,IAAO,IAAAO,EAAA,OAAKP,SAAgB,QAATO,EAAPP,EAAShB,eAATuB,IAAgBA,OAAhBA,EAAAA,EAAkBC,aAAa,EC1DtDC,E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