slate 0.57.2 → 0.57.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../src/utils/weak-maps.ts","../src/utils/string.ts","../src/interfaces/editor.ts","../src/interfaces/element.ts","../src/interfaces/location.ts","../src/interfaces/node.ts","../src/interfaces/operation.ts","../src/interfaces/path.ts","../src/interfaces/path-ref.ts","../src/interfaces/point.ts","../src/interfaces/point-ref.ts","../src/interfaces/range.ts","../src/interfaces/range-ref.ts","../src/interfaces/text.ts","../src/transforms/general.ts","../src/transforms/node.ts","../src/transforms/selection.ts","../src/transforms/text.ts","../src/transforms/index.ts","../src/create-editor.ts"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","import { Editor, Path, PathRef, PointRef, RangeRef } from '..'\n\nexport const DIRTY_PATHS: WeakMap<Editor, Path[]> = new WeakMap()\nexport const FLUSHING: WeakMap<Editor, boolean> = new WeakMap()\nexport const NORMALIZING: WeakMap<Editor, boolean> = new WeakMap()\nexport const PATH_REFS: WeakMap<Editor, Set<PathRef>> = new WeakMap()\nexport const POINT_REFS: WeakMap<Editor, Set<PointRef>> = new WeakMap()\nexport const RANGE_REFS: WeakMap<Editor, Set<RangeRef>> = new WeakMap()\n","/**\n * Constants for string distance checking.\n */\n\nconst SPACE = /\\s/\nconst PUNCTUATION = /[\\u0021-\\u0023\\u0025-\\u002A\\u002C-\\u002F\\u003A\\u003B\\u003F\\u0040\\u005B-\\u005D\\u005F\\u007B\\u007D\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]/\nconst CHAMELEON = /['\\u2018\\u2019]/\nconst SURROGATE_START = 0xd800\nconst SURROGATE_END = 0xdfff\nconst ZERO_WIDTH_JOINER = 0x200d\n\n/**\n * Get the distance to the end of the first character in a string of text.\n */\n\nexport const getCharacterDistance = (text: string): number => {\n let offset = 0\n // prev types:\n // SURR: surrogate pair\n // MOD: modifier (technically also surrogate pair)\n // ZWJ: zero width joiner\n // VAR: variation selector\n // BMP: sequenceable character from basic multilingual plane\n let prev: 'SURR' | 'MOD' | 'ZWJ' | 'VAR' | 'BMP' | null = null\n let charCode = text.charCodeAt(0)\n\n while (charCode) {\n if (isSurrogate(charCode)) {\n const modifier = isModifier(charCode, text, offset)\n\n // Early returns are the heart of this function, where we decide if previous and current\n // codepoints should form a single character (in terms of how many of them should selection\n // jump over).\n if (prev === 'SURR' || prev === 'BMP') {\n break\n }\n\n offset += 2\n prev = modifier ? 'MOD' : 'SURR'\n charCode = text.charCodeAt(offset)\n // Absolutely fine to `continue` without any checks because if `charCode` is NaN (which\n // is the case when out of `text` range), next `while` loop won\"t execute and we\"re done.\n continue\n }\n\n if (charCode === ZERO_WIDTH_JOINER) {\n offset += 1\n prev = 'ZWJ'\n charCode = text.charCodeAt(offset)\n\n continue\n }\n\n if (isBMPEmoji(charCode)) {\n if (prev && prev !== 'ZWJ' && prev !== 'VAR') {\n break\n }\n offset += 1\n prev = 'BMP'\n charCode = text.charCodeAt(offset)\n\n continue\n }\n\n if (isVariationSelector(charCode)) {\n if (prev && prev !== 'ZWJ') {\n break\n }\n offset += 1\n prev = 'VAR'\n charCode = text.charCodeAt(offset)\n continue\n }\n\n // Modifier 'groups up' with what ever character is before that (even whitespace), need to\n // look ahead.\n if (prev === 'MOD') {\n offset += 1\n break\n }\n\n // If while loop ever gets here, we're done (e.g latin chars).\n break\n }\n\n return offset || 1\n}\n\n/**\n * Get the distance to the end of the first word in a string of text.\n */\n\nexport const getWordDistance = (text: string): number => {\n let length = 0\n let i = 0\n let started = false\n let char\n\n while ((char = text.charAt(i))) {\n const l = getCharacterDistance(char)\n char = text.slice(i, i + l)\n const rest = text.slice(i + l)\n\n if (isWordCharacter(char, rest)) {\n started = true\n length += l\n } else if (!started) {\n length += l\n } else {\n break\n }\n\n i += l\n }\n\n return length\n}\n\n/**\n * Check if a character is a word character. The `remaining` argument is used\n * because sometimes you must read subsequent characters to truly determine it.\n */\n\nconst isWordCharacter = (char: string, remaining: string): boolean => {\n if (SPACE.test(char)) {\n return false\n }\n\n // Chameleons count as word characters as long as they're in a word, so\n // recurse to see if the next one is a word character or not.\n if (CHAMELEON.test(char)) {\n let next = remaining.charAt(0)\n const length = getCharacterDistance(next)\n next = remaining.slice(0, length)\n const rest = remaining.slice(length)\n\n if (isWordCharacter(next, rest)) {\n return true\n }\n }\n\n if (PUNCTUATION.test(char)) {\n return false\n }\n\n return true\n}\n\n/**\n * Determines if `code` is a surrogate\n */\n\nconst isSurrogate = (code: number): boolean =>\n SURROGATE_START <= code && code <= SURROGATE_END\n\n/**\n * Does `code` form Modifier with next one.\n *\n * https://emojipedia.org/modifiers/\n */\n\nconst isModifier = (code: number, text: string, offset: number): boolean => {\n if (code === 0xd83c) {\n const next = text.charCodeAt(offset + 1)\n return next <= 0xdfff && next >= 0xdffb\n }\n return false\n}\n\n/**\n * Is `code` a Variation Selector.\n *\n * https://codepoints.net/variation_selectors\n */\n\nconst isVariationSelector = (code: number): boolean => {\n return code <= 0xfe0f && code >= 0xfe00\n}\n\n/**\n * Is `code` one of the BMP codes used in emoji sequences.\n *\n * https://emojipedia.org/emoji-zwj-sequences/\n */\n\nconst isBMPEmoji = (code: number): boolean => {\n // This requires tiny bit of maintanance, better ideas?\n // Fortunately it only happens if new Unicode Standard\n // is released. Fails gracefully if upkeep lags behind,\n // same way Slate previously behaved with all emojis.\n return (\n code === 0x2764 || // heart (❤)\n code === 0x2642 || // male (♂)\n code === 0x2640 || // female (♀)\n code === 0x2620 || // scull (☠)\n code === 0x2695 || // medical (⚕)\n code === 0x2708 || // plane (✈️)\n code === 0x25ef // large circle (◯)\n )\n}\n","import isPlainObject from 'is-plain-object'\nimport { createDraft, finishDraft, isDraft } from 'immer'\nimport { reverse as reverseText } from 'esrever'\n\nimport {\n Ancestor,\n Descendant,\n Element,\n Location,\n Node,\n NodeEntry,\n Operation,\n Path,\n PathRef,\n Point,\n PointRef,\n Range,\n RangeRef,\n Span,\n Text,\n} from '..'\nimport {\n DIRTY_PATHS,\n NORMALIZING,\n PATH_REFS,\n POINT_REFS,\n RANGE_REFS,\n} from '../utils/weak-maps'\nimport { getWordDistance, getCharacterDistance } from '../utils/string'\n\n/**\n * The `Editor` interface stores all the state of a Slate editor. It is extended\n * by plugins that wish to add their own helpers and implement new behaviors.\n */\n\nexport interface Editor {\n children: Node[]\n selection: Range | null\n operations: Operation[]\n marks: Record<string, any> | null\n [key: string]: any\n\n // Schema-specific node behaviors.\n isInline: (element: Element) => boolean\n isVoid: (element: Element) => boolean\n normalizeNode: (entry: NodeEntry) => void\n onChange: () => void\n\n // Overrideable core actions.\n addMark: (key: string, value: any) => void\n apply: (operation: Operation) => void\n deleteBackward: (unit: 'character' | 'word' | 'line' | 'block') => void\n deleteForward: (unit: 'character' | 'word' | 'line' | 'block') => void\n deleteFragment: () => void\n insertBreak: () => void\n insertFragment: (fragment: Node[]) => void\n insertNode: (node: Node) => void\n insertText: (text: string) => void\n removeMark: (key: string) => void\n}\n\nexport const Editor = {\n /**\n * Get the ancestor above a location in the document.\n */\n\n above<T extends Ancestor>(\n editor: Editor,\n options: {\n at?: Location\n match?: NodeMatch<T>\n mode?: 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ): NodeEntry<T> | undefined {\n const {\n voids = false,\n mode = 'lowest',\n at = editor.selection,\n match,\n } = options\n\n if (!at) {\n return\n }\n\n const path = Editor.path(editor, at)\n const reverse = mode === 'lowest'\n\n for (const [n, p] of Editor.levels(editor, {\n at: path,\n voids,\n match,\n reverse,\n })) {\n if (!Text.isText(n) && !Path.equals(path, p)) {\n return [n, p]\n }\n }\n },\n\n /**\n * Add a custom property to the leaf text nodes in the current selection.\n *\n * If the selection is currently collapsed, the marks will be added to the\n * `editor.marks` property instead, and applied when text is inserted next.\n */\n\n addMark(editor: Editor, key: string, value: any): void {\n editor.addMark(key, value)\n },\n\n /**\n * Get the point after a location.\n */\n\n after(\n editor: Editor,\n at: Location,\n options: {\n distance?: number\n unit?: 'offset' | 'character' | 'word' | 'line' | 'block'\n } = {}\n ): Point | undefined {\n const anchor = Editor.point(editor, at, { edge: 'end' })\n const focus = Editor.end(editor, [])\n const range = { anchor, focus }\n const { distance = 1 } = options\n let d = 0\n let target\n\n for (const p of Editor.positions(editor, { ...options, at: range })) {\n if (d > distance) {\n break\n }\n\n if (d !== 0) {\n target = p\n }\n\n d++\n }\n\n return target\n },\n\n /**\n * Get the point before a location.\n */\n\n before(\n editor: Editor,\n at: Location,\n options: {\n distance?: number\n unit?: 'offset' | 'character' | 'word' | 'line' | 'block'\n } = {}\n ): Point | undefined {\n const anchor = Editor.start(editor, [])\n const focus = Editor.point(editor, at, { edge: 'start' })\n const range = { anchor, focus }\n const { distance = 1 } = options\n let d = 0\n let target\n\n for (const p of Editor.positions(editor, {\n ...options,\n at: range,\n reverse: true,\n })) {\n if (d > distance) {\n break\n }\n\n if (d !== 0) {\n target = p\n }\n\n d++\n }\n\n return target\n },\n\n /**\n * Delete content in the editor backward from the current selection.\n */\n\n deleteBackward(\n editor: Editor,\n options: {\n unit?: 'character' | 'word' | 'line' | 'block'\n } = {}\n ): void {\n const { unit = 'character' } = options\n editor.deleteBackward(unit)\n },\n\n /**\n * Delete content in the editor forward from the current selection.\n */\n\n deleteForward(\n editor: Editor,\n options: {\n unit?: 'character' | 'word' | 'line' | 'block'\n } = {}\n ): void {\n const { unit = 'character' } = options\n editor.deleteForward(unit)\n },\n\n /**\n * Delete the content in the current selection.\n */\n\n deleteFragment(editor: Editor): void {\n editor.deleteFragment()\n },\n\n /**\n * Get the start and end points of a location.\n */\n\n edges(editor: Editor, at: Location): [Point, Point] {\n return [Editor.start(editor, at), Editor.end(editor, at)]\n },\n\n /**\n * Get the end point of a location.\n */\n\n end(editor: Editor, at: Location): Point {\n return Editor.point(editor, at, { edge: 'end' })\n },\n\n /**\n * Get the first node at a location.\n */\n\n first(editor: Editor, at: Location): NodeEntry {\n const path = Editor.path(editor, at, { edge: 'start' })\n return Editor.node(editor, path)\n },\n\n /**\n * Get the fragment at a location.\n */\n\n fragment(editor: Editor, at: Location): Descendant[] {\n const range = Editor.range(editor, at)\n const fragment = Node.fragment(editor, range)\n return fragment\n },\n /**\n * Check if a node has block children.\n */\n\n hasBlocks(editor: Editor, element: Element): boolean {\n return element.children.some(n => Editor.isBlock(editor, n))\n },\n\n /**\n * Check if a node has inline and text children.\n */\n\n hasInlines(editor: Editor, element: Element): boolean {\n return element.children.some(\n n => Text.isText(n) || Editor.isInline(editor, n)\n )\n },\n\n /**\n * Check if a node has text children.\n */\n\n hasTexts(editor: Editor, element: Element): boolean {\n return element.children.every(n => Text.isText(n))\n },\n\n /**\n * Insert a block break at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\n\n insertBreak(editor: Editor): void {\n editor.insertBreak()\n },\n\n /**\n * Insert a fragment at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\n\n insertFragment(editor: Editor, fragment: Node[]): void {\n editor.insertFragment(fragment)\n },\n\n /**\n * Insert a node at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\n\n insertNode(editor: Editor, node: Node): void {\n editor.insertNode(node)\n },\n\n /**\n * Insert text at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\n\n insertText(editor: Editor, text: string): void {\n editor.insertText(text)\n },\n\n /**\n * Check if a value is a block `Element` object.\n */\n\n isBlock(editor: Editor, value: any): value is Element {\n return Element.isElement(value) && !editor.isInline(value)\n },\n\n /**\n * Check if a value is an `Editor` object.\n */\n\n isEditor(value: any): value is Editor {\n return (\n isPlainObject(value) &&\n typeof value.addMark === 'function' &&\n typeof value.apply === 'function' &&\n typeof value.deleteBackward === 'function' &&\n typeof value.deleteForward === 'function' &&\n typeof value.deleteFragment === 'function' &&\n typeof value.insertBreak === 'function' &&\n typeof value.insertFragment === 'function' &&\n typeof value.insertNode === 'function' &&\n typeof value.insertText === 'function' &&\n typeof value.isInline === 'function' &&\n typeof value.isVoid === 'function' &&\n typeof value.normalizeNode === 'function' &&\n typeof value.onChange === 'function' &&\n typeof value.removeMark === 'function' &&\n (value.marks === null || isPlainObject(value.marks)) &&\n (value.selection === null || Range.isRange(value.selection)) &&\n Node.isNodeList(value.children) &&\n Operation.isOperationList(value.operations)\n )\n },\n\n /**\n * Check if a point is the end point of a location.\n */\n\n isEnd(editor: Editor, point: Point, at: Location): boolean {\n const end = Editor.end(editor, at)\n return Point.equals(point, end)\n },\n\n /**\n * Check if a point is an edge of a location.\n */\n\n isEdge(editor: Editor, point: Point, at: Location): boolean {\n return Editor.isStart(editor, point, at) || Editor.isEnd(editor, point, at)\n },\n\n /**\n * Check if an element is empty, accounting for void nodes.\n */\n\n isEmpty(editor: Editor, element: Element): boolean {\n const { children } = element\n const [first] = children\n return (\n children.length === 0 ||\n (children.length === 1 &&\n Text.isText(first) &&\n first.text === '' &&\n !editor.isVoid(element))\n )\n },\n\n /**\n * Check if a value is an inline `Element` object.\n */\n\n isInline(editor: Editor, value: any): value is Element {\n return Element.isElement(value) && editor.isInline(value)\n },\n\n /**\n * Check if the editor is currently normalizing after each operation.\n */\n\n isNormalizing(editor: Editor): boolean {\n const isNormalizing = NORMALIZING.get(editor)\n return isNormalizing === undefined ? true : isNormalizing\n },\n\n /**\n * Check if a point is the start point of a location.\n */\n\n isStart(editor: Editor, point: Point, at: Location): boolean {\n // PERF: If the offset isn't `0` we know it's not the start.\n if (point.offset !== 0) {\n return false\n }\n\n const start = Editor.start(editor, at)\n return Point.equals(point, start)\n },\n\n /**\n * Check if a value is a void `Element` object.\n */\n\n isVoid(editor: Editor, value: any): value is Element {\n return Element.isElement(value) && editor.isVoid(value)\n },\n\n /**\n * Get the last node at a location.\n */\n\n last(editor: Editor, at: Location): NodeEntry {\n const path = Editor.path(editor, at, { edge: 'end' })\n return Editor.node(editor, path)\n },\n\n /**\n * Get the leaf text node at a location.\n */\n\n leaf(\n editor: Editor,\n at: Location,\n options: {\n depth?: number\n edge?: 'start' | 'end'\n } = {}\n ): NodeEntry<Text> {\n const path = Editor.path(editor, at, options)\n const node = Node.leaf(editor, path)\n return [node, path]\n },\n\n /**\n * Iterate through all of the levels at a location.\n */\n\n *levels<T extends Node>(\n editor: Editor,\n options: {\n at?: Location\n match?: NodeMatch<T>\n reverse?: boolean\n voids?: boolean\n } = {}\n ): Iterable<NodeEntry<T>> {\n const { at = editor.selection, reverse = false, voids = false } = options\n let { match } = options\n\n if (match == null) {\n match = () => true\n }\n\n if (!at) {\n return\n }\n\n const levels: NodeEntry<T>[] = []\n const path = Editor.path(editor, at)\n\n for (const [n, p] of Node.levels(editor, path)) {\n if (!match(n)) {\n continue\n }\n\n levels.push([n, p])\n\n if (!voids && Editor.isVoid(editor, n)) {\n break\n }\n }\n\n if (reverse) {\n levels.reverse()\n }\n\n yield* levels\n },\n\n /**\n * Get the marks that would be added to text at the current selection.\n */\n\n marks(editor: Editor): Record<string, any> | null {\n const { marks, selection } = editor\n\n if (!selection) {\n return null\n }\n\n if (marks) {\n return marks\n }\n\n if (Range.isExpanded(selection)) {\n const [match] = Editor.nodes(editor, { match: Text.isText })\n\n if (match) {\n const [node] = match as NodeEntry<Text>\n const { text, ...rest } = node\n return rest\n } else {\n return {}\n }\n }\n\n const { anchor } = selection\n const { path } = anchor\n let [node] = Editor.leaf(editor, path)\n\n if (anchor.offset === 0) {\n const prev = Editor.previous(editor, { at: path, match: Text.isText })\n const block = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n })\n\n if (prev && block) {\n const [prevNode, prevPath] = prev\n const [, blockPath] = block\n\n if (Path.isAncestor(blockPath, prevPath)) {\n node = prevNode as Text\n }\n }\n }\n\n const { text, ...rest } = node\n return rest\n },\n\n /**\n * Get the matching node in the branch of the document after a location.\n */\n\n next<T extends Node>(\n editor: Editor,\n options: {\n at?: Location\n match?: NodeMatch<T>\n mode?: 'all' | 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ): NodeEntry<T> | undefined {\n const { mode = 'lowest', voids = false } = options\n let { match, at = editor.selection } = options\n\n if (!at) {\n return\n }\n\n const [, from] = Editor.last(editor, at)\n const [, to] = Editor.last(editor, [])\n const span: Span = [from, to]\n\n if (Path.isPath(at) && at.length === 0) {\n throw new Error(`Cannot get the next node from the root node!`)\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n const [parent] = Editor.parent(editor, at)\n match = n => parent.children.includes(n)\n } else {\n match = () => true\n }\n }\n\n const [, next] = Editor.nodes(editor, { at: span, match, mode, voids })\n return next\n },\n\n /**\n * Get the node at a location.\n */\n\n node(\n editor: Editor,\n at: Location,\n options: {\n depth?: number\n edge?: 'start' | 'end'\n } = {}\n ): NodeEntry {\n const path = Editor.path(editor, at, options)\n const node = Node.get(editor, path)\n return [node, path]\n },\n\n /**\n * Iterate through all of the nodes in the Editor.\n */\n\n *nodes<T extends Node>(\n editor: Editor,\n options: {\n at?: Location | Span\n match?: NodeMatch<T>\n mode?: 'all' | 'highest' | 'lowest'\n universal?: boolean\n reverse?: boolean\n voids?: boolean\n } = {}\n ): Iterable<NodeEntry<T>> {\n const {\n at = editor.selection,\n mode = 'all',\n universal = false,\n reverse = false,\n voids = false,\n } = options\n let { match } = options\n\n if (!match) {\n match = () => true\n }\n\n if (!at) {\n return\n }\n\n let from\n let to\n\n if (Span.isSpan(at)) {\n from = at[0]\n to = at[1]\n } else {\n const first = Editor.path(editor, at, { edge: 'start' })\n const last = Editor.path(editor, at, { edge: 'end' })\n from = reverse ? last : first\n to = reverse ? first : last\n }\n\n const iterable = Node.nodes(editor, {\n reverse,\n from,\n to,\n pass: ([n]) => (voids ? false : Editor.isVoid(editor, n)),\n })\n\n const matches: NodeEntry<T>[] = []\n let hit: NodeEntry<T> | undefined\n\n for (const [node, path] of iterable) {\n const isLower = hit && Path.compare(path, hit[1]) === 0\n\n // In highest mode any node lower than the last hit is not a match.\n if (mode === 'highest' && isLower) {\n continue\n }\n\n if (!match(node)) {\n // If we've arrived at a leaf text node that is not lower than the last\n // hit, then we've found a branch that doesn't include a match, which\n // means the match is not universal.\n if (universal && !isLower && Text.isText(node)) {\n return\n } else {\n continue\n }\n }\n\n // If there's a match and it's lower than the last, update the hit.\n if (mode === 'lowest' && isLower) {\n hit = [node, path]\n continue\n }\n\n // In lowest mode we emit the last hit, once it's guaranteed lowest.\n const emit: NodeEntry<T> | undefined =\n mode === 'lowest' ? hit : [node, path]\n\n if (emit) {\n if (universal) {\n matches.push(emit)\n } else {\n yield emit\n }\n }\n\n hit = [node, path]\n }\n\n // Since lowest is always emitting one behind, catch up at the end.\n if (mode === 'lowest' && hit) {\n if (universal) {\n matches.push(hit)\n } else {\n yield hit\n }\n }\n\n // Universal defers to ensure that the match occurs in every branch, so we\n // yield all of the matches after iterating.\n if (universal) {\n yield* matches\n }\n },\n /**\n * Normalize any dirty objects in the editor.\n */\n\n normalize(\n editor: Editor,\n options: {\n force?: boolean\n } = {}\n ) {\n const { force = false } = options\n const getDirtyPaths = (editor: Editor) => {\n return DIRTY_PATHS.get(editor) || []\n }\n\n if (!Editor.isNormalizing(editor)) {\n return\n }\n\n if (force) {\n const allPaths = Array.from(Node.nodes(editor), ([, p]) => p)\n DIRTY_PATHS.set(editor, allPaths)\n }\n\n if (getDirtyPaths(editor).length === 0) {\n return\n }\n\n Editor.withoutNormalizing(editor, () => {\n const max = getDirtyPaths(editor).length * 42 // HACK: better way?\n let m = 0\n\n while (getDirtyPaths(editor).length !== 0) {\n if (m > max) {\n throw new Error(`\n Could not completely normalize the editor after ${max} iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state.\n `)\n }\n\n const path = getDirtyPaths(editor).pop()!\n const entry = Editor.node(editor, path)\n editor.normalizeNode(entry)\n m++\n }\n })\n },\n\n /**\n * Get the parent node of a location.\n */\n\n parent(\n editor: Editor,\n at: Location,\n options: {\n depth?: number\n edge?: 'start' | 'end'\n } = {}\n ): NodeEntry<Ancestor> {\n const path = Editor.path(editor, at, options)\n const parentPath = Path.parent(path)\n const entry = Editor.node(editor, parentPath)\n return entry as NodeEntry<Ancestor>\n },\n\n /**\n * Get the path of a location.\n */\n\n path(\n editor: Editor,\n at: Location,\n options: {\n depth?: number\n edge?: 'start' | 'end'\n } = {}\n ): Path {\n const { depth, edge } = options\n\n if (Path.isPath(at)) {\n if (edge === 'start') {\n const [, firstPath] = Node.first(editor, at)\n at = firstPath\n } else if (edge === 'end') {\n const [, lastPath] = Node.last(editor, at)\n at = lastPath\n }\n }\n\n if (Range.isRange(at)) {\n if (edge === 'start') {\n at = Range.start(at)\n } else if (edge === 'end') {\n at = Range.end(at)\n } else {\n at = Path.common(at.anchor.path, at.focus.path)\n }\n }\n\n if (Point.isPoint(at)) {\n at = at.path\n }\n\n if (depth != null) {\n at = at.slice(0, depth)\n }\n\n return at\n },\n\n /**\n * Create a mutable ref for a `Path` object, which will stay in sync as new\n * operations are applied to the editor.\n */\n\n pathRef(\n editor: Editor,\n path: Path,\n options: {\n affinity?: 'backward' | 'forward' | null\n } = {}\n ): PathRef {\n const { affinity = 'forward' } = options\n const ref: PathRef = {\n current: path,\n affinity,\n unref() {\n const { current } = ref\n const pathRefs = Editor.pathRefs(editor)\n pathRefs.delete(ref)\n ref.current = null\n return current\n },\n }\n\n const refs = Editor.pathRefs(editor)\n refs.add(ref)\n return ref\n },\n\n /**\n * Get the set of currently tracked path refs of the editor.\n */\n\n pathRefs(editor: Editor): Set<PathRef> {\n let refs = PATH_REFS.get(editor)\n\n if (!refs) {\n refs = new Set()\n PATH_REFS.set(editor, refs)\n }\n\n return refs\n },\n\n /**\n * Get the start or end point of a location.\n */\n\n point(\n editor: Editor,\n at: Location,\n options: {\n edge?: 'start' | 'end'\n } = {}\n ): Point {\n const { edge = 'start' } = options\n\n if (Path.isPath(at)) {\n let path\n\n if (edge === 'end') {\n const [, lastPath] = Node.last(editor, at)\n path = lastPath\n } else {\n const [, firstPath] = Node.first(editor, at)\n path = firstPath\n }\n\n const node = Node.get(editor, path)\n\n if (!Text.isText(node)) {\n throw new Error(\n `Cannot get the ${edge} point in the node at path [${at}] because it has no ${edge} text node.`\n )\n }\n\n return { path, offset: edge === 'end' ? node.text.length : 0 }\n }\n\n if (Range.isRange(at)) {\n const [start, end] = Range.edges(at)\n return edge === 'start' ? start : end\n }\n\n return at\n },\n\n /**\n * Create a mutable ref for a `Point` object, which will stay in sync as new\n * operations are applied to the editor.\n */\n\n pointRef(\n editor: Editor,\n point: Point,\n options: {\n affinity?: 'backward' | 'forward' | null\n } = {}\n ): PointRef {\n const { affinity = 'forward' } = options\n const ref: PointRef = {\n current: point,\n affinity,\n unref() {\n const { current } = ref\n const pointRefs = Editor.pointRefs(editor)\n pointRefs.delete(ref)\n ref.current = null\n return current\n },\n }\n\n const refs = Editor.pointRefs(editor)\n refs.add(ref)\n return ref\n },\n\n /**\n * Get the set of currently tracked point refs of the editor.\n */\n\n pointRefs(editor: Editor): Set<PointRef> {\n let refs = POINT_REFS.get(editor)\n\n if (!refs) {\n refs = new Set()\n POINT_REFS.set(editor, refs)\n }\n\n return refs\n },\n\n /**\n * Iterate through all of the positions in the document where a `Point` can be\n * placed.\n *\n * By default it will move forward by individual offsets at a time, but you\n * can pass the `unit: 'character'` option to moved forward one character, word,\n * or line at at time.\n *\n * Note: void nodes are treated as a single point, and iteration will not\n * happen inside their content.\n */\n\n *positions(\n editor: Editor,\n options: {\n at?: Location\n unit?: 'offset' | 'character' | 'word' | 'line' | 'block'\n reverse?: boolean\n } = {}\n ): Iterable<Point> {\n const { at = editor.selection, unit = 'offset', reverse = false } = options\n\n if (!at) {\n return\n }\n\n const range = Editor.range(editor, at)\n const [start, end] = Range.edges(range)\n const first = reverse ? end : start\n let string = ''\n let available = 0\n let offset = 0\n let distance: number | null = null\n let isNewBlock = false\n\n const advance = () => {\n if (distance == null) {\n if (unit === 'character') {\n distance = getCharacterDistance(string)\n } else if (unit === 'word') {\n distance = getWordDistance(string)\n } else if (unit === 'line' || unit === 'block') {\n distance = string.length\n } else {\n distance = 1\n }\n\n string = string.slice(distance)\n }\n\n // Add or substract the offset.\n offset = reverse ? offset - distance : offset + distance\n // Subtract the distance traveled from the available text.\n available = available - distance!\n // If the available had room to spare, reset the distance so that it will\n // advance again next time. Otherwise, set it to the overflow amount.\n distance = available >= 0 ? null : 0 - available\n }\n\n for (const [node, path] of Editor.nodes(editor, { at, reverse })) {\n if (Element.isElement(node)) {\n // Void nodes are a special case, since we don't want to iterate over\n // their content. We instead always just yield their first point.\n if (editor.isVoid(node)) {\n yield Editor.start(editor, path)\n continue\n }\n\n if (editor.isInline(node)) {\n continue\n }\n\n if (Editor.hasInlines(editor, node)) {\n const e = Path.isAncestor(path, end.path)\n ? end\n : Editor.end(editor, path)\n const s = Path.isAncestor(path, start.path)\n ? start\n : Editor.start(editor, path)\n\n const text = Editor.string(editor, { anchor: s, focus: e })\n string = reverse ? reverseText(text) : text\n isNewBlock = true\n }\n }\n\n if (Text.isText(node)) {\n const isFirst = Path.equals(path, first.path)\n available = node.text.length\n offset = reverse ? available : 0\n\n if (isFirst) {\n available = reverse ? first.offset : available - first.offset\n offset = first.offset\n }\n\n if (isFirst || isNewBlock || unit === 'offset') {\n yield { path, offset }\n }\n\n while (true) {\n // If there's no more string, continue to the next block.\n if (string === '') {\n break\n } else {\n advance()\n }\n\n // If the available space hasn't overflow, we have another point to\n // yield in the current text node.\n if (available >= 0) {\n yield { path, offset }\n } else {\n break\n }\n }\n\n isNewBlock = false\n }\n }\n },\n\n /**\n * Get the matching node in the branch of the document before a location.\n */\n\n previous<T extends Node>(\n editor: Editor,\n options: {\n at?: Location\n match?: NodeMatch<T>\n mode?: 'all' | 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ): NodeEntry<T> | undefined {\n const { mode = 'lowest', voids = false } = options\n let { match, at = editor.selection } = options\n\n if (!at) {\n return\n }\n\n const [, from] = Editor.first(editor, at)\n const [, to] = Editor.first(editor, [])\n const span: Span = [from, to]\n\n if (Path.isPath(at) && at.length === 0) {\n throw new Error(`Cannot get the previous node from the root node!`)\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n const [parent] = Editor.parent(editor, at)\n match = n => parent.children.includes(n)\n } else {\n match = () => true\n }\n }\n\n const [, previous] = Editor.nodes(editor, {\n reverse: true,\n at: span,\n match,\n mode,\n voids,\n })\n\n return previous\n },\n\n /**\n * Get a range of a location.\n */\n\n range(editor: Editor, at: Location, to?: Location): Range {\n if (Range.isRange(at) && !to) {\n return at\n }\n\n const start = Editor.start(editor, at)\n const end = Editor.end(editor, to || at)\n return { anchor: start, focus: end }\n },\n\n /**\n * Create a mutable ref for a `Range` object, which will stay in sync as new\n * operations are applied to the editor.\n */\n\n rangeRef(\n editor: Editor,\n range: Range,\n options: {\n affinity?: 'backward' | 'forward' | 'outward' | 'inward' | null\n } = {}\n ): RangeRef {\n const { affinity = 'forward' } = options\n const ref: RangeRef = {\n current: range,\n affinity,\n unref() {\n const { current } = ref\n const rangeRefs = Editor.rangeRefs(editor)\n rangeRefs.delete(ref)\n ref.current = null\n return current\n },\n }\n\n const refs = Editor.rangeRefs(editor)\n refs.add(ref)\n return ref\n },\n\n /**\n * Get the set of currently tracked range refs of the editor.\n */\n\n rangeRefs(editor: Editor): Set<RangeRef> {\n let refs = RANGE_REFS.get(editor)\n\n if (!refs) {\n refs = new Set()\n RANGE_REFS.set(editor, refs)\n }\n\n return refs\n },\n\n /**\n * Remove a custom property from all of the leaf text nodes in the current\n * selection.\n *\n * If the selection is currently collapsed, the removal will be stored on\n * `editor.marks` and applied to the text inserted next.\n */\n\n removeMark(editor: Editor, key: string): void {\n editor.removeMark(key)\n },\n\n /**\n * Get the start point of a location.\n */\n\n start(editor: Editor, at: Location): Point {\n return Editor.point(editor, at, { edge: 'start' })\n },\n\n /**\n * Get the text string content of a location.\n *\n * Note: the text of void nodes is presumed to be an empty string, regardless\n * of what their actual content is.\n */\n\n string(editor: Editor, at: Location): string {\n const range = Editor.range(editor, at)\n const [start, end] = Range.edges(range)\n let text = ''\n\n for (const [node, path] of Editor.nodes(editor, {\n at: range,\n match: Text.isText,\n })) {\n let t = node.text\n\n if (Path.equals(path, end.path)) {\n t = t.slice(0, end.offset)\n }\n\n if (Path.equals(path, start.path)) {\n t = t.slice(start.offset)\n }\n\n text += t\n }\n\n return text\n },\n\n /**\n * Transform the editor by an operation.\n */\n\n transform(editor: Editor, op: Operation) {\n editor.children = createDraft(editor.children)\n let selection = editor.selection && createDraft(editor.selection)\n\n switch (op.type) {\n case 'insert_node': {\n const { path, node } = op\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n parent.children.splice(index, 0, node)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'insert_text': {\n const { path, offset, text } = op\n const node = Node.leaf(editor, path)\n const before = node.text.slice(0, offset)\n const after = node.text.slice(offset)\n node.text = before + text + after\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'merge_node': {\n const { path } = op\n const node = Node.get(editor, path)\n const prevPath = Path.previous(path)\n const prev = Node.get(editor, prevPath)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n\n if (Text.isText(node) && Text.isText(prev)) {\n prev.text += node.text\n } else if (!Text.isText(node) && !Text.isText(prev)) {\n prev.children.push(...node.children)\n } else {\n throw new Error(\n `Cannot apply a \"merge_node\" operation at path [${path}] to nodes of different interaces: ${node} ${prev}`\n )\n }\n\n parent.children.splice(index, 1)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'move_node': {\n const { path, newPath } = op\n\n if (Path.isAncestor(path, newPath)) {\n throw new Error(\n `Cannot move a path [${path}] to new path [${newPath}] because the destination is inside itself.`\n )\n }\n\n const node = Node.get(editor, path)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n\n // This is tricky, but since the `path` and `newPath` both refer to\n // the same snapshot in time, there's a mismatch. After either\n // removing the original position, the second step's path can be out\n // of date. So instead of using the `op.newPath` directly, we\n // transform `op.path` to ascertain what the `newPath` would be after\n // the operation was applied.\n parent.children.splice(index, 1)\n const truePath = Path.transform(path, op)!\n const newParent = Node.get(editor, Path.parent(truePath))\n const newIndex = truePath[truePath.length - 1]\n\n newParent.children.splice(newIndex, 0, node)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'remove_node': {\n const { path } = op\n const index = path[path.length - 1]\n const parent = Node.parent(editor, path)\n parent.children.splice(index, 1)\n\n // Transform all of the points in the value, but if the point was in the\n // node that was removed we need to update the range or remove it.\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n const result = Point.transform(point, op)\n\n if (selection != null && result != null) {\n selection[key] = result\n } else {\n let prev: NodeEntry<Text> | undefined\n let next: NodeEntry<Text> | undefined\n\n for (const [n, p] of Node.texts(editor)) {\n if (Path.compare(p, path) === -1) {\n prev = [n, p]\n } else {\n next = [n, p]\n break\n }\n }\n\n if (prev) {\n point.path = prev[1]\n point.offset = prev[0].text.length\n } else if (next) {\n point.path = next[1]\n point.offset = 0\n } else {\n selection = null\n }\n }\n }\n }\n\n break\n }\n\n case 'remove_text': {\n const { path, offset, text } = op\n const node = Node.leaf(editor, path)\n const before = node.text.slice(0, offset)\n const after = node.text.slice(offset + text.length)\n node.text = before + after\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'set_node': {\n const { path, newProperties } = op\n\n if (path.length === 0) {\n throw new Error(`Cannot set properties on the root node!`)\n }\n\n const node = Node.get(editor, path)\n\n for (const key in newProperties) {\n if (key === 'children' || key === 'text') {\n throw new Error(`Cannot set the \"${key}\" property of nodes!`)\n }\n\n const value = newProperties[key]\n\n if (value == null) {\n delete node[key]\n } else {\n node[key] = value\n }\n }\n\n break\n }\n\n case 'set_selection': {\n const { newProperties } = op\n\n if (newProperties == null) {\n selection = newProperties\n } else if (selection == null) {\n if (!Range.isRange(newProperties)) {\n throw new Error(\n `Cannot apply an incomplete \"set_selection\" operation properties ${JSON.stringify(\n newProperties\n )} when there is no current selection.`\n )\n }\n\n selection = newProperties\n } else {\n Object.assign(selection, newProperties)\n }\n\n break\n }\n\n case 'split_node': {\n const { path, position, properties } = op\n\n if (path.length === 0) {\n throw new Error(\n `Cannot apply a \"split_node\" operation at path [${path}] because the root node cannot be split.`\n )\n }\n\n const node = Node.get(editor, path)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n let newNode: Descendant\n\n if (Text.isText(node)) {\n const before = node.text.slice(0, position)\n const after = node.text.slice(position)\n node.text = before\n newNode = {\n ...node,\n ...(properties as Partial<Text>),\n text: after,\n }\n } else {\n const before = node.children.slice(0, position)\n const after = node.children.slice(position)\n node.children = before\n\n newNode = {\n ...node,\n ...(properties as Partial<Element>),\n children: after,\n }\n }\n\n parent.children.splice(index + 1, 0, newNode)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n }\n\n editor.children = finishDraft(editor.children) as Node[]\n\n if (selection) {\n editor.selection = isDraft(selection)\n ? (finishDraft(selection) as Range)\n : selection\n } else {\n editor.selection = null\n }\n },\n\n /**\n * Convert a range into a non-hanging one.\n */\n\n unhangRange(\n editor: Editor,\n range: Range,\n options: {\n voids?: boolean\n } = {}\n ): Range {\n const { voids = false } = options\n let [start, end] = Range.edges(range)\n\n // PERF: exit early if we can guarantee that the range isn't hanging.\n if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {\n return range\n }\n\n const endBlock = Editor.above(editor, {\n at: end,\n match: n => Editor.isBlock(editor, n),\n })\n const blockPath = endBlock ? endBlock[1] : []\n const first = Editor.start(editor, [])\n const before = { anchor: first, focus: end }\n let skip = true\n\n for (const [node, path] of Editor.nodes(editor, {\n at: before,\n match: Text.isText,\n reverse: true,\n voids,\n })) {\n if (skip) {\n skip = false\n continue\n }\n\n if (node.text !== '' || Path.isBefore(path, blockPath)) {\n end = { path, offset: node.text.length }\n break\n }\n }\n\n return { anchor: start, focus: end }\n },\n\n /**\n * Match a void node in the current branch of the editor.\n */\n\n void(\n editor: Editor,\n options: {\n at?: Location\n mode?: 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ): NodeEntry<Element> | undefined {\n return Editor.above(editor, {\n ...options,\n match: n => Editor.isVoid(editor, n),\n })\n },\n\n /**\n * Call a function, deferring normalization until after it completes.\n */\n\n withoutNormalizing(editor: Editor, fn: () => void): void {\n const value = Editor.isNormalizing(editor)\n NORMALIZING.set(editor, false)\n fn()\n NORMALIZING.set(editor, value)\n Editor.normalize(editor)\n },\n}\n\n/**\n * A helper type for narrowing matched nodes with a predicate.\n */\n\ntype NodeMatch<T extends Node> =\n | ((node: Node) => node is T)\n | ((node: Node) => boolean)\n","import isPlainObject from 'is-plain-object'\nimport { Editor, Node, Path } from '..'\n\n/**\n * `Element` objects are a type of node in a Slate document that contain other\n * element nodes or text nodes. They can be either \"blocks\" or \"inlines\"\n * depending on the Slate editor's configuration.\n */\n\nexport interface Element {\n children: Node[]\n [key: string]: any\n}\n\nexport const Element = {\n /**\n * Check if a value implements the `Element` interface.\n */\n\n isElement(value: any): value is Element {\n return (\n isPlainObject(value) &&\n Node.isNodeList(value.children) &&\n !Editor.isEditor(value)\n )\n },\n\n /**\n * Check if a value is an array of `Element` objects.\n */\n\n isElementList(value: any): value is Element[] {\n return (\n Array.isArray(value) &&\n (value.length === 0 || Element.isElement(value[0]))\n )\n },\n\n /**\n * Check if an element matches set of properties.\n *\n * Note: this checks custom properties, and it does not ensure that any\n * children are equivalent.\n */\n\n matches(element: Element, props: Partial<Element>): boolean {\n for (const key in props) {\n if (key === 'children') {\n continue\n }\n\n if (element[key] !== props[key]) {\n return false\n }\n }\n\n return true\n },\n}\n\n/**\n * `ElementEntry` objects refer to an `Element` and the `Path` where it can be\n * found inside a root node.\n */\n\nexport type ElementEntry = [Element, Path]\n","import { Path, Point, Range } from '..'\n\n/**\n * The `Location` interface is a union of the ways to refer to a specific\n * location in a Slate document: paths, points or ranges.\n *\n * Methods will often accept a `Location` instead of requiring only a `Path`,\n * `Point` or `Range`. This eliminates the need for developers to manage\n * converting between the different interfaces in their own code base.\n */\n\nexport type Location = Path | Point | Range\n\nexport const Location = {\n /**\n * Check if a value implements the `Location` interface.\n */\n\n isLocation(value: any): value is Location {\n return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value)\n },\n}\n\n/**\n * The `Span` interface is a low-level way to refer to locations in nodes\n * without using `Point` which requires leaf text nodes to be present.\n */\n\nexport type Span = [Path, Path]\n\nexport const Span = {\n /**\n * Check if a value implements the `Span` interface.\n */\n\n isSpan(value: any): value is Span {\n return (\n Array.isArray(value) && value.length === 2 && value.every(Path.isPath)\n )\n },\n}\n","import { produce } from 'immer'\nimport { Editor, Element, ElementEntry, Path, Range, Text } from '..'\n\n/**\n * The `Node` union type represents all of the different types of nodes that\n * occur in a Slate document tree.\n */\n\nexport type Node = Editor | Element | Text\n\nexport const Node = {\n /**\n * Get the node at a specific path, asserting that it's an ancestor node.\n */\n\n ancestor(root: Node, path: Path): Ancestor {\n const node = Node.get(root, path)\n\n if (Text.isText(node)) {\n throw new Error(\n `Cannot get the ancestor node at path [${path}] because it refers to a text node instead: ${node}`\n )\n }\n\n return node\n },\n\n /**\n * Return an iterable of all the ancestor nodes above a specific path.\n *\n * By default the order is bottom-up, from lowest to highest ancestor in\n * the tree, but you can pass the `reverse: true` option to go top-down.\n */\n\n *ancestors(\n root: Node,\n path: Path,\n options: {\n reverse?: boolean\n } = {}\n ): Iterable<NodeEntry<Ancestor>> {\n for (const p of Path.ancestors(path, options)) {\n const n = Node.ancestor(root, p)\n const entry: NodeEntry<Ancestor> = [n, p]\n yield entry\n }\n },\n\n /**\n * Get the child of a node at a specific index.\n */\n\n child(root: Node, index: number): Descendant {\n if (Text.isText(root)) {\n throw new Error(\n `Cannot get the child of a text node: ${JSON.stringify(root)}`\n )\n }\n\n const c = root.children[index] as Descendant\n\n if (c == null) {\n throw new Error(\n `Cannot get child at index \\`${index}\\` in node: ${JSON.stringify(\n root\n )}`\n )\n }\n\n return c\n },\n\n /**\n * Iterate over the children of a node at a specific path.\n */\n\n *children(\n root: Node,\n path: Path,\n options: {\n reverse?: boolean\n } = {}\n ): Iterable<NodeEntry<Descendant>> {\n const { reverse = false } = options\n const ancestor = Node.ancestor(root, path)\n const { children } = ancestor\n let index = reverse ? children.length - 1 : 0\n\n while (reverse ? index >= 0 : index < children.length) {\n const child = Node.child(ancestor, index)\n const childPath = path.concat(index)\n yield [child, childPath]\n index = reverse ? index - 1 : index + 1\n }\n },\n\n /**\n * Get an entry for the common ancesetor node of two paths.\n */\n\n common(root: Node, path: Path, another: Path): NodeEntry {\n const p = Path.common(path, another)\n const n = Node.get(root, p)\n return [n, p]\n },\n\n /**\n * Get the node at a specific path, asserting that it's a descendant node.\n */\n\n descendant(root: Node, path: Path): Descendant {\n const node = Node.get(root, path)\n\n if (Editor.isEditor(node)) {\n throw new Error(\n `Cannot get the descendant node at path [${path}] because it refers to the root editor node instead: ${node}`\n )\n }\n\n return node\n },\n\n /**\n * Return an iterable of all the descendant node entries inside a root node.\n */\n\n *descendants(\n root: Node,\n options: {\n from?: Path\n to?: Path\n reverse?: boolean\n pass?: (node: NodeEntry) => boolean\n } = {}\n ): Iterable<NodeEntry<Descendant>> {\n for (const [node, path] of Node.nodes(root, options)) {\n if (path.length !== 0) {\n // NOTE: we have to coerce here because checking the path's length does\n // guarantee that `node` is not a `Editor`, but TypeScript doesn't know.\n yield [node, path] as NodeEntry<Descendant>\n }\n }\n },\n\n /**\n * Return an iterable of all the element nodes inside a root node. Each iteration\n * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the\n * root node is an element it will be included in the iteration as well.\n */\n\n *elements(\n root: Node,\n options: {\n from?: Path\n to?: Path\n reverse?: boolean\n pass?: (node: NodeEntry) => boolean\n } = {}\n ): Iterable<ElementEntry> {\n for (const [node, path] of Node.nodes(root, options)) {\n if (Element.isElement(node)) {\n yield [node, path]\n }\n }\n },\n\n /**\n * Get the first node entry in a root node from a path.\n */\n\n first(root: Node, path: Path): NodeEntry {\n const p = path.slice()\n let n = Node.get(root, p)\n\n while (n) {\n if (Text.isText(n) || n.children.length === 0) {\n break\n } else {\n n = n.children[0]\n p.push(0)\n }\n }\n\n return [n, p]\n },\n\n /**\n * Get the sliced fragment represented by a range inside a root node.\n */\n\n fragment(root: Node, range: Range): Descendant[] {\n if (Text.isText(root)) {\n throw new Error(\n `Cannot get a fragment starting from a root text node: ${JSON.stringify(\n root\n )}`\n )\n }\n\n const newRoot = produce(root, r => {\n const [start, end] = Range.edges(range)\n const iterable = Node.nodes(r, {\n reverse: true,\n pass: ([, path]) => !Range.includes(range, path),\n })\n\n for (const [, path] of iterable) {\n if (!Range.includes(range, path)) {\n const parent = Node.parent(r, path)\n const index = path[path.length - 1]\n parent.children.splice(index, 1)\n }\n\n if (Path.equals(path, end.path)) {\n const leaf = Node.leaf(r, path)\n leaf.text = leaf.text.slice(0, end.offset)\n }\n\n if (Path.equals(path, start.path)) {\n const leaf = Node.leaf(r, path)\n leaf.text = leaf.text.slice(start.offset)\n }\n }\n\n delete r.selection\n })\n\n return newRoot.children\n },\n\n /**\n * Get the descendant node referred to by a specific path. If the path is an\n * empty array, it refers to the root node itself.\n */\n\n get(root: Node, path: Path): Node {\n let node = root\n\n for (let i = 0; i < path.length; i++) {\n const p = path[i]\n\n if (Text.isText(node) || !node.children[p]) {\n throw new Error(\n `Cannot find a descendant at path [${path}] in node: ${JSON.stringify(\n root\n )}`\n )\n }\n\n node = node.children[p]\n }\n\n return node\n },\n\n /**\n * Check if a descendant node exists at a specific path.\n */\n\n has(root: Node, path: Path): boolean {\n let node = root\n\n for (let i = 0; i < path.length; i++) {\n const p = path[i]\n\n if (Text.isText(node) || !node.children[p]) {\n return false\n }\n\n node = node.children[p]\n }\n\n return true\n },\n\n /**\n * Check if a value implements the `Node` interface.\n */\n\n isNode(value: any): value is Node {\n return (\n Text.isText(value) || Element.isElement(value) || Editor.isEditor(value)\n )\n },\n\n /**\n * Check if a value is a list of `Node` objects.\n */\n\n isNodeList(value: any): value is Node[] {\n return Array.isArray(value) && (value.length === 0 || Node.isNode(value[0]))\n },\n\n /**\n * Get the lash node entry in a root node from a path.\n */\n\n last(root: Node, path: Path): NodeEntry {\n const p = path.slice()\n let n = Node.get(root, p)\n\n while (n) {\n if (Text.isText(n) || n.children.length === 0) {\n break\n } else {\n const i = n.children.length - 1\n n = n.children[i]\n p.push(i)\n }\n }\n\n return [n, p]\n },\n\n /**\n * Get the node at a specific path, ensuring it's a leaf text node.\n */\n\n leaf(root: Node, path: Path): Text {\n const node = Node.get(root, path)\n\n if (!Text.isText(node)) {\n throw new Error(\n `Cannot get the leaf node at path [${path}] because it refers to a non-leaf node: ${node}`\n )\n }\n\n return node\n },\n\n /**\n * Return an iterable of the in a branch of the tree, from a specific path.\n *\n * By default the order is top-down, from lowest to highest node in the tree,\n * but you can pass the `reverse: true` option to go bottom-up.\n */\n\n *levels(\n root: Node,\n path: Path,\n options: {\n reverse?: boolean\n } = {}\n ): Iterable<NodeEntry> {\n for (const p of Path.levels(path, options)) {\n const n = Node.get(root, p)\n yield [n, p]\n }\n },\n\n /**\n * Check if a node matches a set of props.\n */\n\n matches(node: Node, props: Partial<Node>): boolean {\n return (\n (Element.isElement(node) && Element.matches(node, props)) ||\n (Text.isText(node) && Text.matches(node, props))\n )\n },\n\n /**\n * Return an iterable of all the node entries of a root node. Each entry is\n * returned as a `[Node, Path]` tuple, with the path referring to the node's\n * position inside the root node.\n */\n\n *nodes(\n root: Node,\n options: {\n from?: Path\n to?: Path\n reverse?: boolean\n pass?: (entry: NodeEntry) => boolean\n } = {}\n ): Iterable<NodeEntry> {\n const { pass, reverse = false } = options\n const { from = [], to } = options\n const visited = new Set()\n let p: Path = []\n let n = root\n\n while (true) {\n if (to && (reverse ? Path.isBefore(p, to) : Path.isAfter(p, to))) {\n break\n }\n\n if (!visited.has(n)) {\n yield [n, p]\n }\n\n // If we're allowed to go downward and we haven't decsended yet, do.\n if (\n !visited.has(n) &&\n !Text.isText(n) &&\n n.children.length !== 0 &&\n (pass == null || pass([n, p]) === false)\n ) {\n visited.add(n)\n let nextIndex = reverse ? n.children.length - 1 : 0\n\n if (Path.isAncestor(p, from)) {\n nextIndex = from[p.length]\n }\n\n p = p.concat(nextIndex)\n n = Node.get(root, p)\n continue\n }\n\n // If we're at the root and we can't go down, we're done.\n if (p.length === 0) {\n break\n }\n\n // If we're going forward...\n if (!reverse) {\n const newPath = Path.next(p)\n\n if (Node.has(root, newPath)) {\n p = newPath\n n = Node.get(root, p)\n continue\n }\n }\n\n // If we're going backward...\n if (reverse && p[p.length - 1] !== 0) {\n const newPath = Path.previous(p)\n p = newPath\n n = Node.get(root, p)\n continue\n }\n\n // Otherwise we're going upward...\n p = Path.parent(p)\n n = Node.get(root, p)\n visited.add(n)\n }\n },\n\n /**\n * Get the parent of a node at a specific path.\n */\n\n parent(root: Node, path: Path): Ancestor {\n const parentPath = Path.parent(path)\n const p = Node.get(root, parentPath)\n\n if (Text.isText(p)) {\n throw new Error(\n `Cannot get the parent of path [${path}] because it does not exist in the root.`\n )\n }\n\n return p\n },\n\n /**\n * Get the concatenated text string of a node's content.\n *\n * Note that this will not include spaces or line breaks between block nodes.\n * It is not a user-facing string, but a string for performing offset-related\n * computations for a node.\n */\n\n string(node: Node): string {\n if (Text.isText(node)) {\n return node.text\n } else {\n return node.children.map(Node.string).join('')\n }\n },\n\n /**\n * Return an iterable of all leaf text nodes in a root node.\n */\n\n *texts(\n root: Node,\n options: {\n from?: Path\n to?: Path\n reverse?: boolean\n pass?: (node: NodeEntry) => boolean\n } = {}\n ): Iterable<NodeEntry<Text>> {\n for (const [node, path] of Node.nodes(root, options)) {\n if (Text.isText(node)) {\n yield [node, path]\n }\n }\n },\n}\n\n/**\n * The `Descendant` union type represents nodes that are descendants in the\n * tree. It is returned as a convenience in certain cases to narrow a value\n * further than the more generic `Node` union.\n */\n\nexport type Descendant = Element | Text\n\n/**\n * The `Ancestor` union type represents nodes that are ancestors in the tree.\n * It is returned as a convenience in certain cases to narrow a value further\n * than the more generic `Node` union.\n */\n\nexport type Ancestor = Editor | Element\n\n/**\n * `NodeEntry` objects are returned when iterating over the nodes in a Slate\n * document tree. They consist of the node and its `Path` relative to the root\n * node in the document.\n */\n\nexport type NodeEntry<T extends Node = Node> = [T, Path]\n","import { Node, Path, Range } from '..'\nimport isPlainObject from 'is-plain-object'\n\nexport type InsertNodeOperation = {\n type: 'insert_node'\n path: Path\n node: Node\n [key: string]: any\n}\n\nexport type InsertTextOperation = {\n type: 'insert_text'\n path: Path\n offset: number\n text: string\n [key: string]: any\n}\n\nexport type MergeNodeOperation = {\n type: 'merge_node'\n path: Path\n position: number\n target: number | null\n properties: Partial<Node>\n [key: string]: any\n}\n\nexport type MoveNodeOperation = {\n type: 'move_node'\n path: Path\n newPath: Path\n [key: string]: any\n}\n\nexport type RemoveNodeOperation = {\n type: 'remove_node'\n path: Path\n node: Node\n [key: string]: any\n}\n\nexport type RemoveTextOperation = {\n type: 'remove_text'\n path: Path\n offset: number\n text: string\n [key: string]: any\n}\n\nexport type SetNodeOperation = {\n type: 'set_node'\n path: Path\n properties: Partial<Node>\n newProperties: Partial<Node>\n [key: string]: any\n}\n\nexport type SetSelectionOperation =\n | {\n type: 'set_selection'\n [key: string]: any\n properties: null\n newProperties: Range\n }\n | {\n type: 'set_selection'\n [key: string]: any\n properties: Partial<Range>\n newProperties: Partial<Range>\n }\n | {\n type: 'set_selection'\n [key: string]: any\n properties: Range\n newProperties: null\n }\n\nexport type SplitNodeOperation = {\n type: 'split_node'\n path: Path\n position: number\n target: number | null\n properties: Partial<Node>\n [key: string]: any\n}\n\nexport type NodeOperation =\n | InsertNodeOperation\n | MergeNodeOperation\n | MoveNodeOperation\n | RemoveNodeOperation\n | SetNodeOperation\n | SplitNodeOperation\n\nexport type SelectionOperation = SetSelectionOperation\n\nexport type TextOperation = InsertTextOperation | RemoveTextOperation\n\n/**\n * `Operation` objects define the low-level instructions that Slate editors use\n * to apply changes to their internal state. Representing all changes as\n * operations is what allows Slate editors to easily implement history,\n * collaboration, and other features.\n */\n\nexport type Operation = NodeOperation | SelectionOperation | TextOperation\n\nexport const Operation = {\n /**\n * Check of a value is a `NodeOperation` object.\n */\n\n isNodeOperation(value: any): value is NodeOperation {\n return Operation.isOperation(value) && value.type.endsWith('_node')\n },\n\n /**\n * Check of a value is an `Operation` object.\n */\n\n isOperation(value: any): value is Operation {\n if (!isPlainObject(value)) {\n return false\n }\n\n switch (value.type) {\n case 'insert_node':\n return Path.isPath(value.path) && Node.isNode(value.node)\n case 'insert_text':\n return (\n typeof value.offset === 'number' &&\n typeof value.text === 'string' &&\n Path.isPath(value.path)\n )\n case 'merge_node':\n return (\n typeof value.position === 'number' &&\n (typeof value.target === 'number' || value.target === null) &&\n Path.isPath(value.path) &&\n isPlainObject(value.properties)\n )\n case 'move_node':\n return Path.isPath(value.path) && Path.isPath(value.newPath)\n case 'remove_node':\n return Path.isPath(value.path) && Node.isNode(value.node)\n case 'remove_text':\n return (\n typeof value.offset === 'number' &&\n typeof value.text === 'string' &&\n Path.isPath(value.path)\n )\n case 'set_node':\n return (\n Path.isPath(value.path) &&\n isPlainObject(value.properties) &&\n isPlainObject(value.newProperties)\n )\n case 'set_selection':\n return (\n (value.properties === null && Range.isRange(value.newProperties)) ||\n (value.newProperties === null && Range.isRange(value.properties)) ||\n (isPlainObject(value.properties) &&\n isPlainObject(value.newProperties))\n )\n case 'split_node':\n return (\n Path.isPath(value.path) &&\n typeof value.position === 'number' &&\n (typeof value.target === 'number' || value.target === null) &&\n isPlainObject(value.properties)\n )\n default:\n return false\n }\n },\n\n /**\n * Check if a value is a list of `Operation` objects.\n */\n\n isOperationList(value: any): value is Operation[] {\n return (\n Array.isArray(value) &&\n (value.length === 0 || Operation.isOperation(value[0]))\n )\n },\n\n /**\n * Check of a value is a `SelectionOperation` object.\n */\n\n isSelectionOperation(value: any): value is SelectionOperation {\n return Operation.isOperation(value) && value.type.endsWith('_selection')\n },\n\n /**\n * Check of a value is a `TextOperation` object.\n */\n\n isTextOperation(value: any): value is TextOperation {\n return Operation.isOperation(value) && value.type.endsWith('_text')\n },\n\n /**\n * Invert an operation, returning a new operation that will exactly undo the\n * original when applied.\n */\n\n inverse(op: Operation): Operation {\n switch (op.type) {\n case 'insert_node': {\n return { ...op, type: 'remove_node' }\n }\n\n case 'insert_text': {\n return { ...op, type: 'remove_text' }\n }\n\n case 'merge_node': {\n return { ...op, type: 'split_node', path: Path.previous(op.path) }\n }\n\n case 'move_node': {\n const { newPath, path } = op\n\n // PERF: in this case the move operation is a no-op anyways.\n if (Path.equals(newPath, path)) {\n return op\n }\n\n // We need to get the original path here, but sometimes the `newPath`\n // is a younger sibling of (or ends before) the original, and this\n // accounts for it.\n const inversePath = Path.transform(path, op)!\n const inverseNewPath = Path.transform(Path.next(path), op)!\n return { ...op, path: inversePath, newPath: inverseNewPath }\n }\n\n case 'remove_node': {\n return { ...op, type: 'insert_node' }\n }\n\n case 'remove_text': {\n return { ...op, type: 'insert_text' }\n }\n\n case 'set_node': {\n const { properties, newProperties } = op\n return { ...op, properties: newProperties, newProperties: properties }\n }\n\n case 'set_selection': {\n const { properties, newProperties } = op\n\n if (properties == null) {\n return {\n ...op,\n properties: newProperties as Range,\n newProperties: null,\n }\n } else if (newProperties == null) {\n return {\n ...op,\n properties: null,\n newProperties: properties as Range,\n }\n } else {\n return { ...op, properties: newProperties, newProperties: properties }\n }\n }\n\n case 'split_node': {\n return { ...op, type: 'merge_node', path: Path.next(op.path) }\n }\n }\n },\n}\n","import { produce } from 'immer'\nimport { Operation } from '..'\n\n/**\n * `Path` arrays are a list of indexes that describe a node's exact position in\n * a Slate node tree. Although they are usually relative to the root `Editor`\n * object, they can be relative to any `Node` object.\n */\n\nexport type Path = number[]\n\nexport const Path = {\n /**\n * Get a list of ancestor paths for a given path.\n *\n * The paths are sorted from deepest to shallowest ancestor. However, if the\n * `reverse: true` option is passed, they are reversed.\n */\n\n ancestors(path: Path, options: { reverse?: boolean } = {}): Path[] {\n const { reverse = false } = options\n let paths = Path.levels(path, options)\n\n if (reverse) {\n paths = paths.slice(1)\n } else {\n paths = paths.slice(0, -1)\n }\n\n return paths\n },\n\n /**\n * Get the common ancestor path of two paths.\n */\n\n common(path: Path, another: Path): Path {\n const common: Path = []\n\n for (let i = 0; i < path.length && i < another.length; i++) {\n const av = path[i]\n const bv = another[i]\n\n if (av !== bv) {\n break\n }\n\n common.push(av)\n }\n\n return common\n },\n\n /**\n * Compare a path to another, returning an integer indicating whether the path\n * was before, at, or after the other.\n *\n * Note: Two paths of unequal length can still receive a `0` result if one is\n * directly above or below the other. If you want exact matching, use\n * [[Path.equals]] instead.\n */\n\n compare(path: Path, another: Path): -1 | 0 | 1 {\n const min = Math.min(path.length, another.length)\n\n for (let i = 0; i < min; i++) {\n if (path[i] < another[i]) return -1\n if (path[i] > another[i]) return 1\n }\n\n return 0\n },\n\n /**\n * Check if a path ends after one of the indexes in another.\n */\n\n endsAfter(path: Path, another: Path): boolean {\n const i = path.length - 1\n const as = path.slice(0, i)\n const bs = another.slice(0, i)\n const av = path[i]\n const bv = another[i]\n return Path.equals(as, bs) && av > bv\n },\n\n /**\n * Check if a path ends at one of the indexes in another.\n */\n\n endsAt(path: Path, another: Path): boolean {\n const i = path.length\n const as = path.slice(0, i)\n const bs = another.slice(0, i)\n return Path.equals(as, bs)\n },\n\n /**\n * Check if a path ends before one of the indexes in another.\n */\n\n endsBefore(path: Path, another: Path): boolean {\n const i = path.length - 1\n const as = path.slice(0, i)\n const bs = another.slice(0, i)\n const av = path[i]\n const bv = another[i]\n return Path.equals(as, bs) && av < bv\n },\n\n /**\n * Check if a path is exactly equal to another.\n */\n\n equals(path: Path, another: Path): boolean {\n return (\n path.length === another.length && path.every((n, i) => n === another[i])\n )\n },\n\n /**\n * Check if a path is after another.\n */\n\n isAfter(path: Path, another: Path): boolean {\n return Path.compare(path, another) === 1\n },\n\n /**\n * Check if a path is an ancestor of another.\n */\n\n isAncestor(path: Path, another: Path): boolean {\n return path.length < another.length && Path.compare(path, another) === 0\n },\n\n /**\n * Check if a path is before another.\n */\n\n isBefore(path: Path, another: Path): boolean {\n return Path.compare(path, another) === -1\n },\n\n /**\n * Check if a path is a child of another.\n */\n\n isChild(path: Path, another: Path): boolean {\n return (\n path.length === another.length + 1 && Path.compare(path, another) === 0\n )\n },\n\n /**\n * Check if a path is equal to or an ancestor of another.\n */\n\n isCommon(path: Path, another: Path): boolean {\n return path.length <= another.length && Path.compare(path, another) === 0\n },\n\n /**\n * Check if a path is a descendant of another.\n */\n\n isDescendant(path: Path, another: Path): boolean {\n return path.length > another.length && Path.compare(path, another) === 0\n },\n\n /**\n * Check if a path is the parent of another.\n */\n\n isParent(path: Path, another: Path): boolean {\n return (\n path.length + 1 === another.length && Path.compare(path, another) === 0\n )\n },\n\n /**\n * Check is a value implements the `Path` interface.\n */\n\n isPath(value: any): value is Path {\n return (\n Array.isArray(value) &&\n (value.length === 0 || typeof value[0] === 'number')\n )\n },\n\n /**\n * Check if a path is a sibling of another.\n */\n\n isSibling(path: Path, another: Path): boolean {\n if (path.length !== another.length) {\n return false\n }\n\n const as = path.slice(0, -1)\n const bs = another.slice(0, -1)\n const al = path[path.length - 1]\n const bl = another[another.length - 1]\n return al !== bl && Path.equals(as, bs)\n },\n\n /**\n * Get a list of paths at every level down to a path. Note: this is the same\n * as `Path.ancestors`, but including the path itself.\n *\n * The paths are sorted from shallowest to deepest. However, if the `reverse:\n * true` option is passed, they are reversed.\n */\n\n levels(\n path: Path,\n options: {\n reverse?: boolean\n } = {}\n ): Path[] {\n const { reverse = false } = options\n const list: Path[] = []\n\n for (let i = 0; i <= path.length; i++) {\n list.push(path.slice(0, i))\n }\n\n if (reverse) {\n list.reverse()\n }\n\n return list\n },\n\n /**\n * Given a path, get the path to the next sibling node.\n */\n\n next(path: Path): Path {\n if (path.length === 0) {\n throw new Error(\n `Cannot get the next path of a root path [${path}], because it has no next index.`\n )\n }\n\n const last = path[path.length - 1]\n return path.slice(0, -1).concat(last + 1)\n },\n\n /**\n * Given a path, return a new path referring to the parent node above it.\n */\n\n parent(path: Path): Path {\n if (path.length === 0) {\n throw new Error(`Cannot get the parent path of the root path [${path}].`)\n }\n\n return path.slice(0, -1)\n },\n\n /**\n * Given a path, get the path to the previous sibling node.\n */\n\n previous(path: Path): Path {\n if (path.length === 0) {\n throw new Error(\n `Cannot get the previous path of a root path [${path}], because it has no previous index.`\n )\n }\n\n const last = path[path.length - 1]\n\n if (last <= 0) {\n throw new Error(\n `Cannot get the previous path of a first child path [${path}] because it would result in a negative index.`\n )\n }\n\n return path.slice(0, -1).concat(last - 1)\n },\n\n /**\n * Get a path relative to an ancestor.\n */\n\n relative(path: Path, ancestor: Path): Path {\n if (!Path.isAncestor(ancestor, path) && !Path.equals(path, ancestor)) {\n throw new Error(\n `Cannot get the relative path of [${path}] inside ancestor [${ancestor}], because it is not above or equal to the path.`\n )\n }\n\n return path.slice(ancestor.length)\n },\n\n /**\n * Transform a path by an operation.\n */\n\n transform(\n path: Path,\n operation: Operation,\n options: { affinity?: 'forward' | 'backward' | null } = {}\n ): Path | null {\n return produce(path, p => {\n const { affinity = 'forward' } = options\n\n // PERF: Exit early if the operation is guaranteed not to have an effect.\n if (path.length === 0) {\n return\n }\n\n switch (operation.type) {\n case 'insert_node': {\n const { path: op } = operation\n\n if (\n Path.equals(op, p) ||\n Path.endsBefore(op, p) ||\n Path.isAncestor(op, p)\n ) {\n p[op.length - 1] += 1\n }\n\n break\n }\n\n case 'remove_node': {\n const { path: op } = operation\n\n if (Path.equals(op, p) || Path.isAncestor(op, p)) {\n return null\n } else if (Path.endsBefore(op, p)) {\n p[op.length - 1] -= 1\n }\n\n break\n }\n\n case 'merge_node': {\n const { path: op, position } = operation\n\n if (Path.equals(op, p) || Path.endsBefore(op, p)) {\n p[op.length - 1] -= 1\n } else if (Path.isAncestor(op, p)) {\n p[op.length - 1] -= 1\n p[op.length] += position\n }\n\n break\n }\n\n case 'split_node': {\n const { path: op, position } = operation\n\n if (Path.equals(op, p)) {\n if (affinity === 'forward') {\n p[p.length - 1] += 1\n } else if (affinity === 'backward') {\n // Nothing, because it still refers to the right path.\n } else {\n return null\n }\n } else if (Path.endsBefore(op, p)) {\n p[op.length - 1] += 1\n } else if (Path.isAncestor(op, p) && path[op.length] >= position) {\n p[op.length - 1] += 1\n p[op.length] -= position\n }\n\n break\n }\n\n case 'move_node': {\n const { path: op, newPath: onp } = operation\n\n // If the old and new path are the same, it's a no-op.\n if (Path.equals(op, onp)) {\n return\n }\n\n if (Path.isAncestor(op, p) || Path.equals(op, p)) {\n const copy = onp.slice()\n\n if (Path.endsBefore(op, onp) && op.length < onp.length) {\n const i = Math.min(onp.length, op.length) - 1\n copy[i] -= 1\n }\n\n return copy.concat(p.slice(op.length))\n } else if (\n Path.endsBefore(onp, p) ||\n Path.equals(onp, p) ||\n Path.isAncestor(onp, p)\n ) {\n if (Path.endsBefore(op, p)) {\n p[op.length - 1] -= 1\n }\n\n p[onp.length - 1] += 1\n } else if (Path.endsBefore(op, p)) {\n if (Path.equals(onp, p)) {\n p[onp.length - 1] += 1\n }\n\n p[op.length - 1] -= 1\n }\n\n break\n }\n }\n })\n },\n}\n","import { Operation, Path } from '..'\n\n/**\n * `PathRef` objects keep a specific path in a document synced over time as new\n * operations are applied to the editor. You can access their `current` property\n * at any time for the up-to-date path value.\n */\n\nexport interface PathRef {\n current: Path | null\n affinity: 'forward' | 'backward' | null\n unref(): Path | null\n}\n\nexport const PathRef = {\n /**\n * Transform the path ref's current value by an operation.\n */\n\n transform(ref: PathRef, op: Operation): void {\n const { current, affinity } = ref\n\n if (current == null) {\n return\n }\n\n const path = Path.transform(current, op, { affinity })\n ref.current = path\n\n if (path == null) {\n ref.unref()\n }\n },\n}\n","import isPlainObject from 'is-plain-object'\nimport { produce } from 'immer'\nimport { Operation, Path } from '..'\n\n/**\n * `Point` objects refer to a specific location in a text node in a Slate\n * document. Its path refers to the location of the node in the tree, and its\n * offset refers to the distance into the node's string of text. Points can\n * only refer to `Text` nodes.\n */\n\nexport interface Point {\n path: Path\n offset: number\n [key: string]: any\n}\n\nexport const Point = {\n /**\n * Compare a point to another, returning an integer indicating whether the\n * point was before, at, or after the other.\n */\n\n compare(point: Point, another: Point): -1 | 0 | 1 {\n const result = Path.compare(point.path, another.path)\n\n if (result === 0) {\n if (point.offset < another.offset) return -1\n if (point.offset > another.offset) return 1\n return 0\n }\n\n return result\n },\n\n /**\n * Check if a point is after another.\n */\n\n isAfter(point: Point, another: Point): boolean {\n return Point.compare(point, another) === 1\n },\n\n /**\n * Check if a point is before another.\n */\n\n isBefore(point: Point, another: Point): boolean {\n return Point.compare(point, another) === -1\n },\n\n /**\n * Check if a point is exactly equal to another.\n */\n\n equals(point: Point, another: Point): boolean {\n // PERF: ensure the offsets are equal first since they are cheaper to check.\n return (\n point.offset === another.offset && Path.equals(point.path, another.path)\n )\n },\n\n /**\n * Check if a value implements the `Point` interface.\n */\n\n isPoint(value: any): value is Point {\n return (\n isPlainObject(value) &&\n typeof value.offset === 'number' &&\n Path.isPath(value.path)\n )\n },\n\n /**\n * Transform a point by an operation.\n */\n\n transform(\n point: Point,\n op: Operation,\n options: { affinity?: 'forward' | 'backward' | null } = {}\n ): Point | null {\n return produce(point, p => {\n const { affinity = 'forward' } = options\n const { path, offset } = p\n\n switch (op.type) {\n case 'insert_node':\n case 'move_node': {\n p.path = Path.transform(path, op, options)!\n break\n }\n\n case 'insert_text': {\n if (Path.equals(op.path, path) && op.offset <= offset) {\n p.offset += op.text.length\n }\n\n break\n }\n\n case 'merge_node': {\n if (Path.equals(op.path, path)) {\n p.offset += op.position\n }\n\n p.path = Path.transform(path, op, options)!\n break\n }\n\n case 'remove_text': {\n if (Path.equals(op.path, path) && op.offset <= offset) {\n p.offset -= Math.min(offset - op.offset, op.text.length)\n }\n\n break\n }\n\n case 'remove_node': {\n if (Path.equals(op.path, path) || Path.isAncestor(op.path, path)) {\n return null\n }\n\n p.path = Path.transform(path, op, options)!\n break\n }\n\n case 'split_node': {\n if (Path.equals(op.path, path)) {\n if (op.position === offset && affinity == null) {\n return null\n } else if (\n op.position < offset ||\n (op.position === offset && affinity === 'forward')\n ) {\n p.offset -= op.position\n\n p.path = Path.transform(path, op, {\n ...options,\n affinity: 'forward',\n })!\n }\n } else {\n p.path = Path.transform(path, op, options)!\n }\n\n break\n }\n }\n })\n },\n}\n\n/**\n * `PointEntry` objects are returned when iterating over `Point` objects that\n * belong to a range.\n */\n\nexport type PointEntry = [Point, 'anchor' | 'focus']\n","import { Operation, Point } from '..'\n\n/**\n * `PointRef` objects keep a specific point in a document synced over time as new\n * operations are applied to the editor. You can access their `current` property\n * at any time for the up-to-date point value.\n */\n\nexport interface PointRef {\n current: Point | null\n affinity: 'forward' | 'backward' | null\n unref(): Point | null\n}\n\nexport const PointRef = {\n /**\n * Transform the point ref's current value by an operation.\n */\n\n transform(ref: PointRef, op: Operation): void {\n const { current, affinity } = ref\n\n if (current == null) {\n return\n }\n\n const point = Point.transform(current, op, { affinity })\n ref.current = point\n\n if (point == null) {\n ref.unref()\n }\n },\n}\n","import { produce } from 'immer'\nimport isPlainObject from 'is-plain-object'\nimport { Operation, Path, Point, PointEntry } from '..'\n\n/**\n * `Range` objects are a set of points that refer to a specific span of a Slate\n * document. They can define a span inside a single node or a can span across\n * multiple nodes.\n */\n\nexport interface Range {\n anchor: Point\n focus: Point\n [key: string]: any\n}\n\nexport const Range = {\n /**\n * Get the start and end points of a range, in the order in which they appear\n * in the document.\n */\n\n edges(\n range: Range,\n options: {\n reverse?: boolean\n } = {}\n ): [Point, Point] {\n const { reverse = false } = options\n const { anchor, focus } = range\n return Range.isBackward(range) === reverse\n ? [anchor, focus]\n : [focus, anchor]\n },\n\n /**\n * Get the end point of a range.\n */\n\n end(range: Range): Point {\n const [, end] = Range.edges(range)\n return end\n },\n\n /**\n * Check if a range is exactly equal to another.\n */\n\n equals(range: Range, another: Range): boolean {\n return (\n Point.equals(range.anchor, another.anchor) &&\n Point.equals(range.focus, another.focus)\n )\n },\n\n /**\n * Check if a range includes a path, a point or part of another range.\n */\n\n includes(range: Range, target: Path | Point | Range): boolean {\n if (Range.isRange(target)) {\n if (\n Range.includes(range, target.anchor) ||\n Range.includes(range, target.focus)\n ) {\n return true\n }\n\n const [rs, re] = Range.edges(range)\n const [ts, te] = Range.edges(target)\n return Point.isBefore(rs, ts) && Point.isAfter(re, te)\n }\n\n const [start, end] = Range.edges(range)\n let isAfterStart = false\n let isBeforeEnd = false\n\n if (Point.isPoint(target)) {\n isAfterStart = Point.compare(target, start) >= 0\n isBeforeEnd = Point.compare(target, end) <= 0\n } else {\n isAfterStart = Path.compare(target, start.path) >= 0\n isBeforeEnd = Path.compare(target, end.path) <= 0\n }\n\n return isAfterStart && isBeforeEnd\n },\n\n /**\n * Get the intersection of a range with another.\n */\n\n intersection(range: Range, another: Range): Range | null {\n const { anchor, focus, ...rest } = range\n const [s1, e1] = Range.edges(range)\n const [s2, e2] = Range.edges(another)\n const start = Point.isBefore(s1, s2) ? s2 : s1\n const end = Point.isBefore(e1, e2) ? e1 : e2\n\n if (Point.isBefore(end, start)) {\n return null\n } else {\n return { anchor: start, focus: end, ...rest }\n }\n },\n\n /**\n * Check if a range is backward, meaning that its anchor point appears in the\n * document _after_ its focus point.\n */\n\n isBackward(range: Range): boolean {\n const { anchor, focus } = range\n return Point.isAfter(anchor, focus)\n },\n\n /**\n * Check if a range is collapsed, meaning that both its anchor and focus\n * points refer to the exact same position in the document.\n */\n\n isCollapsed(range: Range): boolean {\n const { anchor, focus } = range\n return Point.equals(anchor, focus)\n },\n\n /**\n * Check if a range is expanded.\n *\n * This is the opposite of [[Range.isCollapsed]] and is provided for legibility.\n */\n\n isExpanded(range: Range): boolean {\n return !Range.isCollapsed(range)\n },\n\n /**\n * Check if a range is forward.\n *\n * This is the opposite of [[Range.isBackward]] and is provided for legibility.\n */\n\n isForward(range: Range): boolean {\n return !Range.isBackward(range)\n },\n\n /**\n * Check if a value implements the [[Range]] interface.\n */\n\n isRange(value: any): value is Range {\n return (\n isPlainObject(value) &&\n Point.isPoint(value.anchor) &&\n Point.isPoint(value.focus)\n )\n },\n\n /**\n * Iterate through all of the point entries in a range.\n */\n\n *points(range: Range): Iterable<PointEntry> {\n yield [range.anchor, 'anchor']\n yield [range.focus, 'focus']\n },\n\n /**\n * Get the start point of a range.\n */\n\n start(range: Range): Point {\n const [start] = Range.edges(range)\n return start\n },\n\n /**\n * Transform a range by an operation.\n */\n\n transform(\n range: Range,\n op: Operation,\n options: { affinity: 'forward' | 'backward' | 'outward' | 'inward' | null }\n ): Range | null {\n const { affinity = 'inward' } = options\n let affinityAnchor: 'forward' | 'backward' | null\n let affinityFocus: 'forward' | 'backward' | null\n\n if (affinity === 'inward') {\n if (Range.isForward(range)) {\n affinityAnchor = 'forward'\n affinityFocus = 'backward'\n } else {\n affinityAnchor = 'backward'\n affinityFocus = 'forward'\n }\n } else if (affinity === 'outward') {\n if (Range.isForward(range)) {\n affinityAnchor = 'backward'\n affinityFocus = 'forward'\n } else {\n affinityAnchor = 'forward'\n affinityFocus = 'backward'\n }\n } else {\n affinityAnchor = affinity\n affinityFocus = affinity\n }\n\n return produce(range, r => {\n const anchor = Point.transform(r.anchor, op, { affinity: affinityAnchor })\n const focus = Point.transform(r.focus, op, { affinity: affinityFocus })\n\n if (!anchor || !focus) {\n return null\n }\n\n r.anchor = anchor\n r.focus = focus\n })\n },\n}\n","import { Operation, Range } from '..'\n\n/**\n * `RangeRef` objects keep a specific range in a document synced over time as new\n * operations are applied to the editor. You can access their `current` property\n * at any time for the up-to-date range value.\n */\n\nexport interface RangeRef {\n current: Range | null\n affinity: 'forward' | 'backward' | 'outward' | 'inward' | null\n unref(): Range | null\n}\n\nexport const RangeRef = {\n /**\n * Transform the range ref's current value by an operation.\n */\n\n transform(ref: RangeRef, op: Operation): void {\n const { current, affinity } = ref\n\n if (current == null) {\n return\n }\n\n const path = Range.transform(current, op, { affinity })\n ref.current = path\n\n if (path == null) {\n ref.unref()\n }\n },\n}\n","import isPlainObject from 'is-plain-object'\nimport { Range } from '..'\n\n/**\n * `Text` objects represent the nodes that contain the actual text content of a\n * Slate document along with any formatting properties. They are always leaf\n * nodes in the document tree as they cannot contain any children.\n */\n\nexport interface Text {\n text: string\n [key: string]: any\n}\n\nexport const Text = {\n /**\n * Check if two text nodes are equal.\n */\n\n equals(\n text: Text,\n another: Text,\n options: { loose?: boolean } = {}\n ): boolean {\n const { loose = false } = options\n\n for (const key in text) {\n if (loose && key === 'text') {\n continue\n }\n\n if (text[key] !== another[key]) {\n return false\n }\n }\n\n for (const key in another) {\n if (loose && key === 'text') {\n continue\n }\n\n if (text[key] !== another[key]) {\n return false\n }\n }\n\n return true\n },\n\n /**\n * Check if a value implements the `Text` interface.\n */\n\n isText(value: any): value is Text {\n return isPlainObject(value) && typeof value.text === 'string'\n },\n\n /**\n * Check if a value is a list of `Text` objects.\n */\n\n isTextList(value: any): value is Text[] {\n return Array.isArray(value) && (value.length === 0 || Text.isText(value[0]))\n },\n\n /**\n * Check if an text matches set of properties.\n *\n * Note: this is for matching custom properties, and it does not ensure that\n * the `text` property are two nodes equal.\n */\n\n matches(text: Text, props: Partial<Text>): boolean {\n for (const key in props) {\n if (key === 'text') {\n continue\n }\n\n if (text[key] !== props[key]) {\n return false\n }\n }\n\n return true\n },\n\n /**\n * Get the leaves for a text node given decorations.\n */\n\n decorations(node: Text, decorations: Range[]): Text[] {\n let leaves: Text[] = [{ ...node }]\n\n for (const dec of decorations) {\n const { anchor, focus, ...rest } = dec\n const [start, end] = Range.edges(dec)\n const next = []\n let o = 0\n\n for (const leaf of leaves) {\n const { length } = leaf.text\n const offset = o\n o += length\n\n // If the range encompases the entire leaf, add the range.\n if (start.offset <= offset && end.offset >= offset + length) {\n Object.assign(leaf, rest)\n next.push(leaf)\n continue\n }\n\n // If the range starts after the leaf, or ends before it, continue.\n if (\n start.offset > offset + length ||\n end.offset < offset ||\n (end.offset === offset && offset !== 0)\n ) {\n next.push(leaf)\n continue\n }\n\n // Otherwise we need to split the leaf, at the start, end, or both,\n // and add the range to the middle intersecting section. Do the end\n // split first since we don't need to update the offset that way.\n let middle = leaf\n let before\n let after\n\n if (end.offset < offset + length) {\n const off = end.offset - offset\n after = { ...middle, text: middle.text.slice(off) }\n middle = { ...middle, text: middle.text.slice(0, off) }\n }\n\n if (start.offset > offset) {\n const off = start.offset - offset\n before = { ...middle, text: middle.text.slice(0, off) }\n middle = { ...middle, text: middle.text.slice(off) }\n }\n\n Object.assign(middle, rest)\n\n if (before) {\n next.push(before)\n }\n\n next.push(middle)\n\n if (after) {\n next.push(after)\n }\n }\n\n leaves = next\n }\n\n return leaves\n },\n}\n","import { createDraft, finishDraft, isDraft } from 'immer'\nimport {\n Node,\n Editor,\n Range,\n Point,\n Text,\n Element,\n Operation,\n Descendant,\n NodeEntry,\n Path,\n Transforms,\n} from '..'\n\nexport const GeneralTransforms = {\n /**\n * Transform the editor by an operation.\n */\n\n transform(editor: Editor, op: Operation) {\n editor.children = createDraft(editor.children)\n let selection = editor.selection && createDraft(editor.selection)\n\n switch (op.type) {\n case 'insert_node': {\n const { path, node } = op\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n parent.children.splice(index, 0, node)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'insert_text': {\n const { path, offset, text } = op\n const node = Node.leaf(editor, path)\n const before = node.text.slice(0, offset)\n const after = node.text.slice(offset)\n node.text = before + text + after\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'merge_node': {\n const { path } = op\n const node = Node.get(editor, path)\n const prevPath = Path.previous(path)\n const prev = Node.get(editor, prevPath)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n\n if (Text.isText(node) && Text.isText(prev)) {\n prev.text += node.text\n } else if (!Text.isText(node) && !Text.isText(prev)) {\n prev.children.push(...node.children)\n } else {\n throw new Error(\n `Cannot apply a \"merge_node\" operation at path [${path}] to nodes of different interaces: ${node} ${prev}`\n )\n }\n\n parent.children.splice(index, 1)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'move_node': {\n const { path, newPath } = op\n\n if (Path.isAncestor(path, newPath)) {\n throw new Error(\n `Cannot move a path [${path}] to new path [${newPath}] because the destination is inside itself.`\n )\n }\n\n const node = Node.get(editor, path)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n\n // This is tricky, but since the `path` and `newPath` both refer to\n // the same snapshot in time, there's a mismatch. After either\n // removing the original position, the second step's path can be out\n // of date. So instead of using the `op.newPath` directly, we\n // transform `op.path` to ascertain what the `newPath` would be after\n // the operation was applied.\n parent.children.splice(index, 1)\n const truePath = Path.transform(path, op)!\n const newParent = Node.get(editor, Path.parent(truePath))\n const newIndex = truePath[truePath.length - 1]\n\n newParent.children.splice(newIndex, 0, node)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'remove_node': {\n const { path } = op\n const index = path[path.length - 1]\n const parent = Node.parent(editor, path)\n parent.children.splice(index, 1)\n\n // Transform all of the points in the value, but if the point was in the\n // node that was removed we need to update the range or remove it.\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n const result = Point.transform(point, op)\n\n if (selection != null && result != null) {\n selection[key] = result\n } else {\n let prev: NodeEntry<Text> | undefined\n let next: NodeEntry<Text> | undefined\n\n for (const [n, p] of Node.texts(editor)) {\n if (Path.compare(p, path) === -1) {\n prev = [n, p]\n } else {\n next = [n, p]\n break\n }\n }\n\n if (prev) {\n point.path = prev[1]\n point.offset = prev[0].text.length\n } else if (next) {\n point.path = next[1]\n point.offset = 0\n } else {\n selection = null\n }\n }\n }\n }\n\n break\n }\n\n case 'remove_text': {\n const { path, offset, text } = op\n const node = Node.leaf(editor, path)\n const before = node.text.slice(0, offset)\n const after = node.text.slice(offset + text.length)\n node.text = before + after\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'set_node': {\n const { path, newProperties } = op\n\n if (path.length === 0) {\n throw new Error(`Cannot set properties on the root node!`)\n }\n\n const node = Node.get(editor, path)\n\n for (const key in newProperties) {\n if (key === 'children' || key === 'text') {\n throw new Error(`Cannot set the \"${key}\" property of nodes!`)\n }\n\n const value = newProperties[key]\n\n if (value == null) {\n delete node[key]\n } else {\n node[key] = value\n }\n }\n\n break\n }\n\n case 'set_selection': {\n const { newProperties } = op\n\n if (newProperties == null) {\n selection = newProperties\n } else if (selection == null) {\n if (!Range.isRange(newProperties)) {\n throw new Error(\n `Cannot apply an incomplete \"set_selection\" operation properties ${JSON.stringify(\n newProperties\n )} when there is no current selection.`\n )\n }\n\n selection = newProperties\n } else {\n Object.assign(selection, newProperties)\n }\n\n break\n }\n\n case 'split_node': {\n const { path, position, properties } = op\n\n if (path.length === 0) {\n throw new Error(\n `Cannot apply a \"split_node\" operation at path [${path}] because the root node cannot be split.`\n )\n }\n\n const node = Node.get(editor, path)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n let newNode: Descendant\n\n if (Text.isText(node)) {\n const before = node.text.slice(0, position)\n const after = node.text.slice(position)\n node.text = before\n newNode = {\n ...node,\n ...(properties as Partial<Text>),\n text: after,\n }\n } else {\n const before = node.children.slice(0, position)\n const after = node.children.slice(position)\n node.children = before\n\n newNode = {\n ...node,\n ...(properties as Partial<Element>),\n children: after,\n }\n }\n\n parent.children.splice(index + 1, 0, newNode)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n }\n\n editor.children = finishDraft(editor.children) as Node[]\n\n if (selection) {\n editor.selection = isDraft(selection)\n ? (finishDraft(selection) as Range)\n : selection\n } else {\n editor.selection = null\n }\n },\n}\n","import {\n Editor,\n Element,\n Location,\n Node,\n Path,\n Point,\n Range,\n Text,\n Transforms,\n} from '..'\n\nexport const NodeTransforms = {\n /**\n * Insert nodes at a specific location in the Editor.\n */\n\n insertNodes(\n editor: Editor,\n nodes: Node | Node[],\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'highest' | 'lowest'\n hanging?: boolean\n select?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { hanging = false, voids = false, mode = 'lowest' } = options\n let { at, match, select } = options\n\n if (Node.isNode(nodes)) {\n nodes = [nodes]\n }\n\n if (nodes.length === 0) {\n return\n }\n\n const [node] = nodes\n\n // By default, use the selection as the target location. But if there is\n // no selection, insert at the end of the document since that is such a\n // common use case when inserting from a non-selected state.\n if (!at) {\n if (editor.selection) {\n at = editor.selection\n } else if (editor.children.length > 0) {\n at = Editor.end(editor, [])\n } else {\n at = [0]\n }\n\n select = true\n }\n\n if (select == null) {\n select = false\n }\n\n if (Range.isRange(at)) {\n if (!hanging) {\n at = Editor.unhangRange(editor, at)\n }\n\n if (Range.isCollapsed(at)) {\n at = at.anchor\n } else {\n const [, end] = Range.edges(at)\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at })\n at = pointRef.unref()!\n }\n }\n\n if (Point.isPoint(at)) {\n if (match == null) {\n if (Text.isText(node)) {\n match = n => Text.isText(n)\n } else if (editor.isInline(node)) {\n match = n => Text.isText(n) || Editor.isInline(editor, n)\n } else {\n match = n => Editor.isBlock(editor, n)\n }\n }\n\n const [entry] = Editor.nodes(editor, {\n at: at.path,\n match,\n mode,\n voids,\n })\n\n if (entry) {\n const [, matchPath] = entry\n const pathRef = Editor.pathRef(editor, matchPath)\n const isAtEnd = Editor.isEnd(editor, at, matchPath)\n Transforms.splitNodes(editor, { at, match, mode, voids })\n const path = pathRef.unref()!\n at = isAtEnd ? Path.next(path) : path\n } else {\n return\n }\n }\n\n const parentPath = Path.parent(at)\n let index = at[at.length - 1]\n\n if (!voids && Editor.void(editor, { at: parentPath })) {\n return\n }\n\n for (const node of nodes) {\n const path = parentPath.concat(index)\n index++\n editor.apply({ type: 'insert_node', path, node })\n }\n\n if (select) {\n const point = Editor.end(editor, at)\n\n if (point) {\n Transforms.select(editor, point)\n }\n }\n })\n },\n\n /**\n * Lift nodes at a specific location upwards in the document tree, splitting\n * their parent in two if necessary.\n */\n\n liftNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { at = editor.selection, mode = 'lowest', voids = false } = options\n let { match } = options\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n if (!at) {\n return\n }\n\n const matches = Editor.nodes(editor, { at, match, mode, voids })\n const pathRefs = Array.from(matches, ([, p]) => Editor.pathRef(editor, p))\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n\n if (path.length < 2) {\n throw new Error(\n `Cannot lift node at a path [${path}] because it has a depth of less than \\`2\\`.`\n )\n }\n\n const [parent, parentPath] = Editor.node(editor, Path.parent(path))\n const index = path[path.length - 1]\n const { length } = parent.children\n\n if (length === 1) {\n const toPath = Path.next(parentPath)\n Transforms.moveNodes(editor, { at: path, to: toPath, voids })\n Transforms.removeNodes(editor, { at: parentPath, voids })\n } else if (index === 0) {\n Transforms.moveNodes(editor, { at: path, to: parentPath, voids })\n } else if (index === length - 1) {\n const toPath = Path.next(parentPath)\n Transforms.moveNodes(editor, { at: path, to: toPath, voids })\n } else {\n const splitPath = Path.next(path)\n const toPath = Path.next(parentPath)\n Transforms.splitNodes(editor, { at: splitPath, voids })\n Transforms.moveNodes(editor, { at: path, to: toPath, voids })\n }\n }\n })\n },\n\n /**\n * Merge a node at a location with the previous node of the same depth,\n * removing any empty containing nodes after the merge if necessary.\n */\n\n mergeNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'highest' | 'lowest'\n hanging?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n let { match, at = editor.selection } = options\n const { hanging = false, voids = false, mode = 'lowest' } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n const [parent] = Editor.parent(editor, at)\n match = n => parent.children.includes(n)\n } else {\n match = n => Editor.isBlock(editor, n)\n }\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at)\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor\n } else {\n const [, end] = Range.edges(at)\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at })\n at = pointRef.unref()!\n\n if (options.at == null) {\n Transforms.select(editor, at)\n }\n }\n }\n\n const [current] = Editor.nodes(editor, { at, match, voids, mode })\n const prev = Editor.previous(editor, { at, match, voids, mode })\n\n if (!current || !prev) {\n return\n }\n\n const [node, path] = current\n const [prevNode, prevPath] = prev\n\n if (path.length === 0 || prevPath.length === 0) {\n return\n }\n\n const newPath = Path.next(prevPath)\n const commonPath = Path.common(path, prevPath)\n const isPreviousSibling = Path.isSibling(path, prevPath)\n const levels = Array.from(Editor.levels(editor, { at: path }), ([n]) => n)\n .slice(commonPath.length)\n .slice(0, -1)\n\n // Determine if the merge will leave an ancestor of the path empty as a\n // result, in which case we'll want to remove it after merging.\n const emptyAncestor = Editor.above(editor, {\n at: path,\n mode: 'highest',\n match: n =>\n levels.includes(n) && Element.isElement(n) && n.children.length === 1,\n })\n\n const emptyRef = emptyAncestor && Editor.pathRef(editor, emptyAncestor[1])\n let properties\n let position\n\n // Ensure that the nodes are equivalent, and figure out what the position\n // and extra properties of the merge will be.\n if (Text.isText(node) && Text.isText(prevNode)) {\n const { text, ...rest } = node\n position = prevNode.text.length\n properties = rest as Partial<Text>\n } else if (Element.isElement(node) && Element.isElement(prevNode)) {\n const { children, ...rest } = node\n position = prevNode.children.length\n properties = rest as Partial<Element>\n } else {\n throw new Error(\n `Cannot merge the node at path [${path}] with the previous sibling because it is not the same kind: ${JSON.stringify(\n node\n )} ${JSON.stringify(prevNode)}`\n )\n }\n\n // If the node isn't already the next sibling of the previous node, move\n // it so that it is before merging.\n if (!isPreviousSibling) {\n Transforms.moveNodes(editor, { at: path, to: newPath, voids })\n }\n\n // If there was going to be an empty ancestor of the node that was merged,\n // we remove it from the tree.\n if (emptyRef) {\n Transforms.removeNodes(editor, { at: emptyRef.current!, voids })\n }\n\n // If the target node that we're merging with is empty, remove it instead\n // of merging the two. This is a common rich text editor behavior to\n // prevent losing formatting when deleting entire nodes when you have a\n // hanging selection.\n if (\n (Element.isElement(prevNode) && Editor.isEmpty(editor, prevNode)) ||\n (Text.isText(prevNode) && prevNode.text === '')\n ) {\n Transforms.removeNodes(editor, { at: prevPath, voids })\n } else {\n editor.apply({\n type: 'merge_node',\n path: newPath,\n position,\n target: null,\n properties,\n })\n }\n\n if (emptyRef) {\n emptyRef.unref()\n }\n })\n },\n\n /**\n * Move the nodes at a location to a new location.\n */\n\n moveNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n to: Path\n voids?: boolean\n }\n ) {\n Editor.withoutNormalizing(editor, () => {\n const {\n to,\n at = editor.selection,\n mode = 'lowest',\n voids = false,\n } = options\n let { match } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n const toRef = Editor.pathRef(editor, to)\n const targets = Editor.nodes(editor, { at, match, mode, voids })\n const pathRefs = Array.from(targets, ([, p]) => Editor.pathRef(editor, p))\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n const newPath = toRef.current!\n\n if (path.length !== 0) {\n editor.apply({ type: 'move_node', path, newPath })\n }\n }\n\n toRef.unref()\n })\n },\n\n /**\n * Remove the nodes at a specific location in the document.\n */\n\n removeNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'highest' | 'lowest'\n hanging?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { hanging = false, voids = false, mode = 'lowest' } = options\n let { at = editor.selection, match } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at)\n }\n\n const depths = Editor.nodes(editor, { at, match, mode, voids })\n const pathRefs = Array.from(depths, ([, p]) => Editor.pathRef(editor, p))\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n\n if (path) {\n const [node] = Editor.node(editor, path)\n editor.apply({ type: 'remove_node', path, node })\n }\n }\n })\n },\n\n /**\n * Set new properties on the nodes at a location.\n */\n\n setNodes(\n editor: Editor,\n props: Partial<Node>,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n hanging?: boolean\n split?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n let { match, at = editor.selection } = options\n const {\n hanging = false,\n mode = 'lowest',\n split = false,\n voids = false,\n } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at)\n }\n\n if (split && Range.isRange(at)) {\n const rangeRef = Editor.rangeRef(editor, at, { affinity: 'inward' })\n const [start, end] = Range.edges(at)\n const splitMode = mode === 'lowest' ? 'lowest' : 'highest'\n Transforms.splitNodes(editor, {\n at: end,\n match,\n mode: splitMode,\n voids,\n })\n Transforms.splitNodes(editor, {\n at: start,\n match,\n mode: splitMode,\n voids,\n })\n at = rangeRef.unref()!\n\n if (options.at == null) {\n Transforms.select(editor, at)\n }\n }\n\n for (const [node, path] of Editor.nodes(editor, {\n at,\n match,\n mode,\n voids,\n })) {\n const properties: Partial<Node> = {}\n const newProperties: Partial<Node> = {}\n\n // You can't set properties on the editor node.\n if (path.length === 0) {\n continue\n }\n\n for (const k in props) {\n if (k === 'children' || k === 'text') {\n continue\n }\n\n if (props[k] !== node[k]) {\n properties[k] = node[k]\n newProperties[k] = props[k]\n }\n }\n\n if (Object.keys(newProperties).length !== 0) {\n editor.apply({\n type: 'set_node',\n path,\n properties,\n newProperties,\n })\n }\n }\n })\n },\n\n /**\n * Split the nodes at a specific location.\n */\n\n splitNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'highest' | 'lowest'\n always?: boolean\n height?: number\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { mode = 'lowest', voids = false } = options\n let { match, at = editor.selection, height = 0, always = false } = options\n\n if (match == null) {\n match = n => Editor.isBlock(editor, n)\n }\n\n if (Range.isRange(at)) {\n at = deleteRange(editor, at)\n }\n\n // If the target is a path, the default height-skipping and position\n // counters need to account for us potentially splitting at a non-leaf.\n if (Path.isPath(at)) {\n const path = at\n const point = Editor.point(editor, path)\n const [parent] = Editor.parent(editor, path)\n match = n => n === parent\n height = point.path.length - path.length + 1\n at = point\n always = true\n }\n\n if (!at) {\n return\n }\n\n const beforeRef = Editor.pointRef(editor, at, {\n affinity: 'backward',\n })\n const [highest] = Editor.nodes(editor, { at, match, mode, voids })\n\n if (!highest) {\n return\n }\n\n const voidMatch = Editor.void(editor, { at, mode: 'highest' })\n const nudge = 0\n\n if (!voids && voidMatch) {\n const [voidNode, voidPath] = voidMatch\n\n if (Element.isElement(voidNode) && editor.isInline(voidNode)) {\n let after = Editor.after(editor, voidPath)\n\n if (!after) {\n const text = { text: '' }\n const afterPath = Path.next(voidPath)\n Transforms.insertNodes(editor, text, { at: afterPath, voids })\n after = Editor.point(editor, afterPath)!\n }\n\n at = after\n always = true\n }\n\n const siblingHeight = at.path.length - voidPath.length\n height = siblingHeight + 1\n always = true\n }\n\n const afterRef = Editor.pointRef(editor, at)\n const depth = at.path.length - height\n const [, highestPath] = highest\n const lowestPath = at.path.slice(0, depth)\n let position = height === 0 ? at.offset : at.path[depth] + nudge\n let target: number | null = null\n\n for (const [node, path] of Editor.levels(editor, {\n at: lowestPath,\n reverse: true,\n voids,\n })) {\n let split = false\n\n if (\n path.length < highestPath.length ||\n path.length === 0 ||\n (!voids && Editor.isVoid(editor, node))\n ) {\n break\n }\n\n const point = beforeRef.current!\n const isEnd = Editor.isEnd(editor, point, path)\n\n if (always || !beforeRef || !Editor.isEdge(editor, point, path)) {\n split = true\n const { text, children, ...properties } = node\n editor.apply({\n type: 'split_node',\n path,\n position,\n target,\n properties,\n })\n }\n\n target = position\n position = path[path.length - 1] + (split || isEnd ? 1 : 0)\n }\n\n if (options.at == null) {\n const point = afterRef.current || Editor.end(editor, [])\n Transforms.select(editor, point)\n }\n\n beforeRef.unref()\n afterRef.unref()\n })\n },\n\n /**\n * Unset properties on the nodes at a location.\n */\n\n unsetNodes(\n editor: Editor,\n props: string | string[],\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n split?: boolean\n voids?: boolean\n } = {}\n ) {\n if (!Array.isArray(props)) {\n props = [props]\n }\n\n const obj = {}\n\n for (const key of props) {\n obj[key] = null\n }\n\n Transforms.setNodes(editor, obj, options)\n },\n\n /**\n * Unwrap the nodes at a location from a parent node, splitting the parent if\n * necessary to ensure that only the content in the range is unwrapped.\n */\n\n unwrapNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n split?: boolean\n voids?: boolean\n }\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { mode = 'lowest', split = false, voids = false } = options\n let { at = editor.selection, match } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n if (Path.isPath(at)) {\n at = Editor.range(editor, at)\n }\n\n const rangeRef = Range.isRange(at) ? Editor.rangeRef(editor, at) : null\n const matches = Editor.nodes(editor, { at, match, mode, voids })\n const pathRefs = Array.from(matches, ([, p]) => Editor.pathRef(editor, p))\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n const [node] = Editor.node(editor, path)\n let range = Editor.range(editor, path)\n\n if (split && rangeRef) {\n range = Range.intersection(rangeRef.current!, range)!\n }\n\n Transforms.liftNodes(editor, {\n at: range,\n match: n => node.children.includes(n),\n voids,\n })\n }\n\n if (rangeRef) {\n rangeRef.unref()\n }\n })\n },\n\n /**\n * Wrap the nodes at a location in a new container node, splitting the edges\n * of the range first to ensure that only the content in the range is wrapped.\n */\n\n wrapNodes(\n editor: Editor,\n element: Element,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n split?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { mode = 'lowest', split = false, voids = false } = options\n let { match, at = editor.selection } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n match = matchPath(editor, at)\n } else if (editor.isInline(element)) {\n match = n => Editor.isInline(editor, n) || Text.isText(n)\n } else {\n match = n => Editor.isBlock(editor, n)\n }\n }\n\n if (split && Range.isRange(at)) {\n const [start, end] = Range.edges(at)\n const rangeRef = Editor.rangeRef(editor, at, {\n affinity: 'inward',\n })\n Transforms.splitNodes(editor, { at: end, match, voids })\n Transforms.splitNodes(editor, { at: start, match, voids })\n at = rangeRef.unref()!\n\n if (options.at == null) {\n Transforms.select(editor, at)\n }\n }\n\n const roots = Array.from(\n Editor.nodes(editor, {\n at,\n match: editor.isInline(element)\n ? n => Editor.isBlock(editor, n)\n : n => Editor.isEditor(n),\n mode: 'highest',\n voids,\n })\n )\n\n for (const [, rootPath] of roots) {\n const a = Range.isRange(at)\n ? Range.intersection(at, Editor.range(editor, rootPath))\n : at\n\n if (!a) {\n continue\n }\n\n const matches = Array.from(\n Editor.nodes(editor, { at: a, match, mode, voids })\n )\n\n if (matches.length > 0) {\n const [first] = matches\n const last = matches[matches.length - 1]\n const [, firstPath] = first\n const [, lastPath] = last\n const commonPath = Path.equals(firstPath, lastPath)\n ? Path.parent(firstPath)\n : Path.common(firstPath, lastPath)\n\n const range = Editor.range(editor, firstPath, lastPath)\n const [commonNode] = Editor.node(editor, commonPath)\n const depth = commonPath.length + 1\n const wrapperPath = Path.next(lastPath.slice(0, depth))\n const wrapper = { ...element, children: [] }\n Transforms.insertNodes(editor, wrapper, { at: wrapperPath, voids })\n\n Transforms.moveNodes(editor, {\n at: range,\n match: n => commonNode.children.includes(n),\n to: wrapperPath.concat(0),\n voids,\n })\n }\n }\n })\n },\n}\n\n/**\n * Convert a range into a point by deleting it's content.\n */\n\nconst deleteRange = (editor: Editor, range: Range): Point | null => {\n if (Range.isCollapsed(range)) {\n return range.anchor\n } else {\n const [, end] = Range.edges(range)\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at: range })\n return pointRef.unref()\n }\n}\n\nconst matchPath = (editor: Editor, path: Path): ((node: Node) => boolean) => {\n const [node] = Editor.node(editor, path)\n return n => n === node\n}\n","import { Editor, Location, Point, Range, Transforms } from '..'\n\nexport const SelectionTransforms = {\n /**\n * Collapse the selection.\n */\n\n collapse(\n editor: Editor,\n options: {\n edge?: 'anchor' | 'focus' | 'start' | 'end'\n } = {}\n ) {\n const { edge = 'anchor' } = options\n const { selection } = editor\n\n if (!selection) {\n return\n } else if (edge === 'anchor') {\n Transforms.select(editor, selection.anchor)\n } else if (edge === 'focus') {\n Transforms.select(editor, selection.focus)\n } else if (edge === 'start') {\n const [start] = Range.edges(selection)\n Transforms.select(editor, start)\n } else if (edge === 'end') {\n const [, end] = Range.edges(selection)\n Transforms.select(editor, end)\n }\n },\n\n /**\n * Unset the selection.\n */\n\n deselect(editor: Editor) {\n const { selection } = editor\n\n if (selection) {\n editor.apply({\n type: 'set_selection',\n properties: selection,\n newProperties: null,\n })\n }\n },\n\n /**\n * Move the selection's point forward or backward.\n */\n\n move(\n editor: Editor,\n options: {\n distance?: number\n unit?: 'offset' | 'character' | 'word' | 'line'\n reverse?: boolean\n edge?: 'anchor' | 'focus' | 'start' | 'end'\n } = {}\n ) {\n const { selection } = editor\n const { distance = 1, unit = 'character', reverse = false } = options\n let { edge = null } = options\n\n if (!selection) {\n return\n }\n\n if (edge === 'start') {\n edge = Range.isBackward(selection) ? 'focus' : 'anchor'\n }\n\n if (edge === 'end') {\n edge = Range.isBackward(selection) ? 'anchor' : 'focus'\n }\n\n const { anchor, focus } = selection\n const opts = { distance, unit }\n const props: Partial<Range> = {}\n\n if (edge == null || edge === 'anchor') {\n const point = reverse\n ? Editor.before(editor, anchor, opts)\n : Editor.after(editor, anchor, opts)\n\n if (point) {\n props.anchor = point\n }\n }\n\n if (edge == null || edge === 'focus') {\n const point = reverse\n ? Editor.before(editor, focus, opts)\n : Editor.after(editor, focus, opts)\n\n if (point) {\n props.focus = point\n }\n }\n\n Transforms.setSelection(editor, props)\n },\n\n /**\n * Set the selection to a new value.\n */\n\n select(editor: Editor, target: Location) {\n const { selection } = editor\n target = Editor.range(editor, target)\n\n if (selection) {\n Transforms.setSelection(editor, target)\n return\n }\n\n if (!Range.isRange(target)) {\n throw new Error(\n `When setting the selection and the current selection is \\`null\\` you must provide at least an \\`anchor\\` and \\`focus\\`, but you passed: ${JSON.stringify(\n target\n )}`\n )\n }\n\n editor.apply({\n type: 'set_selection',\n properties: selection,\n newProperties: target,\n })\n },\n\n /**\n * Set new properties on one of the selection's points.\n */\n\n setPoint(\n editor: Editor,\n props: Partial<Point>,\n options: {\n edge?: 'anchor' | 'focus' | 'start' | 'end'\n }\n ) {\n const { selection } = editor\n let { edge = 'both' } = options\n\n if (!selection) {\n return\n }\n\n if (edge === 'start') {\n edge = Range.isBackward(selection) ? 'focus' : 'anchor'\n }\n\n if (edge === 'end') {\n edge = Range.isBackward(selection) ? 'anchor' : 'focus'\n }\n\n const { anchor, focus } = selection\n const point = edge === 'anchor' ? anchor : focus\n\n Transforms.setSelection(editor, {\n [edge === 'anchor' ? 'anchor' : 'focus']: { ...point, ...props },\n })\n },\n\n /**\n * Set new properties on the selection.\n */\n\n setSelection(editor: Editor, props: Partial<Range>) {\n const { selection } = editor\n const oldProps: Partial<Range> | null = {}\n const newProps: Partial<Range> = {}\n\n if (!selection) {\n return\n }\n\n for (const k in props) {\n if (\n (k === 'anchor' &&\n props.anchor != null &&\n !Point.equals(props.anchor, selection.anchor)) ||\n (k === 'focus' &&\n props.focus != null &&\n !Point.equals(props.focus, selection.focus)) ||\n (k !== 'anchor' && k !== 'focus' && props[k] !== selection[k])\n ) {\n oldProps[k] = selection[k]\n newProps[k] = props[k]\n }\n }\n\n if (Object.keys(oldProps).length > 0) {\n editor.apply({\n type: 'set_selection',\n properties: oldProps,\n newProperties: newProps,\n })\n }\n },\n}\n","import {\n Editor,\n Element,\n Location,\n Node,\n NodeEntry,\n Path,\n Text,\n Point,\n Range,\n Transforms,\n} from '..'\n\nexport const TextTransforms = {\n /**\n * Delete content in the editor.\n */\n\n delete(\n editor: Editor,\n options: {\n at?: Location\n distance?: number\n unit?: 'character' | 'word' | 'line' | 'block'\n reverse?: boolean\n hanging?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const {\n reverse = false,\n unit = 'character',\n distance = 1,\n voids = false,\n } = options\n let { at = editor.selection, hanging = false } = options\n\n if (!at) {\n return\n }\n\n if (Range.isRange(at) && Range.isCollapsed(at)) {\n at = at.anchor\n }\n\n if (Point.isPoint(at)) {\n const furthestVoid = Editor.void(editor, { at, mode: 'highest' })\n\n if (!voids && furthestVoid) {\n const [, voidPath] = furthestVoid\n at = voidPath\n } else {\n const opts = { unit, distance }\n const target = reverse\n ? Editor.before(editor, at, opts) || Editor.start(editor, [])\n : Editor.after(editor, at, opts) || Editor.end(editor, [])\n at = { anchor: at, focus: target }\n hanging = true\n }\n }\n\n if (Path.isPath(at)) {\n Transforms.removeNodes(editor, { at, voids })\n return\n }\n\n if (Range.isCollapsed(at)) {\n return\n }\n\n if (!hanging) {\n at = Editor.unhangRange(editor, at, { voids })\n }\n\n let [start, end] = Range.edges(at)\n const startBlock = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: start,\n voids,\n })\n const endBlock = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: end,\n voids,\n })\n const isAcrossBlocks =\n startBlock && endBlock && !Path.equals(startBlock[1], endBlock[1])\n const isSingleText = Path.equals(start.path, end.path)\n const startVoid = voids\n ? null\n : Editor.void(editor, { at: start, mode: 'highest' })\n const endVoid = voids\n ? null\n : Editor.void(editor, { at: end, mode: 'highest' })\n\n // If the start or end points are inside an inline void, nudge them out.\n if (startVoid) {\n const before = Editor.before(editor, start)\n\n if (\n before &&\n startBlock &&\n Path.isAncestor(startBlock[1], before.path)\n ) {\n start = before\n }\n }\n\n if (endVoid) {\n const after = Editor.after(editor, end)\n\n if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) {\n end = after\n }\n }\n\n // Get the highest nodes that are completely inside the range, as well as\n // the start and end nodes.\n const matches: NodeEntry[] = []\n let lastPath: Path | undefined\n\n for (const entry of Editor.nodes(editor, { at, voids })) {\n const [node, path] = entry\n\n if (lastPath && Path.compare(path, lastPath) === 0) {\n continue\n }\n\n if (\n (!voids && Editor.isVoid(editor, node)) ||\n (!Path.isCommon(path, start.path) && !Path.isCommon(path, end.path))\n ) {\n matches.push(entry)\n lastPath = path\n }\n }\n\n const pathRefs = Array.from(matches, ([, p]) => Editor.pathRef(editor, p))\n const startRef = Editor.pointRef(editor, start)\n const endRef = Editor.pointRef(editor, end)\n\n if (!isSingleText && !startVoid) {\n const point = startRef.current!\n const [node] = Editor.leaf(editor, point)\n const { path } = point\n const { offset } = start\n const text = node.text.slice(offset)\n editor.apply({ type: 'remove_text', path, offset, text })\n }\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n Transforms.removeNodes(editor, { at: path, voids })\n }\n\n if (!endVoid) {\n const point = endRef.current!\n const [node] = Editor.leaf(editor, point)\n const { path } = point\n const offset = isSingleText ? start.offset : 0\n const text = node.text.slice(offset, end.offset)\n editor.apply({ type: 'remove_text', path, offset, text })\n }\n\n if (\n !isSingleText &&\n isAcrossBlocks &&\n endRef.current &&\n startRef.current\n ) {\n Transforms.mergeNodes(editor, {\n at: endRef.current,\n hanging: true,\n voids,\n })\n }\n\n const point = endRef.unref() || startRef.unref()\n\n if (options.at == null && point) {\n Transforms.select(editor, point)\n }\n })\n },\n\n /**\n * Insert a fragment at a specific location in the editor.\n */\n\n insertFragment(\n editor: Editor,\n fragment: Node[],\n options: {\n at?: Location\n hanging?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { hanging = false, voids = false } = options\n let { at = editor.selection } = options\n\n if (!fragment.length) {\n return\n }\n\n if (!at) {\n return\n } else if (Range.isRange(at)) {\n if (!hanging) {\n at = Editor.unhangRange(editor, at)\n }\n\n if (Range.isCollapsed(at)) {\n at = at.anchor\n } else {\n const [, end] = Range.edges(at)\n\n if (!voids && Editor.void(editor, { at: end })) {\n return\n }\n\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at })\n at = pointRef.unref()!\n }\n } else if (Path.isPath(at)) {\n at = Editor.start(editor, at)\n }\n\n if (!voids && Editor.void(editor, { at })) {\n return\n }\n\n // If the insert point is at the edge of an inline node, move it outside\n // instead since it will need to be split otherwise.\n const inlineElementMatch = Editor.above(editor, {\n at,\n match: n => Editor.isInline(editor, n),\n mode: 'highest',\n voids,\n })\n\n if (inlineElementMatch) {\n const [, inlinePath] = inlineElementMatch\n\n if (Editor.isEnd(editor, at, inlinePath)) {\n const after = Editor.after(editor, inlinePath)!\n at = after\n } else if (Editor.isStart(editor, at, inlinePath)) {\n const before = Editor.before(editor, inlinePath)!\n at = before\n }\n }\n\n const blockMatch = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at,\n voids,\n })!\n const [, blockPath] = blockMatch\n const isBlockStart = Editor.isStart(editor, at, blockPath)\n const isBlockEnd = Editor.isEnd(editor, at, blockPath)\n const mergeStart = !isBlockStart || (isBlockStart && isBlockEnd)\n const mergeEnd = !isBlockEnd\n const [, firstPath] = Node.first({ children: fragment }, [])\n const [, lastPath] = Node.last({ children: fragment }, [])\n\n const matches: NodeEntry[] = []\n const matcher = ([n, p]: NodeEntry) => {\n if (\n mergeStart &&\n Path.isAncestor(p, firstPath) &&\n Element.isElement(n) &&\n !editor.isVoid(n) &&\n !editor.isInline(n)\n ) {\n return false\n }\n\n if (\n mergeEnd &&\n Path.isAncestor(p, lastPath) &&\n Element.isElement(n) &&\n !editor.isVoid(n) &&\n !editor.isInline(n)\n ) {\n return false\n }\n\n return true\n }\n\n for (const entry of Node.nodes(\n { children: fragment },\n { pass: matcher }\n )) {\n if (entry[1].length > 0 && matcher(entry)) {\n matches.push(entry)\n }\n }\n\n const starts = []\n const middles = []\n const ends = []\n let starting = true\n let hasBlocks = false\n\n for (const [node] of matches) {\n if (Element.isElement(node) && !editor.isInline(node)) {\n starting = false\n hasBlocks = true\n middles.push(node)\n } else if (starting) {\n starts.push(node)\n } else {\n ends.push(node)\n }\n }\n\n const [inlineMatch] = Editor.nodes(editor, {\n at,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids,\n })!\n\n const [, inlinePath] = inlineMatch\n const isInlineStart = Editor.isStart(editor, at, inlinePath)\n const isInlineEnd = Editor.isEnd(editor, at, inlinePath)\n\n const middleRef = Editor.pathRef(\n editor,\n isBlockEnd ? Path.next(blockPath) : blockPath\n )\n\n const endRef = Editor.pathRef(\n editor,\n isInlineEnd ? Path.next(inlinePath) : inlinePath\n )\n\n Transforms.splitNodes(editor, {\n at,\n match: n =>\n hasBlocks\n ? Editor.isBlock(editor, n)\n : Text.isText(n) || Editor.isInline(editor, n),\n mode: hasBlocks ? 'lowest' : 'highest',\n voids,\n })\n\n const startRef = Editor.pathRef(\n editor,\n !isInlineStart || (isInlineStart && isInlineEnd)\n ? Path.next(inlinePath)\n : inlinePath\n )\n\n Transforms.insertNodes(editor, starts, {\n at: startRef.current!,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids,\n })\n\n Transforms.insertNodes(editor, middles, {\n at: middleRef.current!,\n match: n => Editor.isBlock(editor, n),\n mode: 'lowest',\n voids,\n })\n\n Transforms.insertNodes(editor, ends, {\n at: endRef.current!,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids,\n })\n\n if (!options.at) {\n let path\n\n if (ends.length > 0) {\n path = Path.previous(endRef.current!)\n } else if (middles.length > 0) {\n path = Path.previous(middleRef.current!)\n } else {\n path = Path.previous(startRef.current!)\n }\n\n const end = Editor.end(editor, path)\n Transforms.select(editor, end)\n }\n\n startRef.unref()\n middleRef.unref()\n endRef.unref()\n })\n },\n\n /**\n * Insert a string of text in the Editor.\n */\n\n insertText(\n editor: Editor,\n text: string,\n options: {\n at?: Location\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { voids = false } = options\n let { at = editor.selection } = options\n\n if (!at) {\n return\n }\n\n if (Path.isPath(at)) {\n at = Editor.range(editor, at)\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor\n } else {\n const end = Range.end(at)\n\n if (!voids && Editor.void(editor, { at: end })) {\n return\n }\n\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at, voids })\n at = pointRef.unref()!\n Transforms.setSelection(editor, { anchor: at, focus: at })\n }\n }\n\n if (!voids && Editor.void(editor, { at })) {\n return\n }\n\n const { path, offset } = at\n editor.apply({ type: 'insert_text', path, offset, text })\n })\n },\n}\n","import { GeneralTransforms } from './general'\nimport { NodeTransforms } from './node'\nimport { SelectionTransforms } from './selection'\nimport { TextTransforms } from './text'\n\nexport const Transforms = {\n ...GeneralTransforms,\n ...NodeTransforms,\n ...SelectionTransforms,\n ...TextTransforms,\n}\n","import {\n Descendant,\n Editor,\n Element,\n Node,\n NodeEntry,\n Operation,\n Path,\n PathRef,\n PointRef,\n Range,\n RangeRef,\n Text,\n Transforms,\n} from './'\nimport { DIRTY_PATHS, FLUSHING } from './utils/weak-maps'\n\n/**\n * Create a new Slate `Editor` object.\n */\n\nexport const createEditor = (): Editor => {\n const editor: Editor = {\n children: [],\n operations: [],\n selection: null,\n marks: null,\n isInline: () => false,\n isVoid: () => false,\n onChange: () => {},\n\n apply: (op: Operation) => {\n for (const ref of Editor.pathRefs(editor)) {\n PathRef.transform(ref, op)\n }\n\n for (const ref of Editor.pointRefs(editor)) {\n PointRef.transform(ref, op)\n }\n\n for (const ref of Editor.rangeRefs(editor)) {\n RangeRef.transform(ref, op)\n }\n\n const set = new Set()\n const dirtyPaths: Path[] = []\n\n const add = (path: Path | null) => {\n if (path) {\n const key = path.join(',')\n\n if (!set.has(key)) {\n set.add(key)\n dirtyPaths.push(path)\n }\n }\n }\n\n const oldDirtyPaths = DIRTY_PATHS.get(editor) || []\n const newDirtyPaths = getDirtyPaths(op)\n\n for (const path of oldDirtyPaths) {\n const newPath = Path.transform(path, op)\n add(newPath)\n }\n\n for (const path of newDirtyPaths) {\n add(path)\n }\n\n DIRTY_PATHS.set(editor, dirtyPaths)\n Editor.transform(editor, op)\n editor.operations.push(op)\n Editor.normalize(editor)\n\n // Clear any formats applied to the cursor if the selection changes.\n if (op.type === 'set_selection') {\n editor.marks = null\n }\n\n if (!FLUSHING.get(editor)) {\n FLUSHING.set(editor, true)\n\n Promise.resolve().then(() => {\n FLUSHING.set(editor, false)\n editor.onChange()\n editor.operations = []\n })\n }\n },\n\n addMark: (key: string, value: any) => {\n const { selection } = editor\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Transforms.setNodes(\n editor,\n { [key]: value },\n { match: Text.isText, split: true }\n )\n } else {\n const marks = {\n ...(Editor.marks(editor) || {}),\n [key]: value,\n }\n\n editor.marks = marks\n editor.onChange()\n }\n }\n },\n\n deleteBackward: (unit: 'character' | 'word' | 'line' | 'block') => {\n const { selection } = editor\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.delete(editor, { unit, reverse: true })\n }\n },\n\n deleteForward: (unit: 'character' | 'word' | 'line' | 'block') => {\n const { selection } = editor\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.delete(editor, { unit })\n }\n },\n\n deleteFragment: () => {\n const { selection } = editor\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.delete(editor)\n }\n },\n\n insertBreak: () => {\n Transforms.splitNodes(editor, { always: true })\n },\n\n insertFragment: (fragment: Node[]) => {\n Transforms.insertFragment(editor, fragment)\n },\n\n insertNode: (node: Node) => {\n Transforms.insertNodes(editor, node)\n },\n\n insertText: (text: string) => {\n const { selection, marks } = editor\n\n if (selection) {\n // If the cursor is at the end of an inline, move it outside of\n // the inline before inserting\n if (Range.isCollapsed(selection)) {\n const inline = Editor.above(editor, {\n match: n => Editor.isInline(editor, n),\n mode: 'highest',\n })\n\n if (inline) {\n const [, inlinePath] = inline\n\n if (Editor.isEnd(editor, selection.anchor, inlinePath)) {\n const point = Editor.after(editor, inlinePath)!\n Transforms.setSelection(editor, {\n anchor: point,\n focus: point,\n })\n }\n }\n }\n\n if (marks) {\n const node = { text, ...marks }\n Transforms.insertNodes(editor, node)\n } else {\n Transforms.insertText(editor, text)\n }\n\n editor.marks = null\n }\n },\n\n normalizeNode: (entry: NodeEntry) => {\n const [node, path] = entry\n\n // There are no core normalizations for text nodes.\n if (Text.isText(node)) {\n return\n }\n\n // Ensure that block and inline nodes have at least one text child.\n if (Element.isElement(node) && node.children.length === 0) {\n const child = { text: '' }\n Transforms.insertNodes(editor, child, {\n at: path.concat(0),\n voids: true,\n })\n return\n }\n\n // Determine whether the node should have block or inline children.\n const shouldHaveInlines = Editor.isEditor(node)\n ? false\n : Element.isElement(node) &&\n (editor.isInline(node) ||\n node.children.length === 0 ||\n Text.isText(node.children[0]) ||\n editor.isInline(node.children[0]))\n\n // Since we'll be applying operations while iterating, keep track of an\n // index that accounts for any added/removed nodes.\n let n = 0\n\n for (let i = 0; i < node.children.length; i++, n++) {\n const child = node.children[i] as Descendant\n const prev = node.children[i - 1] as Descendant\n const isLast = i === node.children.length - 1\n const isInlineOrText =\n Text.isText(child) ||\n (Element.isElement(child) && editor.isInline(child))\n\n // Only allow block nodes in the top-level children and parent blocks\n // that only contain block nodes. Similarly, only allow inline nodes in\n // other inline nodes, or parent blocks that only contain inlines and\n // text.\n if (isInlineOrText !== shouldHaveInlines) {\n Transforms.removeNodes(editor, { at: path.concat(n), voids: true })\n n--\n } else if (Element.isElement(child)) {\n // Ensure that inline nodes are surrounded by text nodes.\n if (editor.isInline(child)) {\n if (prev == null || !Text.isText(prev)) {\n const newChild = { text: '' }\n Transforms.insertNodes(editor, newChild, {\n at: path.concat(n),\n voids: true,\n })\n n++\n } else if (isLast) {\n const newChild = { text: '' }\n Transforms.insertNodes(editor, newChild, {\n at: path.concat(n + 1),\n voids: true,\n })\n n++\n }\n }\n } else {\n // Merge adjacent text nodes that are empty or match.\n if (prev != null && Text.isText(prev)) {\n if (Text.equals(child, prev, { loose: true })) {\n Transforms.mergeNodes(editor, { at: path.concat(n), voids: true })\n n--\n } else if (prev.text === '') {\n Transforms.removeNodes(editor, {\n at: path.concat(n - 1),\n voids: true,\n })\n n--\n } else if (isLast && child.text === '') {\n Transforms.removeNodes(editor, {\n at: path.concat(n),\n voids: true,\n })\n n--\n }\n }\n }\n }\n },\n\n removeMark: (key: string) => {\n const { selection } = editor\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Transforms.unsetNodes(editor, key, {\n match: Text.isText,\n split: true,\n })\n } else {\n const marks = { ...(Editor.marks(editor) || {}) }\n delete marks[key]\n editor.marks = marks\n editor.onChange()\n }\n }\n },\n }\n\n return editor\n}\n\n/**\n * Get the \"dirty\" paths generated from an operation.\n */\n\nconst getDirtyPaths = (op: Operation) => {\n switch (op.type) {\n case 'insert_text':\n case 'remove_text':\n case 'set_node': {\n const { path } = op\n return Path.levels(path)\n }\n\n case 'insert_node': {\n const { node, path } = op\n const levels = Path.levels(path)\n const descendants = Text.isText(node)\n ? []\n : Array.from(Node.nodes(node), ([, p]) => path.concat(p))\n\n return [...levels, ...descendants]\n }\n\n case 'merge_node': {\n const { path } = op\n const ancestors = Path.ancestors(path)\n const previousPath = Path.previous(path)\n return [...ancestors, previousPath]\n }\n\n case 'move_node': {\n const { path, newPath } = op\n\n if (Path.equals(path, newPath)) {\n return []\n }\n\n const oldAncestors: Path[] = []\n const newAncestors: Path[] = []\n\n for (const ancestor of Path.ancestors(path)) {\n const p = Path.transform(ancestor, op)\n oldAncestors.push(p!)\n }\n\n for (const ancestor of Path.ancestors(newPath)) {\n const p = Path.transform(ancestor, op)\n newAncestors.push(p!)\n }\n\n return [...oldAncestors, ...newAncestors]\n }\n\n case 'remove_node': {\n const { path } = op\n const ancestors = Path.ancestors(path)\n return [...ancestors]\n }\n\n case 'split_node': {\n const { path } = op\n const levels = Path.levels(path)\n const nextPath = Path.next(path)\n return [...levels, nextPath]\n }\n\n default: {\n return []\n }\n }\n}\n"],"names":["objectWithoutPropertiesLoose","DIRTY_PATHS","WeakMap","FLUSHING","NORMALIZING","PATH_REFS","POINT_REFS","RANGE_REFS","SPACE","PUNCTUATION","CHAMELEON","SURROGATE_START","SURROGATE_END","ZERO_WIDTH_JOINER","getCharacterDistance","text","offset","prev","charCode","charCodeAt","isSurrogate","modifier","isModifier","isBMPEmoji","isVariationSelector","getWordDistance","length","i","started","char","charAt","l","slice","rest","isWordCharacter","remaining","test","next","code","Editor","above","editor","options","voids","mode","at","selection","match","path","reverse","n","p","levels","Text","isText","Path","equals","addMark","key","value","after","anchor","point","edge","focus","end","range","distance","d","target","positions","before","start","deleteBackward","unit","deleteForward","deleteFragment","edges","first","node","fragment","Node","hasBlocks","element","children","some","isBlock","hasInlines","isInline","hasTexts","every","insertBreak","insertFragment","insertNode","insertText","Element","isElement","isEditor","isPlainObject","apply","isVoid","normalizeNode","onChange","removeMark","marks","Range","isRange","isNodeList","Operation","isOperationList","operations","isEnd","Point","isEdge","isStart","isEmpty","isNormalizing","get","undefined","last","leaf","push","isExpanded","nodes","previous","block","prevNode","prevPath","blockPath","isAncestor","from","to","span","isPath","Error","parent","includes","universal","Span","isSpan","iterable","pass","matches","hit","isLower","compare","emit","normalize","force","getDirtyPaths","allPaths","Array","set","withoutNormalizing","max","m","pop","entry","parentPath","depth","firstPath","lastPath","common","isPoint","pathRef","affinity","ref","current","unref","pathRefs","delete","refs","add","Set","pointRef","pointRefs","string","available","isNewBlock","advance","e","s","reverseText","isFirst","rangeRef","rangeRefs","t","transform","op","createDraft","type","index","splice","points","newPath","truePath","newParent","newIndex","result","texts","newProperties","JSON","stringify","Object","assign","position","properties","newNode","finishDraft","isDraft","unhangRange","isCollapsed","endBlock","skip","isBefore","void","fn","isElementList","isArray","props","Location","isLocation","ancestor","root","ancestors","child","c","childPath","concat","another","descendant","descendants","elements","newRoot","produce","r","has","isNode","visited","isAfter","nextIndex","map","join","isNodeOperation","isOperation","endsWith","isSelectionOperation","isTextOperation","inverse","inversePath","inverseNewPath","paths","av","bv","min","Math","endsAfter","as","bs","endsAt","endsBefore","isChild","isCommon","isDescendant","isParent","isSibling","al","bl","list","relative","operation","onp","copy","PathRef","PointRef","isBackward","rs","re","ts","te","isAfterStart","isBeforeEnd","intersection","s1","e1","s2","e2","isForward","affinityAnchor","affinityFocus","RangeRef","loose","isTextList","decorations","leaves","dec","o","middle","off","GeneralTransforms","NodeTransforms","insertNodes","hanging","select","Transforms","matchPath","isAtEnd","splitNodes","liftNodes","toPath","moveNodes","removeNodes","splitPath","mergeNodes","commonPath","isPreviousSibling","emptyAncestor","emptyRef","toRef","targets","depths","setNodes","split","splitMode","k","keys","height","always","deleteRange","beforeRef","highest","voidMatch","nudge","voidNode","voidPath","afterPath","siblingHeight","afterRef","highestPath","lowestPath","unsetNodes","obj","unwrapNodes","wrapNodes","roots","rootPath","a","commonNode","wrapperPath","wrapper","SelectionTransforms","collapse","deselect","move","opts","setSelection","setPoint","oldProps","newProps","TextTransforms","furthestVoid","startBlock","isAcrossBlocks","isSingleText","startVoid","endVoid","startRef","endRef","inlineElementMatch","inlinePath","blockMatch","isBlockStart","isBlockEnd","mergeStart","mergeEnd","matcher","starts","middles","ends","starting","inlineMatch","isInlineStart","isInlineEnd","middleRef","createEditor","dirtyPaths","oldDirtyPaths","newDirtyPaths","Promise","resolve","then","inline","shouldHaveInlines","isLast","isInlineOrText","newChild","previousPath","oldAncestors","newAncestors","nextPath"],"mappings":";;;;;;;;;;AAAe,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;EACvD,IAAI,GAAG,IAAI,GAAG,EAAE;IACd,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;MAC9B,KAAK,EAAE,KAAK;MACZ,UAAU,EAAE,IAAI;MAChB,YAAY,EAAE,IAAI;MAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;GACJ,MAAM;IACL,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;GAClB;;EAED,OAAO,GAAG,CAAC;;;CACZ,DCbc,SAAS,6BAA6B,CAAC,MAAM,EAAE,QAAQ,EAAE;EACtE,IAAI,MAAM,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;EAC9B,IAAI,MAAM,GAAG,EAAE,CAAC;EAChB,IAAI,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;EACrC,IAAI,GAAG,EAAE,CAAC,CAAC;;EAEX,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACtC,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS;IACzC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;GAC3B;;EAED,OAAO,MAAM,CAAC;;;CACf,DCZc,SAAS,wBAAwB,CAAC,MAAM,EA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AJ,EAAe4K,YAAf,CAAP;;;SAGG,WAAL;;YACQ;UAAE5V,IAAI,EAAJA,MAAF;UAAQkJ;YAAYN,EAA1B;;YAEIrI,IAAI,CAACC,MAAL,CAAYR,MAAZ,EAAkBkJ,OAAlB,CAAJ,EAAgC;iBACvB,EAAP;;;YAGI2M,YAAY,GAAW,EAA7B;YACMC,YAAY,GAAW,EAA7B;;aAEK,IAAMhL,QAAX,IAAuBvK,IAAI,CAACyK,SAAL,CAAehL,MAAf,CAAvB,EAA6C;cACrCG,CAAC,GAAGI,IAAI,CAACoI,SAAL,CAAemC,QAAf,EAAyBlC,EAAzB,CAAV;UACAiN,YAAY,CAACpR,IAAb,CAAkBtE,CAAlB;;;aAGG,IAAM2K,SAAX,IAAuBvK,IAAI,CAACyK,SAAL,CAAe9B,OAAf,CAAvB,EAAgD;cACxC/I,EAAC,GAAGI,IAAI,CAACoI,SAAL,CAAemC,SAAf,EAAyBlC,EAAzB,CAAV;;UACAkN,YAAY,CAACrR,IAAb,CAAkBtE,EAAlB;;;eAGK,CAAC,GAAG0V,YAAJ,EAAkB,GAAGC,YAArB,CAAP;;;SAGG,aAAL;;YACQ;UAAE9V,IAAI,EAAJA;YAAS4I,EAAjB;;YACMoC,UAAS,GAAGzK,IAAI,CAACyK,SAAL,CAAehL,MAAf,CAAlB;;eACO,CAAC,GAAGgL,UAAJ,CAAP;;;SAGG,YAAL;;YACQ;UAAEhL,IAAI,EAAJA;YAAS4I,EAAjB;;YACMxI,OAAM,GAAGG,IAAI,CAACH,MAAL,CAAYJ,MAAZ,CAAf;;YACM+V,QAAQ,GAAGxV,IAAI,CAAClB,IAAL,CAAUW,MAAV,CAAjB;eACO,CAAC,GAAGI,OAAJ,EAAY2V,QAAZ,CAAP;;;;;eAIO,EAAP;;;CA/DN;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../src/utils/weak-maps.ts","../src/utils/string.ts","../src/interfaces/editor.ts","../src/interfaces/element.ts","../src/interfaces/location.ts","../src/interfaces/node.ts","../src/interfaces/operation.ts","../src/interfaces/path.ts","../src/interfaces/path-ref.ts","../src/interfaces/point.ts","../src/interfaces/point-ref.ts","../src/interfaces/range.ts","../src/interfaces/range-ref.ts","../src/interfaces/text.ts","../src/transforms/general.ts","../src/transforms/node.ts","../src/transforms/selection.ts","../src/transforms/text.ts","../src/transforms/index.ts","../src/create-editor.ts"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","import { Editor, Path, PathRef, PointRef, RangeRef } from '..'\n\nexport const DIRTY_PATHS: WeakMap<Editor, Path[]> = new WeakMap()\nexport const FLUSHING: WeakMap<Editor, boolean> = new WeakMap()\nexport const NORMALIZING: WeakMap<Editor, boolean> = new WeakMap()\nexport const PATH_REFS: WeakMap<Editor, Set<PathRef>> = new WeakMap()\nexport const POINT_REFS: WeakMap<Editor, Set<PointRef>> = new WeakMap()\nexport const RANGE_REFS: WeakMap<Editor, Set<RangeRef>> = new WeakMap()\n","/**\n * Constants for string distance checking.\n */\n\nconst SPACE = /\\s/\nconst PUNCTUATION = /[\\u0021-\\u0023\\u0025-\\u002A\\u002C-\\u002F\\u003A\\u003B\\u003F\\u0040\\u005B-\\u005D\\u005F\\u007B\\u007D\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]/\nconst CHAMELEON = /['\\u2018\\u2019]/\nconst SURROGATE_START = 0xd800\nconst SURROGATE_END = 0xdfff\nconst ZERO_WIDTH_JOINER = 0x200d\n\n/**\n * Get the distance to the end of the first character in a string of text.\n */\n\nexport const getCharacterDistance = (text: string): number => {\n let offset = 0\n // prev types:\n // SURR: surrogate pair\n // MOD: modifier (technically also surrogate pair)\n // ZWJ: zero width joiner\n // VAR: variation selector\n // BMP: sequenceable character from basic multilingual plane\n let prev: 'SURR' | 'MOD' | 'ZWJ' | 'VAR' | 'BMP' | null = null\n let charCode = text.charCodeAt(0)\n\n while (charCode) {\n if (isSurrogate(charCode)) {\n const modifier = isModifier(charCode, text, offset)\n\n // Early returns are the heart of this function, where we decide if previous and current\n // codepoints should form a single character (in terms of how many of them should selection\n // jump over).\n if (prev === 'SURR' || prev === 'BMP') {\n break\n }\n\n offset += 2\n prev = modifier ? 'MOD' : 'SURR'\n charCode = text.charCodeAt(offset)\n // Absolutely fine to `continue` without any checks because if `charCode` is NaN (which\n // is the case when out of `text` range), next `while` loop won\"t execute and we\"re done.\n continue\n }\n\n if (charCode === ZERO_WIDTH_JOINER) {\n offset += 1\n prev = 'ZWJ'\n charCode = text.charCodeAt(offset)\n\n continue\n }\n\n if (isBMPEmoji(charCode)) {\n if (prev && prev !== 'ZWJ' && prev !== 'VAR') {\n break\n }\n offset += 1\n prev = 'BMP'\n charCode = text.charCodeAt(offset)\n\n continue\n }\n\n if (isVariationSelector(charCode)) {\n if (prev && prev !== 'ZWJ') {\n break\n }\n offset += 1\n prev = 'VAR'\n charCode = text.charCodeAt(offset)\n continue\n }\n\n // Modifier 'groups up' with what ever character is before that (even whitespace), need to\n // look ahead.\n if (prev === 'MOD') {\n offset += 1\n break\n }\n\n // If while loop ever gets here, we're done (e.g latin chars).\n break\n }\n\n return offset || 1\n}\n\n/**\n * Get the distance to the end of the first word in a string of text.\n */\n\nexport const getWordDistance = (text: string): number => {\n let length = 0\n let i = 0\n let started = false\n let char\n\n while ((char = text.charAt(i))) {\n const l = getCharacterDistance(char)\n char = text.slice(i, i + l)\n const rest = text.slice(i + l)\n\n if (isWordCharacter(char, rest)) {\n started = true\n length += l\n } else if (!started) {\n length += l\n } else {\n break\n }\n\n i += l\n }\n\n return length\n}\n\n/**\n * Check if a character is a word character. The `remaining` argument is used\n * because sometimes you must read subsequent characters to truly determine it.\n */\n\nconst isWordCharacter = (char: string, remaining: string): boolean => {\n if (SPACE.test(char)) {\n return false\n }\n\n // Chameleons count as word characters as long as they're in a word, so\n // recurse to see if the next one is a word character or not.\n if (CHAMELEON.test(char)) {\n let next = remaining.charAt(0)\n const length = getCharacterDistance(next)\n next = remaining.slice(0, length)\n const rest = remaining.slice(length)\n\n if (isWordCharacter(next, rest)) {\n return true\n }\n }\n\n if (PUNCTUATION.test(char)) {\n return false\n }\n\n return true\n}\n\n/**\n * Determines if `code` is a surrogate\n */\n\nconst isSurrogate = (code: number): boolean =>\n SURROGATE_START <= code && code <= SURROGATE_END\n\n/**\n * Does `code` form Modifier with next one.\n *\n * https://emojipedia.org/modifiers/\n */\n\nconst isModifier = (code: number, text: string, offset: number): boolean => {\n if (code === 0xd83c) {\n const next = text.charCodeAt(offset + 1)\n return next <= 0xdfff && next >= 0xdffb\n }\n return false\n}\n\n/**\n * Is `code` a Variation Selector.\n *\n * https://codepoints.net/variation_selectors\n */\n\nconst isVariationSelector = (code: number): boolean => {\n return code <= 0xfe0f && code >= 0xfe00\n}\n\n/**\n * Is `code` one of the BMP codes used in emoji sequences.\n *\n * https://emojipedia.org/emoji-zwj-sequences/\n */\n\nconst isBMPEmoji = (code: number): boolean => {\n // This requires tiny bit of maintanance, better ideas?\n // Fortunately it only happens if new Unicode Standard\n // is released. Fails gracefully if upkeep lags behind,\n // same way Slate previously behaved with all emojis.\n return (\n code === 0x2764 || // heart (❤)\n code === 0x2642 || // male (♂)\n code === 0x2640 || // female (♀)\n code === 0x2620 || // scull (☠)\n code === 0x2695 || // medical (⚕)\n code === 0x2708 || // plane (✈️)\n code === 0x25ef // large circle (◯)\n )\n}\n","import isPlainObject from 'is-plain-object'\nimport { createDraft, finishDraft, isDraft } from 'immer'\nimport { reverse as reverseText } from 'esrever'\n\nimport {\n Ancestor,\n Descendant,\n Element,\n Location,\n Node,\n NodeEntry,\n Operation,\n Path,\n PathRef,\n Point,\n PointRef,\n Range,\n RangeRef,\n Span,\n Text,\n} from '..'\nimport {\n DIRTY_PATHS,\n NORMALIZING,\n PATH_REFS,\n POINT_REFS,\n RANGE_REFS,\n} from '../utils/weak-maps'\nimport { getWordDistance, getCharacterDistance } from '../utils/string'\n\n/**\n * The `Editor` interface stores all the state of a Slate editor. It is extended\n * by plugins that wish to add their own helpers and implement new behaviors.\n */\n\nexport interface Editor {\n children: Node[]\n selection: Range | null\n operations: Operation[]\n marks: Record<string, any> | null\n [key: string]: any\n\n // Schema-specific node behaviors.\n isInline: (element: Element) => boolean\n isVoid: (element: Element) => boolean\n normalizeNode: (entry: NodeEntry) => void\n onChange: () => void\n\n // Overrideable core actions.\n addMark: (key: string, value: any) => void\n apply: (operation: Operation) => void\n deleteBackward: (unit: 'character' | 'word' | 'line' | 'block') => void\n deleteForward: (unit: 'character' | 'word' | 'line' | 'block') => void\n deleteFragment: () => void\n getFragment: () => Descendant[]\n insertBreak: () => void\n insertFragment: (fragment: Node[]) => void\n insertNode: (node: Node) => void\n insertText: (text: string) => void\n removeMark: (key: string) => void\n}\n\nexport const Editor = {\n /**\n * Get the ancestor above a location in the document.\n */\n\n above<T extends Ancestor>(\n editor: Editor,\n options: {\n at?: Location\n match?: NodeMatch<T>\n mode?: 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ): NodeEntry<T> | undefined {\n const {\n voids = false,\n mode = 'lowest',\n at = editor.selection,\n match,\n } = options\n\n if (!at) {\n return\n }\n\n const path = Editor.path(editor, at)\n const reverse = mode === 'lowest'\n\n for (const [n, p] of Editor.levels(editor, {\n at: path,\n voids,\n match,\n reverse,\n })) {\n if (!Text.isText(n) && !Path.equals(path, p)) {\n return [n, p]\n }\n }\n },\n\n /**\n * Add a custom property to the leaf text nodes in the current selection.\n *\n * If the selection is currently collapsed, the marks will be added to the\n * `editor.marks` property instead, and applied when text is inserted next.\n */\n\n addMark(editor: Editor, key: string, value: any): void {\n editor.addMark(key, value)\n },\n\n /**\n * Get the point after a location.\n */\n\n after(\n editor: Editor,\n at: Location,\n options: {\n distance?: number\n unit?: 'offset' | 'character' | 'word' | 'line' | 'block'\n } = {}\n ): Point | undefined {\n const anchor = Editor.point(editor, at, { edge: 'end' })\n const focus = Editor.end(editor, [])\n const range = { anchor, focus }\n const { distance = 1 } = options\n let d = 0\n let target\n\n for (const p of Editor.positions(editor, { ...options, at: range })) {\n if (d > distance) {\n break\n }\n\n if (d !== 0) {\n target = p\n }\n\n d++\n }\n\n return target\n },\n\n /**\n * Get the point before a location.\n */\n\n before(\n editor: Editor,\n at: Location,\n options: {\n distance?: number\n unit?: 'offset' | 'character' | 'word' | 'line' | 'block'\n } = {}\n ): Point | undefined {\n const anchor = Editor.start(editor, [])\n const focus = Editor.point(editor, at, { edge: 'start' })\n const range = { anchor, focus }\n const { distance = 1 } = options\n let d = 0\n let target\n\n for (const p of Editor.positions(editor, {\n ...options,\n at: range,\n reverse: true,\n })) {\n if (d > distance) {\n break\n }\n\n if (d !== 0) {\n target = p\n }\n\n d++\n }\n\n return target\n },\n\n /**\n * Delete content in the editor backward from the current selection.\n */\n\n deleteBackward(\n editor: Editor,\n options: {\n unit?: 'character' | 'word' | 'line' | 'block'\n } = {}\n ): void {\n const { unit = 'character' } = options\n editor.deleteBackward(unit)\n },\n\n /**\n * Delete content in the editor forward from the current selection.\n */\n\n deleteForward(\n editor: Editor,\n options: {\n unit?: 'character' | 'word' | 'line' | 'block'\n } = {}\n ): void {\n const { unit = 'character' } = options\n editor.deleteForward(unit)\n },\n\n /**\n * Delete the content in the current selection.\n */\n\n deleteFragment(editor: Editor): void {\n editor.deleteFragment()\n },\n\n /**\n * Get the start and end points of a location.\n */\n\n edges(editor: Editor, at: Location): [Point, Point] {\n return [Editor.start(editor, at), Editor.end(editor, at)]\n },\n\n /**\n * Get the end point of a location.\n */\n\n end(editor: Editor, at: Location): Point {\n return Editor.point(editor, at, { edge: 'end' })\n },\n\n /**\n * Get the first node at a location.\n */\n\n first(editor: Editor, at: Location): NodeEntry {\n const path = Editor.path(editor, at, { edge: 'start' })\n return Editor.node(editor, path)\n },\n\n /**\n * Get the fragment at a location.\n */\n\n fragment(editor: Editor, at: Location): Descendant[] {\n const range = Editor.range(editor, at)\n const fragment = Node.fragment(editor, range)\n return fragment\n },\n /**\n * Check if a node has block children.\n */\n\n hasBlocks(editor: Editor, element: Element): boolean {\n return element.children.some(n => Editor.isBlock(editor, n))\n },\n\n /**\n * Check if a node has inline and text children.\n */\n\n hasInlines(editor: Editor, element: Element): boolean {\n return element.children.some(\n n => Text.isText(n) || Editor.isInline(editor, n)\n )\n },\n\n /**\n * Check if a node has text children.\n */\n\n hasTexts(editor: Editor, element: Element): boolean {\n return element.children.every(n => Text.isText(n))\n },\n\n /**\n * Insert a block break at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\n\n insertBreak(editor: Editor): void {\n editor.insertBreak()\n },\n\n /**\n * Insert a fragment at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\n\n insertFragment(editor: Editor, fragment: Node[]): void {\n editor.insertFragment(fragment)\n },\n\n /**\n * Insert a node at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\n\n insertNode(editor: Editor, node: Node): void {\n editor.insertNode(node)\n },\n\n /**\n * Insert text at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\n\n insertText(editor: Editor, text: string): void {\n editor.insertText(text)\n },\n\n /**\n * Check if a value is a block `Element` object.\n */\n\n isBlock(editor: Editor, value: any): value is Element {\n return Element.isElement(value) && !editor.isInline(value)\n },\n\n /**\n * Check if a value is an `Editor` object.\n */\n\n isEditor(value: any): value is Editor {\n return (\n isPlainObject(value) &&\n typeof value.addMark === 'function' &&\n typeof value.apply === 'function' &&\n typeof value.deleteBackward === 'function' &&\n typeof value.deleteForward === 'function' &&\n typeof value.deleteFragment === 'function' &&\n typeof value.insertBreak === 'function' &&\n typeof value.insertFragment === 'function' &&\n typeof value.insertNode === 'function' &&\n typeof value.insertText === 'function' &&\n typeof value.isInline === 'function' &&\n typeof value.isVoid === 'function' &&\n typeof value.normalizeNode === 'function' &&\n typeof value.onChange === 'function' &&\n typeof value.removeMark === 'function' &&\n (value.marks === null || isPlainObject(value.marks)) &&\n (value.selection === null || Range.isRange(value.selection)) &&\n Node.isNodeList(value.children) &&\n Operation.isOperationList(value.operations)\n )\n },\n\n /**\n * Check if a point is the end point of a location.\n */\n\n isEnd(editor: Editor, point: Point, at: Location): boolean {\n const end = Editor.end(editor, at)\n return Point.equals(point, end)\n },\n\n /**\n * Check if a point is an edge of a location.\n */\n\n isEdge(editor: Editor, point: Point, at: Location): boolean {\n return Editor.isStart(editor, point, at) || Editor.isEnd(editor, point, at)\n },\n\n /**\n * Check if an element is empty, accounting for void nodes.\n */\n\n isEmpty(editor: Editor, element: Element): boolean {\n const { children } = element\n const [first] = children\n return (\n children.length === 0 ||\n (children.length === 1 &&\n Text.isText(first) &&\n first.text === '' &&\n !editor.isVoid(element))\n )\n },\n\n /**\n * Check if a value is an inline `Element` object.\n */\n\n isInline(editor: Editor, value: any): value is Element {\n return Element.isElement(value) && editor.isInline(value)\n },\n\n /**\n * Check if the editor is currently normalizing after each operation.\n */\n\n isNormalizing(editor: Editor): boolean {\n const isNormalizing = NORMALIZING.get(editor)\n return isNormalizing === undefined ? true : isNormalizing\n },\n\n /**\n * Check if a point is the start point of a location.\n */\n\n isStart(editor: Editor, point: Point, at: Location): boolean {\n // PERF: If the offset isn't `0` we know it's not the start.\n if (point.offset !== 0) {\n return false\n }\n\n const start = Editor.start(editor, at)\n return Point.equals(point, start)\n },\n\n /**\n * Check if a value is a void `Element` object.\n */\n\n isVoid(editor: Editor, value: any): value is Element {\n return Element.isElement(value) && editor.isVoid(value)\n },\n\n /**\n * Get the last node at a location.\n */\n\n last(editor: Editor, at: Location): NodeEntry {\n const path = Editor.path(editor, at, { edge: 'end' })\n return Editor.node(editor, path)\n },\n\n /**\n * Get the leaf text node at a location.\n */\n\n leaf(\n editor: Editor,\n at: Location,\n options: {\n depth?: number\n edge?: 'start' | 'end'\n } = {}\n ): NodeEntry<Text> {\n const path = Editor.path(editor, at, options)\n const node = Node.leaf(editor, path)\n return [node, path]\n },\n\n /**\n * Iterate through all of the levels at a location.\n */\n\n *levels<T extends Node>(\n editor: Editor,\n options: {\n at?: Location\n match?: NodeMatch<T>\n reverse?: boolean\n voids?: boolean\n } = {}\n ): Iterable<NodeEntry<T>> {\n const { at = editor.selection, reverse = false, voids = false } = options\n let { match } = options\n\n if (match == null) {\n match = () => true\n }\n\n if (!at) {\n return\n }\n\n const levels: NodeEntry<T>[] = []\n const path = Editor.path(editor, at)\n\n for (const [n, p] of Node.levels(editor, path)) {\n if (!match(n)) {\n continue\n }\n\n levels.push([n, p])\n\n if (!voids && Editor.isVoid(editor, n)) {\n break\n }\n }\n\n if (reverse) {\n levels.reverse()\n }\n\n yield* levels\n },\n\n /**\n * Get the marks that would be added to text at the current selection.\n */\n\n marks(editor: Editor): Record<string, any> | null {\n const { marks, selection } = editor\n\n if (!selection) {\n return null\n }\n\n if (marks) {\n return marks\n }\n\n if (Range.isExpanded(selection)) {\n const [match] = Editor.nodes(editor, { match: Text.isText })\n\n if (match) {\n const [node] = match as NodeEntry<Text>\n const { text, ...rest } = node\n return rest\n } else {\n return {}\n }\n }\n\n const { anchor } = selection\n const { path } = anchor\n let [node] = Editor.leaf(editor, path)\n\n if (anchor.offset === 0) {\n const prev = Editor.previous(editor, { at: path, match: Text.isText })\n const block = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n })\n\n if (prev && block) {\n const [prevNode, prevPath] = prev\n const [, blockPath] = block\n\n if (Path.isAncestor(blockPath, prevPath)) {\n node = prevNode as Text\n }\n }\n }\n\n const { text, ...rest } = node\n return rest\n },\n\n /**\n * Get the matching node in the branch of the document after a location.\n */\n\n next<T extends Node>(\n editor: Editor,\n options: {\n at?: Location\n match?: NodeMatch<T>\n mode?: 'all' | 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ): NodeEntry<T> | undefined {\n const { mode = 'lowest', voids = false } = options\n let { match, at = editor.selection } = options\n\n if (!at) {\n return\n }\n\n const [, from] = Editor.last(editor, at)\n const [, to] = Editor.last(editor, [])\n const span: Span = [from, to]\n\n if (Path.isPath(at) && at.length === 0) {\n throw new Error(`Cannot get the next node from the root node!`)\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n const [parent] = Editor.parent(editor, at)\n match = n => parent.children.includes(n)\n } else {\n match = () => true\n }\n }\n\n const [, next] = Editor.nodes(editor, { at: span, match, mode, voids })\n return next\n },\n\n /**\n * Get the node at a location.\n */\n\n node(\n editor: Editor,\n at: Location,\n options: {\n depth?: number\n edge?: 'start' | 'end'\n } = {}\n ): NodeEntry {\n const path = Editor.path(editor, at, options)\n const node = Node.get(editor, path)\n return [node, path]\n },\n\n /**\n * Iterate through all of the nodes in the Editor.\n */\n\n *nodes<T extends Node>(\n editor: Editor,\n options: {\n at?: Location | Span\n match?: NodeMatch<T>\n mode?: 'all' | 'highest' | 'lowest'\n universal?: boolean\n reverse?: boolean\n voids?: boolean\n } = {}\n ): Iterable<NodeEntry<T>> {\n const {\n at = editor.selection,\n mode = 'all',\n universal = false,\n reverse = false,\n voids = false,\n } = options\n let { match } = options\n\n if (!match) {\n match = () => true\n }\n\n if (!at) {\n return\n }\n\n let from\n let to\n\n if (Span.isSpan(at)) {\n from = at[0]\n to = at[1]\n } else {\n const first = Editor.path(editor, at, { edge: 'start' })\n const last = Editor.path(editor, at, { edge: 'end' })\n from = reverse ? last : first\n to = reverse ? first : last\n }\n\n const iterable = Node.nodes(editor, {\n reverse,\n from,\n to,\n pass: ([n]) => (voids ? false : Editor.isVoid(editor, n)),\n })\n\n const matches: NodeEntry<T>[] = []\n let hit: NodeEntry<T> | undefined\n\n for (const [node, path] of iterable) {\n const isLower = hit && Path.compare(path, hit[1]) === 0\n\n // In highest mode any node lower than the last hit is not a match.\n if (mode === 'highest' && isLower) {\n continue\n }\n\n if (!match(node)) {\n // If we've arrived at a leaf text node that is not lower than the last\n // hit, then we've found a branch that doesn't include a match, which\n // means the match is not universal.\n if (universal && !isLower && Text.isText(node)) {\n return\n } else {\n continue\n }\n }\n\n // If there's a match and it's lower than the last, update the hit.\n if (mode === 'lowest' && isLower) {\n hit = [node, path]\n continue\n }\n\n // In lowest mode we emit the last hit, once it's guaranteed lowest.\n const emit: NodeEntry<T> | undefined =\n mode === 'lowest' ? hit : [node, path]\n\n if (emit) {\n if (universal) {\n matches.push(emit)\n } else {\n yield emit\n }\n }\n\n hit = [node, path]\n }\n\n // Since lowest is always emitting one behind, catch up at the end.\n if (mode === 'lowest' && hit) {\n if (universal) {\n matches.push(hit)\n } else {\n yield hit\n }\n }\n\n // Universal defers to ensure that the match occurs in every branch, so we\n // yield all of the matches after iterating.\n if (universal) {\n yield* matches\n }\n },\n /**\n * Normalize any dirty objects in the editor.\n */\n\n normalize(\n editor: Editor,\n options: {\n force?: boolean\n } = {}\n ) {\n const { force = false } = options\n const getDirtyPaths = (editor: Editor) => {\n return DIRTY_PATHS.get(editor) || []\n }\n\n if (!Editor.isNormalizing(editor)) {\n return\n }\n\n if (force) {\n const allPaths = Array.from(Node.nodes(editor), ([, p]) => p)\n DIRTY_PATHS.set(editor, allPaths)\n }\n\n if (getDirtyPaths(editor).length === 0) {\n return\n }\n\n Editor.withoutNormalizing(editor, () => {\n const max = getDirtyPaths(editor).length * 42 // HACK: better way?\n let m = 0\n\n while (getDirtyPaths(editor).length !== 0) {\n if (m > max) {\n throw new Error(`\n Could not completely normalize the editor after ${max} iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state.\n `)\n }\n\n const path = getDirtyPaths(editor).pop()!\n const entry = Editor.node(editor, path)\n editor.normalizeNode(entry)\n m++\n }\n })\n },\n\n /**\n * Get the parent node of a location.\n */\n\n parent(\n editor: Editor,\n at: Location,\n options: {\n depth?: number\n edge?: 'start' | 'end'\n } = {}\n ): NodeEntry<Ancestor> {\n const path = Editor.path(editor, at, options)\n const parentPath = Path.parent(path)\n const entry = Editor.node(editor, parentPath)\n return entry as NodeEntry<Ancestor>\n },\n\n /**\n * Get the path of a location.\n */\n\n path(\n editor: Editor,\n at: Location,\n options: {\n depth?: number\n edge?: 'start' | 'end'\n } = {}\n ): Path {\n const { depth, edge } = options\n\n if (Path.isPath(at)) {\n if (edge === 'start') {\n const [, firstPath] = Node.first(editor, at)\n at = firstPath\n } else if (edge === 'end') {\n const [, lastPath] = Node.last(editor, at)\n at = lastPath\n }\n }\n\n if (Range.isRange(at)) {\n if (edge === 'start') {\n at = Range.start(at)\n } else if (edge === 'end') {\n at = Range.end(at)\n } else {\n at = Path.common(at.anchor.path, at.focus.path)\n }\n }\n\n if (Point.isPoint(at)) {\n at = at.path\n }\n\n if (depth != null) {\n at = at.slice(0, depth)\n }\n\n return at\n },\n\n /**\n * Create a mutable ref for a `Path` object, which will stay in sync as new\n * operations are applied to the editor.\n */\n\n pathRef(\n editor: Editor,\n path: Path,\n options: {\n affinity?: 'backward' | 'forward' | null\n } = {}\n ): PathRef {\n const { affinity = 'forward' } = options\n const ref: PathRef = {\n current: path,\n affinity,\n unref() {\n const { current } = ref\n const pathRefs = Editor.pathRefs(editor)\n pathRefs.delete(ref)\n ref.current = null\n return current\n },\n }\n\n const refs = Editor.pathRefs(editor)\n refs.add(ref)\n return ref\n },\n\n /**\n * Get the set of currently tracked path refs of the editor.\n */\n\n pathRefs(editor: Editor): Set<PathRef> {\n let refs = PATH_REFS.get(editor)\n\n if (!refs) {\n refs = new Set()\n PATH_REFS.set(editor, refs)\n }\n\n return refs\n },\n\n /**\n * Get the start or end point of a location.\n */\n\n point(\n editor: Editor,\n at: Location,\n options: {\n edge?: 'start' | 'end'\n } = {}\n ): Point {\n const { edge = 'start' } = options\n\n if (Path.isPath(at)) {\n let path\n\n if (edge === 'end') {\n const [, lastPath] = Node.last(editor, at)\n path = lastPath\n } else {\n const [, firstPath] = Node.first(editor, at)\n path = firstPath\n }\n\n const node = Node.get(editor, path)\n\n if (!Text.isText(node)) {\n throw new Error(\n `Cannot get the ${edge} point in the node at path [${at}] because it has no ${edge} text node.`\n )\n }\n\n return { path, offset: edge === 'end' ? node.text.length : 0 }\n }\n\n if (Range.isRange(at)) {\n const [start, end] = Range.edges(at)\n return edge === 'start' ? start : end\n }\n\n return at\n },\n\n /**\n * Create a mutable ref for a `Point` object, which will stay in sync as new\n * operations are applied to the editor.\n */\n\n pointRef(\n editor: Editor,\n point: Point,\n options: {\n affinity?: 'backward' | 'forward' | null\n } = {}\n ): PointRef {\n const { affinity = 'forward' } = options\n const ref: PointRef = {\n current: point,\n affinity,\n unref() {\n const { current } = ref\n const pointRefs = Editor.pointRefs(editor)\n pointRefs.delete(ref)\n ref.current = null\n return current\n },\n }\n\n const refs = Editor.pointRefs(editor)\n refs.add(ref)\n return ref\n },\n\n /**\n * Get the set of currently tracked point refs of the editor.\n */\n\n pointRefs(editor: Editor): Set<PointRef> {\n let refs = POINT_REFS.get(editor)\n\n if (!refs) {\n refs = new Set()\n POINT_REFS.set(editor, refs)\n }\n\n return refs\n },\n\n /**\n * Iterate through all of the positions in the document where a `Point` can be\n * placed.\n *\n * By default it will move forward by individual offsets at a time, but you\n * can pass the `unit: 'character'` option to moved forward one character, word,\n * or line at at time.\n *\n * Note: void nodes are treated as a single point, and iteration will not\n * happen inside their content.\n */\n\n *positions(\n editor: Editor,\n options: {\n at?: Location\n unit?: 'offset' | 'character' | 'word' | 'line' | 'block'\n reverse?: boolean\n } = {}\n ): Iterable<Point> {\n const { at = editor.selection, unit = 'offset', reverse = false } = options\n\n if (!at) {\n return\n }\n\n const range = Editor.range(editor, at)\n const [start, end] = Range.edges(range)\n const first = reverse ? end : start\n let string = ''\n let available = 0\n let offset = 0\n let distance: number | null = null\n let isNewBlock = false\n\n const advance = () => {\n if (distance == null) {\n if (unit === 'character') {\n distance = getCharacterDistance(string)\n } else if (unit === 'word') {\n distance = getWordDistance(string)\n } else if (unit === 'line' || unit === 'block') {\n distance = string.length\n } else {\n distance = 1\n }\n\n string = string.slice(distance)\n }\n\n // Add or substract the offset.\n offset = reverse ? offset - distance : offset + distance\n // Subtract the distance traveled from the available text.\n available = available - distance!\n // If the available had room to spare, reset the distance so that it will\n // advance again next time. Otherwise, set it to the overflow amount.\n distance = available >= 0 ? null : 0 - available\n }\n\n for (const [node, path] of Editor.nodes(editor, { at, reverse })) {\n if (Element.isElement(node)) {\n // Void nodes are a special case, since we don't want to iterate over\n // their content. We instead always just yield their first point.\n if (editor.isVoid(node)) {\n yield Editor.start(editor, path)\n continue\n }\n\n if (editor.isInline(node)) {\n continue\n }\n\n if (Editor.hasInlines(editor, node)) {\n const e = Path.isAncestor(path, end.path)\n ? end\n : Editor.end(editor, path)\n const s = Path.isAncestor(path, start.path)\n ? start\n : Editor.start(editor, path)\n\n const text = Editor.string(editor, { anchor: s, focus: e })\n string = reverse ? reverseText(text) : text\n isNewBlock = true\n }\n }\n\n if (Text.isText(node)) {\n const isFirst = Path.equals(path, first.path)\n available = node.text.length\n offset = reverse ? available : 0\n\n if (isFirst) {\n available = reverse ? first.offset : available - first.offset\n offset = first.offset\n }\n\n if (isFirst || isNewBlock || unit === 'offset') {\n yield { path, offset }\n }\n\n while (true) {\n // If there's no more string, continue to the next block.\n if (string === '') {\n break\n } else {\n advance()\n }\n\n // If the available space hasn't overflow, we have another point to\n // yield in the current text node.\n if (available >= 0) {\n yield { path, offset }\n } else {\n break\n }\n }\n\n isNewBlock = false\n }\n }\n },\n\n /**\n * Get the matching node in the branch of the document before a location.\n */\n\n previous<T extends Node>(\n editor: Editor,\n options: {\n at?: Location\n match?: NodeMatch<T>\n mode?: 'all' | 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ): NodeEntry<T> | undefined {\n const { mode = 'lowest', voids = false } = options\n let { match, at = editor.selection } = options\n\n if (!at) {\n return\n }\n\n const [, from] = Editor.first(editor, at)\n const [, to] = Editor.first(editor, [])\n const span: Span = [from, to]\n\n if (Path.isPath(at) && at.length === 0) {\n throw new Error(`Cannot get the previous node from the root node!`)\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n const [parent] = Editor.parent(editor, at)\n match = n => parent.children.includes(n)\n } else {\n match = () => true\n }\n }\n\n const [, previous] = Editor.nodes(editor, {\n reverse: true,\n at: span,\n match,\n mode,\n voids,\n })\n\n return previous\n },\n\n /**\n * Get a range of a location.\n */\n\n range(editor: Editor, at: Location, to?: Location): Range {\n if (Range.isRange(at) && !to) {\n return at\n }\n\n const start = Editor.start(editor, at)\n const end = Editor.end(editor, to || at)\n return { anchor: start, focus: end }\n },\n\n /**\n * Create a mutable ref for a `Range` object, which will stay in sync as new\n * operations are applied to the editor.\n */\n\n rangeRef(\n editor: Editor,\n range: Range,\n options: {\n affinity?: 'backward' | 'forward' | 'outward' | 'inward' | null\n } = {}\n ): RangeRef {\n const { affinity = 'forward' } = options\n const ref: RangeRef = {\n current: range,\n affinity,\n unref() {\n const { current } = ref\n const rangeRefs = Editor.rangeRefs(editor)\n rangeRefs.delete(ref)\n ref.current = null\n return current\n },\n }\n\n const refs = Editor.rangeRefs(editor)\n refs.add(ref)\n return ref\n },\n\n /**\n * Get the set of currently tracked range refs of the editor.\n */\n\n rangeRefs(editor: Editor): Set<RangeRef> {\n let refs = RANGE_REFS.get(editor)\n\n if (!refs) {\n refs = new Set()\n RANGE_REFS.set(editor, refs)\n }\n\n return refs\n },\n\n /**\n * Remove a custom property from all of the leaf text nodes in the current\n * selection.\n *\n * If the selection is currently collapsed, the removal will be stored on\n * `editor.marks` and applied to the text inserted next.\n */\n\n removeMark(editor: Editor, key: string): void {\n editor.removeMark(key)\n },\n\n /**\n * Get the start point of a location.\n */\n\n start(editor: Editor, at: Location): Point {\n return Editor.point(editor, at, { edge: 'start' })\n },\n\n /**\n * Get the text string content of a location.\n *\n * Note: the text of void nodes is presumed to be an empty string, regardless\n * of what their actual content is.\n */\n\n string(editor: Editor, at: Location): string {\n const range = Editor.range(editor, at)\n const [start, end] = Range.edges(range)\n let text = ''\n\n for (const [node, path] of Editor.nodes(editor, {\n at: range,\n match: Text.isText,\n })) {\n let t = node.text\n\n if (Path.equals(path, end.path)) {\n t = t.slice(0, end.offset)\n }\n\n if (Path.equals(path, start.path)) {\n t = t.slice(start.offset)\n }\n\n text += t\n }\n\n return text\n },\n\n /**\n * Transform the editor by an operation.\n */\n\n transform(editor: Editor, op: Operation) {\n editor.children = createDraft(editor.children)\n let selection = editor.selection && createDraft(editor.selection)\n\n switch (op.type) {\n case 'insert_node': {\n const { path, node } = op\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n parent.children.splice(index, 0, node)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'insert_text': {\n const { path, offset, text } = op\n const node = Node.leaf(editor, path)\n const before = node.text.slice(0, offset)\n const after = node.text.slice(offset)\n node.text = before + text + after\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'merge_node': {\n const { path } = op\n const node = Node.get(editor, path)\n const prevPath = Path.previous(path)\n const prev = Node.get(editor, prevPath)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n\n if (Text.isText(node) && Text.isText(prev)) {\n prev.text += node.text\n } else if (!Text.isText(node) && !Text.isText(prev)) {\n prev.children.push(...node.children)\n } else {\n throw new Error(\n `Cannot apply a \"merge_node\" operation at path [${path}] to nodes of different interaces: ${node} ${prev}`\n )\n }\n\n parent.children.splice(index, 1)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'move_node': {\n const { path, newPath } = op\n\n if (Path.isAncestor(path, newPath)) {\n throw new Error(\n `Cannot move a path [${path}] to new path [${newPath}] because the destination is inside itself.`\n )\n }\n\n const node = Node.get(editor, path)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n\n // This is tricky, but since the `path` and `newPath` both refer to\n // the same snapshot in time, there's a mismatch. After either\n // removing the original position, the second step's path can be out\n // of date. So instead of using the `op.newPath` directly, we\n // transform `op.path` to ascertain what the `newPath` would be after\n // the operation was applied.\n parent.children.splice(index, 1)\n const truePath = Path.transform(path, op)!\n const newParent = Node.get(editor, Path.parent(truePath))\n const newIndex = truePath[truePath.length - 1]\n\n newParent.children.splice(newIndex, 0, node)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'remove_node': {\n const { path } = op\n const index = path[path.length - 1]\n const parent = Node.parent(editor, path)\n parent.children.splice(index, 1)\n\n // Transform all of the points in the value, but if the point was in the\n // node that was removed we need to update the range or remove it.\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n const result = Point.transform(point, op)\n\n if (selection != null && result != null) {\n selection[key] = result\n } else {\n let prev: NodeEntry<Text> | undefined\n let next: NodeEntry<Text> | undefined\n\n for (const [n, p] of Node.texts(editor)) {\n if (Path.compare(p, path) === -1) {\n prev = [n, p]\n } else {\n next = [n, p]\n break\n }\n }\n\n if (prev) {\n point.path = prev[1]\n point.offset = prev[0].text.length\n } else if (next) {\n point.path = next[1]\n point.offset = 0\n } else {\n selection = null\n }\n }\n }\n }\n\n break\n }\n\n case 'remove_text': {\n const { path, offset, text } = op\n const node = Node.leaf(editor, path)\n const before = node.text.slice(0, offset)\n const after = node.text.slice(offset + text.length)\n node.text = before + after\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'set_node': {\n const { path, newProperties } = op\n\n if (path.length === 0) {\n throw new Error(`Cannot set properties on the root node!`)\n }\n\n const node = Node.get(editor, path)\n\n for (const key in newProperties) {\n if (key === 'children' || key === 'text') {\n throw new Error(`Cannot set the \"${key}\" property of nodes!`)\n }\n\n const value = newProperties[key]\n\n if (value == null) {\n delete node[key]\n } else {\n node[key] = value\n }\n }\n\n break\n }\n\n case 'set_selection': {\n const { newProperties } = op\n\n if (newProperties == null) {\n selection = newProperties\n } else if (selection == null) {\n if (!Range.isRange(newProperties)) {\n throw new Error(\n `Cannot apply an incomplete \"set_selection\" operation properties ${JSON.stringify(\n newProperties\n )} when there is no current selection.`\n )\n }\n\n selection = newProperties\n } else {\n Object.assign(selection, newProperties)\n }\n\n break\n }\n\n case 'split_node': {\n const { path, position, properties } = op\n\n if (path.length === 0) {\n throw new Error(\n `Cannot apply a \"split_node\" operation at path [${path}] because the root node cannot be split.`\n )\n }\n\n const node = Node.get(editor, path)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n let newNode: Descendant\n\n if (Text.isText(node)) {\n const before = node.text.slice(0, position)\n const after = node.text.slice(position)\n node.text = before\n newNode = {\n ...node,\n ...(properties as Partial<Text>),\n text: after,\n }\n } else {\n const before = node.children.slice(0, position)\n const after = node.children.slice(position)\n node.children = before\n\n newNode = {\n ...node,\n ...(properties as Partial<Element>),\n children: after,\n }\n }\n\n parent.children.splice(index + 1, 0, newNode)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n }\n\n editor.children = finishDraft(editor.children) as Node[]\n\n if (selection) {\n editor.selection = isDraft(selection)\n ? (finishDraft(selection) as Range)\n : selection\n } else {\n editor.selection = null\n }\n },\n\n /**\n * Convert a range into a non-hanging one.\n */\n\n unhangRange(\n editor: Editor,\n range: Range,\n options: {\n voids?: boolean\n } = {}\n ): Range {\n const { voids = false } = options\n let [start, end] = Range.edges(range)\n\n // PERF: exit early if we can guarantee that the range isn't hanging.\n if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {\n return range\n }\n\n const endBlock = Editor.above(editor, {\n at: end,\n match: n => Editor.isBlock(editor, n),\n })\n const blockPath = endBlock ? endBlock[1] : []\n const first = Editor.start(editor, [])\n const before = { anchor: first, focus: end }\n let skip = true\n\n for (const [node, path] of Editor.nodes(editor, {\n at: before,\n match: Text.isText,\n reverse: true,\n voids,\n })) {\n if (skip) {\n skip = false\n continue\n }\n\n if (node.text !== '' || Path.isBefore(path, blockPath)) {\n end = { path, offset: node.text.length }\n break\n }\n }\n\n return { anchor: start, focus: end }\n },\n\n /**\n * Match a void node in the current branch of the editor.\n */\n\n void(\n editor: Editor,\n options: {\n at?: Location\n mode?: 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ): NodeEntry<Element> | undefined {\n return Editor.above(editor, {\n ...options,\n match: n => Editor.isVoid(editor, n),\n })\n },\n\n /**\n * Call a function, deferring normalization until after it completes.\n */\n\n withoutNormalizing(editor: Editor, fn: () => void): void {\n const value = Editor.isNormalizing(editor)\n NORMALIZING.set(editor, false)\n fn()\n NORMALIZING.set(editor, value)\n Editor.normalize(editor)\n },\n}\n\n/**\n * A helper type for narrowing matched nodes with a predicate.\n */\n\ntype NodeMatch<T extends Node> =\n | ((node: Node) => node is T)\n | ((node: Node) => boolean)\n","import isPlainObject from 'is-plain-object'\nimport { Editor, Node, Path } from '..'\n\n/**\n * `Element` objects are a type of node in a Slate document that contain other\n * element nodes or text nodes. They can be either \"blocks\" or \"inlines\"\n * depending on the Slate editor's configuration.\n */\n\nexport interface Element {\n children: Node[]\n [key: string]: any\n}\n\nexport const Element = {\n /**\n * Check if a value implements the `Element` interface.\n */\n\n isElement(value: any): value is Element {\n return (\n isPlainObject(value) &&\n Node.isNodeList(value.children) &&\n !Editor.isEditor(value)\n )\n },\n\n /**\n * Check if a value is an array of `Element` objects.\n */\n\n isElementList(value: any): value is Element[] {\n return (\n Array.isArray(value) &&\n (value.length === 0 || Element.isElement(value[0]))\n )\n },\n\n /**\n * Check if an element matches set of properties.\n *\n * Note: this checks custom properties, and it does not ensure that any\n * children are equivalent.\n */\n\n matches(element: Element, props: Partial<Element>): boolean {\n for (const key in props) {\n if (key === 'children') {\n continue\n }\n\n if (element[key] !== props[key]) {\n return false\n }\n }\n\n return true\n },\n}\n\n/**\n * `ElementEntry` objects refer to an `Element` and the `Path` where it can be\n * found inside a root node.\n */\n\nexport type ElementEntry = [Element, Path]\n","import { Path, Point, Range } from '..'\n\n/**\n * The `Location` interface is a union of the ways to refer to a specific\n * location in a Slate document: paths, points or ranges.\n *\n * Methods will often accept a `Location` instead of requiring only a `Path`,\n * `Point` or `Range`. This eliminates the need for developers to manage\n * converting between the different interfaces in their own code base.\n */\n\nexport type Location = Path | Point | Range\n\nexport const Location = {\n /**\n * Check if a value implements the `Location` interface.\n */\n\n isLocation(value: any): value is Location {\n return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value)\n },\n}\n\n/**\n * The `Span` interface is a low-level way to refer to locations in nodes\n * without using `Point` which requires leaf text nodes to be present.\n */\n\nexport type Span = [Path, Path]\n\nexport const Span = {\n /**\n * Check if a value implements the `Span` interface.\n */\n\n isSpan(value: any): value is Span {\n return (\n Array.isArray(value) && value.length === 2 && value.every(Path.isPath)\n )\n },\n}\n","import { produce } from 'immer'\nimport { Editor, Element, ElementEntry, Path, Range, Text } from '..'\n\n/**\n * The `Node` union type represents all of the different types of nodes that\n * occur in a Slate document tree.\n */\n\nexport type Node = Editor | Element | Text\n\nexport const Node = {\n /**\n * Get the node at a specific path, asserting that it's an ancestor node.\n */\n\n ancestor(root: Node, path: Path): Ancestor {\n const node = Node.get(root, path)\n\n if (Text.isText(node)) {\n throw new Error(\n `Cannot get the ancestor node at path [${path}] because it refers to a text node instead: ${node}`\n )\n }\n\n return node\n },\n\n /**\n * Return an iterable of all the ancestor nodes above a specific path.\n *\n * By default the order is bottom-up, from lowest to highest ancestor in\n * the tree, but you can pass the `reverse: true` option to go top-down.\n */\n\n *ancestors(\n root: Node,\n path: Path,\n options: {\n reverse?: boolean\n } = {}\n ): Iterable<NodeEntry<Ancestor>> {\n for (const p of Path.ancestors(path, options)) {\n const n = Node.ancestor(root, p)\n const entry: NodeEntry<Ancestor> = [n, p]\n yield entry\n }\n },\n\n /**\n * Get the child of a node at a specific index.\n */\n\n child(root: Node, index: number): Descendant {\n if (Text.isText(root)) {\n throw new Error(\n `Cannot get the child of a text node: ${JSON.stringify(root)}`\n )\n }\n\n const c = root.children[index] as Descendant\n\n if (c == null) {\n throw new Error(\n `Cannot get child at index \\`${index}\\` in node: ${JSON.stringify(\n root\n )}`\n )\n }\n\n return c\n },\n\n /**\n * Iterate over the children of a node at a specific path.\n */\n\n *children(\n root: Node,\n path: Path,\n options: {\n reverse?: boolean\n } = {}\n ): Iterable<NodeEntry<Descendant>> {\n const { reverse = false } = options\n const ancestor = Node.ancestor(root, path)\n const { children } = ancestor\n let index = reverse ? children.length - 1 : 0\n\n while (reverse ? index >= 0 : index < children.length) {\n const child = Node.child(ancestor, index)\n const childPath = path.concat(index)\n yield [child, childPath]\n index = reverse ? index - 1 : index + 1\n }\n },\n\n /**\n * Get an entry for the common ancesetor node of two paths.\n */\n\n common(root: Node, path: Path, another: Path): NodeEntry {\n const p = Path.common(path, another)\n const n = Node.get(root, p)\n return [n, p]\n },\n\n /**\n * Get the node at a specific path, asserting that it's a descendant node.\n */\n\n descendant(root: Node, path: Path): Descendant {\n const node = Node.get(root, path)\n\n if (Editor.isEditor(node)) {\n throw new Error(\n `Cannot get the descendant node at path [${path}] because it refers to the root editor node instead: ${node}`\n )\n }\n\n return node\n },\n\n /**\n * Return an iterable of all the descendant node entries inside a root node.\n */\n\n *descendants(\n root: Node,\n options: {\n from?: Path\n to?: Path\n reverse?: boolean\n pass?: (node: NodeEntry) => boolean\n } = {}\n ): Iterable<NodeEntry<Descendant>> {\n for (const [node, path] of Node.nodes(root, options)) {\n if (path.length !== 0) {\n // NOTE: we have to coerce here because checking the path's length does\n // guarantee that `node` is not a `Editor`, but TypeScript doesn't know.\n yield [node, path] as NodeEntry<Descendant>\n }\n }\n },\n\n /**\n * Return an iterable of all the element nodes inside a root node. Each iteration\n * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the\n * root node is an element it will be included in the iteration as well.\n */\n\n *elements(\n root: Node,\n options: {\n from?: Path\n to?: Path\n reverse?: boolean\n pass?: (node: NodeEntry) => boolean\n } = {}\n ): Iterable<ElementEntry> {\n for (const [node, path] of Node.nodes(root, options)) {\n if (Element.isElement(node)) {\n yield [node, path]\n }\n }\n },\n\n /**\n * Get the first node entry in a root node from a path.\n */\n\n first(root: Node, path: Path): NodeEntry {\n const p = path.slice()\n let n = Node.get(root, p)\n\n while (n) {\n if (Text.isText(n) || n.children.length === 0) {\n break\n } else {\n n = n.children[0]\n p.push(0)\n }\n }\n\n return [n, p]\n },\n\n /**\n * Get the sliced fragment represented by a range inside a root node.\n */\n\n fragment(root: Node, range: Range): Descendant[] {\n if (Text.isText(root)) {\n throw new Error(\n `Cannot get a fragment starting from a root text node: ${JSON.stringify(\n root\n )}`\n )\n }\n\n const newRoot = produce(root, r => {\n const [start, end] = Range.edges(range)\n const iterable = Node.nodes(r, {\n reverse: true,\n pass: ([, path]) => !Range.includes(range, path),\n })\n\n for (const [, path] of iterable) {\n if (!Range.includes(range, path)) {\n const parent = Node.parent(r, path)\n const index = path[path.length - 1]\n parent.children.splice(index, 1)\n }\n\n if (Path.equals(path, end.path)) {\n const leaf = Node.leaf(r, path)\n leaf.text = leaf.text.slice(0, end.offset)\n }\n\n if (Path.equals(path, start.path)) {\n const leaf = Node.leaf(r, path)\n leaf.text = leaf.text.slice(start.offset)\n }\n }\n\n delete r.selection\n })\n\n return newRoot.children\n },\n\n /**\n * Get the descendant node referred to by a specific path. If the path is an\n * empty array, it refers to the root node itself.\n */\n\n get(root: Node, path: Path): Node {\n let node = root\n\n for (let i = 0; i < path.length; i++) {\n const p = path[i]\n\n if (Text.isText(node) || !node.children[p]) {\n throw new Error(\n `Cannot find a descendant at path [${path}] in node: ${JSON.stringify(\n root\n )}`\n )\n }\n\n node = node.children[p]\n }\n\n return node\n },\n\n /**\n * Check if a descendant node exists at a specific path.\n */\n\n has(root: Node, path: Path): boolean {\n let node = root\n\n for (let i = 0; i < path.length; i++) {\n const p = path[i]\n\n if (Text.isText(node) || !node.children[p]) {\n return false\n }\n\n node = node.children[p]\n }\n\n return true\n },\n\n /**\n * Check if a value implements the `Node` interface.\n */\n\n isNode(value: any): value is Node {\n return (\n Text.isText(value) || Element.isElement(value) || Editor.isEditor(value)\n )\n },\n\n /**\n * Check if a value is a list of `Node` objects.\n */\n\n isNodeList(value: any): value is Node[] {\n return Array.isArray(value) && (value.length === 0 || Node.isNode(value[0]))\n },\n\n /**\n * Get the lash node entry in a root node from a path.\n */\n\n last(root: Node, path: Path): NodeEntry {\n const p = path.slice()\n let n = Node.get(root, p)\n\n while (n) {\n if (Text.isText(n) || n.children.length === 0) {\n break\n } else {\n const i = n.children.length - 1\n n = n.children[i]\n p.push(i)\n }\n }\n\n return [n, p]\n },\n\n /**\n * Get the node at a specific path, ensuring it's a leaf text node.\n */\n\n leaf(root: Node, path: Path): Text {\n const node = Node.get(root, path)\n\n if (!Text.isText(node)) {\n throw new Error(\n `Cannot get the leaf node at path [${path}] because it refers to a non-leaf node: ${node}`\n )\n }\n\n return node\n },\n\n /**\n * Return an iterable of the in a branch of the tree, from a specific path.\n *\n * By default the order is top-down, from lowest to highest node in the tree,\n * but you can pass the `reverse: true` option to go bottom-up.\n */\n\n *levels(\n root: Node,\n path: Path,\n options: {\n reverse?: boolean\n } = {}\n ): Iterable<NodeEntry> {\n for (const p of Path.levels(path, options)) {\n const n = Node.get(root, p)\n yield [n, p]\n }\n },\n\n /**\n * Check if a node matches a set of props.\n */\n\n matches(node: Node, props: Partial<Node>): boolean {\n return (\n (Element.isElement(node) && Element.matches(node, props)) ||\n (Text.isText(node) && Text.matches(node, props))\n )\n },\n\n /**\n * Return an iterable of all the node entries of a root node. Each entry is\n * returned as a `[Node, Path]` tuple, with the path referring to the node's\n * position inside the root node.\n */\n\n *nodes(\n root: Node,\n options: {\n from?: Path\n to?: Path\n reverse?: boolean\n pass?: (entry: NodeEntry) => boolean\n } = {}\n ): Iterable<NodeEntry> {\n const { pass, reverse = false } = options\n const { from = [], to } = options\n const visited = new Set()\n let p: Path = []\n let n = root\n\n while (true) {\n if (to && (reverse ? Path.isBefore(p, to) : Path.isAfter(p, to))) {\n break\n }\n\n if (!visited.has(n)) {\n yield [n, p]\n }\n\n // If we're allowed to go downward and we haven't decsended yet, do.\n if (\n !visited.has(n) &&\n !Text.isText(n) &&\n n.children.length !== 0 &&\n (pass == null || pass([n, p]) === false)\n ) {\n visited.add(n)\n let nextIndex = reverse ? n.children.length - 1 : 0\n\n if (Path.isAncestor(p, from)) {\n nextIndex = from[p.length]\n }\n\n p = p.concat(nextIndex)\n n = Node.get(root, p)\n continue\n }\n\n // If we're at the root and we can't go down, we're done.\n if (p.length === 0) {\n break\n }\n\n // If we're going forward...\n if (!reverse) {\n const newPath = Path.next(p)\n\n if (Node.has(root, newPath)) {\n p = newPath\n n = Node.get(root, p)\n continue\n }\n }\n\n // If we're going backward...\n if (reverse && p[p.length - 1] !== 0) {\n const newPath = Path.previous(p)\n p = newPath\n n = Node.get(root, p)\n continue\n }\n\n // Otherwise we're going upward...\n p = Path.parent(p)\n n = Node.get(root, p)\n visited.add(n)\n }\n },\n\n /**\n * Get the parent of a node at a specific path.\n */\n\n parent(root: Node, path: Path): Ancestor {\n const parentPath = Path.parent(path)\n const p = Node.get(root, parentPath)\n\n if (Text.isText(p)) {\n throw new Error(\n `Cannot get the parent of path [${path}] because it does not exist in the root.`\n )\n }\n\n return p\n },\n\n /**\n * Get the concatenated text string of a node's content.\n *\n * Note that this will not include spaces or line breaks between block nodes.\n * It is not a user-facing string, but a string for performing offset-related\n * computations for a node.\n */\n\n string(node: Node): string {\n if (Text.isText(node)) {\n return node.text\n } else {\n return node.children.map(Node.string).join('')\n }\n },\n\n /**\n * Return an iterable of all leaf text nodes in a root node.\n */\n\n *texts(\n root: Node,\n options: {\n from?: Path\n to?: Path\n reverse?: boolean\n pass?: (node: NodeEntry) => boolean\n } = {}\n ): Iterable<NodeEntry<Text>> {\n for (const [node, path] of Node.nodes(root, options)) {\n if (Text.isText(node)) {\n yield [node, path]\n }\n }\n },\n}\n\n/**\n * The `Descendant` union type represents nodes that are descendants in the\n * tree. It is returned as a convenience in certain cases to narrow a value\n * further than the more generic `Node` union.\n */\n\nexport type Descendant = Element | Text\n\n/**\n * The `Ancestor` union type represents nodes that are ancestors in the tree.\n * It is returned as a convenience in certain cases to narrow a value further\n * than the more generic `Node` union.\n */\n\nexport type Ancestor = Editor | Element\n\n/**\n * `NodeEntry` objects are returned when iterating over the nodes in a Slate\n * document tree. They consist of the node and its `Path` relative to the root\n * node in the document.\n */\n\nexport type NodeEntry<T extends Node = Node> = [T, Path]\n","import { Node, Path, Range } from '..'\nimport isPlainObject from 'is-plain-object'\n\nexport type InsertNodeOperation = {\n type: 'insert_node'\n path: Path\n node: Node\n [key: string]: any\n}\n\nexport type InsertTextOperation = {\n type: 'insert_text'\n path: Path\n offset: number\n text: string\n [key: string]: any\n}\n\nexport type MergeNodeOperation = {\n type: 'merge_node'\n path: Path\n position: number\n target: number | null\n properties: Partial<Node>\n [key: string]: any\n}\n\nexport type MoveNodeOperation = {\n type: 'move_node'\n path: Path\n newPath: Path\n [key: string]: any\n}\n\nexport type RemoveNodeOperation = {\n type: 'remove_node'\n path: Path\n node: Node\n [key: string]: any\n}\n\nexport type RemoveTextOperation = {\n type: 'remove_text'\n path: Path\n offset: number\n text: string\n [key: string]: any\n}\n\nexport type SetNodeOperation = {\n type: 'set_node'\n path: Path\n properties: Partial<Node>\n newProperties: Partial<Node>\n [key: string]: any\n}\n\nexport type SetSelectionOperation =\n | {\n type: 'set_selection'\n [key: string]: any\n properties: null\n newProperties: Range\n }\n | {\n type: 'set_selection'\n [key: string]: any\n properties: Partial<Range>\n newProperties: Partial<Range>\n }\n | {\n type: 'set_selection'\n [key: string]: any\n properties: Range\n newProperties: null\n }\n\nexport type SplitNodeOperation = {\n type: 'split_node'\n path: Path\n position: number\n target: number | null\n properties: Partial<Node>\n [key: string]: any\n}\n\nexport type NodeOperation =\n | InsertNodeOperation\n | MergeNodeOperation\n | MoveNodeOperation\n | RemoveNodeOperation\n | SetNodeOperation\n | SplitNodeOperation\n\nexport type SelectionOperation = SetSelectionOperation\n\nexport type TextOperation = InsertTextOperation | RemoveTextOperation\n\n/**\n * `Operation` objects define the low-level instructions that Slate editors use\n * to apply changes to their internal state. Representing all changes as\n * operations is what allows Slate editors to easily implement history,\n * collaboration, and other features.\n */\n\nexport type Operation = NodeOperation | SelectionOperation | TextOperation\n\nexport const Operation = {\n /**\n * Check of a value is a `NodeOperation` object.\n */\n\n isNodeOperation(value: any): value is NodeOperation {\n return Operation.isOperation(value) && value.type.endsWith('_node')\n },\n\n /**\n * Check of a value is an `Operation` object.\n */\n\n isOperation(value: any): value is Operation {\n if (!isPlainObject(value)) {\n return false\n }\n\n switch (value.type) {\n case 'insert_node':\n return Path.isPath(value.path) && Node.isNode(value.node)\n case 'insert_text':\n return (\n typeof value.offset === 'number' &&\n typeof value.text === 'string' &&\n Path.isPath(value.path)\n )\n case 'merge_node':\n return (\n typeof value.position === 'number' &&\n (typeof value.target === 'number' || value.target === null) &&\n Path.isPath(value.path) &&\n isPlainObject(value.properties)\n )\n case 'move_node':\n return Path.isPath(value.path) && Path.isPath(value.newPath)\n case 'remove_node':\n return Path.isPath(value.path) && Node.isNode(value.node)\n case 'remove_text':\n return (\n typeof value.offset === 'number' &&\n typeof value.text === 'string' &&\n Path.isPath(value.path)\n )\n case 'set_node':\n return (\n Path.isPath(value.path) &&\n isPlainObject(value.properties) &&\n isPlainObject(value.newProperties)\n )\n case 'set_selection':\n return (\n (value.properties === null && Range.isRange(value.newProperties)) ||\n (value.newProperties === null && Range.isRange(value.properties)) ||\n (isPlainObject(value.properties) &&\n isPlainObject(value.newProperties))\n )\n case 'split_node':\n return (\n Path.isPath(value.path) &&\n typeof value.position === 'number' &&\n (typeof value.target === 'number' || value.target === null) &&\n isPlainObject(value.properties)\n )\n default:\n return false\n }\n },\n\n /**\n * Check if a value is a list of `Operation` objects.\n */\n\n isOperationList(value: any): value is Operation[] {\n return (\n Array.isArray(value) &&\n (value.length === 0 || Operation.isOperation(value[0]))\n )\n },\n\n /**\n * Check of a value is a `SelectionOperation` object.\n */\n\n isSelectionOperation(value: any): value is SelectionOperation {\n return Operation.isOperation(value) && value.type.endsWith('_selection')\n },\n\n /**\n * Check of a value is a `TextOperation` object.\n */\n\n isTextOperation(value: any): value is TextOperation {\n return Operation.isOperation(value) && value.type.endsWith('_text')\n },\n\n /**\n * Invert an operation, returning a new operation that will exactly undo the\n * original when applied.\n */\n\n inverse(op: Operation): Operation {\n switch (op.type) {\n case 'insert_node': {\n return { ...op, type: 'remove_node' }\n }\n\n case 'insert_text': {\n return { ...op, type: 'remove_text' }\n }\n\n case 'merge_node': {\n return { ...op, type: 'split_node', path: Path.previous(op.path) }\n }\n\n case 'move_node': {\n const { newPath, path } = op\n\n // PERF: in this case the move operation is a no-op anyways.\n if (Path.equals(newPath, path)) {\n return op\n }\n\n // We need to get the original path here, but sometimes the `newPath`\n // is a younger sibling of (or ends before) the original, and this\n // accounts for it.\n const inversePath = Path.transform(path, op)!\n const inverseNewPath = Path.transform(Path.next(path), op)!\n return { ...op, path: inversePath, newPath: inverseNewPath }\n }\n\n case 'remove_node': {\n return { ...op, type: 'insert_node' }\n }\n\n case 'remove_text': {\n return { ...op, type: 'insert_text' }\n }\n\n case 'set_node': {\n const { properties, newProperties } = op\n return { ...op, properties: newProperties, newProperties: properties }\n }\n\n case 'set_selection': {\n const { properties, newProperties } = op\n\n if (properties == null) {\n return {\n ...op,\n properties: newProperties as Range,\n newProperties: null,\n }\n } else if (newProperties == null) {\n return {\n ...op,\n properties: null,\n newProperties: properties as Range,\n }\n } else {\n return { ...op, properties: newProperties, newProperties: properties }\n }\n }\n\n case 'split_node': {\n return { ...op, type: 'merge_node', path: Path.next(op.path) }\n }\n }\n },\n}\n","import { produce } from 'immer'\nimport { Operation } from '..'\n\n/**\n * `Path` arrays are a list of indexes that describe a node's exact position in\n * a Slate node tree. Although they are usually relative to the root `Editor`\n * object, they can be relative to any `Node` object.\n */\n\nexport type Path = number[]\n\nexport const Path = {\n /**\n * Get a list of ancestor paths for a given path.\n *\n * The paths are sorted from deepest to shallowest ancestor. However, if the\n * `reverse: true` option is passed, they are reversed.\n */\n\n ancestors(path: Path, options: { reverse?: boolean } = {}): Path[] {\n const { reverse = false } = options\n let paths = Path.levels(path, options)\n\n if (reverse) {\n paths = paths.slice(1)\n } else {\n paths = paths.slice(0, -1)\n }\n\n return paths\n },\n\n /**\n * Get the common ancestor path of two paths.\n */\n\n common(path: Path, another: Path): Path {\n const common: Path = []\n\n for (let i = 0; i < path.length && i < another.length; i++) {\n const av = path[i]\n const bv = another[i]\n\n if (av !== bv) {\n break\n }\n\n common.push(av)\n }\n\n return common\n },\n\n /**\n * Compare a path to another, returning an integer indicating whether the path\n * was before, at, or after the other.\n *\n * Note: Two paths of unequal length can still receive a `0` result if one is\n * directly above or below the other. If you want exact matching, use\n * [[Path.equals]] instead.\n */\n\n compare(path: Path, another: Path): -1 | 0 | 1 {\n const min = Math.min(path.length, another.length)\n\n for (let i = 0; i < min; i++) {\n if (path[i] < another[i]) return -1\n if (path[i] > another[i]) return 1\n }\n\n return 0\n },\n\n /**\n * Check if a path ends after one of the indexes in another.\n */\n\n endsAfter(path: Path, another: Path): boolean {\n const i = path.length - 1\n const as = path.slice(0, i)\n const bs = another.slice(0, i)\n const av = path[i]\n const bv = another[i]\n return Path.equals(as, bs) && av > bv\n },\n\n /**\n * Check if a path ends at one of the indexes in another.\n */\n\n endsAt(path: Path, another: Path): boolean {\n const i = path.length\n const as = path.slice(0, i)\n const bs = another.slice(0, i)\n return Path.equals(as, bs)\n },\n\n /**\n * Check if a path ends before one of the indexes in another.\n */\n\n endsBefore(path: Path, another: Path): boolean {\n const i = path.length - 1\n const as = path.slice(0, i)\n const bs = another.slice(0, i)\n const av = path[i]\n const bv = another[i]\n return Path.equals(as, bs) && av < bv\n },\n\n /**\n * Check if a path is exactly equal to another.\n */\n\n equals(path: Path, another: Path): boolean {\n return (\n path.length === another.length && path.every((n, i) => n === another[i])\n )\n },\n\n /**\n * Check if a path is after another.\n */\n\n isAfter(path: Path, another: Path): boolean {\n return Path.compare(path, another) === 1\n },\n\n /**\n * Check if a path is an ancestor of another.\n */\n\n isAncestor(path: Path, another: Path): boolean {\n return path.length < another.length && Path.compare(path, another) === 0\n },\n\n /**\n * Check if a path is before another.\n */\n\n isBefore(path: Path, another: Path): boolean {\n return Path.compare(path, another) === -1\n },\n\n /**\n * Check if a path is a child of another.\n */\n\n isChild(path: Path, another: Path): boolean {\n return (\n path.length === another.length + 1 && Path.compare(path, another) === 0\n )\n },\n\n /**\n * Check if a path is equal to or an ancestor of another.\n */\n\n isCommon(path: Path, another: Path): boolean {\n return path.length <= another.length && Path.compare(path, another) === 0\n },\n\n /**\n * Check if a path is a descendant of another.\n */\n\n isDescendant(path: Path, another: Path): boolean {\n return path.length > another.length && Path.compare(path, another) === 0\n },\n\n /**\n * Check if a path is the parent of another.\n */\n\n isParent(path: Path, another: Path): boolean {\n return (\n path.length + 1 === another.length && Path.compare(path, another) === 0\n )\n },\n\n /**\n * Check is a value implements the `Path` interface.\n */\n\n isPath(value: any): value is Path {\n return (\n Array.isArray(value) &&\n (value.length === 0 || typeof value[0] === 'number')\n )\n },\n\n /**\n * Check if a path is a sibling of another.\n */\n\n isSibling(path: Path, another: Path): boolean {\n if (path.length !== another.length) {\n return false\n }\n\n const as = path.slice(0, -1)\n const bs = another.slice(0, -1)\n const al = path[path.length - 1]\n const bl = another[another.length - 1]\n return al !== bl && Path.equals(as, bs)\n },\n\n /**\n * Get a list of paths at every level down to a path. Note: this is the same\n * as `Path.ancestors`, but including the path itself.\n *\n * The paths are sorted from shallowest to deepest. However, if the `reverse:\n * true` option is passed, they are reversed.\n */\n\n levels(\n path: Path,\n options: {\n reverse?: boolean\n } = {}\n ): Path[] {\n const { reverse = false } = options\n const list: Path[] = []\n\n for (let i = 0; i <= path.length; i++) {\n list.push(path.slice(0, i))\n }\n\n if (reverse) {\n list.reverse()\n }\n\n return list\n },\n\n /**\n * Given a path, get the path to the next sibling node.\n */\n\n next(path: Path): Path {\n if (path.length === 0) {\n throw new Error(\n `Cannot get the next path of a root path [${path}], because it has no next index.`\n )\n }\n\n const last = path[path.length - 1]\n return path.slice(0, -1).concat(last + 1)\n },\n\n /**\n * Given a path, return a new path referring to the parent node above it.\n */\n\n parent(path: Path): Path {\n if (path.length === 0) {\n throw new Error(`Cannot get the parent path of the root path [${path}].`)\n }\n\n return path.slice(0, -1)\n },\n\n /**\n * Given a path, get the path to the previous sibling node.\n */\n\n previous(path: Path): Path {\n if (path.length === 0) {\n throw new Error(\n `Cannot get the previous path of a root path [${path}], because it has no previous index.`\n )\n }\n\n const last = path[path.length - 1]\n\n if (last <= 0) {\n throw new Error(\n `Cannot get the previous path of a first child path [${path}] because it would result in a negative index.`\n )\n }\n\n return path.slice(0, -1).concat(last - 1)\n },\n\n /**\n * Get a path relative to an ancestor.\n */\n\n relative(path: Path, ancestor: Path): Path {\n if (!Path.isAncestor(ancestor, path) && !Path.equals(path, ancestor)) {\n throw new Error(\n `Cannot get the relative path of [${path}] inside ancestor [${ancestor}], because it is not above or equal to the path.`\n )\n }\n\n return path.slice(ancestor.length)\n },\n\n /**\n * Transform a path by an operation.\n */\n\n transform(\n path: Path,\n operation: Operation,\n options: { affinity?: 'forward' | 'backward' | null } = {}\n ): Path | null {\n return produce(path, p => {\n const { affinity = 'forward' } = options\n\n // PERF: Exit early if the operation is guaranteed not to have an effect.\n if (path.length === 0) {\n return\n }\n\n switch (operation.type) {\n case 'insert_node': {\n const { path: op } = operation\n\n if (\n Path.equals(op, p) ||\n Path.endsBefore(op, p) ||\n Path.isAncestor(op, p)\n ) {\n p[op.length - 1] += 1\n }\n\n break\n }\n\n case 'remove_node': {\n const { path: op } = operation\n\n if (Path.equals(op, p) || Path.isAncestor(op, p)) {\n return null\n } else if (Path.endsBefore(op, p)) {\n p[op.length - 1] -= 1\n }\n\n break\n }\n\n case 'merge_node': {\n const { path: op, position } = operation\n\n if (Path.equals(op, p) || Path.endsBefore(op, p)) {\n p[op.length - 1] -= 1\n } else if (Path.isAncestor(op, p)) {\n p[op.length - 1] -= 1\n p[op.length] += position\n }\n\n break\n }\n\n case 'split_node': {\n const { path: op, position } = operation\n\n if (Path.equals(op, p)) {\n if (affinity === 'forward') {\n p[p.length - 1] += 1\n } else if (affinity === 'backward') {\n // Nothing, because it still refers to the right path.\n } else {\n return null\n }\n } else if (Path.endsBefore(op, p)) {\n p[op.length - 1] += 1\n } else if (Path.isAncestor(op, p) && path[op.length] >= position) {\n p[op.length - 1] += 1\n p[op.length] -= position\n }\n\n break\n }\n\n case 'move_node': {\n const { path: op, newPath: onp } = operation\n\n // If the old and new path are the same, it's a no-op.\n if (Path.equals(op, onp)) {\n return\n }\n\n if (Path.isAncestor(op, p) || Path.equals(op, p)) {\n const copy = onp.slice()\n\n if (Path.endsBefore(op, onp) && op.length < onp.length) {\n const i = Math.min(onp.length, op.length) - 1\n copy[i] -= 1\n }\n\n return copy.concat(p.slice(op.length))\n } else if (\n Path.endsBefore(onp, p) ||\n Path.equals(onp, p) ||\n Path.isAncestor(onp, p)\n ) {\n if (Path.endsBefore(op, p)) {\n p[op.length - 1] -= 1\n }\n\n p[onp.length - 1] += 1\n } else if (Path.endsBefore(op, p)) {\n if (Path.equals(onp, p)) {\n p[onp.length - 1] += 1\n }\n\n p[op.length - 1] -= 1\n }\n\n break\n }\n }\n })\n },\n}\n","import { Operation, Path } from '..'\n\n/**\n * `PathRef` objects keep a specific path in a document synced over time as new\n * operations are applied to the editor. You can access their `current` property\n * at any time for the up-to-date path value.\n */\n\nexport interface PathRef {\n current: Path | null\n affinity: 'forward' | 'backward' | null\n unref(): Path | null\n}\n\nexport const PathRef = {\n /**\n * Transform the path ref's current value by an operation.\n */\n\n transform(ref: PathRef, op: Operation): void {\n const { current, affinity } = ref\n\n if (current == null) {\n return\n }\n\n const path = Path.transform(current, op, { affinity })\n ref.current = path\n\n if (path == null) {\n ref.unref()\n }\n },\n}\n","import isPlainObject from 'is-plain-object'\nimport { produce } from 'immer'\nimport { Operation, Path } from '..'\n\n/**\n * `Point` objects refer to a specific location in a text node in a Slate\n * document. Its path refers to the location of the node in the tree, and its\n * offset refers to the distance into the node's string of text. Points can\n * only refer to `Text` nodes.\n */\n\nexport interface Point {\n path: Path\n offset: number\n [key: string]: any\n}\n\nexport const Point = {\n /**\n * Compare a point to another, returning an integer indicating whether the\n * point was before, at, or after the other.\n */\n\n compare(point: Point, another: Point): -1 | 0 | 1 {\n const result = Path.compare(point.path, another.path)\n\n if (result === 0) {\n if (point.offset < another.offset) return -1\n if (point.offset > another.offset) return 1\n return 0\n }\n\n return result\n },\n\n /**\n * Check if a point is after another.\n */\n\n isAfter(point: Point, another: Point): boolean {\n return Point.compare(point, another) === 1\n },\n\n /**\n * Check if a point is before another.\n */\n\n isBefore(point: Point, another: Point): boolean {\n return Point.compare(point, another) === -1\n },\n\n /**\n * Check if a point is exactly equal to another.\n */\n\n equals(point: Point, another: Point): boolean {\n // PERF: ensure the offsets are equal first since they are cheaper to check.\n return (\n point.offset === another.offset && Path.equals(point.path, another.path)\n )\n },\n\n /**\n * Check if a value implements the `Point` interface.\n */\n\n isPoint(value: any): value is Point {\n return (\n isPlainObject(value) &&\n typeof value.offset === 'number' &&\n Path.isPath(value.path)\n )\n },\n\n /**\n * Transform a point by an operation.\n */\n\n transform(\n point: Point,\n op: Operation,\n options: { affinity?: 'forward' | 'backward' | null } = {}\n ): Point | null {\n return produce(point, p => {\n const { affinity = 'forward' } = options\n const { path, offset } = p\n\n switch (op.type) {\n case 'insert_node':\n case 'move_node': {\n p.path = Path.transform(path, op, options)!\n break\n }\n\n case 'insert_text': {\n if (Path.equals(op.path, path) && op.offset <= offset) {\n p.offset += op.text.length\n }\n\n break\n }\n\n case 'merge_node': {\n if (Path.equals(op.path, path)) {\n p.offset += op.position\n }\n\n p.path = Path.transform(path, op, options)!\n break\n }\n\n case 'remove_text': {\n if (Path.equals(op.path, path) && op.offset <= offset) {\n p.offset -= Math.min(offset - op.offset, op.text.length)\n }\n\n break\n }\n\n case 'remove_node': {\n if (Path.equals(op.path, path) || Path.isAncestor(op.path, path)) {\n return null\n }\n\n p.path = Path.transform(path, op, options)!\n break\n }\n\n case 'split_node': {\n if (Path.equals(op.path, path)) {\n if (op.position === offset && affinity == null) {\n return null\n } else if (\n op.position < offset ||\n (op.position === offset && affinity === 'forward')\n ) {\n p.offset -= op.position\n\n p.path = Path.transform(path, op, {\n ...options,\n affinity: 'forward',\n })!\n }\n } else {\n p.path = Path.transform(path, op, options)!\n }\n\n break\n }\n }\n })\n },\n}\n\n/**\n * `PointEntry` objects are returned when iterating over `Point` objects that\n * belong to a range.\n */\n\nexport type PointEntry = [Point, 'anchor' | 'focus']\n","import { Operation, Point } from '..'\n\n/**\n * `PointRef` objects keep a specific point in a document synced over time as new\n * operations are applied to the editor. You can access their `current` property\n * at any time for the up-to-date point value.\n */\n\nexport interface PointRef {\n current: Point | null\n affinity: 'forward' | 'backward' | null\n unref(): Point | null\n}\n\nexport const PointRef = {\n /**\n * Transform the point ref's current value by an operation.\n */\n\n transform(ref: PointRef, op: Operation): void {\n const { current, affinity } = ref\n\n if (current == null) {\n return\n }\n\n const point = Point.transform(current, op, { affinity })\n ref.current = point\n\n if (point == null) {\n ref.unref()\n }\n },\n}\n","import { produce } from 'immer'\nimport isPlainObject from 'is-plain-object'\nimport { Operation, Path, Point, PointEntry } from '..'\n\n/**\n * `Range` objects are a set of points that refer to a specific span of a Slate\n * document. They can define a span inside a single node or a can span across\n * multiple nodes.\n */\n\nexport interface Range {\n anchor: Point\n focus: Point\n [key: string]: any\n}\n\nexport const Range = {\n /**\n * Get the start and end points of a range, in the order in which they appear\n * in the document.\n */\n\n edges(\n range: Range,\n options: {\n reverse?: boolean\n } = {}\n ): [Point, Point] {\n const { reverse = false } = options\n const { anchor, focus } = range\n return Range.isBackward(range) === reverse\n ? [anchor, focus]\n : [focus, anchor]\n },\n\n /**\n * Get the end point of a range.\n */\n\n end(range: Range): Point {\n const [, end] = Range.edges(range)\n return end\n },\n\n /**\n * Check if a range is exactly equal to another.\n */\n\n equals(range: Range, another: Range): boolean {\n return (\n Point.equals(range.anchor, another.anchor) &&\n Point.equals(range.focus, another.focus)\n )\n },\n\n /**\n * Check if a range includes a path, a point or part of another range.\n */\n\n includes(range: Range, target: Path | Point | Range): boolean {\n if (Range.isRange(target)) {\n if (\n Range.includes(range, target.anchor) ||\n Range.includes(range, target.focus)\n ) {\n return true\n }\n\n const [rs, re] = Range.edges(range)\n const [ts, te] = Range.edges(target)\n return Point.isBefore(rs, ts) && Point.isAfter(re, te)\n }\n\n const [start, end] = Range.edges(range)\n let isAfterStart = false\n let isBeforeEnd = false\n\n if (Point.isPoint(target)) {\n isAfterStart = Point.compare(target, start) >= 0\n isBeforeEnd = Point.compare(target, end) <= 0\n } else {\n isAfterStart = Path.compare(target, start.path) >= 0\n isBeforeEnd = Path.compare(target, end.path) <= 0\n }\n\n return isAfterStart && isBeforeEnd\n },\n\n /**\n * Get the intersection of a range with another.\n */\n\n intersection(range: Range, another: Range): Range | null {\n const { anchor, focus, ...rest } = range\n const [s1, e1] = Range.edges(range)\n const [s2, e2] = Range.edges(another)\n const start = Point.isBefore(s1, s2) ? s2 : s1\n const end = Point.isBefore(e1, e2) ? e1 : e2\n\n if (Point.isBefore(end, start)) {\n return null\n } else {\n return { anchor: start, focus: end, ...rest }\n }\n },\n\n /**\n * Check if a range is backward, meaning that its anchor point appears in the\n * document _after_ its focus point.\n */\n\n isBackward(range: Range): boolean {\n const { anchor, focus } = range\n return Point.isAfter(anchor, focus)\n },\n\n /**\n * Check if a range is collapsed, meaning that both its anchor and focus\n * points refer to the exact same position in the document.\n */\n\n isCollapsed(range: Range): boolean {\n const { anchor, focus } = range\n return Point.equals(anchor, focus)\n },\n\n /**\n * Check if a range is expanded.\n *\n * This is the opposite of [[Range.isCollapsed]] and is provided for legibility.\n */\n\n isExpanded(range: Range): boolean {\n return !Range.isCollapsed(range)\n },\n\n /**\n * Check if a range is forward.\n *\n * This is the opposite of [[Range.isBackward]] and is provided for legibility.\n */\n\n isForward(range: Range): boolean {\n return !Range.isBackward(range)\n },\n\n /**\n * Check if a value implements the [[Range]] interface.\n */\n\n isRange(value: any): value is Range {\n return (\n isPlainObject(value) &&\n Point.isPoint(value.anchor) &&\n Point.isPoint(value.focus)\n )\n },\n\n /**\n * Iterate through all of the point entries in a range.\n */\n\n *points(range: Range): Iterable<PointEntry> {\n yield [range.anchor, 'anchor']\n yield [range.focus, 'focus']\n },\n\n /**\n * Get the start point of a range.\n */\n\n start(range: Range): Point {\n const [start] = Range.edges(range)\n return start\n },\n\n /**\n * Transform a range by an operation.\n */\n\n transform(\n range: Range,\n op: Operation,\n options: { affinity: 'forward' | 'backward' | 'outward' | 'inward' | null }\n ): Range | null {\n const { affinity = 'inward' } = options\n let affinityAnchor: 'forward' | 'backward' | null\n let affinityFocus: 'forward' | 'backward' | null\n\n if (affinity === 'inward') {\n if (Range.isForward(range)) {\n affinityAnchor = 'forward'\n affinityFocus = 'backward'\n } else {\n affinityAnchor = 'backward'\n affinityFocus = 'forward'\n }\n } else if (affinity === 'outward') {\n if (Range.isForward(range)) {\n affinityAnchor = 'backward'\n affinityFocus = 'forward'\n } else {\n affinityAnchor = 'forward'\n affinityFocus = 'backward'\n }\n } else {\n affinityAnchor = affinity\n affinityFocus = affinity\n }\n\n return produce(range, r => {\n const anchor = Point.transform(r.anchor, op, { affinity: affinityAnchor })\n const focus = Point.transform(r.focus, op, { affinity: affinityFocus })\n\n if (!anchor || !focus) {\n return null\n }\n\n r.anchor = anchor\n r.focus = focus\n })\n },\n}\n","import { Operation, Range } from '..'\n\n/**\n * `RangeRef` objects keep a specific range in a document synced over time as new\n * operations are applied to the editor. You can access their `current` property\n * at any time for the up-to-date range value.\n */\n\nexport interface RangeRef {\n current: Range | null\n affinity: 'forward' | 'backward' | 'outward' | 'inward' | null\n unref(): Range | null\n}\n\nexport const RangeRef = {\n /**\n * Transform the range ref's current value by an operation.\n */\n\n transform(ref: RangeRef, op: Operation): void {\n const { current, affinity } = ref\n\n if (current == null) {\n return\n }\n\n const path = Range.transform(current, op, { affinity })\n ref.current = path\n\n if (path == null) {\n ref.unref()\n }\n },\n}\n","import isPlainObject from 'is-plain-object'\nimport { Range } from '..'\n\n/**\n * `Text` objects represent the nodes that contain the actual text content of a\n * Slate document along with any formatting properties. They are always leaf\n * nodes in the document tree as they cannot contain any children.\n */\n\nexport interface Text {\n text: string\n [key: string]: any\n}\n\nexport const Text = {\n /**\n * Check if two text nodes are equal.\n */\n\n equals(\n text: Text,\n another: Text,\n options: { loose?: boolean } = {}\n ): boolean {\n const { loose = false } = options\n\n for (const key in text) {\n if (loose && key === 'text') {\n continue\n }\n\n if (text[key] !== another[key]) {\n return false\n }\n }\n\n for (const key in another) {\n if (loose && key === 'text') {\n continue\n }\n\n if (text[key] !== another[key]) {\n return false\n }\n }\n\n return true\n },\n\n /**\n * Check if a value implements the `Text` interface.\n */\n\n isText(value: any): value is Text {\n return isPlainObject(value) && typeof value.text === 'string'\n },\n\n /**\n * Check if a value is a list of `Text` objects.\n */\n\n isTextList(value: any): value is Text[] {\n return Array.isArray(value) && (value.length === 0 || Text.isText(value[0]))\n },\n\n /**\n * Check if an text matches set of properties.\n *\n * Note: this is for matching custom properties, and it does not ensure that\n * the `text` property are two nodes equal.\n */\n\n matches(text: Text, props: Partial<Text>): boolean {\n for (const key in props) {\n if (key === 'text') {\n continue\n }\n\n if (text[key] !== props[key]) {\n return false\n }\n }\n\n return true\n },\n\n /**\n * Get the leaves for a text node given decorations.\n */\n\n decorations(node: Text, decorations: Range[]): Text[] {\n let leaves: Text[] = [{ ...node }]\n\n for (const dec of decorations) {\n const { anchor, focus, ...rest } = dec\n const [start, end] = Range.edges(dec)\n const next = []\n let o = 0\n\n for (const leaf of leaves) {\n const { length } = leaf.text\n const offset = o\n o += length\n\n // If the range encompases the entire leaf, add the range.\n if (start.offset <= offset && end.offset >= offset + length) {\n Object.assign(leaf, rest)\n next.push(leaf)\n continue\n }\n\n // If the range starts after the leaf, or ends before it, continue.\n if (\n start.offset > offset + length ||\n end.offset < offset ||\n (end.offset === offset && offset !== 0)\n ) {\n next.push(leaf)\n continue\n }\n\n // Otherwise we need to split the leaf, at the start, end, or both,\n // and add the range to the middle intersecting section. Do the end\n // split first since we don't need to update the offset that way.\n let middle = leaf\n let before\n let after\n\n if (end.offset < offset + length) {\n const off = end.offset - offset\n after = { ...middle, text: middle.text.slice(off) }\n middle = { ...middle, text: middle.text.slice(0, off) }\n }\n\n if (start.offset > offset) {\n const off = start.offset - offset\n before = { ...middle, text: middle.text.slice(0, off) }\n middle = { ...middle, text: middle.text.slice(off) }\n }\n\n Object.assign(middle, rest)\n\n if (before) {\n next.push(before)\n }\n\n next.push(middle)\n\n if (after) {\n next.push(after)\n }\n }\n\n leaves = next\n }\n\n return leaves\n },\n}\n","import { createDraft, finishDraft, isDraft } from 'immer'\nimport {\n Node,\n Editor,\n Range,\n Point,\n Text,\n Element,\n Operation,\n Descendant,\n NodeEntry,\n Path,\n Transforms,\n} from '..'\n\nexport const GeneralTransforms = {\n /**\n * Transform the editor by an operation.\n */\n\n transform(editor: Editor, op: Operation) {\n editor.children = createDraft(editor.children)\n let selection = editor.selection && createDraft(editor.selection)\n\n switch (op.type) {\n case 'insert_node': {\n const { path, node } = op\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n parent.children.splice(index, 0, node)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'insert_text': {\n const { path, offset, text } = op\n const node = Node.leaf(editor, path)\n const before = node.text.slice(0, offset)\n const after = node.text.slice(offset)\n node.text = before + text + after\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'merge_node': {\n const { path } = op\n const node = Node.get(editor, path)\n const prevPath = Path.previous(path)\n const prev = Node.get(editor, prevPath)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n\n if (Text.isText(node) && Text.isText(prev)) {\n prev.text += node.text\n } else if (!Text.isText(node) && !Text.isText(prev)) {\n prev.children.push(...node.children)\n } else {\n throw new Error(\n `Cannot apply a \"merge_node\" operation at path [${path}] to nodes of different interaces: ${node} ${prev}`\n )\n }\n\n parent.children.splice(index, 1)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'move_node': {\n const { path, newPath } = op\n\n if (Path.isAncestor(path, newPath)) {\n throw new Error(\n `Cannot move a path [${path}] to new path [${newPath}] because the destination is inside itself.`\n )\n }\n\n const node = Node.get(editor, path)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n\n // This is tricky, but since the `path` and `newPath` both refer to\n // the same snapshot in time, there's a mismatch. After either\n // removing the original position, the second step's path can be out\n // of date. So instead of using the `op.newPath` directly, we\n // transform `op.path` to ascertain what the `newPath` would be after\n // the operation was applied.\n parent.children.splice(index, 1)\n const truePath = Path.transform(path, op)!\n const newParent = Node.get(editor, Path.parent(truePath))\n const newIndex = truePath[truePath.length - 1]\n\n newParent.children.splice(newIndex, 0, node)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'remove_node': {\n const { path } = op\n const index = path[path.length - 1]\n const parent = Node.parent(editor, path)\n parent.children.splice(index, 1)\n\n // Transform all of the points in the value, but if the point was in the\n // node that was removed we need to update the range or remove it.\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n const result = Point.transform(point, op)\n\n if (selection != null && result != null) {\n selection[key] = result\n } else {\n let prev: NodeEntry<Text> | undefined\n let next: NodeEntry<Text> | undefined\n\n for (const [n, p] of Node.texts(editor)) {\n if (Path.compare(p, path) === -1) {\n prev = [n, p]\n } else {\n next = [n, p]\n break\n }\n }\n\n if (prev) {\n point.path = prev[1]\n point.offset = prev[0].text.length\n } else if (next) {\n point.path = next[1]\n point.offset = 0\n } else {\n selection = null\n }\n }\n }\n }\n\n break\n }\n\n case 'remove_text': {\n const { path, offset, text } = op\n const node = Node.leaf(editor, path)\n const before = node.text.slice(0, offset)\n const after = node.text.slice(offset + text.length)\n node.text = before + after\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n\n case 'set_node': {\n const { path, newProperties } = op\n\n if (path.length === 0) {\n throw new Error(`Cannot set properties on the root node!`)\n }\n\n const node = Node.get(editor, path)\n\n for (const key in newProperties) {\n if (key === 'children' || key === 'text') {\n throw new Error(`Cannot set the \"${key}\" property of nodes!`)\n }\n\n const value = newProperties[key]\n\n if (value == null) {\n delete node[key]\n } else {\n node[key] = value\n }\n }\n\n break\n }\n\n case 'set_selection': {\n const { newProperties } = op\n\n if (newProperties == null) {\n selection = newProperties\n } else if (selection == null) {\n if (!Range.isRange(newProperties)) {\n throw new Error(\n `Cannot apply an incomplete \"set_selection\" operation properties ${JSON.stringify(\n newProperties\n )} when there is no current selection.`\n )\n }\n\n selection = newProperties\n } else {\n Object.assign(selection, newProperties)\n }\n\n break\n }\n\n case 'split_node': {\n const { path, position, properties } = op\n\n if (path.length === 0) {\n throw new Error(\n `Cannot apply a \"split_node\" operation at path [${path}] because the root node cannot be split.`\n )\n }\n\n const node = Node.get(editor, path)\n const parent = Node.parent(editor, path)\n const index = path[path.length - 1]\n let newNode: Descendant\n\n if (Text.isText(node)) {\n const before = node.text.slice(0, position)\n const after = node.text.slice(position)\n node.text = before\n newNode = {\n ...node,\n ...(properties as Partial<Text>),\n text: after,\n }\n } else {\n const before = node.children.slice(0, position)\n const after = node.children.slice(position)\n node.children = before\n\n newNode = {\n ...node,\n ...(properties as Partial<Element>),\n children: after,\n }\n }\n\n parent.children.splice(index + 1, 0, newNode)\n\n if (selection) {\n for (const [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op)!\n }\n }\n\n break\n }\n }\n\n editor.children = finishDraft(editor.children) as Node[]\n\n if (selection) {\n editor.selection = isDraft(selection)\n ? (finishDraft(selection) as Range)\n : selection\n } else {\n editor.selection = null\n }\n },\n}\n","import {\n Editor,\n Element,\n Location,\n Node,\n Path,\n Point,\n Range,\n Text,\n Transforms,\n} from '..'\n\nexport const NodeTransforms = {\n /**\n * Insert nodes at a specific location in the Editor.\n */\n\n insertNodes(\n editor: Editor,\n nodes: Node | Node[],\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'highest' | 'lowest'\n hanging?: boolean\n select?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { hanging = false, voids = false, mode = 'lowest' } = options\n let { at, match, select } = options\n\n if (Node.isNode(nodes)) {\n nodes = [nodes]\n }\n\n if (nodes.length === 0) {\n return\n }\n\n const [node] = nodes\n\n // By default, use the selection as the target location. But if there is\n // no selection, insert at the end of the document since that is such a\n // common use case when inserting from a non-selected state.\n if (!at) {\n if (editor.selection) {\n at = editor.selection\n } else if (editor.children.length > 0) {\n at = Editor.end(editor, [])\n } else {\n at = [0]\n }\n\n select = true\n }\n\n if (select == null) {\n select = false\n }\n\n if (Range.isRange(at)) {\n if (!hanging) {\n at = Editor.unhangRange(editor, at)\n }\n\n if (Range.isCollapsed(at)) {\n at = at.anchor\n } else {\n const [, end] = Range.edges(at)\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at })\n at = pointRef.unref()!\n }\n }\n\n if (Point.isPoint(at)) {\n if (match == null) {\n if (Text.isText(node)) {\n match = n => Text.isText(n)\n } else if (editor.isInline(node)) {\n match = n => Text.isText(n) || Editor.isInline(editor, n)\n } else {\n match = n => Editor.isBlock(editor, n)\n }\n }\n\n const [entry] = Editor.nodes(editor, {\n at: at.path,\n match,\n mode,\n voids,\n })\n\n if (entry) {\n const [, matchPath] = entry\n const pathRef = Editor.pathRef(editor, matchPath)\n const isAtEnd = Editor.isEnd(editor, at, matchPath)\n Transforms.splitNodes(editor, { at, match, mode, voids })\n const path = pathRef.unref()!\n at = isAtEnd ? Path.next(path) : path\n } else {\n return\n }\n }\n\n const parentPath = Path.parent(at)\n let index = at[at.length - 1]\n\n if (!voids && Editor.void(editor, { at: parentPath })) {\n return\n }\n\n for (const node of nodes) {\n const path = parentPath.concat(index)\n index++\n editor.apply({ type: 'insert_node', path, node })\n }\n\n if (select) {\n const point = Editor.end(editor, at)\n\n if (point) {\n Transforms.select(editor, point)\n }\n }\n })\n },\n\n /**\n * Lift nodes at a specific location upwards in the document tree, splitting\n * their parent in two if necessary.\n */\n\n liftNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { at = editor.selection, mode = 'lowest', voids = false } = options\n let { match } = options\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n if (!at) {\n return\n }\n\n const matches = Editor.nodes(editor, { at, match, mode, voids })\n const pathRefs = Array.from(matches, ([, p]) => Editor.pathRef(editor, p))\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n\n if (path.length < 2) {\n throw new Error(\n `Cannot lift node at a path [${path}] because it has a depth of less than \\`2\\`.`\n )\n }\n\n const [parent, parentPath] = Editor.node(editor, Path.parent(path))\n const index = path[path.length - 1]\n const { length } = parent.children\n\n if (length === 1) {\n const toPath = Path.next(parentPath)\n Transforms.moveNodes(editor, { at: path, to: toPath, voids })\n Transforms.removeNodes(editor, { at: parentPath, voids })\n } else if (index === 0) {\n Transforms.moveNodes(editor, { at: path, to: parentPath, voids })\n } else if (index === length - 1) {\n const toPath = Path.next(parentPath)\n Transforms.moveNodes(editor, { at: path, to: toPath, voids })\n } else {\n const splitPath = Path.next(path)\n const toPath = Path.next(parentPath)\n Transforms.splitNodes(editor, { at: splitPath, voids })\n Transforms.moveNodes(editor, { at: path, to: toPath, voids })\n }\n }\n })\n },\n\n /**\n * Merge a node at a location with the previous node of the same depth,\n * removing any empty containing nodes after the merge if necessary.\n */\n\n mergeNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'highest' | 'lowest'\n hanging?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n let { match, at = editor.selection } = options\n const { hanging = false, voids = false, mode = 'lowest' } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n const [parent] = Editor.parent(editor, at)\n match = n => parent.children.includes(n)\n } else {\n match = n => Editor.isBlock(editor, n)\n }\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at)\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor\n } else {\n const [, end] = Range.edges(at)\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at })\n at = pointRef.unref()!\n\n if (options.at == null) {\n Transforms.select(editor, at)\n }\n }\n }\n\n const [current] = Editor.nodes(editor, { at, match, voids, mode })\n const prev = Editor.previous(editor, { at, match, voids, mode })\n\n if (!current || !prev) {\n return\n }\n\n const [node, path] = current\n const [prevNode, prevPath] = prev\n\n if (path.length === 0 || prevPath.length === 0) {\n return\n }\n\n const newPath = Path.next(prevPath)\n const commonPath = Path.common(path, prevPath)\n const isPreviousSibling = Path.isSibling(path, prevPath)\n const levels = Array.from(Editor.levels(editor, { at: path }), ([n]) => n)\n .slice(commonPath.length)\n .slice(0, -1)\n\n // Determine if the merge will leave an ancestor of the path empty as a\n // result, in which case we'll want to remove it after merging.\n const emptyAncestor = Editor.above(editor, {\n at: path,\n mode: 'highest',\n match: n =>\n levels.includes(n) && Element.isElement(n) && n.children.length === 1,\n })\n\n const emptyRef = emptyAncestor && Editor.pathRef(editor, emptyAncestor[1])\n let properties\n let position\n\n // Ensure that the nodes are equivalent, and figure out what the position\n // and extra properties of the merge will be.\n if (Text.isText(node) && Text.isText(prevNode)) {\n const { text, ...rest } = node\n position = prevNode.text.length\n properties = rest as Partial<Text>\n } else if (Element.isElement(node) && Element.isElement(prevNode)) {\n const { children, ...rest } = node\n position = prevNode.children.length\n properties = rest as Partial<Element>\n } else {\n throw new Error(\n `Cannot merge the node at path [${path}] with the previous sibling because it is not the same kind: ${JSON.stringify(\n node\n )} ${JSON.stringify(prevNode)}`\n )\n }\n\n // If the node isn't already the next sibling of the previous node, move\n // it so that it is before merging.\n if (!isPreviousSibling) {\n Transforms.moveNodes(editor, { at: path, to: newPath, voids })\n }\n\n // If there was going to be an empty ancestor of the node that was merged,\n // we remove it from the tree.\n if (emptyRef) {\n Transforms.removeNodes(editor, { at: emptyRef.current!, voids })\n }\n\n // If the target node that we're merging with is empty, remove it instead\n // of merging the two. This is a common rich text editor behavior to\n // prevent losing formatting when deleting entire nodes when you have a\n // hanging selection.\n if (\n (Element.isElement(prevNode) && Editor.isEmpty(editor, prevNode)) ||\n (Text.isText(prevNode) && prevNode.text === '')\n ) {\n Transforms.removeNodes(editor, { at: prevPath, voids })\n } else {\n editor.apply({\n type: 'merge_node',\n path: newPath,\n position,\n target: null,\n properties,\n })\n }\n\n if (emptyRef) {\n emptyRef.unref()\n }\n })\n },\n\n /**\n * Move the nodes at a location to a new location.\n */\n\n moveNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n to: Path\n voids?: boolean\n }\n ) {\n Editor.withoutNormalizing(editor, () => {\n const {\n to,\n at = editor.selection,\n mode = 'lowest',\n voids = false,\n } = options\n let { match } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n const toRef = Editor.pathRef(editor, to)\n const targets = Editor.nodes(editor, { at, match, mode, voids })\n const pathRefs = Array.from(targets, ([, p]) => Editor.pathRef(editor, p))\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n const newPath = toRef.current!\n\n if (path.length !== 0) {\n editor.apply({ type: 'move_node', path, newPath })\n }\n }\n\n toRef.unref()\n })\n },\n\n /**\n * Remove the nodes at a specific location in the document.\n */\n\n removeNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'highest' | 'lowest'\n hanging?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { hanging = false, voids = false, mode = 'lowest' } = options\n let { at = editor.selection, match } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at)\n }\n\n const depths = Editor.nodes(editor, { at, match, mode, voids })\n const pathRefs = Array.from(depths, ([, p]) => Editor.pathRef(editor, p))\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n\n if (path) {\n const [node] = Editor.node(editor, path)\n editor.apply({ type: 'remove_node', path, node })\n }\n }\n })\n },\n\n /**\n * Set new properties on the nodes at a location.\n */\n\n setNodes(\n editor: Editor,\n props: Partial<Node>,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n hanging?: boolean\n split?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n let { match, at = editor.selection } = options\n const {\n hanging = false,\n mode = 'lowest',\n split = false,\n voids = false,\n } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at)\n }\n\n if (split && Range.isRange(at)) {\n const rangeRef = Editor.rangeRef(editor, at, { affinity: 'inward' })\n const [start, end] = Range.edges(at)\n const splitMode = mode === 'lowest' ? 'lowest' : 'highest'\n Transforms.splitNodes(editor, {\n at: end,\n match,\n mode: splitMode,\n voids,\n })\n Transforms.splitNodes(editor, {\n at: start,\n match,\n mode: splitMode,\n voids,\n })\n at = rangeRef.unref()!\n\n if (options.at == null) {\n Transforms.select(editor, at)\n }\n }\n\n for (const [node, path] of Editor.nodes(editor, {\n at,\n match,\n mode,\n voids,\n })) {\n const properties: Partial<Node> = {}\n const newProperties: Partial<Node> = {}\n\n // You can't set properties on the editor node.\n if (path.length === 0) {\n continue\n }\n\n for (const k in props) {\n if (k === 'children' || k === 'text') {\n continue\n }\n\n if (props[k] !== node[k]) {\n properties[k] = node[k]\n newProperties[k] = props[k]\n }\n }\n\n if (Object.keys(newProperties).length !== 0) {\n editor.apply({\n type: 'set_node',\n path,\n properties,\n newProperties,\n })\n }\n }\n })\n },\n\n /**\n * Split the nodes at a specific location.\n */\n\n splitNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'highest' | 'lowest'\n always?: boolean\n height?: number\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { mode = 'lowest', voids = false } = options\n let { match, at = editor.selection, height = 0, always = false } = options\n\n if (match == null) {\n match = n => Editor.isBlock(editor, n)\n }\n\n if (Range.isRange(at)) {\n at = deleteRange(editor, at)\n }\n\n // If the target is a path, the default height-skipping and position\n // counters need to account for us potentially splitting at a non-leaf.\n if (Path.isPath(at)) {\n const path = at\n const point = Editor.point(editor, path)\n const [parent] = Editor.parent(editor, path)\n match = n => n === parent\n height = point.path.length - path.length + 1\n at = point\n always = true\n }\n\n if (!at) {\n return\n }\n\n const beforeRef = Editor.pointRef(editor, at, {\n affinity: 'backward',\n })\n const [highest] = Editor.nodes(editor, { at, match, mode, voids })\n\n if (!highest) {\n return\n }\n\n const voidMatch = Editor.void(editor, { at, mode: 'highest' })\n const nudge = 0\n\n if (!voids && voidMatch) {\n const [voidNode, voidPath] = voidMatch\n\n if (Element.isElement(voidNode) && editor.isInline(voidNode)) {\n let after = Editor.after(editor, voidPath)\n\n if (!after) {\n const text = { text: '' }\n const afterPath = Path.next(voidPath)\n Transforms.insertNodes(editor, text, { at: afterPath, voids })\n after = Editor.point(editor, afterPath)!\n }\n\n at = after\n always = true\n }\n\n const siblingHeight = at.path.length - voidPath.length\n height = siblingHeight + 1\n always = true\n }\n\n const afterRef = Editor.pointRef(editor, at)\n const depth = at.path.length - height\n const [, highestPath] = highest\n const lowestPath = at.path.slice(0, depth)\n let position = height === 0 ? at.offset : at.path[depth] + nudge\n let target: number | null = null\n\n for (const [node, path] of Editor.levels(editor, {\n at: lowestPath,\n reverse: true,\n voids,\n })) {\n let split = false\n\n if (\n path.length < highestPath.length ||\n path.length === 0 ||\n (!voids && Editor.isVoid(editor, node))\n ) {\n break\n }\n\n const point = beforeRef.current!\n const isEnd = Editor.isEnd(editor, point, path)\n\n if (always || !beforeRef || !Editor.isEdge(editor, point, path)) {\n split = true\n const { text, children, ...properties } = node\n editor.apply({\n type: 'split_node',\n path,\n position,\n target,\n properties,\n })\n }\n\n target = position\n position = path[path.length - 1] + (split || isEnd ? 1 : 0)\n }\n\n if (options.at == null) {\n const point = afterRef.current || Editor.end(editor, [])\n Transforms.select(editor, point)\n }\n\n beforeRef.unref()\n afterRef.unref()\n })\n },\n\n /**\n * Unset properties on the nodes at a location.\n */\n\n unsetNodes(\n editor: Editor,\n props: string | string[],\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n split?: boolean\n voids?: boolean\n } = {}\n ) {\n if (!Array.isArray(props)) {\n props = [props]\n }\n\n const obj = {}\n\n for (const key of props) {\n obj[key] = null\n }\n\n Transforms.setNodes(editor, obj, options)\n },\n\n /**\n * Unwrap the nodes at a location from a parent node, splitting the parent if\n * necessary to ensure that only the content in the range is unwrapped.\n */\n\n unwrapNodes(\n editor: Editor,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n split?: boolean\n voids?: boolean\n }\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { mode = 'lowest', split = false, voids = false } = options\n let { at = editor.selection, match } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n match = Path.isPath(at)\n ? matchPath(editor, at)\n : n => Editor.isBlock(editor, n)\n }\n\n if (Path.isPath(at)) {\n at = Editor.range(editor, at)\n }\n\n const rangeRef = Range.isRange(at) ? Editor.rangeRef(editor, at) : null\n const matches = Editor.nodes(editor, { at, match, mode, voids })\n const pathRefs = Array.from(matches, ([, p]) => Editor.pathRef(editor, p))\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n const [node] = Editor.node(editor, path)\n let range = Editor.range(editor, path)\n\n if (split && rangeRef) {\n range = Range.intersection(rangeRef.current!, range)!\n }\n\n Transforms.liftNodes(editor, {\n at: range,\n match: n => node.children.includes(n),\n voids,\n })\n }\n\n if (rangeRef) {\n rangeRef.unref()\n }\n })\n },\n\n /**\n * Wrap the nodes at a location in a new container node, splitting the edges\n * of the range first to ensure that only the content in the range is wrapped.\n */\n\n wrapNodes(\n editor: Editor,\n element: Element,\n options: {\n at?: Location\n match?: (node: Node) => boolean\n mode?: 'all' | 'highest' | 'lowest'\n split?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { mode = 'lowest', split = false, voids = false } = options\n let { match, at = editor.selection } = options\n\n if (!at) {\n return\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n match = matchPath(editor, at)\n } else if (editor.isInline(element)) {\n match = n => Editor.isInline(editor, n) || Text.isText(n)\n } else {\n match = n => Editor.isBlock(editor, n)\n }\n }\n\n if (split && Range.isRange(at)) {\n const [start, end] = Range.edges(at)\n const rangeRef = Editor.rangeRef(editor, at, {\n affinity: 'inward',\n })\n Transforms.splitNodes(editor, { at: end, match, voids })\n Transforms.splitNodes(editor, { at: start, match, voids })\n at = rangeRef.unref()!\n\n if (options.at == null) {\n Transforms.select(editor, at)\n }\n }\n\n const roots = Array.from(\n Editor.nodes(editor, {\n at,\n match: editor.isInline(element)\n ? n => Editor.isBlock(editor, n)\n : n => Editor.isEditor(n),\n mode: 'lowest',\n voids,\n })\n )\n\n for (const [, rootPath] of roots) {\n const a = Range.isRange(at)\n ? Range.intersection(at, Editor.range(editor, rootPath))\n : at\n\n if (!a) {\n continue\n }\n\n const matches = Array.from(\n Editor.nodes(editor, { at: a, match, mode, voids })\n )\n\n if (matches.length > 0) {\n const [first] = matches\n const last = matches[matches.length - 1]\n const [, firstPath] = first\n const [, lastPath] = last\n const commonPath = Path.equals(firstPath, lastPath)\n ? Path.parent(firstPath)\n : Path.common(firstPath, lastPath)\n\n const range = Editor.range(editor, firstPath, lastPath)\n const [commonNode] = Editor.node(editor, commonPath)\n const depth = commonPath.length + 1\n const wrapperPath = Path.next(lastPath.slice(0, depth))\n const wrapper = { ...element, children: [] }\n Transforms.insertNodes(editor, wrapper, { at: wrapperPath, voids })\n\n Transforms.moveNodes(editor, {\n at: range,\n match: n => commonNode.children.includes(n),\n to: wrapperPath.concat(0),\n voids,\n })\n }\n }\n })\n },\n}\n\n/**\n * Convert a range into a point by deleting it's content.\n */\n\nconst deleteRange = (editor: Editor, range: Range): Point | null => {\n if (Range.isCollapsed(range)) {\n return range.anchor\n } else {\n const [, end] = Range.edges(range)\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at: range })\n return pointRef.unref()\n }\n}\n\nconst matchPath = (editor: Editor, path: Path): ((node: Node) => boolean) => {\n const [node] = Editor.node(editor, path)\n return n => n === node\n}\n","import { Editor, Location, Point, Range, Transforms } from '..'\n\nexport const SelectionTransforms = {\n /**\n * Collapse the selection.\n */\n\n collapse(\n editor: Editor,\n options: {\n edge?: 'anchor' | 'focus' | 'start' | 'end'\n } = {}\n ) {\n const { edge = 'anchor' } = options\n const { selection } = editor\n\n if (!selection) {\n return\n } else if (edge === 'anchor') {\n Transforms.select(editor, selection.anchor)\n } else if (edge === 'focus') {\n Transforms.select(editor, selection.focus)\n } else if (edge === 'start') {\n const [start] = Range.edges(selection)\n Transforms.select(editor, start)\n } else if (edge === 'end') {\n const [, end] = Range.edges(selection)\n Transforms.select(editor, end)\n }\n },\n\n /**\n * Unset the selection.\n */\n\n deselect(editor: Editor) {\n const { selection } = editor\n\n if (selection) {\n editor.apply({\n type: 'set_selection',\n properties: selection,\n newProperties: null,\n })\n }\n },\n\n /**\n * Move the selection's point forward or backward.\n */\n\n move(\n editor: Editor,\n options: {\n distance?: number\n unit?: 'offset' | 'character' | 'word' | 'line'\n reverse?: boolean\n edge?: 'anchor' | 'focus' | 'start' | 'end'\n } = {}\n ) {\n const { selection } = editor\n const { distance = 1, unit = 'character', reverse = false } = options\n let { edge = null } = options\n\n if (!selection) {\n return\n }\n\n if (edge === 'start') {\n edge = Range.isBackward(selection) ? 'focus' : 'anchor'\n }\n\n if (edge === 'end') {\n edge = Range.isBackward(selection) ? 'anchor' : 'focus'\n }\n\n const { anchor, focus } = selection\n const opts = { distance, unit }\n const props: Partial<Range> = {}\n\n if (edge == null || edge === 'anchor') {\n const point = reverse\n ? Editor.before(editor, anchor, opts)\n : Editor.after(editor, anchor, opts)\n\n if (point) {\n props.anchor = point\n }\n }\n\n if (edge == null || edge === 'focus') {\n const point = reverse\n ? Editor.before(editor, focus, opts)\n : Editor.after(editor, focus, opts)\n\n if (point) {\n props.focus = point\n }\n }\n\n Transforms.setSelection(editor, props)\n },\n\n /**\n * Set the selection to a new value.\n */\n\n select(editor: Editor, target: Location) {\n const { selection } = editor\n target = Editor.range(editor, target)\n\n if (selection) {\n Transforms.setSelection(editor, target)\n return\n }\n\n if (!Range.isRange(target)) {\n throw new Error(\n `When setting the selection and the current selection is \\`null\\` you must provide at least an \\`anchor\\` and \\`focus\\`, but you passed: ${JSON.stringify(\n target\n )}`\n )\n }\n\n editor.apply({\n type: 'set_selection',\n properties: selection,\n newProperties: target,\n })\n },\n\n /**\n * Set new properties on one of the selection's points.\n */\n\n setPoint(\n editor: Editor,\n props: Partial<Point>,\n options: {\n edge?: 'anchor' | 'focus' | 'start' | 'end'\n }\n ) {\n const { selection } = editor\n let { edge = 'both' } = options\n\n if (!selection) {\n return\n }\n\n if (edge === 'start') {\n edge = Range.isBackward(selection) ? 'focus' : 'anchor'\n }\n\n if (edge === 'end') {\n edge = Range.isBackward(selection) ? 'anchor' : 'focus'\n }\n\n const { anchor, focus } = selection\n const point = edge === 'anchor' ? anchor : focus\n\n Transforms.setSelection(editor, {\n [edge === 'anchor' ? 'anchor' : 'focus']: { ...point, ...props },\n })\n },\n\n /**\n * Set new properties on the selection.\n */\n\n setSelection(editor: Editor, props: Partial<Range>) {\n const { selection } = editor\n const oldProps: Partial<Range> | null = {}\n const newProps: Partial<Range> = {}\n\n if (!selection) {\n return\n }\n\n for (const k in props) {\n if (\n (k === 'anchor' &&\n props.anchor != null &&\n !Point.equals(props.anchor, selection.anchor)) ||\n (k === 'focus' &&\n props.focus != null &&\n !Point.equals(props.focus, selection.focus)) ||\n (k !== 'anchor' && k !== 'focus' && props[k] !== selection[k])\n ) {\n oldProps[k] = selection[k]\n newProps[k] = props[k]\n }\n }\n\n if (Object.keys(oldProps).length > 0) {\n editor.apply({\n type: 'set_selection',\n properties: oldProps,\n newProperties: newProps,\n })\n }\n },\n}\n","import {\n Editor,\n Element,\n Location,\n Node,\n NodeEntry,\n Path,\n Text,\n Point,\n Range,\n Transforms,\n} from '..'\n\nexport const TextTransforms = {\n /**\n * Delete content in the editor.\n */\n\n delete(\n editor: Editor,\n options: {\n at?: Location\n distance?: number\n unit?: 'character' | 'word' | 'line' | 'block'\n reverse?: boolean\n hanging?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const {\n reverse = false,\n unit = 'character',\n distance = 1,\n voids = false,\n } = options\n let { at = editor.selection, hanging = false } = options\n\n if (!at) {\n return\n }\n\n if (Range.isRange(at) && Range.isCollapsed(at)) {\n at = at.anchor\n }\n\n if (Point.isPoint(at)) {\n const furthestVoid = Editor.void(editor, { at, mode: 'highest' })\n\n if (!voids && furthestVoid) {\n const [, voidPath] = furthestVoid\n at = voidPath\n } else {\n const opts = { unit, distance }\n const target = reverse\n ? Editor.before(editor, at, opts) || Editor.start(editor, [])\n : Editor.after(editor, at, opts) || Editor.end(editor, [])\n at = { anchor: at, focus: target }\n hanging = true\n }\n }\n\n if (Path.isPath(at)) {\n Transforms.removeNodes(editor, { at, voids })\n return\n }\n\n if (Range.isCollapsed(at)) {\n return\n }\n\n if (!hanging) {\n at = Editor.unhangRange(editor, at, { voids })\n }\n\n let [start, end] = Range.edges(at)\n const startBlock = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: start,\n voids,\n })\n const endBlock = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: end,\n voids,\n })\n const isAcrossBlocks =\n startBlock && endBlock && !Path.equals(startBlock[1], endBlock[1])\n const isSingleText = Path.equals(start.path, end.path)\n const startVoid = voids\n ? null\n : Editor.void(editor, { at: start, mode: 'highest' })\n const endVoid = voids\n ? null\n : Editor.void(editor, { at: end, mode: 'highest' })\n\n // If the start or end points are inside an inline void, nudge them out.\n if (startVoid) {\n const before = Editor.before(editor, start)\n\n if (\n before &&\n startBlock &&\n Path.isAncestor(startBlock[1], before.path)\n ) {\n start = before\n }\n }\n\n if (endVoid) {\n const after = Editor.after(editor, end)\n\n if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) {\n end = after\n }\n }\n\n // Get the highest nodes that are completely inside the range, as well as\n // the start and end nodes.\n const matches: NodeEntry[] = []\n let lastPath: Path | undefined\n\n for (const entry of Editor.nodes(editor, { at, voids })) {\n const [node, path] = entry\n\n if (lastPath && Path.compare(path, lastPath) === 0) {\n continue\n }\n\n if (\n (!voids && Editor.isVoid(editor, node)) ||\n (!Path.isCommon(path, start.path) && !Path.isCommon(path, end.path))\n ) {\n matches.push(entry)\n lastPath = path\n }\n }\n\n const pathRefs = Array.from(matches, ([, p]) => Editor.pathRef(editor, p))\n const startRef = Editor.pointRef(editor, start)\n const endRef = Editor.pointRef(editor, end)\n\n if (!isSingleText && !startVoid) {\n const point = startRef.current!\n const [node] = Editor.leaf(editor, point)\n const { path } = point\n const { offset } = start\n const text = node.text.slice(offset)\n editor.apply({ type: 'remove_text', path, offset, text })\n }\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref()!\n Transforms.removeNodes(editor, { at: path, voids })\n }\n\n if (!endVoid) {\n const point = endRef.current!\n const [node] = Editor.leaf(editor, point)\n const { path } = point\n const offset = isSingleText ? start.offset : 0\n const text = node.text.slice(offset, end.offset)\n editor.apply({ type: 'remove_text', path, offset, text })\n }\n\n if (\n !isSingleText &&\n isAcrossBlocks &&\n endRef.current &&\n startRef.current\n ) {\n Transforms.mergeNodes(editor, {\n at: endRef.current,\n hanging: true,\n voids,\n })\n }\n\n const point = endRef.unref() || startRef.unref()\n\n if (options.at == null && point) {\n Transforms.select(editor, point)\n }\n })\n },\n\n /**\n * Insert a fragment at a specific location in the editor.\n */\n\n insertFragment(\n editor: Editor,\n fragment: Node[],\n options: {\n at?: Location\n hanging?: boolean\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { hanging = false, voids = false } = options\n let { at = editor.selection } = options\n\n if (!fragment.length) {\n return\n }\n\n if (!at) {\n return\n } else if (Range.isRange(at)) {\n if (!hanging) {\n at = Editor.unhangRange(editor, at)\n }\n\n if (Range.isCollapsed(at)) {\n at = at.anchor\n } else {\n const [, end] = Range.edges(at)\n\n if (!voids && Editor.void(editor, { at: end })) {\n return\n }\n\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at })\n at = pointRef.unref()!\n }\n } else if (Path.isPath(at)) {\n at = Editor.start(editor, at)\n }\n\n if (!voids && Editor.void(editor, { at })) {\n return\n }\n\n // If the insert point is at the edge of an inline node, move it outside\n // instead since it will need to be split otherwise.\n const inlineElementMatch = Editor.above(editor, {\n at,\n match: n => Editor.isInline(editor, n),\n mode: 'highest',\n voids,\n })\n\n if (inlineElementMatch) {\n const [, inlinePath] = inlineElementMatch\n\n if (Editor.isEnd(editor, at, inlinePath)) {\n const after = Editor.after(editor, inlinePath)!\n at = after\n } else if (Editor.isStart(editor, at, inlinePath)) {\n const before = Editor.before(editor, inlinePath)!\n at = before\n }\n }\n\n const blockMatch = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at,\n voids,\n })!\n const [, blockPath] = blockMatch\n const isBlockStart = Editor.isStart(editor, at, blockPath)\n const isBlockEnd = Editor.isEnd(editor, at, blockPath)\n const mergeStart = !isBlockStart || (isBlockStart && isBlockEnd)\n const mergeEnd = !isBlockEnd\n const [, firstPath] = Node.first({ children: fragment }, [])\n const [, lastPath] = Node.last({ children: fragment }, [])\n\n const matches: NodeEntry[] = []\n const matcher = ([n, p]: NodeEntry) => {\n if (\n mergeStart &&\n Path.isAncestor(p, firstPath) &&\n Element.isElement(n) &&\n !editor.isVoid(n) &&\n !editor.isInline(n)\n ) {\n return false\n }\n\n if (\n mergeEnd &&\n Path.isAncestor(p, lastPath) &&\n Element.isElement(n) &&\n !editor.isVoid(n) &&\n !editor.isInline(n)\n ) {\n return false\n }\n\n return true\n }\n\n for (const entry of Node.nodes(\n { children: fragment },\n { pass: matcher }\n )) {\n if (entry[1].length > 0 && matcher(entry)) {\n matches.push(entry)\n }\n }\n\n const starts = []\n const middles = []\n const ends = []\n let starting = true\n let hasBlocks = false\n\n for (const [node] of matches) {\n if (Element.isElement(node) && !editor.isInline(node)) {\n starting = false\n hasBlocks = true\n middles.push(node)\n } else if (starting) {\n starts.push(node)\n } else {\n ends.push(node)\n }\n }\n\n const [inlineMatch] = Editor.nodes(editor, {\n at,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids,\n })!\n\n const [, inlinePath] = inlineMatch\n const isInlineStart = Editor.isStart(editor, at, inlinePath)\n const isInlineEnd = Editor.isEnd(editor, at, inlinePath)\n\n const middleRef = Editor.pathRef(\n editor,\n isBlockEnd ? Path.next(blockPath) : blockPath\n )\n\n const endRef = Editor.pathRef(\n editor,\n isInlineEnd ? Path.next(inlinePath) : inlinePath\n )\n\n Transforms.splitNodes(editor, {\n at,\n match: n =>\n hasBlocks\n ? Editor.isBlock(editor, n)\n : Text.isText(n) || Editor.isInline(editor, n),\n mode: hasBlocks ? 'lowest' : 'highest',\n voids,\n })\n\n const startRef = Editor.pathRef(\n editor,\n !isInlineStart || (isInlineStart && isInlineEnd)\n ? Path.next(inlinePath)\n : inlinePath\n )\n\n Transforms.insertNodes(editor, starts, {\n at: startRef.current!,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids,\n })\n\n Transforms.insertNodes(editor, middles, {\n at: middleRef.current!,\n match: n => Editor.isBlock(editor, n),\n mode: 'lowest',\n voids,\n })\n\n Transforms.insertNodes(editor, ends, {\n at: endRef.current!,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids,\n })\n\n if (!options.at) {\n let path\n\n if (ends.length > 0) {\n path = Path.previous(endRef.current!)\n } else if (middles.length > 0) {\n path = Path.previous(middleRef.current!)\n } else {\n path = Path.previous(startRef.current!)\n }\n\n const end = Editor.end(editor, path)\n Transforms.select(editor, end)\n }\n\n startRef.unref()\n middleRef.unref()\n endRef.unref()\n })\n },\n\n /**\n * Insert a string of text in the Editor.\n */\n\n insertText(\n editor: Editor,\n text: string,\n options: {\n at?: Location\n voids?: boolean\n } = {}\n ) {\n Editor.withoutNormalizing(editor, () => {\n const { voids = false } = options\n let { at = editor.selection } = options\n\n if (!at) {\n return\n }\n\n if (Path.isPath(at)) {\n at = Editor.range(editor, at)\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor\n } else {\n const end = Range.end(at)\n\n if (!voids && Editor.void(editor, { at: end })) {\n return\n }\n\n const pointRef = Editor.pointRef(editor, end)\n Transforms.delete(editor, { at, voids })\n at = pointRef.unref()!\n Transforms.setSelection(editor, { anchor: at, focus: at })\n }\n }\n\n if (!voids && Editor.void(editor, { at })) {\n return\n }\n\n const { path, offset } = at\n editor.apply({ type: 'insert_text', path, offset, text })\n })\n },\n}\n","import { GeneralTransforms } from './general'\nimport { NodeTransforms } from './node'\nimport { SelectionTransforms } from './selection'\nimport { TextTransforms } from './text'\n\nexport const Transforms = {\n ...GeneralTransforms,\n ...NodeTransforms,\n ...SelectionTransforms,\n ...TextTransforms,\n}\n","import {\n Descendant,\n Editor,\n Element,\n Node,\n NodeEntry,\n Operation,\n Path,\n PathRef,\n PointRef,\n Range,\n RangeRef,\n Text,\n Transforms,\n} from './'\nimport { DIRTY_PATHS, FLUSHING } from './utils/weak-maps'\n\n/**\n * Create a new Slate `Editor` object.\n */\n\nexport const createEditor = (): Editor => {\n const editor: Editor = {\n children: [],\n operations: [],\n selection: null,\n marks: null,\n isInline: () => false,\n isVoid: () => false,\n onChange: () => {},\n\n apply: (op: Operation) => {\n for (const ref of Editor.pathRefs(editor)) {\n PathRef.transform(ref, op)\n }\n\n for (const ref of Editor.pointRefs(editor)) {\n PointRef.transform(ref, op)\n }\n\n for (const ref of Editor.rangeRefs(editor)) {\n RangeRef.transform(ref, op)\n }\n\n const set = new Set()\n const dirtyPaths: Path[] = []\n\n const add = (path: Path | null) => {\n if (path) {\n const key = path.join(',')\n\n if (!set.has(key)) {\n set.add(key)\n dirtyPaths.push(path)\n }\n }\n }\n\n const oldDirtyPaths = DIRTY_PATHS.get(editor) || []\n const newDirtyPaths = getDirtyPaths(op)\n\n for (const path of oldDirtyPaths) {\n const newPath = Path.transform(path, op)\n add(newPath)\n }\n\n for (const path of newDirtyPaths) {\n add(path)\n }\n\n DIRTY_PATHS.set(editor, dirtyPaths)\n Editor.transform(editor, op)\n editor.operations.push(op)\n Editor.normalize(editor)\n\n // Clear any formats applied to the cursor if the selection changes.\n if (op.type === 'set_selection') {\n editor.marks = null\n }\n\n if (!FLUSHING.get(editor)) {\n FLUSHING.set(editor, true)\n\n Promise.resolve().then(() => {\n FLUSHING.set(editor, false)\n editor.onChange()\n editor.operations = []\n })\n }\n },\n\n addMark: (key: string, value: any) => {\n const { selection } = editor\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Transforms.setNodes(\n editor,\n { [key]: value },\n { match: Text.isText, split: true }\n )\n } else {\n const marks = {\n ...(Editor.marks(editor) || {}),\n [key]: value,\n }\n\n editor.marks = marks\n editor.onChange()\n }\n }\n },\n\n deleteBackward: (unit: 'character' | 'word' | 'line' | 'block') => {\n const { selection } = editor\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.delete(editor, { unit, reverse: true })\n }\n },\n\n deleteForward: (unit: 'character' | 'word' | 'line' | 'block') => {\n const { selection } = editor\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.delete(editor, { unit })\n }\n },\n\n deleteFragment: () => {\n const { selection } = editor\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.delete(editor)\n }\n },\n\n getFragment: () => {\n const { selection } = editor\n\n if (selection && Range.isExpanded(selection)) {\n return Node.fragment(editor, selection)\n }\n return []\n },\n\n insertBreak: () => {\n Transforms.splitNodes(editor, { always: true })\n },\n\n insertFragment: (fragment: Node[]) => {\n Transforms.insertFragment(editor, fragment)\n },\n\n insertNode: (node: Node) => {\n Transforms.insertNodes(editor, node)\n },\n\n insertText: (text: string) => {\n const { selection, marks } = editor\n\n if (selection) {\n // If the cursor is at the end of an inline, move it outside of\n // the inline before inserting\n if (Range.isCollapsed(selection)) {\n const inline = Editor.above(editor, {\n match: n => Editor.isInline(editor, n),\n mode: 'highest',\n })\n\n if (inline) {\n const [, inlinePath] = inline\n\n if (Editor.isEnd(editor, selection.anchor, inlinePath)) {\n const point = Editor.after(editor, inlinePath)!\n Transforms.setSelection(editor, {\n anchor: point,\n focus: point,\n })\n }\n }\n }\n\n if (marks) {\n const node = { text, ...marks }\n Transforms.insertNodes(editor, node)\n } else {\n Transforms.insertText(editor, text)\n }\n\n editor.marks = null\n }\n },\n\n normalizeNode: (entry: NodeEntry) => {\n const [node, path] = entry\n\n // There are no core normalizations for text nodes.\n if (Text.isText(node)) {\n return\n }\n\n // Ensure that block and inline nodes have at least one text child.\n if (Element.isElement(node) && node.children.length === 0) {\n const child = { text: '' }\n Transforms.insertNodes(editor, child, {\n at: path.concat(0),\n voids: true,\n })\n return\n }\n\n // Determine whether the node should have block or inline children.\n const shouldHaveInlines = Editor.isEditor(node)\n ? false\n : Element.isElement(node) &&\n (editor.isInline(node) ||\n node.children.length === 0 ||\n Text.isText(node.children[0]) ||\n editor.isInline(node.children[0]))\n\n // Since we'll be applying operations while iterating, keep track of an\n // index that accounts for any added/removed nodes.\n let n = 0\n\n for (let i = 0; i < node.children.length; i++, n++) {\n const child = node.children[i] as Descendant\n const prev = node.children[i - 1] as Descendant\n const isLast = i === node.children.length - 1\n const isInlineOrText =\n Text.isText(child) ||\n (Element.isElement(child) && editor.isInline(child))\n\n // Only allow block nodes in the top-level children and parent blocks\n // that only contain block nodes. Similarly, only allow inline nodes in\n // other inline nodes, or parent blocks that only contain inlines and\n // text.\n if (isInlineOrText !== shouldHaveInlines) {\n Transforms.removeNodes(editor, { at: path.concat(n), voids: true })\n n--\n } else if (Element.isElement(child)) {\n // Ensure that inline nodes are surrounded by text nodes.\n if (editor.isInline(child)) {\n if (prev == null || !Text.isText(prev)) {\n const newChild = { text: '' }\n Transforms.insertNodes(editor, newChild, {\n at: path.concat(n),\n voids: true,\n })\n n++\n } else if (isLast) {\n const newChild = { text: '' }\n Transforms.insertNodes(editor, newChild, {\n at: path.concat(n + 1),\n voids: true,\n })\n n++\n }\n }\n } else {\n // Merge adjacent text nodes that are empty or match.\n if (prev != null && Text.isText(prev)) {\n if (Text.equals(child, prev, { loose: true })) {\n Transforms.mergeNodes(editor, { at: path.concat(n), voids: true })\n n--\n } else if (prev.text === '') {\n Transforms.removeNodes(editor, {\n at: path.concat(n - 1),\n voids: true,\n })\n n--\n } else if (isLast && child.text === '') {\n Transforms.removeNodes(editor, {\n at: path.concat(n),\n voids: true,\n })\n n--\n }\n }\n }\n }\n },\n\n removeMark: (key: string) => {\n const { selection } = editor\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Transforms.unsetNodes(editor, key, {\n match: Text.isText,\n split: true,\n })\n } else {\n const marks = { ...(Editor.marks(editor) || {}) }\n delete marks[key]\n editor.marks = marks\n editor.onChange()\n }\n }\n },\n }\n\n return editor\n}\n\n/**\n * Get the \"dirty\" paths generated from an operation.\n */\n\nconst getDirtyPaths = (op: Operation) => {\n switch (op.type) {\n case 'insert_text':\n case 'remove_text':\n case 'set_node': {\n const { path } = op\n return Path.levels(path)\n }\n\n case 'insert_node': {\n const { node, path } = op\n const levels = Path.levels(path)\n const descendants = Text.isText(node)\n ? []\n : Array.from(Node.nodes(node), ([, p]) => path.concat(p))\n\n return [...levels, ...descendants]\n }\n\n case 'merge_node': {\n const { path } = op\n const ancestors = Path.ancestors(path)\n const previousPath = Path.previous(path)\n return [...ancestors, previousPath]\n }\n\n case 'move_node': {\n const { path, newPath } = op\n\n if (Path.equals(path, newPath)) {\n return []\n }\n\n const oldAncestors: Path[] = []\n const newAncestors: Path[] = []\n\n for (const ancestor of Path.ancestors(path)) {\n const p = Path.transform(ancestor, op)\n oldAncestors.push(p!)\n }\n\n for (const ancestor of Path.ancestors(newPath)) {\n const p = Path.transform(ancestor, op)\n newAncestors.push(p!)\n }\n\n return [...oldAncestors, ...newAncestors]\n }\n\n case 'remove_node': {\n const { path } = op\n const ancestors = Path.ancestors(path)\n return [...ancestors]\n }\n\n case 'split_node': {\n const { path } = op\n const levels = Path.levels(path)\n const nextPath = Path.next(path)\n return [...levels, nextPath]\n }\n\n default: {\n return []\n }\n }\n}\n"],"names":["objectWithoutPropertiesLoose","DIRTY_PATHS","WeakMap","FLUSHING","NORMALIZING","PATH_REFS","POINT_REFS","RANGE_REFS","SPACE","PUNCTUATION","CHAMELEON","SURROGATE_START","SURROGATE_END","ZERO_WIDTH_JOINER","getCharacterDistance","text","offset","prev","charCode","charCodeAt","isSurrogate","modifier","isModifier","isBMPEmoji","isVariationSelector","getWordDistance","length","i","started","char","charAt","l","slice","rest","isWordCharacter","remaining","test","next","code","Editor","above","editor","options","voids","mode","at","selection","match","path","reverse","n","p","levels","Text","isText","Path","equals","addMark","key","value","after","anchor","point","edge","focus","end","range","distance","d","target","positions","before","start","deleteBackward","unit","deleteForward","deleteFragment","edges","first","node","fragment","Node","hasBlocks","element","children","some","isBlock","hasInlines","isInline","hasTexts","every","insertBreak","insertFragment","insertNode","insertText","Element","isElement","isEditor","isPlainObject","apply","isVoid","normalizeNode","onChange","removeMark","marks","Range","isRange","isNodeList","Operation","isOperationList","operations","isEnd","Point","isEdge","isStart","isEmpty","isNormalizing","get","undefined","last","leaf","push","isExpanded","nodes","previous","block","prevNode","prevPath","blockPath","isAncestor","from","to","span","isPath","Error","parent","includes","universal","Span","isSpan","iterable","pass","matches","hit","isLower","compare","emit","normalize","force","getDirtyPaths","allPaths","Array","set","withoutNormalizing","max","m","pop","entry","parentPath","depth","firstPath","lastPath","common","isPoint","pathRef","affinity","ref","current","unref","pathRefs","delete","refs","add","Set","pointRef","pointRefs","string","available","isNewBlock","advance","e","s","reverseText","isFirst","rangeRef","rangeRefs","t","transform","op","createDraft","type","index","splice","points","newPath","truePath","newParent","newIndex","result","texts","newProperties","JSON","stringify","Object","assign","position","properties","newNode","finishDraft","isDraft","unhangRange","isCollapsed","endBlock","skip","isBefore","void","fn","isElementList","isArray","props","Location","isLocation","ancestor","root","ancestors","child","c","childPath","concat","another","descendant","descendants","elements","newRoot","produce","r","has","isNode","visited","isAfter","nextIndex","map","join","isNodeOperation","isOperation","endsWith","isSelectionOperation","isTextOperation","inverse","inversePath","inverseNewPath","paths","av","bv","min","Math","endsAfter","as","bs","endsAt","endsBefore","isChild","isCommon","isDescendant","isParent","isSibling","al","bl","list","relative","operation","onp","copy","PathRef","PointRef","isBackward","rs","re","ts","te","isAfterStart","isBeforeEnd","intersection","s1","e1","s2","e2","isForward","affinityAnchor","affinityFocus","RangeRef","loose","isTextList","decorations","leaves","dec","o","middle","off","GeneralTransforms","NodeTransforms","insertNodes","hanging","select","Transforms","matchPath","isAtEnd","splitNodes","liftNodes","toPath","moveNodes","removeNodes","splitPath","mergeNodes","commonPath","isPreviousSibling","emptyAncestor","emptyRef","toRef","targets","depths","setNodes","split","splitMode","k","keys","height","always","deleteRange","beforeRef","highest","voidMatch","nudge","voidNode","voidPath","afterPath","siblingHeight","afterRef","highestPath","lowestPath","unsetNodes","obj","unwrapNodes","wrapNodes","roots","rootPath","a","commonNode","wrapperPath","wrapper","SelectionTransforms","collapse","deselect","move","opts","setSelection","setPoint","oldProps","newProps","TextTransforms","furthestVoid","startBlock","isAcrossBlocks","isSingleText","startVoid","endVoid","startRef","endRef","inlineElementMatch","inlinePath","blockMatch","isBlockStart","isBlockEnd","mergeStart","mergeEnd","matcher","starts","middles","ends","starting","inlineMatch","isInlineStart","isInlineEnd","middleRef","createEditor","dirtyPaths","oldDirtyPaths","newDirtyPaths","Promise","resolve","then","getFragment","inline","shouldHaveInlines","isLast","isInlineOrText","newChild","previousPath","oldAncestors","newAncestors","nextPath"],"mappings":";;;;;;;;;;AAAe,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;EACvD,IAAI,GAAG,IAAI,GAAG,EAAE;IACd,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;MAC9B,KAAK,EAAE,KAAK;MACZ,UAAU,EAAE,IAAI;MAChB,YAAY,EAAE,IAAI;MAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;GACJ,MAAM;IACL,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;GAClB;;EAED,OAAO,GAAG,CAAC;;;CACZ,DCbc,SAAS,6BAA6B,CAAC,MAAM,EAAE,QAAQ,EAAE;EACtE,IAAI,MAAM,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;EAC9B,IAAI,MAAM,GAAG,EAAE,CAAC;EAChB,IAAI,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;EACrC,IAAI,GAAG,EAAE,CAAC,CAAC;;EAEX,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACtC,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS;IACzC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;GAC3B;;EAED,OAAO,MAAM,CAAC;;;CACf,DCZc,SAAS,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE;EACjE,IAAI,MAAM,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;EAC9B,IAAI,MAAM,GAAGA,6BAA4B,CAAC,MAAM,EAAE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