slate-react 0.112.0 → 0.112.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/typeof.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../src/hooks/use-slate-static.tsx","../src/plugin/react-editor.ts","../src/hooks/android-input-manager/android-input-manager.ts","../src/hooks/use-is-mounted.tsx","../src/hooks/use-isomorphic-layout-effect.ts","../src/hooks/use-mutation-observer.ts","../src/hooks/android-input-manager/use-android-input-manager.ts","../src/components/string.tsx","../src/components/leaf.tsx","../src/components/text.tsx","../src/components/element.tsx","../src/hooks/use-decorate.ts","../src/hooks/use-selected.ts","../src/hooks/use-children.tsx","../src/hooks/use-read-only.ts","../src/hooks/use-slate.tsx","../src/hooks/use-track-user-input.ts","../src/components/restore-dom/restore-dom-manager.ts","../src/components/restore-dom/restore-dom.tsx","../src/hooks/use-composing.ts","../src/components/editable.tsx","../src/hooks/use-focused.ts","../src/hooks/use-slate-selector.tsx","../src/utils/environment.ts","../src/components/slate.tsx","../src/hooks/use-editor.tsx","../src/hooks/use-slate-selection.tsx","../src/plugin/with-react.ts"],"sourcesContent":["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 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 return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\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 return target;\n}","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\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 return obj;\n}","import { createContext, useContext } from 'react'\nimport { Editor } from 'slate'\nimport { ReactEditor } from '../plugin/react-editor'\n\n/**\n * A React context for sharing the editor object.\n */\n\nexport const EditorContext = createContext<ReactEditor | null>(null)\n\n/**\n * Get the current editor object from the React context.\n */\n\nexport const useSlateStatic = (): Editor => {\n const editor = useContext(EditorContext)\n\n if (!editor) {\n throw new Error(\n `The \\`useSlateStatic\\` hook must be used inside the <Slate> component's context.`\n )\n }\n\n return editor\n}\n","import { DOMEditor, type DOMEditorInterface } from 'slate-dom'\n\n/**\n * A React and DOM-specific version of the `Editor` interface.\n */\n\nexport interface ReactEditor extends DOMEditor {}\n\nexport interface ReactEditorInterface extends DOMEditorInterface {}\n\n// eslint-disable-next-line no-redeclare\nexport const ReactEditor: ReactEditorInterface = DOMEditor\n","import { DebouncedFunc } from 'lodash'\nimport { Editor, Node, Path, Point, Range, Text, Transforms } from 'slate'\nimport { ReactEditor } from '../../plugin/react-editor'\nimport {\n applyStringDiff,\n mergeStringDiffs,\n normalizePoint,\n normalizeRange,\n normalizeStringDiff,\n StringDiff,\n targetRange,\n TextDiff,\n verifyDiffState,\n} from 'slate-dom'\nimport { isDOMSelection, isTrackedMutation } from 'slate-dom'\nimport {\n EDITOR_TO_FORCE_RENDER,\n EDITOR_TO_PENDING_ACTION,\n EDITOR_TO_PENDING_DIFFS,\n EDITOR_TO_PENDING_INSERTION_MARKS,\n EDITOR_TO_PENDING_SELECTION,\n EDITOR_TO_PLACEHOLDER_ELEMENT,\n EDITOR_TO_USER_MARKS,\n IS_COMPOSING,\n IS_NODE_MAP_DIRTY,\n} from 'slate-dom'\n\nexport type Action = { at?: Point | Range; run: () => void }\n\n// https://github.com/facebook/draft-js/blob/main/src/component/handlers/composition/DraftEditorCompositionHandler.js#L41\n// When using keyboard English association function, conpositionEnd triggered too fast, resulting in after `insertText` still maintain association state.\nconst RESOLVE_DELAY = 25\n\n// Time with no user interaction before the current user action is considered as done.\nconst FLUSH_DELAY = 200\n\n// Replace with `const debug = console.log` to debug\nconst debug = (..._: unknown[]) => {}\n\n// Type guard to check if a value is a DataTransfer\nconst isDataTransfer = (value: any): value is DataTransfer =>\n value?.constructor.name === 'DataTransfer'\n\nexport type CreateAndroidInputManagerOptions = {\n editor: ReactEditor\n\n scheduleOnDOMSelectionChange: DebouncedFunc<() => void>\n onDOMSelectionChange: DebouncedFunc<() => void>\n}\n\nexport type AndroidInputManager = {\n flush: () => void\n scheduleFlush: () => void\n\n hasPendingDiffs: () => boolean\n hasPendingAction: () => boolean\n hasPendingChanges: () => boolean\n isFlushing: () => boolean | 'action'\n\n handleUserSelect: (range: Range | null) => void\n handleCompositionEnd: (event: React.CompositionEvent<HTMLDivElement>) => void\n handleCompositionStart: (\n event: React.CompositionEvent<HTMLDivElement>\n ) => void\n handleDOMBeforeInput: (event: InputEvent) => void\n handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void\n\n handleDomMutations: (mutations: MutationRecord[]) => void\n handleInput: () => void\n}\n\nexport function createAndroidInputManager({\n editor,\n scheduleOnDOMSelectionChange,\n onDOMSelectionChange,\n}: CreateAndroidInputManagerOptions): AndroidInputManager {\n let flushing: 'action' | boolean = false\n let compositionEndTimeoutId: ReturnType<typeof setTimeout> | null = null\n let flushTimeoutId: ReturnType<typeof setTimeout> | null = null\n let actionTimeoutId: ReturnType<typeof setTimeout> | null = null\n\n let idCounter = 0\n let insertPositionHint: StringDiff | null | false = false\n\n const applyPendingSelection = () => {\n const pendingSelection = EDITOR_TO_PENDING_SELECTION.get(editor)\n EDITOR_TO_PENDING_SELECTION.delete(editor)\n\n if (pendingSelection) {\n const { selection } = editor\n const normalized = normalizeRange(editor, pendingSelection)\n\n debug('apply pending selection', pendingSelection, normalized)\n\n if (normalized && (!selection || !Range.equals(normalized, selection))) {\n Transforms.select(editor, normalized)\n }\n }\n }\n\n const performAction = () => {\n const action = EDITOR_TO_PENDING_ACTION.get(editor)\n EDITOR_TO_PENDING_ACTION.delete(editor)\n if (!action) {\n return\n }\n\n if (action.at) {\n const target = Point.isPoint(action.at)\n ? normalizePoint(editor, action.at)\n : normalizeRange(editor, action.at)\n\n if (!target) {\n return\n }\n\n const targetRange = Editor.range(editor, target)\n if (!editor.selection || !Range.equals(editor.selection, targetRange)) {\n Transforms.select(editor, target)\n }\n }\n\n action.run()\n }\n\n const flush = () => {\n if (flushTimeoutId) {\n clearTimeout(flushTimeoutId)\n flushTimeoutId = null\n }\n\n if (actionTimeoutId) {\n clearTimeout(actionTimeoutId)\n actionTimeoutId = null\n }\n\n if (!hasPendingDiffs() && !hasPendingAction()) {\n applyPendingSelection()\n return\n }\n\n if (!flushing) {\n flushing = true\n setTimeout(() => (flushing = false))\n }\n\n if (hasPendingAction()) {\n flushing = 'action'\n }\n\n const selectionRef =\n editor.selection &&\n Editor.rangeRef(editor, editor.selection, { affinity: 'forward' })\n EDITOR_TO_USER_MARKS.set(editor, editor.marks)\n\n debug(\n 'flush',\n EDITOR_TO_PENDING_ACTION.get(editor),\n EDITOR_TO_PENDING_DIFFS.get(editor)\n )\n\n let scheduleSelectionChange = hasPendingDiffs()\n\n let diff: TextDiff | undefined\n while ((diff = EDITOR_TO_PENDING_DIFFS.get(editor)?.[0])) {\n const pendingMarks = EDITOR_TO_PENDING_INSERTION_MARKS.get(editor)\n\n if (pendingMarks !== undefined) {\n EDITOR_TO_PENDING_INSERTION_MARKS.delete(editor)\n editor.marks = pendingMarks\n }\n\n if (pendingMarks && insertPositionHint === false) {\n insertPositionHint = null\n debug('insert after mark placeholder')\n }\n\n const range = targetRange(diff)\n if (!editor.selection || !Range.equals(editor.selection, range)) {\n Transforms.select(editor, range)\n }\n\n if (diff.diff.text) {\n Editor.insertText(editor, diff.diff.text)\n } else {\n Editor.deleteFragment(editor)\n }\n\n // Remove diff only after we have applied it to account for it when transforming\n // pending ranges.\n EDITOR_TO_PENDING_DIFFS.set(\n editor,\n EDITOR_TO_PENDING_DIFFS.get(editor)?.filter(\n ({ id }) => id !== diff!.id\n )!\n )\n\n if (!verifyDiffState(editor, diff)) {\n debug('invalid diff state')\n scheduleSelectionChange = false\n EDITOR_TO_PENDING_ACTION.delete(editor)\n EDITOR_TO_USER_MARKS.delete(editor)\n flushing = 'action'\n\n // Ensure we don't restore the pending user (dom) selection\n // since the document and dom state do not match.\n EDITOR_TO_PENDING_SELECTION.delete(editor)\n scheduleOnDOMSelectionChange.cancel()\n onDOMSelectionChange.cancel()\n selectionRef?.unref()\n }\n }\n\n const selection = selectionRef?.unref()\n if (\n selection &&\n !EDITOR_TO_PENDING_SELECTION.get(editor) &&\n (!editor.selection || !Range.equals(selection, editor.selection))\n ) {\n Transforms.select(editor, selection)\n }\n\n if (hasPendingAction()) {\n performAction()\n return\n }\n\n // COMPAT: The selectionChange event is fired after the action is performed,\n // so we have to manually schedule it to ensure we don't 'throw away' the selection\n // while rendering if we have pending changes.\n if (scheduleSelectionChange) {\n debug('scheduleOnDOMSelectionChange pending changes')\n scheduleOnDOMSelectionChange()\n }\n\n scheduleOnDOMSelectionChange.flush()\n onDOMSelectionChange.flush()\n\n applyPendingSelection()\n\n const userMarks = EDITOR_TO_USER_MARKS.get(editor)\n EDITOR_TO_USER_MARKS.delete(editor)\n if (userMarks !== undefined) {\n editor.marks = userMarks\n editor.onChange()\n }\n }\n\n const handleCompositionEnd = (\n _event: React.CompositionEvent<HTMLDivElement>\n ) => {\n if (compositionEndTimeoutId) {\n clearTimeout(compositionEndTimeoutId)\n }\n\n compositionEndTimeoutId = setTimeout(() => {\n IS_COMPOSING.set(editor, false)\n flush()\n }, RESOLVE_DELAY)\n }\n\n const handleCompositionStart = (\n _event: React.CompositionEvent<HTMLDivElement>\n ) => {\n debug('composition start')\n\n IS_COMPOSING.set(editor, true)\n\n if (compositionEndTimeoutId) {\n clearTimeout(compositionEndTimeoutId)\n compositionEndTimeoutId = null\n }\n }\n\n const updatePlaceholderVisibility = (forceHide = false) => {\n const placeholderElement = EDITOR_TO_PLACEHOLDER_ELEMENT.get(editor)\n if (!placeholderElement) {\n return\n }\n\n if (hasPendingDiffs() || forceHide) {\n placeholderElement.style.display = 'none'\n return\n }\n\n placeholderElement.style.removeProperty('display')\n }\n\n const storeDiff = (path: Path, diff: StringDiff) => {\n debug('storeDiff', path, diff)\n\n const pendingDiffs = EDITOR_TO_PENDING_DIFFS.get(editor) ?? []\n EDITOR_TO_PENDING_DIFFS.set(editor, pendingDiffs)\n\n const target = Node.leaf(editor, path)\n const idx = pendingDiffs.findIndex(change => Path.equals(change.path, path))\n if (idx < 0) {\n const normalized = normalizeStringDiff(target.text, diff)\n if (normalized) {\n pendingDiffs.push({ path, diff, id: idCounter++ })\n }\n\n updatePlaceholderVisibility()\n return\n }\n\n const merged = mergeStringDiffs(target.text, pendingDiffs[idx].diff, diff)\n if (!merged) {\n pendingDiffs.splice(idx, 1)\n updatePlaceholderVisibility()\n return\n }\n\n pendingDiffs[idx] = {\n ...pendingDiffs[idx],\n diff: merged,\n }\n }\n\n const scheduleAction = (\n run: () => void,\n { at }: { at?: Point | Range } = {}\n ): void => {\n insertPositionHint = false\n debug('scheduleAction', { at, run })\n\n EDITOR_TO_PENDING_SELECTION.delete(editor)\n scheduleOnDOMSelectionChange.cancel()\n onDOMSelectionChange.cancel()\n\n if (hasPendingAction()) {\n flush()\n }\n\n EDITOR_TO_PENDING_ACTION.set(editor, { at, run })\n\n // COMPAT: When deleting before a non-contenteditable element chrome only fires a beforeinput,\n // (no input) and doesn't perform any dom mutations. Without a flush timeout we would never flush\n // in this case and thus never actually perform the action.\n actionTimeoutId = setTimeout(flush)\n }\n\n const handleDOMBeforeInput = (event: InputEvent): void => {\n if (flushTimeoutId) {\n clearTimeout(flushTimeoutId)\n flushTimeoutId = null\n }\n\n if (IS_NODE_MAP_DIRTY.get(editor)) {\n return\n }\n\n const { inputType: type } = event\n let targetRange: Range | null = null\n const data: DataTransfer | string | undefined =\n (event as any).dataTransfer || event.data || undefined\n\n if (\n insertPositionHint !== false &&\n type !== 'insertText' &&\n type !== 'insertCompositionText'\n ) {\n insertPositionHint = false\n }\n\n let [nativeTargetRange] = (event as any).getTargetRanges()\n if (nativeTargetRange) {\n targetRange = ReactEditor.toSlateRange(editor, nativeTargetRange, {\n exactMatch: false,\n suppressThrow: true,\n })\n }\n\n // COMPAT: SelectionChange event is fired after the action is performed, so we\n // have to manually get the selection here to ensure it's up-to-date.\n const window = ReactEditor.getWindow(editor)\n const domSelection = window.getSelection()\n if (!targetRange && domSelection) {\n nativeTargetRange = domSelection\n targetRange = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: true,\n })\n }\n\n targetRange = targetRange ?? editor.selection\n if (!targetRange) {\n return\n }\n\n // By default, the input manager tries to store text diffs so that we can\n // defer flushing them at a later point in time. We don't want to flush\n // for every input event as this can be expensive. However, there are some\n // scenarios where we cannot safely store the text diff and must instead\n // schedule an action to let Slate normalize the editor state.\n let canStoreDiff = true\n\n if (type.startsWith('delete')) {\n if (Range.isExpanded(targetRange)) {\n const [start, end] = Range.edges(targetRange)\n const leaf = Node.leaf(editor, start.path)\n\n if (leaf.text.length === start.offset && end.offset === 0) {\n const next = Editor.next(editor, {\n at: start.path,\n match: Text.isText,\n })\n if (next && Path.equals(next[1], end.path)) {\n targetRange = { anchor: end, focus: end }\n }\n }\n }\n\n const direction = type.endsWith('Backward') ? 'backward' : 'forward'\n const [start, end] = Range.edges(targetRange)\n const [leaf, path] = Editor.leaf(editor, start.path)\n\n const diff = {\n text: '',\n start: start.offset,\n end: end.offset,\n }\n const pendingDiffs = EDITOR_TO_PENDING_DIFFS.get(editor)\n const relevantPendingDiffs = pendingDiffs?.find(change =>\n Path.equals(change.path, path)\n )\n const diffs = relevantPendingDiffs\n ? [relevantPendingDiffs.diff, diff]\n : [diff]\n const text = applyStringDiff(leaf.text, ...diffs)\n\n if (text.length === 0) {\n // Text leaf will be removed, so we need to schedule an\n // action to remove it so that Slate can normalize instead\n // of storing as a diff\n canStoreDiff = false\n }\n\n if (Range.isExpanded(targetRange)) {\n if (\n canStoreDiff &&\n Path.equals(targetRange.anchor.path, targetRange.focus.path)\n ) {\n const point = { path: targetRange.anchor.path, offset: start.offset }\n const range = Editor.range(editor, point, point)\n handleUserSelect(range)\n\n return storeDiff(targetRange.anchor.path, {\n text: '',\n end: end.offset,\n start: start.offset,\n })\n }\n\n return scheduleAction(\n () => Editor.deleteFragment(editor, { direction }),\n { at: targetRange }\n )\n }\n }\n\n switch (type) {\n case 'deleteByComposition':\n case 'deleteByCut':\n case 'deleteByDrag': {\n return scheduleAction(() => Editor.deleteFragment(editor), {\n at: targetRange,\n })\n }\n\n case 'deleteContent':\n case 'deleteContentForward': {\n const { anchor } = targetRange\n if (canStoreDiff && Range.isCollapsed(targetRange)) {\n const targetNode = Node.leaf(editor, anchor.path)\n\n if (anchor.offset < targetNode.text.length) {\n return storeDiff(anchor.path, {\n text: '',\n start: anchor.offset,\n end: anchor.offset + 1,\n })\n }\n }\n\n return scheduleAction(() => Editor.deleteForward(editor), {\n at: targetRange,\n })\n }\n\n case 'deleteContentBackward': {\n const { anchor } = targetRange\n\n // If we have a mismatch between the native and slate selection being collapsed\n // we are most likely deleting a zero-width placeholder and thus should perform it\n // as an action to ensure correct behavior (mostly happens with mark placeholders)\n const nativeCollapsed = isDOMSelection(nativeTargetRange)\n ? nativeTargetRange.isCollapsed\n : !!nativeTargetRange?.collapsed\n\n if (\n canStoreDiff &&\n nativeCollapsed &&\n Range.isCollapsed(targetRange) &&\n anchor.offset > 0\n ) {\n return storeDiff(anchor.path, {\n text: '',\n start: anchor.offset - 1,\n end: anchor.offset,\n })\n }\n\n return scheduleAction(() => Editor.deleteBackward(editor), {\n at: targetRange,\n })\n }\n\n case 'deleteEntireSoftLine': {\n return scheduleAction(\n () => {\n Editor.deleteBackward(editor, { unit: 'line' })\n Editor.deleteForward(editor, { unit: 'line' })\n },\n { at: targetRange }\n )\n }\n\n case 'deleteHardLineBackward': {\n return scheduleAction(\n () => Editor.deleteBackward(editor, { unit: 'block' }),\n { at: targetRange }\n )\n }\n\n case 'deleteSoftLineBackward': {\n return scheduleAction(\n () => Editor.deleteBackward(editor, { unit: 'line' }),\n { at: targetRange }\n )\n }\n\n case 'deleteHardLineForward': {\n return scheduleAction(\n () => Editor.deleteForward(editor, { unit: 'block' }),\n { at: targetRange }\n )\n }\n\n case 'deleteSoftLineForward': {\n return scheduleAction(\n () => Editor.deleteForward(editor, { unit: 'line' }),\n { at: targetRange }\n )\n }\n\n case 'deleteWordBackward': {\n return scheduleAction(\n () => Editor.deleteBackward(editor, { unit: 'word' }),\n { at: targetRange }\n )\n }\n\n case 'deleteWordForward': {\n return scheduleAction(\n () => Editor.deleteForward(editor, { unit: 'word' }),\n { at: targetRange }\n )\n }\n\n case 'insertLineBreak': {\n return scheduleAction(() => Editor.insertSoftBreak(editor), {\n at: targetRange,\n })\n }\n\n case 'insertParagraph': {\n return scheduleAction(() => Editor.insertBreak(editor), {\n at: targetRange,\n })\n }\n case 'insertCompositionText':\n case 'deleteCompositionText':\n case 'insertFromComposition':\n case 'insertFromDrop':\n case 'insertFromPaste':\n case 'insertFromYank':\n case 'insertReplacementText':\n case 'insertText': {\n if (isDataTransfer(data)) {\n return scheduleAction(() => ReactEditor.insertData(editor, data), {\n at: targetRange,\n })\n }\n\n let text = data ?? ''\n\n // COMPAT: If we are writing inside a placeholder, the ime inserts the text inside\n // the placeholder itself and thus includes the zero-width space inside edit events.\n if (EDITOR_TO_PENDING_INSERTION_MARKS.get(editor)) {\n text = text.replace('\\uFEFF', '')\n }\n\n // Pastes from the Android clipboard will generate `insertText` events.\n // If the copied text contains any newlines, Android will append an\n // extra newline to the end of the copied text.\n if (type === 'insertText' && /.*\\n.*\\n$/.test(text)) {\n text = text.slice(0, -1)\n }\n\n // If the text includes a newline, split it at newlines and paste each component\n // string, with soft breaks in between each.\n if (text.includes('\\n')) {\n return scheduleAction(\n () => {\n const parts = text.split('\\n')\n parts.forEach((line, i) => {\n if (line) {\n Editor.insertText(editor, line)\n }\n if (i !== parts.length - 1) {\n Editor.insertSoftBreak(editor)\n }\n })\n },\n {\n at: targetRange,\n }\n )\n }\n\n if (Path.equals(targetRange.anchor.path, targetRange.focus.path)) {\n const [start, end] = Range.edges(targetRange)\n\n const diff = {\n start: start.offset,\n end: end.offset,\n text,\n }\n\n // COMPAT: Swiftkey has a weird bug where the target range of the 2nd word\n // inserted after a mark placeholder is inserted with an anchor offset off by 1.\n // So writing 'some text' will result in 'some ttext'. Luckily all 'normal' insert\n // text events are fired with the correct target ranges, only the final 'insertComposition'\n // isn't, so we can adjust the target range start offset if we are confident this is the\n // swiftkey insert causing the issue.\n if (text && insertPositionHint && type === 'insertCompositionText') {\n const hintPosition =\n insertPositionHint.start + insertPositionHint.text.search(/\\S|$/)\n const diffPosition = diff.start + diff.text.search(/\\S|$/)\n\n if (\n diffPosition === hintPosition + 1 &&\n diff.end ===\n insertPositionHint.start + insertPositionHint.text.length\n ) {\n debug('adjusting swiftKey insert position using hint')\n diff.start -= 1\n insertPositionHint = null\n scheduleFlush()\n } else {\n insertPositionHint = false\n }\n } else if (type === 'insertText') {\n if (insertPositionHint === null) {\n insertPositionHint = diff\n } else if (\n insertPositionHint &&\n Range.isCollapsed(targetRange) &&\n insertPositionHint.end + insertPositionHint.text.length ===\n start.offset\n ) {\n insertPositionHint = {\n ...insertPositionHint,\n text: insertPositionHint.text + text,\n }\n } else {\n insertPositionHint = false\n }\n } else {\n insertPositionHint = false\n }\n\n if (canStoreDiff) {\n storeDiff(start.path, diff)\n return\n }\n }\n\n return scheduleAction(() => Editor.insertText(editor, text), {\n at: targetRange,\n })\n }\n }\n }\n\n const hasPendingAction = () => {\n return !!EDITOR_TO_PENDING_ACTION.get(editor)\n }\n\n const hasPendingDiffs = () => {\n return !!EDITOR_TO_PENDING_DIFFS.get(editor)?.length\n }\n\n const hasPendingChanges = () => {\n return hasPendingAction() || hasPendingDiffs()\n }\n\n const isFlushing = () => {\n return flushing\n }\n\n const handleUserSelect = (range: Range | null) => {\n EDITOR_TO_PENDING_SELECTION.set(editor, range)\n\n if (flushTimeoutId) {\n clearTimeout(flushTimeoutId)\n flushTimeoutId = null\n }\n\n const { selection } = editor\n if (!range) {\n return\n }\n\n const pathChanged =\n !selection || !Path.equals(selection.anchor.path, range.anchor.path)\n const parentPathChanged =\n !selection ||\n !Path.equals(\n selection.anchor.path.slice(0, -1),\n range.anchor.path.slice(0, -1)\n )\n\n if ((pathChanged && insertPositionHint) || parentPathChanged) {\n insertPositionHint = false\n }\n\n if (pathChanged || hasPendingDiffs()) {\n flushTimeoutId = setTimeout(flush, FLUSH_DELAY)\n }\n }\n\n const handleInput = () => {\n if (hasPendingAction() || !hasPendingDiffs()) {\n debug('flush input')\n flush()\n }\n }\n\n const handleKeyDown = (_: React.KeyboardEvent) => {\n // COMPAT: Swiftkey closes the keyboard when typing inside a empty node\n // directly next to a non-contenteditable element (= the placeholder).\n // The only event fired soon enough for us to allow hiding the placeholder\n // without swiftkey picking it up is the keydown event, so we have to hide it\n // here. See https://github.com/ianstormtaylor/slate/pull/4988#issuecomment-1201050535\n if (!hasPendingDiffs()) {\n updatePlaceholderVisibility(true)\n setTimeout(updatePlaceholderVisibility)\n }\n }\n\n const scheduleFlush = () => {\n if (!hasPendingAction()) {\n actionTimeoutId = setTimeout(flush)\n }\n }\n\n const handleDomMutations = (mutations: MutationRecord[]) => {\n if (hasPendingDiffs() || hasPendingAction()) {\n return\n }\n\n if (\n mutations.some(mutation => isTrackedMutation(editor, mutation, mutations))\n ) {\n // Cause a re-render to restore the dom state if we encounter tracked mutations without\n // a corresponding pending action.\n EDITOR_TO_FORCE_RENDER.get(editor)?.()\n }\n }\n\n return {\n flush,\n scheduleFlush,\n\n hasPendingDiffs,\n hasPendingAction,\n hasPendingChanges,\n\n isFlushing,\n\n handleUserSelect,\n handleCompositionEnd,\n handleCompositionStart,\n handleDOMBeforeInput,\n handleKeyDown,\n\n handleDomMutations,\n handleInput,\n }\n}\n","import { useEffect, useRef } from 'react'\n\nexport function useIsMounted() {\n const isMountedRef = useRef(false)\n\n useEffect(() => {\n isMountedRef.current = true\n return () => {\n isMountedRef.current = false\n }\n }, [])\n\n return isMountedRef.current\n}\n","import { useLayoutEffect, useEffect } from 'react'\nimport { CAN_USE_DOM } from 'slate-dom'\n\n/**\n * Prevent warning on SSR by falling back to useEffect when DOM isn't available\n */\n\nexport const useIsomorphicLayoutEffect = CAN_USE_DOM\n ? useLayoutEffect\n : useEffect\n","import { RefObject, useEffect, useState } from 'react'\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect'\n\nexport function useMutationObserver(\n node: RefObject<HTMLElement>,\n callback: MutationCallback,\n options: MutationObserverInit\n) {\n const [mutationObserver] = useState(() => new MutationObserver(callback))\n\n useIsomorphicLayoutEffect(() => {\n // Discard mutations caused during render phase. This works due to react calling\n // useLayoutEffect synchronously after the render phase before the next tick.\n mutationObserver.takeRecords()\n })\n\n useEffect(() => {\n if (!node.current) {\n throw new Error('Failed to attach MutationObserver, `node` is undefined')\n }\n\n mutationObserver.observe(node.current, options)\n return () => mutationObserver.disconnect()\n }, [mutationObserver, node, options])\n}\n","import { RefObject, useState } from 'react'\nimport { useSlateStatic } from '../use-slate-static'\nimport { IS_ANDROID } from 'slate-dom'\nimport { EDITOR_TO_SCHEDULE_FLUSH } from 'slate-dom'\nimport {\n createAndroidInputManager,\n CreateAndroidInputManagerOptions,\n} from './android-input-manager'\nimport { useIsMounted } from '../use-is-mounted'\nimport { useMutationObserver } from '../use-mutation-observer'\n\ntype UseAndroidInputManagerOptions = {\n node: RefObject<HTMLElement>\n} & Omit<\n CreateAndroidInputManagerOptions,\n 'editor' | 'onUserInput' | 'receivedUserInput'\n>\n\nconst MUTATION_OBSERVER_CONFIG: MutationObserverInit = {\n subtree: true,\n childList: true,\n characterData: true,\n}\n\nexport const useAndroidInputManager = !IS_ANDROID\n ? () => null\n : ({ node, ...options }: UseAndroidInputManagerOptions) => {\n if (!IS_ANDROID) {\n return null\n }\n\n const editor = useSlateStatic()\n const isMounted = useIsMounted()\n\n const [inputManager] = useState(() =>\n createAndroidInputManager({\n editor,\n ...options,\n })\n )\n\n useMutationObserver(\n node,\n inputManager.handleDomMutations,\n MUTATION_OBSERVER_CONFIG\n )\n\n EDITOR_TO_SCHEDULE_FLUSH.set(editor, inputManager.scheduleFlush)\n if (isMounted) {\n inputManager.flush()\n }\n\n return inputManager\n }\n","import React, { forwardRef, memo, useRef, useState } from 'react'\nimport { Editor, Text, Path, Element, Node } from 'slate'\n\nimport { ReactEditor, useSlateStatic } from '..'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { IS_ANDROID, IS_IOS } from 'slate-dom'\nimport { MARK_PLACEHOLDER_SYMBOL } from 'slate-dom'\n\n/**\n * Leaf content strings.\n */\n\nconst String = (props: {\n isLast: boolean\n leaf: Text\n parent: Element\n text: Text\n}) => {\n const { isLast, leaf, parent, text } = props\n const editor = useSlateStatic()\n const path = ReactEditor.findPath(editor, text)\n const parentPath = Path.parent(path)\n const isMarkPlaceholder = Boolean(leaf[MARK_PLACEHOLDER_SYMBOL])\n\n // COMPAT: Render text inside void nodes with a zero-width space.\n // So the node can contain selection but the text is not visible.\n if (editor.isVoid(parent)) {\n return <ZeroWidthString length={Node.string(parent).length} />\n }\n\n // COMPAT: If this is the last text node in an empty block, render a zero-\n // width space that will convert into a line break when copying and pasting\n // to support expected plain text.\n if (\n leaf.text === '' &&\n parent.children[parent.children.length - 1] === text &&\n !editor.isInline(parent) &&\n Editor.string(editor, parentPath) === ''\n ) {\n return <ZeroWidthString isLineBreak isMarkPlaceholder={isMarkPlaceholder} />\n }\n\n // COMPAT: If the text is empty, it's because it's on the edge of an inline\n // node, so we render a zero-width space so that the selection can be\n // inserted next to it still.\n if (leaf.text === '') {\n return <ZeroWidthString isMarkPlaceholder={isMarkPlaceholder} />\n }\n\n // COMPAT: Browsers will collapse trailing new lines at the end of blocks,\n // so we need to add an extra trailing new lines to prevent that.\n if (isLast && leaf.text.slice(-1) === '\\n') {\n return <TextString isTrailing text={leaf.text} />\n }\n\n return <TextString text={leaf.text} />\n}\n\n/**\n * Leaf strings with text in them.\n */\nconst TextString = (props: { text: string; isTrailing?: boolean }) => {\n const { text, isTrailing = false } = props\n const ref = useRef<HTMLSpanElement>(null)\n const getTextContent = () => {\n return `${text ?? ''}${isTrailing ? '\\n' : ''}`\n }\n const [initialText] = useState(getTextContent)\n\n // This is the actual text rendering boundary where we interface with the DOM\n // The text is not rendered as part of the virtual DOM, as since we handle basic character insertions natively,\n // updating the DOM is not a one way dataflow anymore. What we need here is not reconciliation and diffing\n // with previous version of the virtual DOM, but rather diffing with the actual DOM element, and replace the DOM <span> content\n // exactly if and only if its current content does not match our current virtual DOM.\n // Otherwise the DOM TextNode would always be replaced by React as the user types, which interferes with native text features,\n // eg makes native spellcheck opt out from checking the text node.\n\n // useLayoutEffect: updating our span before browser paint\n useIsomorphicLayoutEffect(() => {\n // null coalescing text to make sure we're not outputing \"null\" as a string in the extreme case it is nullish at runtime\n const textWithTrailing = getTextContent()\n\n if (ref.current && ref.current.textContent !== textWithTrailing) {\n ref.current.textContent = textWithTrailing\n }\n\n // intentionally not specifying dependencies, so that this effect runs on every render\n // as this effectively replaces \"specifying the text in the virtual DOM under the <span> below\" on each render\n })\n\n // We intentionally render a memoized <span> that only receives the initial text content when the component is mounted.\n // We defer to the layout effect above to update the `textContent` of the span element when needed.\n return <MemoizedText ref={ref}>{initialText}</MemoizedText>\n}\n\nconst MemoizedText = memo(\n forwardRef<HTMLSpanElement, { children: string }>((props, ref) => {\n return (\n <span data-slate-string ref={ref}>\n {props.children}\n </span>\n )\n })\n)\n\n/**\n * Leaf strings without text, render as zero-width strings.\n */\n\nexport const ZeroWidthString = (props: {\n length?: number\n isLineBreak?: boolean\n isMarkPlaceholder?: boolean\n}) => {\n const { length = 0, isLineBreak = false, isMarkPlaceholder = false } = props\n\n const attributes: {\n 'data-slate-zero-width': string\n 'data-slate-length': number\n 'data-slate-mark-placeholder'?: boolean\n } = {\n 'data-slate-zero-width': isLineBreak ? 'n' : 'z',\n 'data-slate-length': length,\n }\n\n if (isMarkPlaceholder) {\n attributes['data-slate-mark-placeholder'] = true\n }\n\n return (\n <span {...attributes}>\n {!(IS_ANDROID || IS_IOS) || !isLineBreak ? '\\uFEFF' : null}\n {isLineBreak ? <br /> : null}\n </span>\n )\n}\n\nexport default String\n","import React, {\n useRef,\n useCallback,\n MutableRefObject,\n useState,\n useEffect,\n} from 'react'\nimport { JSX } from 'react'\nimport { Element, Text } from 'slate'\nimport { ResizeObserver as ResizeObserverPolyfill } from '@juggle/resize-observer'\nimport String from './string'\nimport {\n PLACEHOLDER_SYMBOL,\n EDITOR_TO_PLACEHOLDER_ELEMENT,\n EDITOR_TO_FORCE_RENDER,\n} from 'slate-dom'\nimport { RenderLeafProps, RenderPlaceholderProps } from './editable'\nimport { useSlateStatic } from '../hooks/use-slate-static'\nimport { IS_WEBKIT, IS_ANDROID } from 'slate-dom'\n\n// Delay the placeholder on Android to prevent the keyboard from closing.\n// (https://github.com/ianstormtaylor/slate/pull/5368)\nconst PLACEHOLDER_DELAY = IS_ANDROID ? 300 : 0\n\nfunction disconnectPlaceholderResizeObserver(\n placeholderResizeObserver: MutableRefObject<ResizeObserver | null>,\n releaseObserver: boolean\n) {\n if (placeholderResizeObserver.current) {\n placeholderResizeObserver.current.disconnect()\n if (releaseObserver) {\n placeholderResizeObserver.current = null\n }\n }\n}\n\ntype TimerId = ReturnType<typeof setTimeout> | null\n\nfunction clearTimeoutRef(timeoutRef: MutableRefObject<TimerId>) {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n timeoutRef.current = null\n }\n}\n\n/**\n * Individual leaves in a text node with unique formatting.\n */\nconst Leaf = (props: {\n isLast: boolean\n leaf: Text\n parent: Element\n renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n text: Text\n}) => {\n const {\n leaf,\n isLast,\n text,\n parent,\n renderPlaceholder,\n renderLeaf = (props: RenderLeafProps) => <DefaultLeaf {...props} />,\n } = props\n\n const editor = useSlateStatic()\n const placeholderResizeObserver = useRef<ResizeObserver | null>(null)\n const placeholderRef = useRef<HTMLElement | null>(null)\n const [showPlaceholder, setShowPlaceholder] = useState(false)\n const showPlaceholderTimeoutRef = useRef<TimerId>(null)\n\n const callbackPlaceholderRef = useCallback(\n (placeholderEl: HTMLElement | null) => {\n disconnectPlaceholderResizeObserver(\n placeholderResizeObserver,\n placeholderEl == null\n )\n\n if (placeholderEl == null) {\n EDITOR_TO_PLACEHOLDER_ELEMENT.delete(editor)\n leaf.onPlaceholderResize?.(null)\n } else {\n EDITOR_TO_PLACEHOLDER_ELEMENT.set(editor, placeholderEl)\n\n if (!placeholderResizeObserver.current) {\n // Create a new observer and observe the placeholder element.\n const ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill\n placeholderResizeObserver.current = new ResizeObserver(() => {\n leaf.onPlaceholderResize?.(placeholderEl)\n })\n }\n placeholderResizeObserver.current.observe(placeholderEl)\n placeholderRef.current = placeholderEl\n }\n },\n [placeholderRef, leaf, editor]\n )\n\n let children = (\n <String isLast={isLast} leaf={leaf} parent={parent} text={text} />\n )\n\n const leafIsPlaceholder = Boolean(leaf[PLACEHOLDER_SYMBOL])\n useEffect(() => {\n if (leafIsPlaceholder) {\n if (!showPlaceholderTimeoutRef.current) {\n // Delay the placeholder, so it will not render in a selection\n showPlaceholderTimeoutRef.current = setTimeout(() => {\n setShowPlaceholder(true)\n showPlaceholderTimeoutRef.current = null\n }, PLACEHOLDER_DELAY)\n }\n } else {\n clearTimeoutRef(showPlaceholderTimeoutRef)\n setShowPlaceholder(false)\n }\n return () => clearTimeoutRef(showPlaceholderTimeoutRef)\n }, [leafIsPlaceholder, setShowPlaceholder])\n\n if (leafIsPlaceholder && showPlaceholder) {\n const placeholderProps: RenderPlaceholderProps = {\n children: leaf.placeholder,\n attributes: {\n 'data-slate-placeholder': true,\n style: {\n position: 'absolute',\n top: 0,\n pointerEvents: 'none',\n width: '100%',\n maxWidth: '100%',\n display: 'block',\n opacity: '0.333',\n userSelect: 'none',\n textDecoration: 'none',\n // Fixes https://github.com/udecode/plate/issues/2315\n WebkitUserModify: IS_WEBKIT ? 'inherit' : undefined,\n },\n contentEditable: false,\n ref: callbackPlaceholderRef,\n },\n }\n\n children = (\n <React.Fragment>\n {renderPlaceholder(placeholderProps)}\n {children}\n </React.Fragment>\n )\n }\n\n // COMPAT: Having the `data-` attributes on these leaf elements ensures that\n // in certain misbehaving browsers they aren't weirdly cloned/destroyed by\n // contenteditable behaviors. (2019/05/08)\n const attributes: {\n 'data-slate-leaf': true\n } = {\n 'data-slate-leaf': true,\n }\n\n return renderLeaf({ attributes, children, leaf, text })\n}\n\nconst MemoizedLeaf = React.memo(Leaf, (prev, next) => {\n return (\n next.parent === prev.parent &&\n next.isLast === prev.isLast &&\n next.renderLeaf === prev.renderLeaf &&\n next.renderPlaceholder === prev.renderPlaceholder &&\n next.text === prev.text &&\n Text.equals(next.leaf, prev.leaf) &&\n next.leaf[PLACEHOLDER_SYMBOL] === prev.leaf[PLACEHOLDER_SYMBOL]\n )\n})\n\nexport const DefaultLeaf = (props: RenderLeafProps) => {\n const { attributes, children } = props\n return <span {...attributes}>{children}</span>\n}\n\nexport default MemoizedLeaf\n","import React, { useCallback, useRef } from 'react'\nimport { Element, DecoratedRange, Text as SlateText } from 'slate'\nimport { ReactEditor, useSlateStatic } from '..'\nimport { isTextDecorationsEqual } from 'slate-dom'\nimport {\n EDITOR_TO_KEY_TO_ELEMENT,\n ELEMENT_TO_NODE,\n NODE_TO_ELEMENT,\n} from 'slate-dom'\nimport { RenderLeafProps, RenderPlaceholderProps } from './editable'\nimport Leaf from './leaf'\n\n/**\n * Text.\n */\n\nconst Text = (props: {\n decorations: DecoratedRange[]\n isLast: boolean\n parent: Element\n renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n text: SlateText\n}) => {\n const { decorations, isLast, parent, renderPlaceholder, renderLeaf, text } =\n props\n const editor = useSlateStatic()\n const ref = useRef<HTMLSpanElement | null>(null)\n const leaves = SlateText.decorations(text, decorations)\n const key = ReactEditor.findKey(editor, text)\n const children = []\n\n for (let i = 0; i < leaves.length; i++) {\n const leaf = leaves[i]\n\n children.push(\n <Leaf\n isLast={isLast && i === leaves.length - 1}\n key={`${key.id}-${i}`}\n renderPlaceholder={renderPlaceholder}\n leaf={leaf}\n text={text}\n parent={parent}\n renderLeaf={renderLeaf}\n />\n )\n }\n\n // Update element-related weak maps with the DOM element ref.\n const callbackRef = useCallback(\n (span: HTMLSpanElement | null) => {\n const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor)\n if (span) {\n KEY_TO_ELEMENT?.set(key, span)\n NODE_TO_ELEMENT.set(text, span)\n ELEMENT_TO_NODE.set(span, text)\n } else {\n KEY_TO_ELEMENT?.delete(key)\n NODE_TO_ELEMENT.delete(text)\n if (ref.current) {\n ELEMENT_TO_NODE.delete(ref.current)\n }\n }\n ref.current = span\n },\n [ref, editor, key, text]\n )\n return (\n <span data-slate-node=\"text\" ref={callbackRef}>\n {children}\n </span>\n )\n}\n\nconst MemoizedText = React.memo(Text, (prev, next) => {\n return (\n next.parent === prev.parent &&\n next.isLast === prev.isLast &&\n next.renderLeaf === prev.renderLeaf &&\n next.renderPlaceholder === prev.renderPlaceholder &&\n next.text === prev.text &&\n isTextDecorationsEqual(next.decorations, prev.decorations)\n )\n})\n\nexport default MemoizedText\n","import getDirection from 'direction'\nimport React, { useCallback } from 'react'\nimport { JSX } from 'react'\nimport {\n Editor,\n Element as SlateElement,\n Node,\n Range,\n DecoratedRange,\n} from 'slate'\nimport { ReactEditor, useReadOnly, useSlateStatic } from '..'\nimport useChildren from '../hooks/use-children'\nimport { isElementDecorationsEqual } from 'slate-dom'\nimport {\n EDITOR_TO_KEY_TO_ELEMENT,\n ELEMENT_TO_NODE,\n NODE_TO_ELEMENT,\n NODE_TO_INDEX,\n NODE_TO_PARENT,\n} from 'slate-dom'\nimport {\n RenderElementProps,\n RenderLeafProps,\n RenderPlaceholderProps,\n} from './editable'\n\nimport Text from './text'\n\n/**\n * Element.\n */\n\nconst Element = (props: {\n decorations: DecoratedRange[]\n element: SlateElement\n renderElement?: (props: RenderElementProps) => JSX.Element\n renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n selection: Range | null\n}) => {\n const {\n decorations,\n element,\n renderElement = (p: RenderElementProps) => <DefaultElement {...p} />,\n renderPlaceholder,\n renderLeaf,\n selection,\n } = props\n const editor = useSlateStatic()\n const readOnly = useReadOnly()\n const isInline = editor.isInline(element)\n const key = ReactEditor.findKey(editor, element)\n const ref = useCallback(\n (ref: HTMLElement | null) => {\n // Update element-related weak maps with the DOM element ref.\n const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor)\n if (ref) {\n KEY_TO_ELEMENT?.set(key, ref)\n NODE_TO_ELEMENT.set(element, ref)\n ELEMENT_TO_NODE.set(ref, element)\n } else {\n KEY_TO_ELEMENT?.delete(key)\n NODE_TO_ELEMENT.delete(element)\n }\n },\n [editor, key, element]\n )\n let children: React.ReactNode = useChildren({\n decorations,\n node: element,\n renderElement,\n renderPlaceholder,\n renderLeaf,\n selection,\n })\n\n // Attributes that the developer must mix into the element in their\n // custom node renderer component.\n const attributes: {\n 'data-slate-node': 'element'\n 'data-slate-void'?: true\n 'data-slate-inline'?: true\n contentEditable?: false\n dir?: 'rtl'\n ref: any\n } = {\n 'data-slate-node': 'element',\n ref,\n }\n\n if (isInline) {\n attributes['data-slate-inline'] = true\n }\n\n // If it's a block node with inline children, add the proper `dir` attribute\n // for text direction.\n if (!isInline && Editor.hasInlines(editor, element)) {\n const text = Node.string(element)\n const dir = getDirection(text)\n\n if (dir === 'rtl') {\n attributes.dir = dir\n }\n }\n\n // If it's a void node, wrap the children in extra void-specific elements.\n if (Editor.isVoid(editor, element)) {\n attributes['data-slate-void'] = true\n\n if (!readOnly && isInline) {\n attributes.contentEditable = false\n }\n\n const Tag = isInline ? 'span' : 'div'\n const [[text]] = Node.texts(element)\n\n children = (\n <Tag\n data-slate-spacer\n style={{\n height: '0',\n color: 'transparent',\n outline: 'none',\n position: 'absolute',\n }}\n >\n <Text\n renderPlaceholder={renderPlaceholder}\n decorations={[]}\n isLast={false}\n parent={element}\n text={text}\n />\n </Tag>\n )\n\n NODE_TO_INDEX.set(text, 0)\n NODE_TO_PARENT.set(text, element)\n }\n\n return renderElement({ attributes, children, element })\n}\n\nconst MemoizedElement = React.memo(Element, (prev, next) => {\n return (\n prev.element === next.element &&\n prev.renderElement === next.renderElement &&\n prev.renderLeaf === next.renderLeaf &&\n prev.renderPlaceholder === next.renderPlaceholder &&\n isElementDecorationsEqual(prev.decorations, next.decorations) &&\n (prev.selection === next.selection ||\n (!!prev.selection &&\n !!next.selection &&\n Range.equals(prev.selection, next.selection)))\n )\n})\n\n/**\n * The default element renderer.\n */\n\nexport const DefaultElement = (props: RenderElementProps) => {\n const { attributes, children, element } = props\n const editor = useSlateStatic()\n const Tag = editor.isInline(element) ? 'span' : 'div'\n return (\n <Tag {...attributes} style={{ position: 'relative' }}>\n {children}\n </Tag>\n )\n}\n\nexport default MemoizedElement\n","import { createContext, useContext } from 'react'\nimport { DecoratedRange, NodeEntry } from 'slate'\n\n/**\n * A React context for sharing the `decorate` prop of the editable.\n */\n\nexport const DecorateContext = createContext<\n (entry: NodeEntry) => DecoratedRange[]\n>(() => [])\n\n/**\n * Get the current `decorate` prop of the editable.\n */\n\nexport const useDecorate = (): ((entry: NodeEntry) => DecoratedRange[]) => {\n return useContext(DecorateContext)\n}\n","import { createContext, useContext } from 'react'\n\n/**\n * A React context for sharing the `selected` state of an element.\n */\n\nexport const SelectedContext = createContext(false)\n\n/**\n * Get the current `selected` state of an element.\n */\n\nexport const useSelected = (): boolean => {\n return useContext(SelectedContext)\n}\n","import React from 'react'\nimport {\n Ancestor,\n Descendant,\n Editor,\n Element,\n Range,\n DecoratedRange,\n} from 'slate'\nimport {\n RenderElementProps,\n RenderLeafProps,\n RenderPlaceholderProps,\n} from '../components/editable'\n\nimport ElementComponent from '../components/element'\nimport TextComponent from '../components/text'\nimport { ReactEditor } from '../plugin/react-editor'\nimport { IS_NODE_MAP_DIRTY, NODE_TO_INDEX, NODE_TO_PARENT } from 'slate-dom'\nimport { useDecorate } from './use-decorate'\nimport { SelectedContext } from './use-selected'\nimport { useSlateStatic } from './use-slate-static'\n\n/**\n * Children.\n */\n\nconst useChildren = (props: {\n decorations: DecoratedRange[]\n node: Ancestor\n renderElement?: (props: RenderElementProps) => JSX.Element\n renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n selection: Range | null\n}) => {\n const {\n decorations,\n node,\n renderElement,\n renderPlaceholder,\n renderLeaf,\n selection,\n } = props\n const decorate = useDecorate()\n const editor = useSlateStatic()\n IS_NODE_MAP_DIRTY.set(editor as ReactEditor, false)\n const path = ReactEditor.findPath(editor, node)\n const children = []\n const isLeafBlock =\n Element.isElement(node) &&\n !editor.isInline(node) &&\n Editor.hasInlines(editor, node)\n\n for (let i = 0; i < node.children.length; i++) {\n const p = path.concat(i)\n const n = node.children[i] as Descendant\n const key = ReactEditor.findKey(editor, n)\n const range = Editor.range(editor, p)\n const sel = selection && Range.intersection(range, selection)\n const ds = decorate([n, p])\n\n for (const dec of decorations) {\n const d = Range.intersection(dec, range)\n\n if (d) {\n ds.push(d)\n }\n }\n\n if (Element.isElement(n)) {\n children.push(\n <SelectedContext.Provider key={`provider-${key.id}`} value={!!sel}>\n <ElementComponent\n decorations={ds}\n element={n}\n key={key.id}\n renderElement={renderElement}\n renderPlaceholder={renderPlaceholder}\n renderLeaf={renderLeaf}\n selection={sel}\n />\n </SelectedContext.Provider>\n )\n } else {\n children.push(\n <TextComponent\n decorations={ds}\n key={key.id}\n isLast={isLeafBlock && i === node.children.length - 1}\n parent={node}\n renderPlaceholder={renderPlaceholder}\n renderLeaf={renderLeaf}\n text={n}\n />\n )\n }\n\n NODE_TO_INDEX.set(n, i)\n NODE_TO_PARENT.set(n, node)\n }\n\n return children\n}\n\nexport default useChildren\n","import { createContext, useContext } from 'react'\n\n/**\n * A React context for sharing the `readOnly` state of the editor.\n */\n\nexport const ReadOnlyContext = createContext(false)\n\n/**\n * Get the current `readOnly` state of the editor.\n */\n\nexport const useReadOnly = (): boolean => {\n return useContext(ReadOnlyContext)\n}\n","import { createContext, useContext } from 'react'\nimport { Editor } from 'slate'\nimport { ReactEditor } from '../plugin/react-editor'\n\n/**\n * A React context for sharing the editor object, in a way that re-renders the\n * context whenever changes occur.\n */\n\nexport interface SlateContextValue {\n v: number\n editor: ReactEditor\n}\n\nexport const SlateContext = createContext<{\n v: number\n editor: ReactEditor\n} | null>(null)\n\n/**\n * Get the current editor object from the React context.\n */\n\nexport const useSlate = (): Editor => {\n const context = useContext(SlateContext)\n\n if (!context) {\n throw new Error(\n `The \\`useSlate\\` hook must be used inside the <Slate> component's context.`\n )\n }\n\n const { editor } = context\n return editor\n}\n\nexport const useSlateWithV = (): { editor: Editor; v: number } => {\n const context = useContext(SlateContext)\n\n if (!context) {\n throw new Error(\n `The \\`useSlate\\` hook must be used inside the <Slate> component's context.`\n )\n }\n\n return context\n}\n","import { useCallback, useEffect, useRef } from 'react'\nimport { ReactEditor } from '../plugin/react-editor'\nimport { useSlateStatic } from './use-slate-static'\n\nexport function useTrackUserInput() {\n const editor = useSlateStatic()\n\n const receivedUserInput = useRef<boolean>(false)\n const animationFrameIdRef = useRef<number>(0)\n\n const onUserInput = useCallback(() => {\n if (receivedUserInput.current) {\n return\n }\n\n receivedUserInput.current = true\n\n const window = ReactEditor.getWindow(editor)\n window.cancelAnimationFrame(animationFrameIdRef.current)\n\n animationFrameIdRef.current = window.requestAnimationFrame(() => {\n receivedUserInput.current = false\n })\n }, [editor])\n\n useEffect(() => () => cancelAnimationFrame(animationFrameIdRef.current), [])\n\n return {\n receivedUserInput,\n onUserInput,\n }\n}\n","import { RefObject } from 'react'\nimport { ReactEditor } from '../../plugin/react-editor'\nimport { isTrackedMutation } from 'slate-dom'\n\nexport type RestoreDOMManager = {\n registerMutations: (mutations: MutationRecord[]) => void\n restoreDOM: () => void\n clear: () => void\n}\n\nexport const createRestoreDomManager = (\n editor: ReactEditor,\n receivedUserInput: RefObject<boolean>\n): RestoreDOMManager => {\n let bufferedMutations: MutationRecord[] = []\n\n const clear = () => {\n bufferedMutations = []\n }\n\n const registerMutations = (mutations: MutationRecord[]) => {\n if (!receivedUserInput.current) {\n return\n }\n\n const trackedMutations = mutations.filter(mutation =>\n isTrackedMutation(editor, mutation, mutations)\n )\n\n bufferedMutations.push(...trackedMutations)\n }\n\n function restoreDOM() {\n if (bufferedMutations.length > 0) {\n bufferedMutations.reverse().forEach(mutation => {\n if (mutation.type === 'characterData') {\n // We don't want to restore the DOM for characterData mutations\n // because this interrupts the composition.\n return\n }\n\n mutation.removedNodes.forEach(node => {\n mutation.target.insertBefore(node, mutation.nextSibling)\n })\n\n mutation.addedNodes.forEach(node => {\n mutation.target.removeChild(node)\n })\n })\n\n // Clear buffered mutations to ensure we don't undo them twice\n clear()\n }\n }\n\n return {\n registerMutations,\n restoreDOM,\n clear,\n }\n}\n","import React, {\n Component,\n ComponentType,\n ContextType,\n ReactNode,\n RefObject,\n} from 'react'\nimport { EditorContext } from '../../hooks/use-slate-static'\nimport { IS_ANDROID } from 'slate-dom'\nimport {\n createRestoreDomManager,\n RestoreDOMManager,\n} from './restore-dom-manager'\n\nconst MUTATION_OBSERVER_CONFIG: MutationObserverInit = {\n subtree: true,\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n}\n\ntype RestoreDOMProps = {\n children?: ReactNode\n receivedUserInput: RefObject<boolean>\n node: RefObject<HTMLDivElement>\n}\n\n// We have to use a class component here since we rely on `getSnapshotBeforeUpdate` which has no FC equivalent\n// to run code synchronously immediately before react commits the component update to the DOM.\nclass RestoreDOMComponent extends Component<RestoreDOMProps> {\n static contextType = EditorContext\n context: ContextType<typeof EditorContext> = null\n\n private manager: RestoreDOMManager | null = null\n private mutationObserver: MutationObserver | null = null\n\n observe() {\n const { node } = this.props\n if (!node.current) {\n throw new Error('Failed to attach MutationObserver, `node` is undefined')\n }\n\n this.mutationObserver?.observe(node.current, MUTATION_OBSERVER_CONFIG)\n }\n\n componentDidMount() {\n const { receivedUserInput } = this.props\n const editor = this.context!\n\n this.manager = createRestoreDomManager(editor, receivedUserInput)\n this.mutationObserver = new MutationObserver(this.manager.registerMutations)\n\n this.observe()\n }\n\n getSnapshotBeforeUpdate() {\n const pendingMutations = this.mutationObserver?.takeRecords()\n if (pendingMutations?.length) {\n this.manager?.registerMutations(pendingMutations)\n }\n\n this.mutationObserver?.disconnect()\n this.manager?.restoreDOM()\n\n return null\n }\n\n componentDidUpdate() {\n this.manager?.clear()\n this.observe()\n }\n\n componentWillUnmount() {\n this.mutationObserver?.disconnect()\n }\n\n render() {\n return this.props.children\n }\n}\n\nexport const RestoreDOM: ComponentType<RestoreDOMProps> = IS_ANDROID\n ? RestoreDOMComponent\n : ({ children }) => <>{children}</>\n","import { createContext, useContext } from 'react'\n\n/**\n * A React context for sharing the `composing` state of the editor.\n */\n\nexport const ComposingContext = createContext(false)\n\n/**\n * Get the current `composing` state of the editor.\n */\n\nexport const useComposing = (): boolean => {\n return useContext(ComposingContext)\n}\n","import getDirection from 'direction'\nimport debounce from 'lodash/debounce'\nimport throttle from 'lodash/throttle'\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n forwardRef,\n ForwardedRef,\n} from 'react'\nimport { JSX } from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\nimport {\n Editor,\n Element,\n Node,\n NodeEntry,\n Path,\n Range,\n Text,\n Transforms,\n DecoratedRange,\n} from 'slate'\nimport { useAndroidInputManager } from '../hooks/android-input-manager/use-android-input-manager'\nimport useChildren from '../hooks/use-children'\nimport { DecorateContext } from '../hooks/use-decorate'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { ReadOnlyContext } from '../hooks/use-read-only'\nimport { useSlate } from '../hooks/use-slate'\nimport { useTrackUserInput } from '../hooks/use-track-user-input'\nimport { ReactEditor } from '../plugin/react-editor'\nimport { TRIPLE_CLICK } from 'slate-dom'\nimport {\n DOMElement,\n DOMRange,\n DOMText,\n getActiveElement,\n getDefaultView,\n getSelection,\n isDOMElement,\n isDOMNode,\n isPlainTextOnlyPaste,\n} from 'slate-dom'\nimport {\n CAN_USE_DOM,\n HAS_BEFORE_INPUT_SUPPORT,\n IS_ANDROID,\n IS_CHROME,\n IS_FIREFOX,\n IS_FIREFOX_LEGACY,\n IS_IOS,\n IS_WEBKIT,\n IS_UC_MOBILE,\n IS_WECHATBROWSER,\n} from 'slate-dom'\nimport { Hotkeys } from 'slate-dom'\nimport {\n IS_NODE_MAP_DIRTY,\n EDITOR_TO_ELEMENT,\n EDITOR_TO_FORCE_RENDER,\n EDITOR_TO_PENDING_INSERTION_MARKS,\n EDITOR_TO_USER_MARKS,\n EDITOR_TO_USER_SELECTION,\n EDITOR_TO_WINDOW,\n ELEMENT_TO_NODE,\n IS_COMPOSING,\n IS_FOCUSED,\n IS_READ_ONLY,\n MARK_PLACEHOLDER_SYMBOL,\n NODE_TO_ELEMENT,\n PLACEHOLDER_SYMBOL,\n} from 'slate-dom'\nimport { RestoreDOM } from './restore-dom/restore-dom'\nimport { AndroidInputManager } from '../hooks/android-input-manager/android-input-manager'\nimport { ComposingContext } from '../hooks/use-composing'\n\ntype DeferredOperation = () => void\n\nconst Children = (props: Parameters<typeof useChildren>[0]) => (\n <React.Fragment>{useChildren(props)}</React.Fragment>\n)\n\n/**\n * `RenderElementProps` are passed to the `renderElement` handler.\n */\n\nexport interface RenderElementProps {\n children: any\n element: Element\n attributes: {\n 'data-slate-node': 'element'\n 'data-slate-inline'?: true\n 'data-slate-void'?: true\n dir?: 'rtl'\n ref: any\n }\n}\n\n/**\n * `RenderLeafProps` are passed to the `renderLeaf` handler.\n */\n\nexport interface RenderLeafProps {\n children: any\n leaf: Text\n text: Text\n attributes: {\n 'data-slate-leaf': true\n }\n}\n\n/**\n * `EditableProps` are passed to the `<Editable>` component.\n */\n\nexport type EditableProps = {\n decorate?: (entry: NodeEntry) => DecoratedRange[]\n onDOMBeforeInput?: (event: InputEvent) => void\n placeholder?: string\n readOnly?: boolean\n role?: string\n style?: React.CSSProperties\n renderElement?: (props: RenderElementProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n renderPlaceholder?: (props: RenderPlaceholderProps) => JSX.Element\n scrollSelectionIntoView?: (editor: ReactEditor, domRange: DOMRange) => void\n as?: React.ElementType\n disableDefaultStyles?: boolean\n} & React.TextareaHTMLAttributes<HTMLDivElement>\n\n/**\n * Editable.\n */\n\nexport const Editable = forwardRef(\n (props: EditableProps, forwardedRef: ForwardedRef<HTMLDivElement>) => {\n const defaultRenderPlaceholder = useCallback(\n (props: RenderPlaceholderProps) => <DefaultPlaceholder {...props} />,\n []\n )\n const {\n autoFocus,\n decorate = defaultDecorate,\n onDOMBeforeInput: propsOnDOMBeforeInput,\n placeholder,\n readOnly = false,\n renderElement,\n renderLeaf,\n renderPlaceholder = defaultRenderPlaceholder,\n scrollSelectionIntoView = defaultScrollSelectionIntoView,\n style: userStyle = {},\n as: Component = 'div',\n disableDefaultStyles = false,\n ...attributes\n } = props\n const editor = useSlate()\n // Rerender editor when composition status changed\n const [isComposing, setIsComposing] = useState(false)\n const ref = useRef<HTMLDivElement | null>(null)\n const deferredOperations = useRef<DeferredOperation[]>([])\n const [placeholderHeight, setPlaceholderHeight] = useState<\n number | undefined\n >()\n const processing = useRef(false)\n\n const { onUserInput, receivedUserInput } = useTrackUserInput()\n\n const [, forceRender] = useReducer(s => s + 1, 0)\n EDITOR_TO_FORCE_RENDER.set(editor, forceRender)\n\n // Update internal state on each render.\n IS_READ_ONLY.set(editor, readOnly)\n\n // Keep track of some state for the event handler logic.\n const state = useMemo(\n () => ({\n isDraggingInternally: false,\n isUpdatingSelection: false,\n latestElement: null as DOMElement | null,\n hasMarkPlaceholder: false,\n }),\n []\n )\n\n // The autoFocus TextareaHTMLAttribute doesn't do anything on a div, so it\n // needs to be manually focused.\n useEffect(() => {\n if (ref.current && autoFocus) {\n ref.current.focus()\n }\n }, [autoFocus])\n\n /**\n * The AndroidInputManager object has a cyclical dependency on onDOMSelectionChange\n *\n * It is defined as a reference to simplify hook dependencies and clarify that\n * it needs to be initialized.\n */\n const androidInputManagerRef = useRef<\n AndroidInputManager | null | undefined\n >()\n\n // Listen on the native `selectionchange` event to be able to update any time\n // the selection changes. This is required because React's `onSelect` is leaky\n // and non-standard so it doesn't fire until after a selection has been\n // released. This causes issues in situations where another change happens\n // while a selection is being dragged.\n const onDOMSelectionChange = useMemo(\n () =>\n throttle(() => {\n if (IS_NODE_MAP_DIRTY.get(editor)) {\n onDOMSelectionChange()\n return\n }\n\n const el = ReactEditor.toDOMNode(editor, editor)\n const root = el.getRootNode()\n\n if (!processing.current && IS_WEBKIT && root instanceof ShadowRoot) {\n processing.current = true\n\n const active = getActiveElement()\n\n if (active) {\n document.execCommand('indent')\n } else {\n Transforms.deselect(editor)\n }\n\n processing.current = false\n return\n }\n\n const androidInputManager = androidInputManagerRef.current\n if (\n (IS_ANDROID || !ReactEditor.isComposing(editor)) &&\n (!state.isUpdatingSelection || androidInputManager?.isFlushing()) &&\n !state.isDraggingInternally\n ) {\n const root = ReactEditor.findDocumentOrShadowRoot(editor)\n const { activeElement } = root\n const el = ReactEditor.toDOMNode(editor, editor)\n const domSelection = getSelection(root)\n\n if (activeElement === el) {\n state.latestElement = activeElement\n IS_FOCUSED.set(editor, true)\n } else {\n IS_FOCUSED.delete(editor)\n }\n\n if (!domSelection) {\n return Transforms.deselect(editor)\n }\n\n const { anchorNode, focusNode } = domSelection\n\n const anchorNodeSelectable =\n ReactEditor.hasEditableTarget(editor, anchorNode) ||\n ReactEditor.isTargetInsideNonReadonlyVoid(editor, anchorNode)\n\n const focusNodeInEditor = ReactEditor.hasTarget(editor, focusNode)\n\n if (anchorNodeSelectable && focusNodeInEditor) {\n const range = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: true,\n })\n\n if (range) {\n if (\n !ReactEditor.isComposing(editor) &&\n !androidInputManager?.hasPendingChanges() &&\n !androidInputManager?.isFlushing()\n ) {\n Transforms.select(editor, range)\n } else {\n androidInputManager?.handleUserSelect(range)\n }\n }\n }\n\n // Deselect the editor if the dom selection is not selectable in readonly mode\n if (readOnly && (!anchorNodeSelectable || !focusNodeInEditor)) {\n Transforms.deselect(editor)\n }\n }\n }, 100),\n [editor, readOnly, state]\n )\n\n const scheduleOnDOMSelectionChange = useMemo(\n () => debounce(onDOMSelectionChange, 0),\n [onDOMSelectionChange]\n )\n\n androidInputManagerRef.current = useAndroidInputManager({\n node: ref,\n onDOMSelectionChange,\n scheduleOnDOMSelectionChange,\n })\n\n useIsomorphicLayoutEffect(() => {\n // Update element-related weak maps with the DOM element ref.\n let window\n if (ref.current && (window = getDefaultView(ref.current))) {\n EDITOR_TO_WINDOW.set(editor, window)\n EDITOR_TO_ELEMENT.set(editor, ref.current)\n NODE_TO_ELEMENT.set(editor, ref.current)\n ELEMENT_TO_NODE.set(ref.current, editor)\n } else {\n NODE_TO_ELEMENT.delete(editor)\n }\n\n // Make sure the DOM selection state is in sync.\n const { selection } = editor\n const root = ReactEditor.findDocumentOrShadowRoot(editor)\n const domSelection = getSelection(root)\n\n if (\n !domSelection ||\n !ReactEditor.isFocused(editor) ||\n androidInputManagerRef.current?.hasPendingAction()\n ) {\n return\n }\n\n const setDomSelection = (forceChange?: boolean) => {\n const hasDomSelection = domSelection.type !== 'None'\n\n // If the DOM selection is properly unset, we're done.\n if (!selection && !hasDomSelection) {\n return\n }\n\n // Get anchorNode and focusNode\n const focusNode = domSelection.focusNode\n let anchorNode\n\n // COMPAT: In firefox the normal selection way does not work\n // (https://github.com/ianstormtaylor/slate/pull/5486#issue-1820720223)\n if (IS_FIREFOX && domSelection.rangeCount > 1) {\n const firstRange = domSelection.getRangeAt(0)\n const lastRange = domSelection.getRangeAt(domSelection.rangeCount - 1)\n\n // Right to left\n if (firstRange.startContainer === focusNode) {\n anchorNode = lastRange.endContainer\n } else {\n // Left to right\n anchorNode = firstRange.startContainer\n }\n } else {\n anchorNode = domSelection.anchorNode\n }\n\n // verify that the dom selection is in the editor\n const editorElement = EDITOR_TO_ELEMENT.get(editor)!\n let hasDomSelectionInEditor = false\n if (\n editorElement.contains(anchorNode) &&\n editorElement.contains(focusNode)\n ) {\n hasDomSelectionInEditor = true\n }\n\n // If the DOM selection is in the editor and the editor selection is already correct, we're done.\n if (\n hasDomSelection &&\n hasDomSelectionInEditor &&\n selection &&\n !forceChange\n ) {\n const slateRange = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: true,\n\n // domSelection is not necessarily a valid Slate range\n // (e.g. when clicking on contentEditable:false element)\n suppressThrow: true,\n })\n\n if (slateRange && Range.equals(slateRange, selection)) {\n if (!state.hasMarkPlaceholder) {\n return\n }\n\n // Ensure selection is inside the mark placeholder\n if (\n anchorNode?.parentElement?.hasAttribute(\n 'data-slate-mark-placeholder'\n )\n ) {\n return\n }\n }\n }\n\n // when <Editable/> is being controlled through external value\n // then its children might just change - DOM responds to it on its own\n // but Slate's value is not being updated through any operation\n // and thus it doesn't transform selection on its own\n if (selection && !ReactEditor.hasRange(editor, selection)) {\n editor.selection = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: true,\n })\n return\n }\n\n // Otherwise the DOM selection is out of sync, so update it.\n state.isUpdatingSelection = true\n\n let newDomRange: DOMRange | null = null\n\n try {\n newDomRange = selection && ReactEditor.toDOMRange(editor, selection)\n } catch (e) {\n // Ignore, dom and state might be out of sync\n }\n\n if (newDomRange) {\n if (ReactEditor.isComposing(editor) && !IS_ANDROID) {\n domSelection.collapseToEnd()\n } else if (Range.isBackward(selection!)) {\n domSelection.setBaseAndExtent(\n newDomRange.endContainer,\n newDomRange.endOffset,\n newDomRange.startContainer,\n newDomRange.startOffset\n )\n } else {\n domSelection.setBaseAndExtent(\n newDomRange.startContainer,\n newDomRange.startOffset,\n newDomRange.endContainer,\n newDomRange.endOffset\n )\n }\n scrollSelectionIntoView(editor, newDomRange)\n } else {\n domSelection.removeAllRanges()\n }\n\n return newDomRange\n }\n\n // In firefox if there is more then 1 range and we call setDomSelection we remove the ability to select more cells in a table\n if (domSelection.rangeCount <= 1) {\n setDomSelection()\n }\n\n const ensureSelection =\n androidInputManagerRef.current?.isFlushing() === 'action'\n\n if (!IS_ANDROID || !ensureSelection) {\n setTimeout(() => {\n state.isUpdatingSelection = false\n })\n return\n }\n\n let timeoutId: ReturnType<typeof setTimeout> | null = null\n const animationFrameId = requestAnimationFrame(() => {\n if (ensureSelection) {\n const ensureDomSelection = (forceChange?: boolean) => {\n try {\n const el = ReactEditor.toDOMNode(editor, editor)\n el.focus()\n\n setDomSelection(forceChange)\n } catch (e) {\n // Ignore, dom and state might be out of sync\n }\n }\n\n // Compat: Android IMEs try to force their selection by manually re-applying it even after we set it.\n // This essentially would make setting the slate selection during an update meaningless, so we force it\n // again here. We can't only do it in the setTimeout after the animation frame since that would cause a\n // visible flicker.\n ensureDomSelection()\n\n timeoutId = setTimeout(() => {\n // COMPAT: While setting the selection in an animation frame visually correctly sets the selection,\n // it doesn't update GBoards spellchecker state. We have to manually trigger a selection change after\n // the animation frame to ensure it displays the correct state.\n ensureDomSelection(true)\n state.isUpdatingSelection = false\n })\n }\n })\n\n return () => {\n cancelAnimationFrame(animationFrameId)\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n })\n\n // Listen on the native `beforeinput` event to get real \"Level 2\" events. This\n // is required because React's `beforeinput` is fake and never really attaches\n // to the real event sadly. (2019/11/01)\n // https://github.com/facebook/react/issues/11211\n const onDOMBeforeInput = useCallback(\n (event: InputEvent) => {\n const el = ReactEditor.toDOMNode(editor, editor)\n const root = el.getRootNode()\n\n if (processing?.current && IS_WEBKIT && root instanceof ShadowRoot) {\n const ranges = event.getTargetRanges()\n const range = ranges[0]\n\n const newRange = new window.Range()\n\n newRange.setStart(range.startContainer, range.startOffset)\n newRange.setEnd(range.endContainer, range.endOffset)\n\n // Translate the DOM Range into a Slate Range\n const slateRange = ReactEditor.toSlateRange(editor, newRange, {\n exactMatch: false,\n suppressThrow: false,\n })\n\n Transforms.select(editor, slateRange)\n\n event.preventDefault()\n event.stopImmediatePropagation()\n return\n }\n onUserInput()\n\n if (\n !readOnly &&\n ReactEditor.hasEditableTarget(editor, event.target) &&\n !isDOMEventHandled(event, propsOnDOMBeforeInput)\n ) {\n // COMPAT: BeforeInput events aren't cancelable on android, so we have to handle them differently using the android input manager.\n if (androidInputManagerRef.current) {\n return androidInputManagerRef.current.handleDOMBeforeInput(event)\n }\n\n // Some IMEs/Chrome extensions like e.g. Grammarly set the selection immediately before\n // triggering a `beforeinput` expecting the change to be applied to the immediately before\n // set selection.\n scheduleOnDOMSelectionChange.flush()\n onDOMSelectionChange.flush()\n\n const { selection } = editor\n const { inputType: type } = event\n const data = (event as any).dataTransfer || event.data || undefined\n\n const isCompositionChange =\n type === 'insertCompositionText' || type === 'deleteCompositionText'\n\n // COMPAT: use composition change events as a hint to where we should insert\n // composition text if we aren't composing to work around https://github.com/ianstormtaylor/slate/issues/5038\n if (isCompositionChange && ReactEditor.isComposing(editor)) {\n return\n }\n\n let native = false\n if (\n type === 'insertText' &&\n selection &&\n Range.isCollapsed(selection) &&\n // Only use native character insertion for single characters a-z or space for now.\n // Long-press events (hold a + press 4 = ä) to choose a special character otherwise\n // causes duplicate inserts.\n event.data &&\n event.data.length === 1 &&\n /[a-z ]/i.test(event.data) &&\n // Chrome has issues correctly editing the start of nodes: https://bugs.chromium.org/p/chromium/issues/detail?id=1249405\n // When there is an inline element, e.g. a link, and you select\n // right after it (the start of the next node).\n selection.anchor.offset !== 0\n ) {\n native = true\n\n // Skip native if there are marks, as\n // `insertText` will insert a node, not just text.\n if (editor.marks) {\n native = false\n }\n\n // If the NODE_MAP is dirty, we can't trust the selection anchor (eg ReactEditor.toDOMPoint)\n if (!IS_NODE_MAP_DIRTY.get(editor)) {\n // Chrome also has issues correctly editing the end of anchor elements: https://bugs.chromium.org/p/chromium/issues/detail?id=1259100\n // Therefore we don't allow native events to insert text at the end of anchor nodes.\n const { anchor } = selection\n\n const [node, offset] = ReactEditor.toDOMPoint(editor, anchor)\n const anchorNode = node.parentElement?.closest('a')\n\n const window = ReactEditor.getWindow(editor)\n\n if (\n native &&\n anchorNode &&\n ReactEditor.hasDOMNode(editor, anchorNode)\n ) {\n // Find the last text node inside the anchor.\n const lastText = window?.document\n .createTreeWalker(anchorNode, NodeFilter.SHOW_TEXT)\n .lastChild() as DOMText | null\n\n if (\n lastText === node &&\n lastText.textContent?.length === offset\n ) {\n native = false\n }\n }\n\n // Chrome has issues with the presence of tab characters inside elements with whiteSpace = 'pre'\n // causing abnormal insert behavior: https://bugs.chromium.org/p/chromium/issues/detail?id=1219139\n if (\n native &&\n node.parentElement &&\n window?.getComputedStyle(node.parentElement)?.whiteSpace ===\n 'pre'\n ) {\n const block = Editor.above(editor, {\n at: anchor.path,\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n })\n\n if (block && Node.string(block[0]).includes('\\t')) {\n native = false\n }\n }\n }\n }\n // COMPAT: For the deleting forward/backward input types we don't want\n // to change the selection because it is the range that will be deleted,\n // and those commands determine that for themselves.\n // If the NODE_MAP is dirty, we can't trust the selection anchor (eg ReactEditor.toDOMPoint via ReactEditor.toSlateRange)\n if (\n (!type.startsWith('delete') || type.startsWith('deleteBy')) &&\n !IS_NODE_MAP_DIRTY.get(editor)\n ) {\n const [targetRange] = (event as any).getTargetRanges()\n\n if (targetRange) {\n const range = ReactEditor.toSlateRange(editor, targetRange, {\n exactMatch: false,\n suppressThrow: false,\n })\n\n if (!selection || !Range.equals(selection, range)) {\n native = false\n\n const selectionRef =\n !isCompositionChange &&\n editor.selection &&\n Editor.rangeRef(editor, editor.selection)\n\n Transforms.select(editor, range)\n\n if (selectionRef) {\n EDITOR_TO_USER_SELECTION.set(editor, selectionRef)\n }\n }\n }\n }\n\n // Composition change types occur while a user is composing text and can't be\n // cancelled. Let them through and wait for the composition to end.\n if (isCompositionChange) {\n return\n }\n\n if (!native) {\n event.preventDefault()\n }\n\n // COMPAT: If the selection is expanded, even if the command seems like\n // a delete forward/backward command it should delete the selection.\n if (\n selection &&\n Range.isExpanded(selection) &&\n type.startsWith('delete')\n ) {\n const direction = type.endsWith('Backward') ? 'backward' : 'forward'\n Editor.deleteFragment(editor, { direction })\n return\n }\n\n switch (type) {\n case 'deleteByComposition':\n case 'deleteByCut':\n case 'deleteByDrag': {\n Editor.deleteFragment(editor)\n break\n }\n\n case 'deleteContent':\n case 'deleteContentForward': {\n Editor.deleteForward(editor)\n break\n }\n\n case 'deleteContentBackward': {\n Editor.deleteBackward(editor)\n break\n }\n\n case 'deleteEntireSoftLine': {\n Editor.deleteBackward(editor, { unit: 'line' })\n Editor.deleteForward(editor, { unit: 'line' })\n break\n }\n\n case 'deleteHardLineBackward': {\n Editor.deleteBackward(editor, { unit: 'block' })\n break\n }\n\n case 'deleteSoftLineBackward': {\n Editor.deleteBackward(editor, { unit: 'line' })\n break\n }\n\n case 'deleteHardLineForward': {\n Editor.deleteForward(editor, { unit: 'block' })\n break\n }\n\n case 'deleteSoftLineForward': {\n Editor.deleteForward(editor, { unit: 'line' })\n break\n }\n\n case 'deleteWordBackward': {\n Editor.deleteBackward(editor, { unit: 'word' })\n break\n }\n\n case 'deleteWordForward': {\n Editor.deleteForward(editor, { unit: 'word' })\n break\n }\n\n case 'insertLineBreak':\n Editor.insertSoftBreak(editor)\n break\n\n case 'insertParagraph': {\n Editor.insertBreak(editor)\n break\n }\n\n case 'insertFromComposition':\n case 'insertFromDrop':\n case 'insertFromPaste':\n case 'insertFromYank':\n case 'insertReplacementText':\n case 'insertText': {\n if (type === 'insertFromComposition') {\n // COMPAT: in Safari, `compositionend` is dispatched after the\n // `beforeinput` for \"insertFromComposition\". But if we wait for it\n // then we will abort because we're still composing and the selection\n // won't be updated properly.\n // https://www.w3.org/TR/input-events-2/\n if (ReactEditor.isComposing(editor)) {\n setIsComposing(false)\n IS_COMPOSING.set(editor, false)\n }\n }\n\n // use a weak comparison instead of 'instanceof' to allow\n // programmatic access of paste events coming from external windows\n // like cypress where cy.window does not work realibly\n if (data?.constructor.name === 'DataTransfer') {\n ReactEditor.insertData(editor, data)\n } else if (typeof data === 'string') {\n // Only insertText operations use the native functionality, for now.\n // Potentially expand to single character deletes, as well.\n if (native) {\n deferredOperations.current.push(() =>\n Editor.insertText(editor, data)\n )\n } else {\n Editor.insertText(editor, data)\n }\n }\n\n break\n }\n }\n\n // Restore the actual user section if nothing manually set it.\n const toRestore = EDITOR_TO_USER_SELECTION.get(editor)?.unref()\n EDITOR_TO_USER_SELECTION.delete(editor)\n\n if (\n toRestore &&\n (!editor.selection || !Range.equals(editor.selection, toRestore))\n ) {\n Transforms.select(editor, toRestore)\n }\n }\n },\n [\n editor,\n onDOMSelectionChange,\n onUserInput,\n propsOnDOMBeforeInput,\n readOnly,\n scheduleOnDOMSelectionChange,\n ]\n )\n\n const callbackRef = useCallback(\n (node: HTMLDivElement | null) => {\n if (node == null) {\n onDOMSelectionChange.cancel()\n scheduleOnDOMSelectionChange.cancel()\n\n EDITOR_TO_ELEMENT.delete(editor)\n NODE_TO_ELEMENT.delete(editor)\n\n if (ref.current && HAS_BEFORE_INPUT_SUPPORT) {\n // @ts-ignore The `beforeinput` event isn't recognized.\n ref.current.removeEventListener('beforeinput', onDOMBeforeInput)\n }\n } else {\n // Attach a native DOM event handler for `beforeinput` events, because React's\n // built-in `onBeforeInput` is actually a leaky polyfill that doesn't expose\n // real `beforeinput` events sadly... (2019/11/04)\n // https://github.com/facebook/react/issues/11211\n if (HAS_BEFORE_INPUT_SUPPORT) {\n // @ts-ignore The `beforeinput` event isn't recognized.\n node.addEventListener('beforeinput', onDOMBeforeInput)\n }\n }\n\n ref.current = node\n if (typeof forwardedRef === 'function') {\n forwardedRef(node)\n } else if (forwardedRef) {\n forwardedRef.current = node\n }\n },\n [\n onDOMSelectionChange,\n scheduleOnDOMSelectionChange,\n editor,\n onDOMBeforeInput,\n forwardedRef,\n ]\n )\n\n useIsomorphicLayoutEffect(() => {\n const window = ReactEditor.getWindow(editor)\n\n // Attach a native DOM event handler for `selectionchange`, because React's\n // built-in `onSelect` handler doesn't fire for all selection changes. It's\n // a leaky polyfill that only fires on keypresses or clicks. Instead, we\n // want to fire for any change to the selection inside the editor.\n // (2019/11/04) https://github.com/facebook/react/issues/5785\n window.document.addEventListener(\n 'selectionchange',\n scheduleOnDOMSelectionChange\n )\n\n // Listen for dragend and drop globally. In Firefox, if a drop handler\n // initiates an operation that causes the originally dragged element to\n // unmount, that element will not emit a dragend event. (2024/06/21)\n const stoppedDragging = () => {\n state.isDraggingInternally = false\n }\n window.document.addEventListener('dragend', stoppedDragging)\n window.document.addEventListener('drop', stoppedDragging)\n\n return () => {\n window.document.removeEventListener(\n 'selectionchange',\n scheduleOnDOMSelectionChange\n )\n window.document.removeEventListener('dragend', stoppedDragging)\n window.document.removeEventListener('drop', stoppedDragging)\n }\n }, [scheduleOnDOMSelectionChange, state])\n\n const decorations = decorate([editor, []])\n\n const showPlaceholder =\n placeholder &&\n editor.children.length === 1 &&\n Array.from(Node.texts(editor)).length === 1 &&\n Node.string(editor) === '' &&\n !isComposing\n\n const placeHolderResizeHandler = useCallback(\n (placeholderEl: HTMLElement | null) => {\n if (placeholderEl && showPlaceholder) {\n setPlaceholderHeight(placeholderEl.getBoundingClientRect()?.height)\n } else {\n setPlaceholderHeight(undefined)\n }\n },\n [showPlaceholder]\n )\n\n if (showPlaceholder) {\n const start = Editor.start(editor, [])\n decorations.push({\n [PLACEHOLDER_SYMBOL]: true,\n placeholder,\n onPlaceholderResize: placeHolderResizeHandler,\n anchor: start,\n focus: start,\n })\n }\n\n const { marks } = editor\n state.hasMarkPlaceholder = false\n\n if (editor.selection && Range.isCollapsed(editor.selection) && marks) {\n const { anchor } = editor.selection\n const leaf = Node.leaf(editor, anchor.path)\n const { text, ...rest } = leaf\n\n // While marks isn't a 'complete' text, we can still use loose Text.equals\n // here which only compares marks anyway.\n if (!Text.equals(leaf, marks as Text, { loose: true })) {\n state.hasMarkPlaceholder = true\n\n const unset = Object.fromEntries(\n Object.keys(rest).map(mark => [mark, null])\n )\n\n decorations.push({\n [MARK_PLACEHOLDER_SYMBOL]: true,\n ...unset,\n ...marks,\n\n anchor,\n focus: anchor,\n })\n }\n }\n\n // Update EDITOR_TO_MARK_PLACEHOLDER_MARKS in setTimeout useEffect to ensure we don't set it\n // before we receive the composition end event.\n useEffect(() => {\n setTimeout(() => {\n const { selection } = editor\n if (selection) {\n const { anchor } = selection\n const text = Node.leaf(editor, anchor.path)\n\n // While marks isn't a 'complete' text, we can still use loose Text.equals\n // here which only compares marks anyway.\n if (marks && !Text.equals(text, marks as Text, { loose: true })) {\n EDITOR_TO_PENDING_INSERTION_MARKS.set(editor, marks)\n return\n }\n }\n\n EDITOR_TO_PENDING_INSERTION_MARKS.delete(editor)\n })\n })\n\n return (\n <ReadOnlyContext.Provider value={readOnly}>\n <ComposingContext.Provider value={isComposing}>\n <DecorateContext.Provider value={decorate}>\n <RestoreDOM node={ref} receivedUserInput={receivedUserInput}>\n <Component\n role={readOnly ? undefined : 'textbox'}\n aria-multiline={readOnly ? undefined : true}\n {...attributes}\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we'd\n // have to use hacks to make these replacement-based features work.\n // For SSR situations HAS_BEFORE_INPUT_SUPPORT is false and results in prop\n // mismatch warning app moves to browser. Pass-through consumer props when\n // not CAN_USE_DOM (SSR) and default to falsy value\n spellCheck={\n HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM\n ? attributes.spellCheck\n : false\n }\n autoCorrect={\n HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM\n ? attributes.autoCorrect\n : 'false'\n }\n autoCapitalize={\n HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM\n ? attributes.autoCapitalize\n : 'false'\n }\n data-slate-editor\n data-slate-node=\"value\"\n // explicitly set this\n contentEditable={!readOnly}\n // in some cases, a decoration needs access to the range / selection to decorate a text node,\n // then you will select the whole text node when you select part the of text\n // this magic zIndex=\"-1\" will fix it\n zindex={-1}\n suppressContentEditableWarning\n ref={callbackRef}\n style={{\n ...(disableDefaultStyles\n ? {}\n : {\n // Allow positioning relative to the editable element.\n position: 'relative',\n // Preserve adjacent whitespace and new lines.\n whiteSpace: 'pre-wrap',\n // Allow words to break if they are too long.\n wordWrap: 'break-word',\n // Make the minimum height that of the placeholder.\n ...(placeholderHeight\n ? { minHeight: placeholderHeight }\n : {}),\n }),\n // Allow for passed-in styles to override anything.\n ...userStyle,\n }}\n onBeforeInput={useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to React's leaky polyfill instead just for it. It\n // only works for the `insertText` input type.\n if (\n !HAS_BEFORE_INPUT_SUPPORT &&\n !readOnly &&\n !isEventHandled(event, attributes.onBeforeInput) &&\n ReactEditor.hasSelectableTarget(editor, event.target)\n ) {\n event.preventDefault()\n if (!ReactEditor.isComposing(editor)) {\n const text = (event as any).data as string\n Editor.insertText(editor, text)\n }\n }\n },\n [attributes.onBeforeInput, editor, readOnly]\n )}\n onInput={useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (isEventHandled(event, attributes.onInput)) {\n return\n }\n\n if (androidInputManagerRef.current) {\n androidInputManagerRef.current.handleInput()\n return\n }\n\n // Flush native operations, as native events will have propogated\n // and we can correctly compare DOM text values in components\n // to stop rendering, so that browser functions like autocorrect\n // and spellcheck work as expected.\n for (const op of deferredOperations.current) {\n op()\n }\n deferredOperations.current = []\n\n // COMPAT: Since `beforeinput` doesn't fully `preventDefault`,\n // there's a chance that content might be placed in the browser's undo stack.\n // This means undo can be triggered even when the div is not focused,\n // and it only triggers the input event for the node. (2024/10/09)\n if (!ReactEditor.isFocused(editor)) {\n const native = event.nativeEvent as InputEvent\n const maybeHistoryEditor: any = editor\n if (\n native.inputType === 'historyUndo' &&\n typeof maybeHistoryEditor.undo === 'function'\n ) {\n maybeHistoryEditor.undo()\n return\n }\n if (\n native.inputType === 'historyRedo' &&\n typeof maybeHistoryEditor.redo === 'function'\n ) {\n maybeHistoryEditor.redo()\n return\n }\n }\n },\n [attributes.onInput, editor]\n )}\n onBlur={useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n if (\n readOnly ||\n state.isUpdatingSelection ||\n !ReactEditor.hasSelectableTarget(editor, event.target) ||\n isEventHandled(event, attributes.onBlur)\n ) {\n return\n }\n\n // COMPAT: If the current `activeElement` is still the previous\n // one, this is due to the window being blurred when the tab\n // itself becomes unfocused, so we want to abort early to allow to\n // editor to stay focused when the tab becomes focused again.\n const root = ReactEditor.findDocumentOrShadowRoot(editor)\n if (state.latestElement === root.activeElement) {\n return\n }\n\n const { relatedTarget } = event\n const el = ReactEditor.toDOMNode(editor, editor)\n\n // COMPAT: The event should be ignored if the focus is returning\n // to the editor from an embedded editable element (eg. an <input>\n // element inside a void node).\n if (relatedTarget === el) {\n return\n }\n\n // COMPAT: The event should be ignored if the focus is moving from\n // the editor to inside a void node's spacer element.\n if (\n isDOMElement(relatedTarget) &&\n relatedTarget.hasAttribute('data-slate-spacer')\n ) {\n return\n }\n\n // COMPAT: The event should be ignored if the focus is moving to a\n // non- editable section of an element that isn't a void node (eg.\n // a list item of the check list example).\n if (\n relatedTarget != null &&\n isDOMNode(relatedTarget) &&\n ReactEditor.hasDOMNode(editor, relatedTarget)\n ) {\n const node = ReactEditor.toSlateNode(\n editor,\n relatedTarget\n )\n\n if (Element.isElement(node) && !editor.isVoid(node)) {\n return\n }\n }\n\n // COMPAT: Safari doesn't always remove the selection even if the content-\n // editable element no longer has focus. Refer to:\n // https://stackoverflow.com/questions/12353247/force-contenteditable-div-to-stop-accepting-input-after-it-loses-focus-under-web\n if (IS_WEBKIT) {\n const domSelection = getSelection(root)\n domSelection?.removeAllRanges()\n }\n\n IS_FOCUSED.delete(editor)\n },\n [\n readOnly,\n state.isUpdatingSelection,\n state.latestElement,\n editor,\n attributes.onBlur,\n ]\n )}\n onClick={useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n if (\n ReactEditor.hasTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onClick) &&\n isDOMNode(event.target)\n ) {\n const node = ReactEditor.toSlateNode(editor, event.target)\n const path = ReactEditor.findPath(editor, node)\n\n // At this time, the Slate document may be arbitrarily different,\n // because onClick handlers can change the document before we get here.\n // Therefore we must check that this path actually exists,\n // and that it still refers to the same node.\n if (\n !Editor.hasPath(editor, path) ||\n Node.get(editor, path) !== node\n ) {\n return\n }\n\n if (event.detail === TRIPLE_CLICK && path.length >= 1) {\n let blockPath = path\n if (\n !(\n Element.isElement(node) &&\n Editor.isBlock(editor, node)\n )\n ) {\n const block = Editor.above(editor, {\n match: n =>\n Element.isElement(n) && Editor.isBlock(editor, n),\n at: path,\n })\n\n blockPath = block?.[1] ?? path.slice(0, 1)\n }\n\n const range = Editor.range(editor, blockPath)\n Transforms.select(editor, range)\n return\n }\n\n if (readOnly) {\n return\n }\n\n const start = Editor.start(editor, path)\n const end = Editor.end(editor, path)\n const startVoid = Editor.void(editor, { at: start })\n const endVoid = Editor.void(editor, { at: end })\n\n if (\n startVoid &&\n endVoid &&\n Path.equals(startVoid[1], endVoid[1])\n ) {\n const range = Editor.range(editor, start)\n Transforms.select(editor, range)\n }\n }\n },\n [editor, attributes.onClick, readOnly]\n )}\n onCompositionEnd={useCallback(\n (event: React.CompositionEvent<HTMLDivElement>) => {\n if (ReactEditor.hasSelectableTarget(editor, event.target)) {\n if (ReactEditor.isComposing(editor)) {\n Promise.resolve().then(() => {\n setIsComposing(false)\n IS_COMPOSING.set(editor, false)\n })\n }\n\n androidInputManagerRef.current?.handleCompositionEnd(\n event\n )\n\n if (\n isEventHandled(event, attributes.onCompositionEnd) ||\n IS_ANDROID\n ) {\n return\n }\n\n // COMPAT: In Chrome, `beforeinput` events for compositions\n // aren't correct and never fire the \"insertFromComposition\"\n // type that we need. So instead, insert whenever a composition\n // ends since it will already have been committed to the DOM.\n if (\n !IS_WEBKIT &&\n !IS_FIREFOX_LEGACY &&\n !IS_IOS &&\n !IS_WECHATBROWSER &&\n !IS_UC_MOBILE &&\n event.data\n ) {\n const placeholderMarks =\n EDITOR_TO_PENDING_INSERTION_MARKS.get(editor)\n EDITOR_TO_PENDING_INSERTION_MARKS.delete(editor)\n\n // Ensure we insert text with the marks the user was actually seeing\n if (placeholderMarks !== undefined) {\n EDITOR_TO_USER_MARKS.set(editor, editor.marks)\n editor.marks = placeholderMarks\n }\n\n Editor.insertText(editor, event.data)\n\n const userMarks = EDITOR_TO_USER_MARKS.get(editor)\n EDITOR_TO_USER_MARKS.delete(editor)\n if (userMarks !== undefined) {\n editor.marks = userMarks\n }\n }\n }\n },\n [attributes.onCompositionEnd, editor]\n )}\n onCompositionUpdate={useCallback(\n (event: React.CompositionEvent<HTMLDivElement>) => {\n if (\n ReactEditor.hasSelectableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onCompositionUpdate)\n ) {\n if (!ReactEditor.isComposing(editor)) {\n setIsComposing(true)\n IS_COMPOSING.set(editor, true)\n }\n }\n },\n [attributes.onCompositionUpdate, editor]\n )}\n onCompositionStart={useCallback(\n (event: React.CompositionEvent<HTMLDivElement>) => {\n if (ReactEditor.hasSelectableTarget(editor, event.target)) {\n androidInputManagerRef.current?.handleCompositionStart(\n event\n )\n\n if (\n isEventHandled(event, attributes.onCompositionStart) ||\n IS_ANDROID\n ) {\n return\n }\n\n setIsComposing(true)\n\n const { selection } = editor\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor)\n return\n }\n }\n },\n [attributes.onCompositionStart, editor]\n )}\n onCopy={useCallback(\n (event: React.ClipboardEvent<HTMLDivElement>) => {\n if (\n ReactEditor.hasSelectableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onCopy) &&\n !isDOMEventTargetInput(event)\n ) {\n event.preventDefault()\n ReactEditor.setFragmentData(\n editor,\n event.clipboardData,\n 'copy'\n )\n }\n },\n [attributes.onCopy, editor]\n )}\n onCut={useCallback(\n (event: React.ClipboardEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasSelectableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onCut) &&\n !isDOMEventTargetInput(event)\n ) {\n event.preventDefault()\n ReactEditor.setFragmentData(\n editor,\n event.clipboardData,\n 'cut'\n )\n const { selection } = editor\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Editor.deleteFragment(editor)\n } else {\n const node = Node.parent(\n editor,\n selection.anchor.path\n )\n if (Editor.isVoid(editor, node)) {\n Transforms.delete(editor)\n }\n }\n }\n }\n },\n [readOnly, editor, attributes.onCut]\n )}\n onDragOver={useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (\n ReactEditor.hasTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onDragOver)\n ) {\n // Only when the target is void, call `preventDefault` to signal\n // that drops are allowed. Editable content is droppable by\n // default, and calling `preventDefault` hides the cursor.\n const node = ReactEditor.toSlateNode(editor, event.target)\n\n if (\n Element.isElement(node) &&\n Editor.isVoid(editor, node)\n ) {\n event.preventDefault()\n }\n }\n },\n [attributes.onDragOver, editor]\n )}\n onDragStart={useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onDragStart)\n ) {\n const node = ReactEditor.toSlateNode(editor, event.target)\n const path = ReactEditor.findPath(editor, node)\n const voidMatch =\n (Element.isElement(node) &&\n Editor.isVoid(editor, node)) ||\n Editor.void(editor, { at: path, voids: true })\n\n // If starting a drag on a void node, make sure it is selected\n // so that it shows up in the selection's fragment.\n if (voidMatch) {\n const range = Editor.range(editor, path)\n Transforms.select(editor, range)\n }\n\n state.isDraggingInternally = true\n\n ReactEditor.setFragmentData(\n editor,\n event.dataTransfer,\n 'drag'\n )\n }\n },\n [readOnly, editor, attributes.onDragStart, state]\n )}\n onDrop={useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onDrop)\n ) {\n event.preventDefault()\n\n // Keep a reference to the dragged range before updating selection\n const draggedRange = editor.selection\n\n // Find the range where the drop happened\n const range = ReactEditor.findEventRange(editor, event)\n const data = event.dataTransfer\n\n Transforms.select(editor, range)\n\n if (state.isDraggingInternally) {\n if (\n draggedRange &&\n !Range.equals(draggedRange, range) &&\n !Editor.void(editor, { at: range, voids: true })\n ) {\n Transforms.delete(editor, {\n at: draggedRange,\n })\n }\n }\n\n ReactEditor.insertData(editor, data)\n\n // When dragging from another source into the editor, it's possible\n // that the current editor does not have focus.\n if (!ReactEditor.isFocused(editor)) {\n ReactEditor.focus(editor)\n }\n }\n },\n [readOnly, editor, attributes.onDrop, state]\n )}\n onDragEnd={useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n state.isDraggingInternally &&\n attributes.onDragEnd &&\n ReactEditor.hasTarget(editor, event.target)\n ) {\n attributes.onDragEnd(event)\n }\n },\n [readOnly, state, attributes, editor]\n )}\n onFocus={useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n !state.isUpdatingSelection &&\n ReactEditor.hasEditableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onFocus)\n ) {\n const el = ReactEditor.toDOMNode(editor, editor)\n const root = ReactEditor.findDocumentOrShadowRoot(editor)\n state.latestElement = root.activeElement\n\n // COMPAT: If the editor has nested editable elements, the focus\n // can go to them. In Firefox, this must be prevented because it\n // results in issues with keyboard navigation. (2017/03/30)\n if (IS_FIREFOX && event.target !== el) {\n el.focus()\n return\n }\n\n IS_FOCUSED.set(editor, true)\n }\n },\n [readOnly, state, editor, attributes.onFocus]\n )}\n onKeyDown={useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasEditableTarget(editor, event.target)\n ) {\n androidInputManagerRef.current?.handleKeyDown(event)\n\n const { nativeEvent } = event\n\n // COMPAT: The composition end event isn't fired reliably in all browsers,\n // so we sometimes might end up stuck in a composition state even though we\n // aren't composing any more.\n if (\n ReactEditor.isComposing(editor) &&\n nativeEvent.isComposing === false\n ) {\n IS_COMPOSING.set(editor, false)\n setIsComposing(false)\n }\n\n if (\n isEventHandled(event, attributes.onKeyDown) ||\n ReactEditor.isComposing(editor)\n ) {\n return\n }\n\n const { selection } = editor\n const element =\n editor.children[\n selection !== null ? selection.focus.path[0] : 0\n ]\n const isRTL = getDirection(Node.string(element)) === 'rtl'\n\n // COMPAT: Since we prevent the default behavior on\n // `beforeinput` events, the browser doesn't think there's ever\n // any history stack to undo or redo, so we have to manage these\n // hotkeys ourselves. (2019/11/06)\n if (Hotkeys.isRedo(nativeEvent)) {\n event.preventDefault()\n const maybeHistoryEditor: any = editor\n\n if (typeof maybeHistoryEditor.redo === 'function') {\n maybeHistoryEditor.redo()\n }\n\n return\n }\n\n if (Hotkeys.isUndo(nativeEvent)) {\n event.preventDefault()\n const maybeHistoryEditor: any = editor\n\n if (typeof maybeHistoryEditor.undo === 'function') {\n maybeHistoryEditor.undo()\n }\n\n return\n }\n\n // COMPAT: Certain browsers don't handle the selection updates\n // properly. In Chrome, the selection isn't properly extended.\n // And in Firefox, the selection isn't properly collapsed.\n // (2017/10/17)\n if (Hotkeys.isMoveLineBackward(nativeEvent)) {\n event.preventDefault()\n Transforms.move(editor, { unit: 'line', reverse: true })\n return\n }\n\n if (Hotkeys.isMoveLineForward(nativeEvent)) {\n event.preventDefault()\n Transforms.move(editor, { unit: 'line' })\n return\n }\n\n if (Hotkeys.isExtendLineBackward(nativeEvent)) {\n event.preventDefault()\n Transforms.move(editor, {\n unit: 'line',\n edge: 'focus',\n reverse: true,\n })\n return\n }\n\n if (Hotkeys.isExtendLineForward(nativeEvent)) {\n event.preventDefault()\n Transforms.move(editor, { unit: 'line', edge: 'focus' })\n return\n }\n\n // COMPAT: If a void node is selected, or a zero-width text node\n // adjacent to an inline is selected, we need to handle these\n // hotkeys manually because browsers won't be able to skip over\n // the void node with the zero-width space not being an empty\n // string.\n if (Hotkeys.isMoveBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.move(editor, { reverse: !isRTL })\n } else {\n Transforms.collapse(editor, {\n edge: isRTL ? 'end' : 'start',\n })\n }\n\n return\n }\n\n if (Hotkeys.isMoveForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.move(editor, { reverse: isRTL })\n } else {\n Transforms.collapse(editor, {\n edge: isRTL ? 'start' : 'end',\n })\n }\n\n return\n }\n\n if (Hotkeys.isMoveWordBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.collapse(editor, { edge: 'focus' })\n }\n\n Transforms.move(editor, {\n unit: 'word',\n reverse: !isRTL,\n })\n return\n }\n\n if (Hotkeys.isMoveWordForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.collapse(editor, { edge: 'focus' })\n }\n\n Transforms.move(editor, {\n unit: 'word',\n reverse: isRTL,\n })\n return\n }\n\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to guessing at the input intention for hotkeys.\n // COMPAT: In iOS, some of these hotkeys are handled in the\n if (!HAS_BEFORE_INPUT_SUPPORT) {\n // We don't have a core behavior for these, but they change the\n // DOM if we don't prevent them, so we have to.\n if (\n Hotkeys.isBold(nativeEvent) ||\n Hotkeys.isItalic(nativeEvent) ||\n Hotkeys.isTransposeCharacter(nativeEvent)\n ) {\n event.preventDefault()\n return\n }\n\n if (Hotkeys.isSoftBreak(nativeEvent)) {\n event.preventDefault()\n Editor.insertSoftBreak(editor)\n return\n }\n\n if (Hotkeys.isSplitBlock(nativeEvent)) {\n event.preventDefault()\n Editor.insertBreak(editor)\n return\n }\n\n if (Hotkeys.isDeleteBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward',\n })\n } else {\n Editor.deleteBackward(editor)\n }\n\n return\n }\n\n if (Hotkeys.isDeleteForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward',\n })\n } else {\n Editor.deleteForward(editor)\n }\n\n return\n }\n\n if (Hotkeys.isDeleteLineBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward',\n })\n } else {\n Editor.deleteBackward(editor, { unit: 'line' })\n }\n\n return\n }\n\n if (Hotkeys.isDeleteLineForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward',\n })\n } else {\n Editor.deleteForward(editor, { unit: 'line' })\n }\n\n return\n }\n\n if (Hotkeys.isDeleteWordBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward',\n })\n } else {\n Editor.deleteBackward(editor, { unit: 'word' })\n }\n\n return\n }\n\n if (Hotkeys.isDeleteWordForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward',\n })\n } else {\n Editor.deleteForward(editor, { unit: 'word' })\n }\n\n return\n }\n } else {\n if (IS_CHROME || IS_WEBKIT) {\n // COMPAT: Chrome and Safari support `beforeinput` event but do not fire\n // an event when deleting backwards in a selected void inline node\n if (\n selection &&\n (Hotkeys.isDeleteBackward(nativeEvent) ||\n Hotkeys.isDeleteForward(nativeEvent)) &&\n Range.isCollapsed(selection)\n ) {\n const currentNode = Node.parent(\n editor,\n selection.anchor.path\n )\n\n if (\n Element.isElement(currentNode) &&\n Editor.isVoid(editor, currentNode) &&\n (Editor.isInline(editor, currentNode) ||\n Editor.isBlock(editor, currentNode))\n ) {\n event.preventDefault()\n Editor.deleteBackward(editor, { unit: 'block' })\n\n return\n }\n }\n }\n }\n }\n },\n [readOnly, editor, attributes.onKeyDown]\n )}\n onPaste={useCallback(\n (event: React.ClipboardEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasEditableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onPaste)\n ) {\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to React's `onPaste` here instead.\n // COMPAT: Firefox, Chrome and Safari don't emit `beforeinput` events\n // when \"paste without formatting\" is used, so fallback. (2020/02/20)\n // COMPAT: Safari InputEvents generated by pasting won't include\n // application/x-slate-fragment items, so use the\n // ClipboardEvent here. (2023/03/15)\n if (\n !HAS_BEFORE_INPUT_SUPPORT ||\n isPlainTextOnlyPaste(event.nativeEvent) ||\n IS_WEBKIT\n ) {\n event.preventDefault()\n ReactEditor.insertData(editor, event.clipboardData)\n }\n }\n },\n [readOnly, editor, attributes.onPaste]\n )}\n >\n <Children\n decorations={decorations}\n node={editor}\n renderElement={renderElement}\n renderPlaceholder={renderPlaceholder}\n renderLeaf={renderLeaf}\n selection={editor.selection}\n />\n </Component>\n </RestoreDOM>\n </DecorateContext.Provider>\n </ComposingContext.Provider>\n </ReadOnlyContext.Provider>\n )\n }\n)\n\n/**\n * The props that get passed to renderPlaceholder\n */\nexport type RenderPlaceholderProps = {\n children: any\n attributes: {\n 'data-slate-placeholder': boolean\n dir?: 'rtl'\n contentEditable: boolean\n ref: React.RefCallback<any>\n style: React.CSSProperties\n }\n}\n\n/**\n * The default placeholder element\n */\n\nexport const DefaultPlaceholder = ({\n attributes,\n children,\n}: RenderPlaceholderProps) => (\n // COMPAT: Artificially add a line-break to the end on the placeholder element\n // to prevent Android IMEs to pick up its content in autocorrect and to auto-capitalize the first letter\n <span {...attributes}>\n {children}\n {IS_ANDROID && <br />}\n </span>\n)\n\n/**\n * A default memoized decorate function.\n */\n\nexport const defaultDecorate: (entry: NodeEntry) => DecoratedRange[] = () => []\n\n/**\n * A default implement to scroll dom range into view.\n */\n\nconst defaultScrollSelectionIntoView = (\n editor: ReactEditor,\n domRange: DOMRange\n) => {\n // This was affecting the selection of multiple blocks and dragging behavior,\n // so enabled only if the selection has been collapsed.\n if (\n domRange.getBoundingClientRect &&\n (!editor.selection ||\n (editor.selection && Range.isCollapsed(editor.selection)))\n ) {\n const leafEl = domRange.startContainer.parentElement!\n leafEl.getBoundingClientRect = domRange.getBoundingClientRect.bind(domRange)\n scrollIntoView(leafEl, {\n scrollMode: 'if-needed',\n })\n\n // @ts-expect-error an unorthodox delete D:\n delete leafEl.getBoundingClientRect\n }\n}\n\n/**\n * Check if an event is overrided by a handler.\n */\n\nexport const isEventHandled = <\n EventType extends React.SyntheticEvent<unknown, unknown>,\n>(\n event: EventType,\n handler?: (event: EventType) => void | boolean\n) => {\n if (!handler) {\n return false\n }\n // The custom event handler may return a boolean to specify whether the event\n // shall be treated as being handled or not.\n const shouldTreatEventAsHandled = handler(event)\n\n if (shouldTreatEventAsHandled != null) {\n return shouldTreatEventAsHandled\n }\n\n return event.isDefaultPrevented() || event.isPropagationStopped()\n}\n\n/**\n * Check if the event's target is an input element\n */\nexport const isDOMEventTargetInput = <\n EventType extends React.SyntheticEvent<unknown, unknown>,\n>(\n event: EventType\n) => {\n return (\n isDOMNode(event.target) &&\n (event.target instanceof HTMLInputElement ||\n event.target instanceof HTMLTextAreaElement)\n )\n}\n\n/**\n * Check if a DOM event is overrided by a handler.\n */\n\nexport const isDOMEventHandled = <E extends Event>(\n event: E,\n handler?: (event: E) => void | boolean\n) => {\n if (!handler) {\n return false\n }\n\n // The custom event handler may return a boolean to specify whether the event\n // shall be treated as being handled or not.\n const shouldTreatEventAsHandled = handler(event)\n\n if (shouldTreatEventAsHandled != null) {\n return shouldTreatEventAsHandled\n }\n\n return event.defaultPrevented\n}\n","import { createContext, useContext } from 'react'\n\n/**\n * A React context for sharing the `focused` state of the editor.\n */\n\nexport const FocusedContext = createContext(false)\n\n/**\n * Get the current `focused` state of the editor.\n */\n\nexport const useFocused = (): boolean => {\n return useContext(FocusedContext)\n}\n","import {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useReducer,\n useRef,\n} from 'react'\nimport { Editor } from 'slate'\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect'\n\nfunction isError(error: any): error is Error {\n return error instanceof Error\n}\n\ntype EditorChangeHandler = (editor: Editor) => void\n/**\n * A React context for sharing the editor selector context in a way to control rerenders\n */\n\nexport const SlateSelectorContext = createContext<{\n getSlate: () => Editor\n addEventListener: (callback: EditorChangeHandler) => () => void\n}>({} as any)\n\nconst refEquality = (a: any, b: any) => a === b\n\n/**\n * use redux style selectors to prevent rerendering on every keystroke.\n * Bear in mind rerendering can only prevented if the returned value is a value type or for reference types (e.g. objects and arrays) add a custom equality function.\n *\n * Example:\n * ```\n * const isSelectionActive = useSlateSelector(editor => Boolean(editor.selection));\n * ```\n */\nexport function useSlateSelector<T>(\n selector: (editor: Editor) => T,\n equalityFn: (a: T, b: T) => boolean = refEquality\n) {\n const [, forceRender] = useReducer(s => s + 1, 0)\n const context = useContext(SlateSelectorContext)\n if (!context) {\n throw new Error(\n `The \\`useSlateSelector\\` hook must be used inside the <Slate> component's context.`\n )\n }\n const { getSlate, addEventListener } = context\n\n const latestSubscriptionCallbackError = useRef<Error | undefined>()\n const latestSelector = useRef<(editor: Editor) => T>(() => null as any)\n const latestSelectedState = useRef<T>(null as any as T)\n let selectedState: T\n\n try {\n if (\n selector !== latestSelector.current ||\n latestSubscriptionCallbackError.current\n ) {\n selectedState = selector(getSlate())\n } else {\n selectedState = latestSelectedState.current\n }\n } catch (err) {\n if (latestSubscriptionCallbackError.current && isError(err)) {\n err.message += `\\nThe error may be correlated with this previous error:\\n${latestSubscriptionCallbackError.current.stack}\\n\\n`\n }\n\n throw err\n }\n useIsomorphicLayoutEffect(() => {\n latestSelector.current = selector\n latestSelectedState.current = selectedState\n latestSubscriptionCallbackError.current = undefined\n })\n\n useIsomorphicLayoutEffect(\n () => {\n function checkForUpdates() {\n try {\n const newSelectedState = latestSelector.current(getSlate())\n\n if (equalityFn(newSelectedState, latestSelectedState.current)) {\n return\n }\n\n latestSelectedState.current = newSelectedState\n } catch (err) {\n // we ignore all errors here, since when the component\n // is re-rendered, the selectors are called again, and\n // will throw again, if neither props nor store state\n // changed\n if (err instanceof Error) {\n latestSubscriptionCallbackError.current = err\n } else {\n latestSubscriptionCallbackError.current = new Error(String(err))\n }\n }\n\n forceRender()\n }\n\n const unsubscribe = addEventListener(checkForUpdates)\n\n checkForUpdates()\n\n return () => unsubscribe()\n },\n // don't rerender on equalityFn change since we want to be able to define it inline\n [addEventListener, getSlate]\n )\n\n return selectedState\n}\n\n/**\n * Create selector context with editor updating on every editor change\n */\nexport function useSelectorContext(editor: Editor) {\n const eventListeners = useRef<EditorChangeHandler[]>([]).current\n const slateRef = useRef<{\n editor: Editor\n }>({\n editor,\n }).current\n const onChange = useCallback(\n (editor: Editor) => {\n slateRef.editor = editor\n eventListeners.forEach((listener: EditorChangeHandler) =>\n listener(editor)\n )\n },\n [eventListeners, slateRef]\n )\n\n const selectorContext = useMemo(() => {\n return {\n getSlate: () => slateRef.editor,\n addEventListener: (callback: EditorChangeHandler) => {\n eventListeners.push(callback)\n return () => {\n eventListeners.splice(eventListeners.indexOf(callback), 1)\n }\n },\n }\n }, [eventListeners, slateRef])\n return { selectorContext, onChange }\n}\n","import React from 'react'\n\nexport const REACT_MAJOR_VERSION = parseInt(React.version.split('.')[0], 10)\n","import React, { useCallback, useEffect, useState } from 'react'\nimport { Descendant, Editor, Node, Operation, Scrubber, Selection } from 'slate'\nimport { EDITOR_TO_ON_CHANGE } from 'slate-dom'\nimport { FocusedContext } from '../hooks/use-focused'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { SlateContext, SlateContextValue } from '../hooks/use-slate'\nimport {\n useSelectorContext,\n SlateSelectorContext,\n} from '../hooks/use-slate-selector'\nimport { EditorContext } from '../hooks/use-slate-static'\nimport { ReactEditor } from '../plugin/react-editor'\nimport { REACT_MAJOR_VERSION } from '../utils/environment'\n\n/**\n * A wrapper around the provider to handle `onChange` events, because the editor\n * is a mutable singleton so it won't ever register as \"changed\" otherwise.\n */\n\nexport const Slate = (props: {\n editor: ReactEditor\n initialValue: Descendant[]\n children: React.ReactNode\n onChange?: (value: Descendant[]) => void\n onSelectionChange?: (selection: Selection) => void\n onValueChange?: (value: Descendant[]) => void\n}) => {\n const {\n editor,\n children,\n onChange,\n onSelectionChange,\n onValueChange,\n initialValue,\n ...rest\n } = props\n\n const [context, setContext] = React.useState<SlateContextValue>(() => {\n if (!Node.isNodeList(initialValue)) {\n throw new Error(\n `[Slate] initialValue is invalid! Expected a list of elements but got: ${Scrubber.stringify(\n initialValue\n )}`\n )\n }\n if (!Editor.isEditor(editor)) {\n throw new Error(\n `[Slate] editor is invalid! You passed: ${Scrubber.stringify(editor)}`\n )\n }\n editor.children = initialValue\n Object.assign(editor, rest)\n return { v: 0, editor }\n })\n\n const { selectorContext, onChange: handleSelectorChange } =\n useSelectorContext(editor)\n\n const onContextChange = useCallback(\n (options?: { operation?: Operation }) => {\n if (onChange) {\n onChange(editor.children)\n }\n\n switch (options?.operation?.type) {\n case 'set_selection':\n onSelectionChange?.(editor.selection)\n break\n default:\n onValueChange?.(editor.children)\n }\n\n setContext(prevContext => ({\n v: prevContext.v + 1,\n editor,\n }))\n handleSelectorChange(editor)\n },\n [editor, handleSelectorChange, onChange, onSelectionChange, onValueChange]\n )\n\n useEffect(() => {\n EDITOR_TO_ON_CHANGE.set(editor, onContextChange)\n\n return () => {\n EDITOR_TO_ON_CHANGE.set(editor, () => {})\n }\n }, [editor, onContextChange])\n\n const [isFocused, setIsFocused] = useState(ReactEditor.isFocused(editor))\n\n useEffect(() => {\n setIsFocused(ReactEditor.isFocused(editor))\n }, [editor])\n\n useIsomorphicLayoutEffect(() => {\n const fn = () => setIsFocused(ReactEditor.isFocused(editor))\n if (REACT_MAJOR_VERSION >= 17) {\n // In React >= 17 onFocus and onBlur listen to the focusin and focusout events during the bubbling phase.\n // Therefore in order for <Editable />'s handlers to run first, which is necessary for ReactEditor.isFocused(editor)\n // to return the correct value, we have to listen to the focusin and focusout events without useCapture here.\n document.addEventListener('focusin', fn)\n document.addEventListener('focusout', fn)\n return () => {\n document.removeEventListener('focusin', fn)\n document.removeEventListener('focusout', fn)\n }\n } else {\n document.addEventListener('focus', fn, true)\n document.addEventListener('blur', fn, true)\n return () => {\n document.removeEventListener('focus', fn, true)\n document.removeEventListener('blur', fn, true)\n }\n }\n }, [])\n\n return (\n <SlateSelectorContext.Provider value={selectorContext}>\n <SlateContext.Provider value={context}>\n <EditorContext.Provider value={context.editor}>\n <FocusedContext.Provider value={isFocused}>\n {children}\n </FocusedContext.Provider>\n </EditorContext.Provider>\n </SlateContext.Provider>\n </SlateSelectorContext.Provider>\n )\n}\n","import { useContext } from 'react'\n\nimport { EditorContext } from './use-slate-static'\n\n/**\n * Get the current editor object from the React context.\n * @deprecated Use useSlateStatic instead.\n */\n\nexport const useEditor = () => {\n const editor = useContext(EditorContext)\n\n if (!editor) {\n throw new Error(\n `The \\`useEditor\\` hook must be used inside the <Slate> component's context.`\n )\n }\n\n return editor\n}\n","import { BaseSelection, Range } from 'slate'\n\nimport { useSlateSelector } from './use-slate-selector'\n\n/**\n * Get the current slate selection.\n * Only triggers a rerender when the selection actually changes\n */\nexport const useSlateSelection = () => {\n return useSlateSelector(editor => editor.selection, isSelectionEqual)\n}\n\nconst isSelectionEqual = (a: BaseSelection, b: BaseSelection) => {\n if (!a && !b) return true\n if (!a || !b) return false\n return Range.equals(a, b)\n}\n","import ReactDOM from 'react-dom'\nimport { BaseEditor } from 'slate'\nimport { withDOM } from 'slate-dom'\nimport { ReactEditor } from './react-editor'\nimport { REACT_MAJOR_VERSION } from '../utils/environment'\n\n/**\n * `withReact` adds React and DOM specific behaviors to the editor.\n *\n * If you are using TypeScript, you must extend Slate's CustomTypes to use\n * this plugin.\n *\n * See https://docs.slatejs.org/concepts/11-typescript to learn how.\n */\nexport const withReact = <T extends BaseEditor>(\n editor: T,\n clipboardFormatKey = 'x-slate-fragment'\n): T & ReactEditor => {\n let e = editor as T & ReactEditor\n\n e = withDOM(e, clipboardFormatKey)\n\n const { onChange } = e\n\n e.onChange = options => {\n // COMPAT: React < 18 doesn't batch `setState` hook calls, which means\n // that the children and selection can get out of sync for one render\n // pass. So we have to use this unstable API to ensure it batches them.\n // (2019/12/03)\n // https://github.com/facebook/react/issues/14259#issuecomment-439702367\n const maybeBatchUpdates =\n REACT_MAJOR_VERSION < 18\n ? ReactDOM.unstable_batchedUpdates\n : (callback: () => void) => callback()\n\n maybeBatchUpdates(() => {\n onChange(options)\n })\n }\n\n return e\n}\n"],"names":["objectWithoutPropertiesLoose","toPrimitive","toPropertyKey","EditorContext","createContext","useSlateStatic","editor","useContext","Error","ReactEditor","DOMEditor","RESOLVE_DELAY","FLUSH_DELAY","debug","isDataTransfer","value","constructor","name","createAndroidInputManager","_ref","scheduleOnDOMSelectionChange","onDOMSelectionChange","flushing","compositionEndTimeoutId","flushTimeoutId","actionTimeoutId","idCounter","insertPositionHint","applyPendingSelection","pendingSelection","EDITOR_TO_PENDING_SELECTION","get","delete","selection","normalized","normalizeRange","Range","equals","Transforms","select","performAction","action","EDITOR_TO_PENDING_ACTION","at","target","Point","isPoint","normalizePoint","targetRange","Editor","range","run","flush","clearTimeout","hasPendingDiffs","hasPendingAction","setTimeout","selectionRef","rangeRef","affinity","EDITOR_TO_USER_MARKS","set","marks","EDITOR_TO_PENDING_DIFFS","scheduleSelectionChange","diff","_EDITOR_TO_PENDING_DI","_EDITOR_TO_PENDING_DI2","pendingMarks","EDITOR_TO_PENDING_INSERTION_MARKS","undefined","text","insertText","deleteFragment","filter","_ref2","id","verifyDiffState","cancel","unref","userMarks","onChange","handleCompositionEnd","_event","IS_COMPOSING","handleCompositionStart","updatePlaceholderVisibility","forceHide","arguments","length","placeholderElement","EDITOR_TO_PLACEHOLDER_ELEMENT","style","display","removeProperty","storeDiff","path","_EDITOR_TO_PENDING_DI3","pendingDiffs","Node","leaf","idx","findIndex","change","Path","normalizeStringDiff","push","merged","mergeStringDiffs","splice","_objectSpread","scheduleAction","handleDOMBeforeInput","event","_targetRange2","IS_NODE_MAP_DIRTY","inputType","type","data","dataTransfer","nativeTargetRange","getTargetRanges","toSlateRange","exactMatch","suppressThrow","window","getWindow","domSelection","getSelection","canStoreDiff","startsWith","isExpanded","start","end","edges","offset","next","match","Text","isText","anchor","focus","direction","endsWith","relevantPendingDiffs","find","diffs","applyStringDiff","point","handleUserSelect","isCollapsed","targetNode","deleteForward","_nativeTargetRange","nativeCollapsed","isDOMSelection","collapsed","deleteBackward","unit","insertSoftBreak","insertBreak","insertData","replace","test","slice","includes","parts","split","forEach","line","i","hintPosition","search","diffPosition","scheduleFlush","_EDITOR_TO_PENDING_DI4","hasPendingChanges","isFlushing","pathChanged","parentPathChanged","handleInput","handleKeyDown","_","handleDomMutations","mutations","some","mutation","isTrackedMutation","_EDITOR_TO_FORCE_REND","EDITOR_TO_FORCE_RENDER","useIsMounted","isMountedRef","useRef","useEffect","current","useIsomorphicLayoutEffect","CAN_USE_DOM","useLayoutEffect","useMutationObserver","node","callback","options","mutationObserver","useState","MutationObserver","takeRecords","observe","disconnect","MUTATION_OBSERVER_CONFIG","subtree","childList","characterData","useAndroidInputManager","IS_ANDROID","_objectWithoutProperties","_excluded","isMounted","inputManager","EDITOR_TO_SCHEDULE_FLUSH","String","props","isLast","parent","findPath","parentPath","isMarkPlaceholder","Boolean","MARK_PLACEHOLDER_SYMBOL","isVoid","React","createElement","ZeroWidthString","string","children","isInline","isLineBreak","TextString","isTrailing","ref","getTextContent","concat","initialText","textWithTrailing","textContent","MemoizedText","memo","forwardRef","attributes","IS_IOS","PLACEHOLDER_DELAY","disconnectPlaceholderResizeObserver","placeholderResizeObserver","releaseObserver","clearTimeoutRef","timeoutRef","Leaf","renderPlaceholder","renderLeaf","DefaultLeaf","placeholderRef","showPlaceholder","setShowPlaceholder","showPlaceholderTimeoutRef","callbackPlaceholderRef","useCallback","placeholderEl","_leaf$onPlaceholderRe","onPlaceholderResize","call","ResizeObserver","ResizeObserverPolyfill","_leaf$onPlaceholderRe2","leafIsPlaceholder","PLACEHOLDER_SYMBOL","placeholderProps","placeholder","position","top","pointerEvents","width","maxWidth","opacity","userSelect","textDecoration","WebkitUserModify","IS_WEBKIT","contentEditable","Fragment","MemoizedLeaf","prev","decorations","leaves","SlateText","key","findKey","callbackRef","span","KEY_TO_ELEMENT","EDITOR_TO_KEY_TO_ELEMENT","NODE_TO_ELEMENT","ELEMENT_TO_NODE","isTextDecorationsEqual","Element","element","renderElement","p","DefaultElement","readOnly","useReadOnly","useChildren","hasInlines","dir","getDirection","Tag","texts","height","color","outline","NODE_TO_INDEX","NODE_TO_PARENT","MemoizedElement","isElementDecorationsEqual","DecorateContext","useDecorate","SelectedContext","useSelected","decorate","isLeafBlock","isElement","n","sel","intersection","ds","dec","d","Provider","ElementComponent","TextComponent","ReadOnlyContext","SlateContext","useSlate","context","useSlateWithV","useTrackUserInput","receivedUserInput","animationFrameIdRef","onUserInput","cancelAnimationFrame","requestAnimationFrame","createRestoreDomManager","bufferedMutations","clear","registerMutations","trackedMutations","restoreDOM","reverse","removedNodes","insertBefore","nextSibling","addedNodes","removeChild","characterDataOldValue","RestoreDOMComponent","Component","_defineProperty","_this$mutationObserve","componentDidMount","manager","getSnapshotBeforeUpdate","_this$mutationObserve2","_this$mutationObserve3","_this$manager2","pendingMutations","_this$manager","componentDidUpdate","_this$manager3","componentWillUnmount","_this$mutationObserve4","render","RestoreDOM","ComposingContext","useComposing","Children","Editable","forwardedRef","defaultRenderPlaceholder","DefaultPlaceholder","autoFocus","defaultDecorate","onDOMBeforeInput","propsOnDOMBeforeInput","scrollSelectionIntoView","defaultScrollSelectionIntoView","userStyle","as","disableDefaultStyles","isComposing","setIsComposing","deferredOperations","placeholderHeight","setPlaceholderHeight","processing","forceRender","useReducer","s","IS_READ_ONLY","state","useMemo","isDraggingInternally","isUpdatingSelection","latestElement","hasMarkPlaceholder","androidInputManagerRef","throttle","el","toDOMNode","root","getRootNode","ShadowRoot","active","getActiveElement","document","execCommand","deselect","androidInputManager","findDocumentOrShadowRoot","activeElement","IS_FOCUSED","anchorNode","focusNode","anchorNodeSelectable","hasEditableTarget","isTargetInsideNonReadonlyVoid","focusNodeInEditor","hasTarget","debounce","_androidInputManagerR","_androidInputManagerR2","getDefaultView","EDITOR_TO_WINDOW","EDITOR_TO_ELEMENT","isFocused","setDomSelection","forceChange","hasDomSelection","IS_FIREFOX","rangeCount","firstRange","getRangeAt","lastRange","startContainer","endContainer","editorElement","hasDomSelectionInEditor","contains","slateRange","_anchorNode","parentElement","hasAttribute","hasRange","newDomRange","toDOMRange","e","collapseToEnd","isBackward","setBaseAndExtent","endOffset","startOffset","removeAllRanges","ensureSelection","timeoutId","animationFrameId","ensureDomSelection","ranges","newRange","setStart","setEnd","preventDefault","stopImmediatePropagation","isDOMEventHandled","_EDITOR_TO_USER_SELEC","isCompositionChange","native","_node$parentElement","_window$getComputedSt","toDOMPoint","closest","hasDOMNode","_lastText$textContent","lastText","createTreeWalker","NodeFilter","SHOW_TEXT","lastChild","getComputedStyle","whiteSpace","block","above","isBlock","EDITOR_TO_USER_SELECTION","toRestore","HAS_BEFORE_INPUT_SUPPORT","removeEventListener","addEventListener","stoppedDragging","Array","from","placeHolderResizeHandler","_placeholderEl$getBou","getBoundingClientRect","rest","_excluded2","loose","unset","Object","fromEntries","keys","map","mark","role","spellCheck","autoCorrect","autoCapitalize","zindex","suppressContentEditableWarning","wordWrap","minHeight","onBeforeInput","isEventHandled","hasSelectableTarget","onInput","op","nativeEvent","maybeHistoryEditor","undo","redo","onBlur","relatedTarget","isDOMElement","isDOMNode","toSlateNode","onClick","hasPath","detail","TRIPLE_CLICK","blockPath","_block$","startVoid","void","endVoid","onCompositionEnd","_androidInputManagerR3","Promise","resolve","then","IS_FIREFOX_LEGACY","IS_WECHATBROWSER","IS_UC_MOBILE","placeholderMarks","onCompositionUpdate","onCompositionStart","_androidInputManagerR4","onCopy","isDOMEventTargetInput","setFragmentData","clipboardData","onCut","onDragOver","onDragStart","voidMatch","voids","onDrop","draggedRange","findEventRange","onDragEnd","onFocus","onKeyDown","_androidInputManagerR5","isRTL","Hotkeys","isRedo","isUndo","isMoveLineBackward","move","isMoveLineForward","isExtendLineBackward","edge","isExtendLineForward","isMoveBackward","collapse","isMoveForward","isMoveWordBackward","isMoveWordForward","isBold","isItalic","isTransposeCharacter","isSoftBreak","isSplitBlock","isDeleteBackward","isDeleteForward","isDeleteLineBackward","isDeleteLineForward","isDeleteWordBackward","isDeleteWordForward","IS_CHROME","currentNode","onPaste","isPlainTextOnlyPaste","domRange","leafEl","bind","scrollIntoView","scrollMode","handler","shouldTreatEventAsHandled","isDefaultPrevented","isPropagationStopped","HTMLInputElement","HTMLTextAreaElement","defaultPrevented","FocusedContext","useFocused","isError","error","SlateSelectorContext","refEquality","a","b","useSlateSelector","selector","equalityFn","getSlate","latestSubscriptionCallbackError","latestSelector","latestSelectedState","selectedState","err","message","stack","checkForUpdates","newSelectedState","unsubscribe","useSelectorContext","eventListeners","slateRef","listener","selectorContext","indexOf","REACT_MAJOR_VERSION","parseInt","version","Slate","onSelectionChange","onValueChange","initialValue","setContext","isNodeList","Scrubber","stringify","isEditor","assign","v","handleSelectorChange","onContextChange","_options$operation","operation","prevContext","EDITOR_TO_ON_CHANGE","setIsFocused","fn","useEditor","useSlateSelection","isSelectionEqual","withReact","clipboardFormatKey","withDOM","maybeBatchUpdates","ReactDOM","unstable_batchedUpdates"],"mappings":";;;;;;;;;;;AAAe,SAAS,6BAA6B,CAAC,MAAM,EAAE,QAAQ,EAAE;AACxE,EAAE,IAAI,MAAM,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;AAChC,EAAE,IAAI,MAAM,GAAG,EAAE,CAAC;AAClB,EAAE,IAAI,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACvC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AACb,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC1C,IAAI,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACxB,IAAI,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS;AAC7C,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAC9B,GAAG;AACH,EAAE,OAAO,MAAM,CAAC;AAChB;;ACVe,SAAS,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAAE;AACnE,EAAE,IAAI,MAAM,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;AAChC,EAAE,IAAI,MAAM,GAAGA,6BAA4B,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC9D,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AACb,EAAE,IAAI,MAAM,CAAC,qBAAqB,EAAE;AACpC,IAAI,IAAI,gBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAChE,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,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;AAAU,GAAA,GAAG6X,CAAC,CAAA;AAEtBA,EAAAA,CAAC,CAAC7X,QAAQ,GAAGwH,OAAO,IAAG;AACrB;AACA;AACA;AACA;AACA;AACA,IAAA,IAAM2d,iBAAiB,GACrB5B,mBAAmB,GAAG,EAAE,GACpB6B,QAAQ,CAACC,uBAAuB,GAC/B9d,QAAoB,IAAKA,QAAQ,EAAE,CAAA;AAE1C4d,IAAAA,iBAAiB,CAAC,MAAK;MACrBnlB,QAAQ,CAACwH,OAAO,CAAC,CAAA;AACnB,KAAC,CAAC,CAAA;GACH,CAAA;AAED,EAAA,OAAOqQ,CAAC,CAAA;AACV;;;;","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"index.es.js","sources":["../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/typeof.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../../../../../.yarn/berry/cache/@babel-runtime-npm-7.23.2-d013d6cf7e-10.zip/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../src/hooks/use-slate-static.tsx","../src/plugin/react-editor.ts","../src/hooks/android-input-manager/android-input-manager.ts","../src/hooks/use-is-mounted.tsx","../src/hooks/use-isomorphic-layout-effect.ts","../src/hooks/use-mutation-observer.ts","../src/hooks/android-input-manager/use-android-input-manager.ts","../src/components/string.tsx","../src/components/leaf.tsx","../src/components/text.tsx","../src/components/element.tsx","../src/hooks/use-decorate.ts","../src/hooks/use-selected.ts","../src/hooks/use-children.tsx","../src/hooks/use-read-only.ts","../src/hooks/use-slate.tsx","../src/hooks/use-track-user-input.ts","../src/components/restore-dom/restore-dom-manager.ts","../src/components/restore-dom/restore-dom.tsx","../src/hooks/use-composing.ts","../src/components/editable.tsx","../src/hooks/use-focused.ts","../src/hooks/use-slate-selector.tsx","../src/utils/environment.ts","../src/components/slate.tsx","../src/hooks/use-editor.tsx","../src/hooks/use-slate-selection.tsx","../src/plugin/with-react.ts"],"sourcesContent":["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 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 return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\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 return target;\n}","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\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 return obj;\n}","import { createContext, useContext } from 'react'\nimport { Editor } from 'slate'\nimport { ReactEditor } from '../plugin/react-editor'\n\n/**\n * A React context for sharing the editor object.\n */\n\nexport const EditorContext = createContext<ReactEditor | null>(null)\n\n/**\n * Get the current editor object from the React context.\n */\n\nexport const useSlateStatic = (): Editor => {\n const editor = useContext(EditorContext)\n\n if (!editor) {\n throw new Error(\n `The \\`useSlateStatic\\` hook must be used inside the <Slate> component's context.`\n )\n }\n\n return editor\n}\n","import { DOMEditor, type DOMEditorInterface } from 'slate-dom'\n\n/**\n * A React and DOM-specific version of the `Editor` interface.\n */\n\nexport interface ReactEditor extends DOMEditor {}\n\nexport interface ReactEditorInterface extends DOMEditorInterface {}\n\n// eslint-disable-next-line no-redeclare\nexport const ReactEditor: ReactEditorInterface = DOMEditor\n","import { DebouncedFunc } from 'lodash'\nimport { Editor, Node, Path, Point, Range, Text, Transforms } from 'slate'\nimport { ReactEditor } from '../../plugin/react-editor'\nimport {\n applyStringDiff,\n mergeStringDiffs,\n normalizePoint,\n normalizeRange,\n normalizeStringDiff,\n StringDiff,\n targetRange,\n TextDiff,\n verifyDiffState,\n} from 'slate-dom'\nimport { isDOMSelection, isTrackedMutation } from 'slate-dom'\nimport {\n EDITOR_TO_FORCE_RENDER,\n EDITOR_TO_PENDING_ACTION,\n EDITOR_TO_PENDING_DIFFS,\n EDITOR_TO_PENDING_INSERTION_MARKS,\n EDITOR_TO_PENDING_SELECTION,\n EDITOR_TO_PLACEHOLDER_ELEMENT,\n EDITOR_TO_USER_MARKS,\n IS_COMPOSING,\n IS_NODE_MAP_DIRTY,\n} from 'slate-dom'\n\nexport type Action = { at?: Point | Range; run: () => void }\n\n// https://github.com/facebook/draft-js/blob/main/src/component/handlers/composition/DraftEditorCompositionHandler.js#L41\n// When using keyboard English association function, conpositionEnd triggered too fast, resulting in after `insertText` still maintain association state.\nconst RESOLVE_DELAY = 25\n\n// Time with no user interaction before the current user action is considered as done.\nconst FLUSH_DELAY = 200\n\n// Replace with `const debug = console.log` to debug\nconst debug = (..._: unknown[]) => {}\n\n// Type guard to check if a value is a DataTransfer\nconst isDataTransfer = (value: any): value is DataTransfer =>\n value?.constructor.name === 'DataTransfer'\n\nexport type CreateAndroidInputManagerOptions = {\n editor: ReactEditor\n\n scheduleOnDOMSelectionChange: DebouncedFunc<() => void>\n onDOMSelectionChange: DebouncedFunc<() => void>\n}\n\nexport type AndroidInputManager = {\n flush: () => void\n scheduleFlush: () => void\n\n hasPendingDiffs: () => boolean\n hasPendingAction: () => boolean\n hasPendingChanges: () => boolean\n isFlushing: () => boolean | 'action'\n\n handleUserSelect: (range: Range | null) => void\n handleCompositionEnd: (event: React.CompositionEvent<HTMLDivElement>) => void\n handleCompositionStart: (\n event: React.CompositionEvent<HTMLDivElement>\n ) => void\n handleDOMBeforeInput: (event: InputEvent) => void\n handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void\n\n handleDomMutations: (mutations: MutationRecord[]) => void\n handleInput: () => void\n}\n\nexport function createAndroidInputManager({\n editor,\n scheduleOnDOMSelectionChange,\n onDOMSelectionChange,\n}: CreateAndroidInputManagerOptions): AndroidInputManager {\n let flushing: 'action' | boolean = false\n let compositionEndTimeoutId: ReturnType<typeof setTimeout> | null = null\n let flushTimeoutId: ReturnType<typeof setTimeout> | null = null\n let actionTimeoutId: ReturnType<typeof setTimeout> | null = null\n\n let idCounter = 0\n let insertPositionHint: StringDiff | null | false = false\n\n const applyPendingSelection = () => {\n const pendingSelection = EDITOR_TO_PENDING_SELECTION.get(editor)\n EDITOR_TO_PENDING_SELECTION.delete(editor)\n\n if (pendingSelection) {\n const { selection } = editor\n const normalized = normalizeRange(editor, pendingSelection)\n\n debug('apply pending selection', pendingSelection, normalized)\n\n if (normalized && (!selection || !Range.equals(normalized, selection))) {\n Transforms.select(editor, normalized)\n }\n }\n }\n\n const performAction = () => {\n const action = EDITOR_TO_PENDING_ACTION.get(editor)\n EDITOR_TO_PENDING_ACTION.delete(editor)\n if (!action) {\n return\n }\n\n if (action.at) {\n const target = Point.isPoint(action.at)\n ? normalizePoint(editor, action.at)\n : normalizeRange(editor, action.at)\n\n if (!target) {\n return\n }\n\n const targetRange = Editor.range(editor, target)\n if (!editor.selection || !Range.equals(editor.selection, targetRange)) {\n Transforms.select(editor, target)\n }\n }\n\n action.run()\n }\n\n const flush = () => {\n if (flushTimeoutId) {\n clearTimeout(flushTimeoutId)\n flushTimeoutId = null\n }\n\n if (actionTimeoutId) {\n clearTimeout(actionTimeoutId)\n actionTimeoutId = null\n }\n\n if (!hasPendingDiffs() && !hasPendingAction()) {\n applyPendingSelection()\n return\n }\n\n if (!flushing) {\n flushing = true\n setTimeout(() => (flushing = false))\n }\n\n if (hasPendingAction()) {\n flushing = 'action'\n }\n\n const selectionRef =\n editor.selection &&\n Editor.rangeRef(editor, editor.selection, { affinity: 'forward' })\n EDITOR_TO_USER_MARKS.set(editor, editor.marks)\n\n debug(\n 'flush',\n EDITOR_TO_PENDING_ACTION.get(editor),\n EDITOR_TO_PENDING_DIFFS.get(editor)\n )\n\n let scheduleSelectionChange = hasPendingDiffs()\n\n let diff: TextDiff | undefined\n while ((diff = EDITOR_TO_PENDING_DIFFS.get(editor)?.[0])) {\n const pendingMarks = EDITOR_TO_PENDING_INSERTION_MARKS.get(editor)\n\n if (pendingMarks !== undefined) {\n EDITOR_TO_PENDING_INSERTION_MARKS.delete(editor)\n editor.marks = pendingMarks\n }\n\n if (pendingMarks && insertPositionHint === false) {\n insertPositionHint = null\n debug('insert after mark placeholder')\n }\n\n const range = targetRange(diff)\n if (!editor.selection || !Range.equals(editor.selection, range)) {\n Transforms.select(editor, range)\n }\n\n if (diff.diff.text) {\n Editor.insertText(editor, diff.diff.text)\n } else {\n Editor.deleteFragment(editor)\n }\n\n // Remove diff only after we have applied it to account for it when transforming\n // pending ranges.\n EDITOR_TO_PENDING_DIFFS.set(\n editor,\n EDITOR_TO_PENDING_DIFFS.get(editor)?.filter(\n ({ id }) => id !== diff!.id\n )!\n )\n\n if (!verifyDiffState(editor, diff)) {\n debug('invalid diff state')\n scheduleSelectionChange = false\n EDITOR_TO_PENDING_ACTION.delete(editor)\n EDITOR_TO_USER_MARKS.delete(editor)\n flushing = 'action'\n\n // Ensure we don't restore the pending user (dom) selection\n // since the document and dom state do not match.\n EDITOR_TO_PENDING_SELECTION.delete(editor)\n scheduleOnDOMSelectionChange.cancel()\n onDOMSelectionChange.cancel()\n selectionRef?.unref()\n }\n }\n\n const selection = selectionRef?.unref()\n if (\n selection &&\n !EDITOR_TO_PENDING_SELECTION.get(editor) &&\n (!editor.selection || !Range.equals(selection, editor.selection))\n ) {\n Transforms.select(editor, selection)\n }\n\n if (hasPendingAction()) {\n performAction()\n return\n }\n\n // COMPAT: The selectionChange event is fired after the action is performed,\n // so we have to manually schedule it to ensure we don't 'throw away' the selection\n // while rendering if we have pending changes.\n if (scheduleSelectionChange) {\n debug('scheduleOnDOMSelectionChange pending changes')\n scheduleOnDOMSelectionChange()\n }\n\n scheduleOnDOMSelectionChange.flush()\n onDOMSelectionChange.flush()\n\n applyPendingSelection()\n\n const userMarks = EDITOR_TO_USER_MARKS.get(editor)\n EDITOR_TO_USER_MARKS.delete(editor)\n if (userMarks !== undefined) {\n editor.marks = userMarks\n editor.onChange()\n }\n }\n\n const handleCompositionEnd = (\n _event: React.CompositionEvent<HTMLDivElement>\n ) => {\n if (compositionEndTimeoutId) {\n clearTimeout(compositionEndTimeoutId)\n }\n\n compositionEndTimeoutId = setTimeout(() => {\n IS_COMPOSING.set(editor, false)\n flush()\n }, RESOLVE_DELAY)\n }\n\n const handleCompositionStart = (\n _event: React.CompositionEvent<HTMLDivElement>\n ) => {\n debug('composition start')\n\n IS_COMPOSING.set(editor, true)\n\n if (compositionEndTimeoutId) {\n clearTimeout(compositionEndTimeoutId)\n compositionEndTimeoutId = null\n }\n }\n\n const updatePlaceholderVisibility = (forceHide = false) => {\n const placeholderElement = EDITOR_TO_PLACEHOLDER_ELEMENT.get(editor)\n if (!placeholderElement) {\n return\n }\n\n if (hasPendingDiffs() || forceHide) {\n placeholderElement.style.display = 'none'\n return\n }\n\n placeholderElement.style.removeProperty('display')\n }\n\n const storeDiff = (path: Path, diff: StringDiff) => {\n debug('storeDiff', path, diff)\n\n const pendingDiffs = EDITOR_TO_PENDING_DIFFS.get(editor) ?? []\n EDITOR_TO_PENDING_DIFFS.set(editor, pendingDiffs)\n\n const target = Node.leaf(editor, path)\n const idx = pendingDiffs.findIndex(change => Path.equals(change.path, path))\n if (idx < 0) {\n const normalized = normalizeStringDiff(target.text, diff)\n if (normalized) {\n pendingDiffs.push({ path, diff, id: idCounter++ })\n }\n\n updatePlaceholderVisibility()\n return\n }\n\n const merged = mergeStringDiffs(target.text, pendingDiffs[idx].diff, diff)\n if (!merged) {\n pendingDiffs.splice(idx, 1)\n updatePlaceholderVisibility()\n return\n }\n\n pendingDiffs[idx] = {\n ...pendingDiffs[idx],\n diff: merged,\n }\n }\n\n const scheduleAction = (\n run: () => void,\n { at }: { at?: Point | Range } = {}\n ): void => {\n insertPositionHint = false\n debug('scheduleAction', { at, run })\n\n EDITOR_TO_PENDING_SELECTION.delete(editor)\n scheduleOnDOMSelectionChange.cancel()\n onDOMSelectionChange.cancel()\n\n if (hasPendingAction()) {\n flush()\n }\n\n EDITOR_TO_PENDING_ACTION.set(editor, { at, run })\n\n // COMPAT: When deleting before a non-contenteditable element chrome only fires a beforeinput,\n // (no input) and doesn't perform any dom mutations. Without a flush timeout we would never flush\n // in this case and thus never actually perform the action.\n actionTimeoutId = setTimeout(flush)\n }\n\n const handleDOMBeforeInput = (event: InputEvent): void => {\n if (flushTimeoutId) {\n clearTimeout(flushTimeoutId)\n flushTimeoutId = null\n }\n\n if (IS_NODE_MAP_DIRTY.get(editor)) {\n return\n }\n\n const { inputType: type } = event\n let targetRange: Range | null = null\n const data: DataTransfer | string | undefined =\n (event as any).dataTransfer || event.data || undefined\n\n if (\n insertPositionHint !== false &&\n type !== 'insertText' &&\n type !== 'insertCompositionText'\n ) {\n insertPositionHint = false\n }\n\n let [nativeTargetRange] = (event as any).getTargetRanges()\n if (nativeTargetRange) {\n targetRange = ReactEditor.toSlateRange(editor, nativeTargetRange, {\n exactMatch: false,\n suppressThrow: true,\n })\n }\n\n // COMPAT: SelectionChange event is fired after the action is performed, so we\n // have to manually get the selection here to ensure it's up-to-date.\n const window = ReactEditor.getWindow(editor)\n const domSelection = window.getSelection()\n if (!targetRange && domSelection) {\n nativeTargetRange = domSelection\n targetRange = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: true,\n })\n }\n\n targetRange = targetRange ?? editor.selection\n if (!targetRange) {\n return\n }\n\n // By default, the input manager tries to store text diffs so that we can\n // defer flushing them at a later point in time. We don't want to flush\n // for every input event as this can be expensive. However, there are some\n // scenarios where we cannot safely store the text diff and must instead\n // schedule an action to let Slate normalize the editor state.\n let canStoreDiff = true\n\n if (type.startsWith('delete')) {\n if (Range.isExpanded(targetRange)) {\n const [start, end] = Range.edges(targetRange)\n const leaf = Node.leaf(editor, start.path)\n\n if (leaf.text.length === start.offset && end.offset === 0) {\n const next = Editor.next(editor, {\n at: start.path,\n match: Text.isText,\n })\n if (next && Path.equals(next[1], end.path)) {\n targetRange = { anchor: end, focus: end }\n }\n }\n }\n\n const direction = type.endsWith('Backward') ? 'backward' : 'forward'\n const [start, end] = Range.edges(targetRange)\n const [leaf, path] = Editor.leaf(editor, start.path)\n\n const diff = {\n text: '',\n start: start.offset,\n end: end.offset,\n }\n const pendingDiffs = EDITOR_TO_PENDING_DIFFS.get(editor)\n const relevantPendingDiffs = pendingDiffs?.find(change =>\n Path.equals(change.path, path)\n )\n const diffs = relevantPendingDiffs\n ? [relevantPendingDiffs.diff, diff]\n : [diff]\n const text = applyStringDiff(leaf.text, ...diffs)\n\n if (text.length === 0) {\n // Text leaf will be removed, so we need to schedule an\n // action to remove it so that Slate can normalize instead\n // of storing as a diff\n canStoreDiff = false\n }\n\n if (Range.isExpanded(targetRange)) {\n if (\n canStoreDiff &&\n Path.equals(targetRange.anchor.path, targetRange.focus.path)\n ) {\n const point = { path: targetRange.anchor.path, offset: start.offset }\n const range = Editor.range(editor, point, point)\n handleUserSelect(range)\n\n return storeDiff(targetRange.anchor.path, {\n text: '',\n end: end.offset,\n start: start.offset,\n })\n }\n\n return scheduleAction(\n () => Editor.deleteFragment(editor, { direction }),\n { at: targetRange }\n )\n }\n }\n\n switch (type) {\n case 'deleteByComposition':\n case 'deleteByCut':\n case 'deleteByDrag': {\n return scheduleAction(() => Editor.deleteFragment(editor), {\n at: targetRange,\n })\n }\n\n case 'deleteContent':\n case 'deleteContentForward': {\n const { anchor } = targetRange\n if (canStoreDiff && Range.isCollapsed(targetRange)) {\n const targetNode = Node.leaf(editor, anchor.path)\n\n if (anchor.offset < targetNode.text.length) {\n return storeDiff(anchor.path, {\n text: '',\n start: anchor.offset,\n end: anchor.offset + 1,\n })\n }\n }\n\n return scheduleAction(() => Editor.deleteForward(editor), {\n at: targetRange,\n })\n }\n\n case 'deleteContentBackward': {\n const { anchor } = targetRange\n\n // If we have a mismatch between the native and slate selection being collapsed\n // we are most likely deleting a zero-width placeholder and thus should perform it\n // as an action to ensure correct behavior (mostly happens with mark placeholders)\n const nativeCollapsed = isDOMSelection(nativeTargetRange)\n ? nativeTargetRange.isCollapsed\n : !!nativeTargetRange?.collapsed\n\n if (\n canStoreDiff &&\n nativeCollapsed &&\n Range.isCollapsed(targetRange) &&\n anchor.offset > 0\n ) {\n return storeDiff(anchor.path, {\n text: '',\n start: anchor.offset - 1,\n end: anchor.offset,\n })\n }\n\n return scheduleAction(() => Editor.deleteBackward(editor), {\n at: targetRange,\n })\n }\n\n case 'deleteEntireSoftLine': {\n return scheduleAction(\n () => {\n Editor.deleteBackward(editor, { unit: 'line' })\n Editor.deleteForward(editor, { unit: 'line' })\n },\n { at: targetRange }\n )\n }\n\n case 'deleteHardLineBackward': {\n return scheduleAction(\n () => Editor.deleteBackward(editor, { unit: 'block' }),\n { at: targetRange }\n )\n }\n\n case 'deleteSoftLineBackward': {\n return scheduleAction(\n () => Editor.deleteBackward(editor, { unit: 'line' }),\n { at: targetRange }\n )\n }\n\n case 'deleteHardLineForward': {\n return scheduleAction(\n () => Editor.deleteForward(editor, { unit: 'block' }),\n { at: targetRange }\n )\n }\n\n case 'deleteSoftLineForward': {\n return scheduleAction(\n () => Editor.deleteForward(editor, { unit: 'line' }),\n { at: targetRange }\n )\n }\n\n case 'deleteWordBackward': {\n return scheduleAction(\n () => Editor.deleteBackward(editor, { unit: 'word' }),\n { at: targetRange }\n )\n }\n\n case 'deleteWordForward': {\n return scheduleAction(\n () => Editor.deleteForward(editor, { unit: 'word' }),\n { at: targetRange }\n )\n }\n\n case 'insertLineBreak': {\n return scheduleAction(() => Editor.insertSoftBreak(editor), {\n at: targetRange,\n })\n }\n\n case 'insertParagraph': {\n return scheduleAction(() => Editor.insertBreak(editor), {\n at: targetRange,\n })\n }\n case 'insertCompositionText':\n case 'deleteCompositionText':\n case 'insertFromComposition':\n case 'insertFromDrop':\n case 'insertFromPaste':\n case 'insertFromYank':\n case 'insertReplacementText':\n case 'insertText': {\n if (isDataTransfer(data)) {\n return scheduleAction(() => ReactEditor.insertData(editor, data), {\n at: targetRange,\n })\n }\n\n let text = data ?? ''\n\n // COMPAT: If we are writing inside a placeholder, the ime inserts the text inside\n // the placeholder itself and thus includes the zero-width space inside edit events.\n if (EDITOR_TO_PENDING_INSERTION_MARKS.get(editor)) {\n text = text.replace('\\uFEFF', '')\n }\n\n // Pastes from the Android clipboard will generate `insertText` events.\n // If the copied text contains any newlines, Android will append an\n // extra newline to the end of the copied text.\n if (type === 'insertText' && /.*\\n.*\\n$/.test(text)) {\n text = text.slice(0, -1)\n }\n\n // If the text includes a newline, split it at newlines and paste each component\n // string, with soft breaks in between each.\n if (text.includes('\\n')) {\n return scheduleAction(\n () => {\n const parts = text.split('\\n')\n parts.forEach((line, i) => {\n if (line) {\n Editor.insertText(editor, line)\n }\n if (i !== parts.length - 1) {\n Editor.insertSoftBreak(editor)\n }\n })\n },\n {\n at: targetRange,\n }\n )\n }\n\n if (Path.equals(targetRange.anchor.path, targetRange.focus.path)) {\n const [start, end] = Range.edges(targetRange)\n\n const diff = {\n start: start.offset,\n end: end.offset,\n text,\n }\n\n // COMPAT: Swiftkey has a weird bug where the target range of the 2nd word\n // inserted after a mark placeholder is inserted with an anchor offset off by 1.\n // So writing 'some text' will result in 'some ttext'. Luckily all 'normal' insert\n // text events are fired with the correct target ranges, only the final 'insertComposition'\n // isn't, so we can adjust the target range start offset if we are confident this is the\n // swiftkey insert causing the issue.\n if (text && insertPositionHint && type === 'insertCompositionText') {\n const hintPosition =\n insertPositionHint.start + insertPositionHint.text.search(/\\S|$/)\n const diffPosition = diff.start + diff.text.search(/\\S|$/)\n\n if (\n diffPosition === hintPosition + 1 &&\n diff.end ===\n insertPositionHint.start + insertPositionHint.text.length\n ) {\n debug('adjusting swiftKey insert position using hint')\n diff.start -= 1\n insertPositionHint = null\n scheduleFlush()\n } else {\n insertPositionHint = false\n }\n } else if (type === 'insertText') {\n if (insertPositionHint === null) {\n insertPositionHint = diff\n } else if (\n insertPositionHint &&\n Range.isCollapsed(targetRange) &&\n insertPositionHint.end + insertPositionHint.text.length ===\n start.offset\n ) {\n insertPositionHint = {\n ...insertPositionHint,\n text: insertPositionHint.text + text,\n }\n } else {\n insertPositionHint = false\n }\n } else {\n insertPositionHint = false\n }\n\n if (canStoreDiff) {\n storeDiff(start.path, diff)\n return\n }\n }\n\n return scheduleAction(() => Editor.insertText(editor, text), {\n at: targetRange,\n })\n }\n }\n }\n\n const hasPendingAction = () => {\n return !!EDITOR_TO_PENDING_ACTION.get(editor)\n }\n\n const hasPendingDiffs = () => {\n return !!EDITOR_TO_PENDING_DIFFS.get(editor)?.length\n }\n\n const hasPendingChanges = () => {\n return hasPendingAction() || hasPendingDiffs()\n }\n\n const isFlushing = () => {\n return flushing\n }\n\n const handleUserSelect = (range: Range | null) => {\n EDITOR_TO_PENDING_SELECTION.set(editor, range)\n\n if (flushTimeoutId) {\n clearTimeout(flushTimeoutId)\n flushTimeoutId = null\n }\n\n const { selection } = editor\n if (!range) {\n return\n }\n\n const pathChanged =\n !selection || !Path.equals(selection.anchor.path, range.anchor.path)\n const parentPathChanged =\n !selection ||\n !Path.equals(\n selection.anchor.path.slice(0, -1),\n range.anchor.path.slice(0, -1)\n )\n\n if ((pathChanged && insertPositionHint) || parentPathChanged) {\n insertPositionHint = false\n }\n\n if (pathChanged || hasPendingDiffs()) {\n flushTimeoutId = setTimeout(flush, FLUSH_DELAY)\n }\n }\n\n const handleInput = () => {\n if (hasPendingAction() || !hasPendingDiffs()) {\n debug('flush input')\n flush()\n }\n }\n\n const handleKeyDown = (_: React.KeyboardEvent) => {\n // COMPAT: Swiftkey closes the keyboard when typing inside a empty node\n // directly next to a non-contenteditable element (= the placeholder).\n // The only event fired soon enough for us to allow hiding the placeholder\n // without swiftkey picking it up is the keydown event, so we have to hide it\n // here. See https://github.com/ianstormtaylor/slate/pull/4988#issuecomment-1201050535\n if (!hasPendingDiffs()) {\n updatePlaceholderVisibility(true)\n setTimeout(updatePlaceholderVisibility)\n }\n }\n\n const scheduleFlush = () => {\n if (!hasPendingAction()) {\n actionTimeoutId = setTimeout(flush)\n }\n }\n\n const handleDomMutations = (mutations: MutationRecord[]) => {\n if (hasPendingDiffs() || hasPendingAction()) {\n return\n }\n\n if (\n mutations.some(mutation => isTrackedMutation(editor, mutation, mutations))\n ) {\n // Cause a re-render to restore the dom state if we encounter tracked mutations without\n // a corresponding pending action.\n EDITOR_TO_FORCE_RENDER.get(editor)?.()\n }\n }\n\n return {\n flush,\n scheduleFlush,\n\n hasPendingDiffs,\n hasPendingAction,\n hasPendingChanges,\n\n isFlushing,\n\n handleUserSelect,\n handleCompositionEnd,\n handleCompositionStart,\n handleDOMBeforeInput,\n handleKeyDown,\n\n handleDomMutations,\n handleInput,\n }\n}\n","import { useEffect, useRef } from 'react'\n\nexport function useIsMounted() {\n const isMountedRef = useRef(false)\n\n useEffect(() => {\n isMountedRef.current = true\n return () => {\n isMountedRef.current = false\n }\n }, [])\n\n return isMountedRef.current\n}\n","import { useLayoutEffect, useEffect } from 'react'\nimport { CAN_USE_DOM } from 'slate-dom'\n\n/**\n * Prevent warning on SSR by falling back to useEffect when DOM isn't available\n */\n\nexport const useIsomorphicLayoutEffect = CAN_USE_DOM\n ? useLayoutEffect\n : useEffect\n","import { RefObject, useEffect, useState } from 'react'\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect'\n\nexport function useMutationObserver(\n node: RefObject<HTMLElement>,\n callback: MutationCallback,\n options: MutationObserverInit\n) {\n const [mutationObserver] = useState(() => new MutationObserver(callback))\n\n useIsomorphicLayoutEffect(() => {\n // Discard mutations caused during render phase. This works due to react calling\n // useLayoutEffect synchronously after the render phase before the next tick.\n mutationObserver.takeRecords()\n })\n\n useEffect(() => {\n if (!node.current) {\n throw new Error('Failed to attach MutationObserver, `node` is undefined')\n }\n\n mutationObserver.observe(node.current, options)\n return () => mutationObserver.disconnect()\n }, [mutationObserver, node, options])\n}\n","import { RefObject, useState } from 'react'\nimport { useSlateStatic } from '../use-slate-static'\nimport { IS_ANDROID } from 'slate-dom'\nimport { EDITOR_TO_SCHEDULE_FLUSH } from 'slate-dom'\nimport {\n createAndroidInputManager,\n CreateAndroidInputManagerOptions,\n} from './android-input-manager'\nimport { useIsMounted } from '../use-is-mounted'\nimport { useMutationObserver } from '../use-mutation-observer'\n\ntype UseAndroidInputManagerOptions = {\n node: RefObject<HTMLElement>\n} & Omit<\n CreateAndroidInputManagerOptions,\n 'editor' | 'onUserInput' | 'receivedUserInput'\n>\n\nconst MUTATION_OBSERVER_CONFIG: MutationObserverInit = {\n subtree: true,\n childList: true,\n characterData: true,\n}\n\nexport const useAndroidInputManager = !IS_ANDROID\n ? () => null\n : ({ node, ...options }: UseAndroidInputManagerOptions) => {\n if (!IS_ANDROID) {\n return null\n }\n\n const editor = useSlateStatic()\n const isMounted = useIsMounted()\n\n const [inputManager] = useState(() =>\n createAndroidInputManager({\n editor,\n ...options,\n })\n )\n\n useMutationObserver(\n node,\n inputManager.handleDomMutations,\n MUTATION_OBSERVER_CONFIG\n )\n\n EDITOR_TO_SCHEDULE_FLUSH.set(editor, inputManager.scheduleFlush)\n if (isMounted) {\n inputManager.flush()\n }\n\n return inputManager\n }\n","import React, { forwardRef, memo, useRef, useState } from 'react'\nimport { Editor, Text, Path, Element, Node } from 'slate'\n\nimport { ReactEditor, useSlateStatic } from '..'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { IS_ANDROID, IS_IOS } from 'slate-dom'\nimport { MARK_PLACEHOLDER_SYMBOL } from 'slate-dom'\n\n/**\n * Leaf content strings.\n */\n\nconst String = (props: {\n isLast: boolean\n leaf: Text\n parent: Element\n text: Text\n}) => {\n const { isLast, leaf, parent, text } = props\n const editor = useSlateStatic()\n const path = ReactEditor.findPath(editor, text)\n const parentPath = Path.parent(path)\n const isMarkPlaceholder = Boolean(leaf[MARK_PLACEHOLDER_SYMBOL])\n\n // COMPAT: Render text inside void nodes with a zero-width space.\n // So the node can contain selection but the text is not visible.\n if (editor.isVoid(parent)) {\n return <ZeroWidthString length={Node.string(parent).length} />\n }\n\n // COMPAT: If this is the last text node in an empty block, render a zero-\n // width space that will convert into a line break when copying and pasting\n // to support expected plain text.\n if (\n leaf.text === '' &&\n parent.children[parent.children.length - 1] === text &&\n !editor.isInline(parent) &&\n Editor.string(editor, parentPath) === ''\n ) {\n return <ZeroWidthString isLineBreak isMarkPlaceholder={isMarkPlaceholder} />\n }\n\n // COMPAT: If the text is empty, it's because it's on the edge of an inline\n // node, so we render a zero-width space so that the selection can be\n // inserted next to it still.\n if (leaf.text === '') {\n return <ZeroWidthString isMarkPlaceholder={isMarkPlaceholder} />\n }\n\n // COMPAT: Browsers will collapse trailing new lines at the end of blocks,\n // so we need to add an extra trailing new lines to prevent that.\n if (isLast && leaf.text.slice(-1) === '\\n') {\n return <TextString isTrailing text={leaf.text} />\n }\n\n return <TextString text={leaf.text} />\n}\n\n/**\n * Leaf strings with text in them.\n */\nconst TextString = (props: { text: string; isTrailing?: boolean }) => {\n const { text, isTrailing = false } = props\n const ref = useRef<HTMLSpanElement>(null)\n const getTextContent = () => {\n return `${text ?? ''}${isTrailing ? '\\n' : ''}`\n }\n const [initialText] = useState(getTextContent)\n\n // This is the actual text rendering boundary where we interface with the DOM\n // The text is not rendered as part of the virtual DOM, as since we handle basic character insertions natively,\n // updating the DOM is not a one way dataflow anymore. What we need here is not reconciliation and diffing\n // with previous version of the virtual DOM, but rather diffing with the actual DOM element, and replace the DOM <span> content\n // exactly if and only if its current content does not match our current virtual DOM.\n // Otherwise the DOM TextNode would always be replaced by React as the user types, which interferes with native text features,\n // eg makes native spellcheck opt out from checking the text node.\n\n // useLayoutEffect: updating our span before browser paint\n useIsomorphicLayoutEffect(() => {\n // null coalescing text to make sure we're not outputing \"null\" as a string in the extreme case it is nullish at runtime\n const textWithTrailing = getTextContent()\n\n if (ref.current && ref.current.textContent !== textWithTrailing) {\n ref.current.textContent = textWithTrailing\n }\n\n // intentionally not specifying dependencies, so that this effect runs on every render\n // as this effectively replaces \"specifying the text in the virtual DOM under the <span> below\" on each render\n })\n\n // We intentionally render a memoized <span> that only receives the initial text content when the component is mounted.\n // We defer to the layout effect above to update the `textContent` of the span element when needed.\n return <MemoizedText ref={ref}>{initialText}</MemoizedText>\n}\n\nconst MemoizedText = memo(\n forwardRef<HTMLSpanElement, { children: string }>((props, ref) => {\n return (\n <span data-slate-string ref={ref}>\n {props.children}\n </span>\n )\n })\n)\n\n/**\n * Leaf strings without text, render as zero-width strings.\n */\n\nexport const ZeroWidthString = (props: {\n length?: number\n isLineBreak?: boolean\n isMarkPlaceholder?: boolean\n}) => {\n const { length = 0, isLineBreak = false, isMarkPlaceholder = false } = props\n\n const attributes: {\n 'data-slate-zero-width': string\n 'data-slate-length': number\n 'data-slate-mark-placeholder'?: boolean\n } = {\n 'data-slate-zero-width': isLineBreak ? 'n' : 'z',\n 'data-slate-length': length,\n }\n\n if (isMarkPlaceholder) {\n attributes['data-slate-mark-placeholder'] = true\n }\n\n return (\n <span {...attributes}>\n {!(IS_ANDROID || IS_IOS) || !isLineBreak ? '\\uFEFF' : null}\n {isLineBreak ? <br /> : null}\n </span>\n )\n}\n\nexport default String\n","import React, {\n useRef,\n useCallback,\n MutableRefObject,\n useState,\n useEffect,\n} from 'react'\nimport { JSX } from 'react'\nimport { Element, Text } from 'slate'\nimport { ResizeObserver as ResizeObserverPolyfill } from '@juggle/resize-observer'\nimport String from './string'\nimport {\n PLACEHOLDER_SYMBOL,\n EDITOR_TO_PLACEHOLDER_ELEMENT,\n EDITOR_TO_FORCE_RENDER,\n} from 'slate-dom'\nimport { RenderLeafProps, RenderPlaceholderProps } from './editable'\nimport { useSlateStatic } from '../hooks/use-slate-static'\nimport { IS_WEBKIT, IS_ANDROID } from 'slate-dom'\n\n// Delay the placeholder on Android to prevent the keyboard from closing.\n// (https://github.com/ianstormtaylor/slate/pull/5368)\nconst PLACEHOLDER_DELAY = IS_ANDROID ? 300 : 0\n\nfunction disconnectPlaceholderResizeObserver(\n placeholderResizeObserver: MutableRefObject<ResizeObserver | null>,\n releaseObserver: boolean\n) {\n if (placeholderResizeObserver.current) {\n placeholderResizeObserver.current.disconnect()\n if (releaseObserver) {\n placeholderResizeObserver.current = null\n }\n }\n}\n\ntype TimerId = ReturnType<typeof setTimeout> | null\n\nfunction clearTimeoutRef(timeoutRef: MutableRefObject<TimerId>) {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n timeoutRef.current = null\n }\n}\n\n/**\n * Individual leaves in a text node with unique formatting.\n */\nconst Leaf = (props: {\n isLast: boolean\n leaf: Text\n parent: Element\n renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n text: Text\n}) => {\n const {\n leaf,\n isLast,\n text,\n parent,\n renderPlaceholder,\n renderLeaf = (props: RenderLeafProps) => <DefaultLeaf {...props} />,\n } = props\n\n const editor = useSlateStatic()\n const placeholderResizeObserver = useRef<ResizeObserver | null>(null)\n const placeholderRef = useRef<HTMLElement | null>(null)\n const [showPlaceholder, setShowPlaceholder] = useState(false)\n const showPlaceholderTimeoutRef = useRef<TimerId>(null)\n\n const callbackPlaceholderRef = useCallback(\n (placeholderEl: HTMLElement | null) => {\n disconnectPlaceholderResizeObserver(\n placeholderResizeObserver,\n placeholderEl == null\n )\n\n if (placeholderEl == null) {\n EDITOR_TO_PLACEHOLDER_ELEMENT.delete(editor)\n leaf.onPlaceholderResize?.(null)\n } else {\n EDITOR_TO_PLACEHOLDER_ELEMENT.set(editor, placeholderEl)\n\n if (!placeholderResizeObserver.current) {\n // Create a new observer and observe the placeholder element.\n const ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill\n placeholderResizeObserver.current = new ResizeObserver(() => {\n leaf.onPlaceholderResize?.(placeholderEl)\n })\n }\n placeholderResizeObserver.current.observe(placeholderEl)\n placeholderRef.current = placeholderEl\n }\n },\n [placeholderRef, leaf, editor]\n )\n\n let children = (\n <String isLast={isLast} leaf={leaf} parent={parent} text={text} />\n )\n\n const leafIsPlaceholder = Boolean(leaf[PLACEHOLDER_SYMBOL])\n useEffect(() => {\n if (leafIsPlaceholder) {\n if (!showPlaceholderTimeoutRef.current) {\n // Delay the placeholder, so it will not render in a selection\n showPlaceholderTimeoutRef.current = setTimeout(() => {\n setShowPlaceholder(true)\n showPlaceholderTimeoutRef.current = null\n }, PLACEHOLDER_DELAY)\n }\n } else {\n clearTimeoutRef(showPlaceholderTimeoutRef)\n setShowPlaceholder(false)\n }\n return () => clearTimeoutRef(showPlaceholderTimeoutRef)\n }, [leafIsPlaceholder, setShowPlaceholder])\n\n if (leafIsPlaceholder && showPlaceholder) {\n const placeholderProps: RenderPlaceholderProps = {\n children: leaf.placeholder,\n attributes: {\n 'data-slate-placeholder': true,\n style: {\n position: 'absolute',\n top: 0,\n pointerEvents: 'none',\n width: '100%',\n maxWidth: '100%',\n display: 'block',\n opacity: '0.333',\n userSelect: 'none',\n textDecoration: 'none',\n // Fixes https://github.com/udecode/plate/issues/2315\n WebkitUserModify: IS_WEBKIT ? 'inherit' : undefined,\n },\n contentEditable: false,\n ref: callbackPlaceholderRef,\n },\n }\n\n children = (\n <React.Fragment>\n {renderPlaceholder(placeholderProps)}\n {children}\n </React.Fragment>\n )\n }\n\n // COMPAT: Having the `data-` attributes on these leaf elements ensures that\n // in certain misbehaving browsers they aren't weirdly cloned/destroyed by\n // contenteditable behaviors. (2019/05/08)\n const attributes: {\n 'data-slate-leaf': true\n } = {\n 'data-slate-leaf': true,\n }\n\n return renderLeaf({ attributes, children, leaf, text })\n}\n\nconst MemoizedLeaf = React.memo(Leaf, (prev, next) => {\n return (\n next.parent === prev.parent &&\n next.isLast === prev.isLast &&\n next.renderLeaf === prev.renderLeaf &&\n next.renderPlaceholder === prev.renderPlaceholder &&\n next.text === prev.text &&\n Text.equals(next.leaf, prev.leaf) &&\n next.leaf[PLACEHOLDER_SYMBOL] === prev.leaf[PLACEHOLDER_SYMBOL]\n )\n})\n\nexport const DefaultLeaf = (props: RenderLeafProps) => {\n const { attributes, children } = props\n return <span {...attributes}>{children}</span>\n}\n\nexport default MemoizedLeaf\n","import React, { useCallback, useRef } from 'react'\nimport { Element, DecoratedRange, Text as SlateText } from 'slate'\nimport { ReactEditor, useSlateStatic } from '..'\nimport { isTextDecorationsEqual } from 'slate-dom'\nimport {\n EDITOR_TO_KEY_TO_ELEMENT,\n ELEMENT_TO_NODE,\n NODE_TO_ELEMENT,\n} from 'slate-dom'\nimport { RenderLeafProps, RenderPlaceholderProps } from './editable'\nimport Leaf from './leaf'\n\n/**\n * Text.\n */\n\nconst Text = (props: {\n decorations: DecoratedRange[]\n isLast: boolean\n parent: Element\n renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n text: SlateText\n}) => {\n const { decorations, isLast, parent, renderPlaceholder, renderLeaf, text } =\n props\n const editor = useSlateStatic()\n const ref = useRef<HTMLSpanElement | null>(null)\n const leaves = SlateText.decorations(text, decorations)\n const key = ReactEditor.findKey(editor, text)\n const children = []\n\n for (let i = 0; i < leaves.length; i++) {\n const leaf = leaves[i]\n\n children.push(\n <Leaf\n isLast={isLast && i === leaves.length - 1}\n key={`${key.id}-${i}`}\n renderPlaceholder={renderPlaceholder}\n leaf={leaf}\n text={text}\n parent={parent}\n renderLeaf={renderLeaf}\n />\n )\n }\n\n // Update element-related weak maps with the DOM element ref.\n const callbackRef = useCallback(\n (span: HTMLSpanElement | null) => {\n const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor)\n if (span) {\n KEY_TO_ELEMENT?.set(key, span)\n NODE_TO_ELEMENT.set(text, span)\n ELEMENT_TO_NODE.set(span, text)\n } else {\n KEY_TO_ELEMENT?.delete(key)\n NODE_TO_ELEMENT.delete(text)\n if (ref.current) {\n ELEMENT_TO_NODE.delete(ref.current)\n }\n }\n ref.current = span\n },\n [ref, editor, key, text]\n )\n return (\n <span data-slate-node=\"text\" ref={callbackRef}>\n {children}\n </span>\n )\n}\n\nconst MemoizedText = React.memo(Text, (prev, next) => {\n return (\n next.parent === prev.parent &&\n next.isLast === prev.isLast &&\n next.renderLeaf === prev.renderLeaf &&\n next.renderPlaceholder === prev.renderPlaceholder &&\n next.text === prev.text &&\n isTextDecorationsEqual(next.decorations, prev.decorations)\n )\n})\n\nexport default MemoizedText\n","import getDirection from 'direction'\nimport React, { useCallback } from 'react'\nimport { JSX } from 'react'\nimport {\n Editor,\n Element as SlateElement,\n Node,\n Range,\n DecoratedRange,\n} from 'slate'\nimport { ReactEditor, useReadOnly, useSlateStatic } from '..'\nimport useChildren from '../hooks/use-children'\nimport { isElementDecorationsEqual } from 'slate-dom'\nimport {\n EDITOR_TO_KEY_TO_ELEMENT,\n ELEMENT_TO_NODE,\n NODE_TO_ELEMENT,\n NODE_TO_INDEX,\n NODE_TO_PARENT,\n} from 'slate-dom'\nimport {\n RenderElementProps,\n RenderLeafProps,\n RenderPlaceholderProps,\n} from './editable'\n\nimport Text from './text'\n\n/**\n * Element.\n */\n\nconst Element = (props: {\n decorations: DecoratedRange[]\n element: SlateElement\n renderElement?: (props: RenderElementProps) => JSX.Element\n renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n selection: Range | null\n}) => {\n const {\n decorations,\n element,\n renderElement = (p: RenderElementProps) => <DefaultElement {...p} />,\n renderPlaceholder,\n renderLeaf,\n selection,\n } = props\n const editor = useSlateStatic()\n const readOnly = useReadOnly()\n const isInline = editor.isInline(element)\n const key = ReactEditor.findKey(editor, element)\n const ref = useCallback(\n (ref: HTMLElement | null) => {\n // Update element-related weak maps with the DOM element ref.\n const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor)\n if (ref) {\n KEY_TO_ELEMENT?.set(key, ref)\n NODE_TO_ELEMENT.set(element, ref)\n ELEMENT_TO_NODE.set(ref, element)\n } else {\n KEY_TO_ELEMENT?.delete(key)\n NODE_TO_ELEMENT.delete(element)\n }\n },\n [editor, key, element]\n )\n let children: React.ReactNode = useChildren({\n decorations,\n node: element,\n renderElement,\n renderPlaceholder,\n renderLeaf,\n selection,\n })\n\n // Attributes that the developer must mix into the element in their\n // custom node renderer component.\n const attributes: {\n 'data-slate-node': 'element'\n 'data-slate-void'?: true\n 'data-slate-inline'?: true\n contentEditable?: false\n dir?: 'rtl'\n ref: any\n } = {\n 'data-slate-node': 'element',\n ref,\n }\n\n if (isInline) {\n attributes['data-slate-inline'] = true\n }\n\n // If it's a block node with inline children, add the proper `dir` attribute\n // for text direction.\n if (!isInline && Editor.hasInlines(editor, element)) {\n const text = Node.string(element)\n const dir = getDirection(text)\n\n if (dir === 'rtl') {\n attributes.dir = dir\n }\n }\n\n // If it's a void node, wrap the children in extra void-specific elements.\n if (Editor.isVoid(editor, element)) {\n attributes['data-slate-void'] = true\n\n if (!readOnly && isInline) {\n attributes.contentEditable = false\n }\n\n const Tag = isInline ? 'span' : 'div'\n const [[text]] = Node.texts(element)\n\n children = (\n <Tag\n data-slate-spacer\n style={{\n height: '0',\n color: 'transparent',\n outline: 'none',\n position: 'absolute',\n }}\n >\n <Text\n renderPlaceholder={renderPlaceholder}\n decorations={[]}\n isLast={false}\n parent={element}\n text={text}\n />\n </Tag>\n )\n\n NODE_TO_INDEX.set(text, 0)\n NODE_TO_PARENT.set(text, element)\n }\n\n return renderElement({ attributes, children, element })\n}\n\nconst MemoizedElement = React.memo(Element, (prev, next) => {\n return (\n prev.element === next.element &&\n prev.renderElement === next.renderElement &&\n prev.renderLeaf === next.renderLeaf &&\n prev.renderPlaceholder === next.renderPlaceholder &&\n isElementDecorationsEqual(prev.decorations, next.decorations) &&\n (prev.selection === next.selection ||\n (!!prev.selection &&\n !!next.selection &&\n Range.equals(prev.selection, next.selection)))\n )\n})\n\n/**\n * The default element renderer.\n */\n\nexport const DefaultElement = (props: RenderElementProps) => {\n const { attributes, children, element } = props\n const editor = useSlateStatic()\n const Tag = editor.isInline(element) ? 'span' : 'div'\n return (\n <Tag {...attributes} style={{ position: 'relative' }}>\n {children}\n </Tag>\n )\n}\n\nexport default MemoizedElement\n","import { createContext, useContext } from 'react'\nimport { DecoratedRange, NodeEntry } from 'slate'\n\n/**\n * A React context for sharing the `decorate` prop of the editable.\n */\n\nexport const DecorateContext = createContext<\n (entry: NodeEntry) => DecoratedRange[]\n>(() => [])\n\n/**\n * Get the current `decorate` prop of the editable.\n */\n\nexport const useDecorate = (): ((entry: NodeEntry) => DecoratedRange[]) => {\n return useContext(DecorateContext)\n}\n","import { createContext, useContext } from 'react'\n\n/**\n * A React context for sharing the `selected` state of an element.\n */\n\nexport const SelectedContext = createContext(false)\n\n/**\n * Get the current `selected` state of an element.\n */\n\nexport const useSelected = (): boolean => {\n return useContext(SelectedContext)\n}\n","import React from 'react'\nimport {\n Ancestor,\n Descendant,\n Editor,\n Element,\n Range,\n DecoratedRange,\n} from 'slate'\nimport {\n RenderElementProps,\n RenderLeafProps,\n RenderPlaceholderProps,\n} from '../components/editable'\n\nimport ElementComponent from '../components/element'\nimport TextComponent from '../components/text'\nimport { ReactEditor } from '../plugin/react-editor'\nimport { IS_NODE_MAP_DIRTY, NODE_TO_INDEX, NODE_TO_PARENT } from 'slate-dom'\nimport { useDecorate } from './use-decorate'\nimport { SelectedContext } from './use-selected'\nimport { useSlateStatic } from './use-slate-static'\n\n/**\n * Children.\n */\n\nconst useChildren = (props: {\n decorations: DecoratedRange[]\n node: Ancestor\n renderElement?: (props: RenderElementProps) => JSX.Element\n renderPlaceholder: (props: RenderPlaceholderProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n selection: Range | null\n}) => {\n const {\n decorations,\n node,\n renderElement,\n renderPlaceholder,\n renderLeaf,\n selection,\n } = props\n const decorate = useDecorate()\n const editor = useSlateStatic()\n IS_NODE_MAP_DIRTY.set(editor as ReactEditor, false)\n const path = ReactEditor.findPath(editor, node)\n const children = []\n const isLeafBlock =\n Element.isElement(node) &&\n !editor.isInline(node) &&\n Editor.hasInlines(editor, node)\n\n for (let i = 0; i < node.children.length; i++) {\n const p = path.concat(i)\n const n = node.children[i] as Descendant\n const key = ReactEditor.findKey(editor, n)\n const range = Editor.range(editor, p)\n const sel = selection && Range.intersection(range, selection)\n const ds = decorate([n, p])\n\n for (const dec of decorations) {\n const d = Range.intersection(dec, range)\n\n if (d) {\n ds.push(d)\n }\n }\n\n if (Element.isElement(n)) {\n children.push(\n <SelectedContext.Provider key={`provider-${key.id}`} value={!!sel}>\n <ElementComponent\n decorations={ds}\n element={n}\n key={key.id}\n renderElement={renderElement}\n renderPlaceholder={renderPlaceholder}\n renderLeaf={renderLeaf}\n selection={sel}\n />\n </SelectedContext.Provider>\n )\n } else {\n children.push(\n <TextComponent\n decorations={ds}\n key={key.id}\n isLast={isLeafBlock && i === node.children.length - 1}\n parent={node}\n renderPlaceholder={renderPlaceholder}\n renderLeaf={renderLeaf}\n text={n}\n />\n )\n }\n\n NODE_TO_INDEX.set(n, i)\n NODE_TO_PARENT.set(n, node)\n }\n\n return children\n}\n\nexport default useChildren\n","import { createContext, useContext } from 'react'\n\n/**\n * A React context for sharing the `readOnly` state of the editor.\n */\n\nexport const ReadOnlyContext = createContext(false)\n\n/**\n * Get the current `readOnly` state of the editor.\n */\n\nexport const useReadOnly = (): boolean => {\n return useContext(ReadOnlyContext)\n}\n","import { createContext, useContext } from 'react'\nimport { Editor } from 'slate'\nimport { ReactEditor } from '../plugin/react-editor'\n\n/**\n * A React context for sharing the editor object, in a way that re-renders the\n * context whenever changes occur.\n */\n\nexport interface SlateContextValue {\n v: number\n editor: ReactEditor\n}\n\nexport const SlateContext = createContext<{\n v: number\n editor: ReactEditor\n} | null>(null)\n\n/**\n * Get the current editor object from the React context.\n */\n\nexport const useSlate = (): Editor => {\n const context = useContext(SlateContext)\n\n if (!context) {\n throw new Error(\n `The \\`useSlate\\` hook must be used inside the <Slate> component's context.`\n )\n }\n\n const { editor } = context\n return editor\n}\n\nexport const useSlateWithV = (): { editor: Editor; v: number } => {\n const context = useContext(SlateContext)\n\n if (!context) {\n throw new Error(\n `The \\`useSlate\\` hook must be used inside the <Slate> component's context.`\n )\n }\n\n return context\n}\n","import { useCallback, useEffect, useRef } from 'react'\nimport { ReactEditor } from '../plugin/react-editor'\nimport { useSlateStatic } from './use-slate-static'\n\nexport function useTrackUserInput() {\n const editor = useSlateStatic()\n\n const receivedUserInput = useRef<boolean>(false)\n const animationFrameIdRef = useRef<number>(0)\n\n const onUserInput = useCallback(() => {\n if (receivedUserInput.current) {\n return\n }\n\n receivedUserInput.current = true\n\n const window = ReactEditor.getWindow(editor)\n window.cancelAnimationFrame(animationFrameIdRef.current)\n\n animationFrameIdRef.current = window.requestAnimationFrame(() => {\n receivedUserInput.current = false\n })\n }, [editor])\n\n useEffect(() => () => cancelAnimationFrame(animationFrameIdRef.current), [])\n\n return {\n receivedUserInput,\n onUserInput,\n }\n}\n","import { RefObject } from 'react'\nimport { ReactEditor } from '../../plugin/react-editor'\nimport { isTrackedMutation } from 'slate-dom'\n\nexport type RestoreDOMManager = {\n registerMutations: (mutations: MutationRecord[]) => void\n restoreDOM: () => void\n clear: () => void\n}\n\nexport const createRestoreDomManager = (\n editor: ReactEditor,\n receivedUserInput: RefObject<boolean>\n): RestoreDOMManager => {\n let bufferedMutations: MutationRecord[] = []\n\n const clear = () => {\n bufferedMutations = []\n }\n\n const registerMutations = (mutations: MutationRecord[]) => {\n if (!receivedUserInput.current) {\n return\n }\n\n const trackedMutations = mutations.filter(mutation =>\n isTrackedMutation(editor, mutation, mutations)\n )\n\n bufferedMutations.push(...trackedMutations)\n }\n\n function restoreDOM() {\n if (bufferedMutations.length > 0) {\n bufferedMutations.reverse().forEach(mutation => {\n if (mutation.type === 'characterData') {\n // We don't want to restore the DOM for characterData mutations\n // because this interrupts the composition.\n return\n }\n\n mutation.removedNodes.forEach(node => {\n mutation.target.insertBefore(node, mutation.nextSibling)\n })\n\n mutation.addedNodes.forEach(node => {\n mutation.target.removeChild(node)\n })\n })\n\n // Clear buffered mutations to ensure we don't undo them twice\n clear()\n }\n }\n\n return {\n registerMutations,\n restoreDOM,\n clear,\n }\n}\n","import React, {\n Component,\n ComponentType,\n ContextType,\n ReactNode,\n RefObject,\n} from 'react'\nimport { EditorContext } from '../../hooks/use-slate-static'\nimport { IS_ANDROID } from 'slate-dom'\nimport {\n createRestoreDomManager,\n RestoreDOMManager,\n} from './restore-dom-manager'\n\nconst MUTATION_OBSERVER_CONFIG: MutationObserverInit = {\n subtree: true,\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n}\n\ntype RestoreDOMProps = {\n children?: ReactNode\n receivedUserInput: RefObject<boolean>\n node: RefObject<HTMLDivElement>\n}\n\n// We have to use a class component here since we rely on `getSnapshotBeforeUpdate` which has no FC equivalent\n// to run code synchronously immediately before react commits the component update to the DOM.\nclass RestoreDOMComponent extends Component<RestoreDOMProps> {\n static contextType = EditorContext\n context: ContextType<typeof EditorContext> = null\n\n private manager: RestoreDOMManager | null = null\n private mutationObserver: MutationObserver | null = null\n\n observe() {\n const { node } = this.props\n if (!node.current) {\n throw new Error('Failed to attach MutationObserver, `node` is undefined')\n }\n\n this.mutationObserver?.observe(node.current, MUTATION_OBSERVER_CONFIG)\n }\n\n componentDidMount() {\n const { receivedUserInput } = this.props\n const editor = this.context!\n\n this.manager = createRestoreDomManager(editor, receivedUserInput)\n this.mutationObserver = new MutationObserver(this.manager.registerMutations)\n\n this.observe()\n }\n\n getSnapshotBeforeUpdate() {\n const pendingMutations = this.mutationObserver?.takeRecords()\n if (pendingMutations?.length) {\n this.manager?.registerMutations(pendingMutations)\n }\n\n this.mutationObserver?.disconnect()\n this.manager?.restoreDOM()\n\n return null\n }\n\n componentDidUpdate() {\n this.manager?.clear()\n this.observe()\n }\n\n componentWillUnmount() {\n this.mutationObserver?.disconnect()\n }\n\n render() {\n return this.props.children\n }\n}\n\nexport const RestoreDOM: ComponentType<RestoreDOMProps> = IS_ANDROID\n ? RestoreDOMComponent\n : ({ children }) => <>{children}</>\n","import { createContext, useContext } from 'react'\n\n/**\n * A React context for sharing the `composing` state of the editor.\n */\n\nexport const ComposingContext = createContext(false)\n\n/**\n * Get the current `composing` state of the editor.\n */\n\nexport const useComposing = (): boolean => {\n return useContext(ComposingContext)\n}\n","import getDirection from 'direction'\nimport debounce from 'lodash/debounce'\nimport throttle from 'lodash/throttle'\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n forwardRef,\n ForwardedRef,\n} from 'react'\nimport { JSX } from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\nimport {\n Editor,\n Element,\n Node,\n NodeEntry,\n Path,\n Range,\n Text,\n Transforms,\n DecoratedRange,\n} from 'slate'\nimport { useAndroidInputManager } from '../hooks/android-input-manager/use-android-input-manager'\nimport useChildren from '../hooks/use-children'\nimport { DecorateContext } from '../hooks/use-decorate'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { ReadOnlyContext } from '../hooks/use-read-only'\nimport { useSlate } from '../hooks/use-slate'\nimport { useTrackUserInput } from '../hooks/use-track-user-input'\nimport { ReactEditor } from '../plugin/react-editor'\nimport { TRIPLE_CLICK } from 'slate-dom'\nimport {\n DOMElement,\n DOMRange,\n DOMText,\n getActiveElement,\n getDefaultView,\n getSelection,\n isDOMElement,\n isDOMNode,\n isPlainTextOnlyPaste,\n} from 'slate-dom'\nimport {\n CAN_USE_DOM,\n HAS_BEFORE_INPUT_SUPPORT,\n IS_ANDROID,\n IS_CHROME,\n IS_FIREFOX,\n IS_FIREFOX_LEGACY,\n IS_IOS,\n IS_WEBKIT,\n IS_UC_MOBILE,\n IS_WECHATBROWSER,\n} from 'slate-dom'\nimport { Hotkeys } from 'slate-dom'\nimport {\n IS_NODE_MAP_DIRTY,\n EDITOR_TO_ELEMENT,\n EDITOR_TO_FORCE_RENDER,\n EDITOR_TO_PENDING_INSERTION_MARKS,\n EDITOR_TO_USER_MARKS,\n EDITOR_TO_USER_SELECTION,\n EDITOR_TO_WINDOW,\n ELEMENT_TO_NODE,\n IS_COMPOSING,\n IS_FOCUSED,\n IS_READ_ONLY,\n MARK_PLACEHOLDER_SYMBOL,\n NODE_TO_ELEMENT,\n PLACEHOLDER_SYMBOL,\n} from 'slate-dom'\nimport { RestoreDOM } from './restore-dom/restore-dom'\nimport { AndroidInputManager } from '../hooks/android-input-manager/android-input-manager'\nimport { ComposingContext } from '../hooks/use-composing'\n\ntype DeferredOperation = () => void\n\nconst Children = (props: Parameters<typeof useChildren>[0]) => (\n <React.Fragment>{useChildren(props)}</React.Fragment>\n)\n\n/**\n * `RenderElementProps` are passed to the `renderElement` handler.\n */\n\nexport interface RenderElementProps {\n children: any\n element: Element\n attributes: {\n 'data-slate-node': 'element'\n 'data-slate-inline'?: true\n 'data-slate-void'?: true\n dir?: 'rtl'\n ref: any\n }\n}\n\n/**\n * `RenderLeafProps` are passed to the `renderLeaf` handler.\n */\n\nexport interface RenderLeafProps {\n children: any\n leaf: Text\n text: Text\n attributes: {\n 'data-slate-leaf': true\n }\n}\n\n/**\n * `EditableProps` are passed to the `<Editable>` component.\n */\n\nexport type EditableProps = {\n decorate?: (entry: NodeEntry) => DecoratedRange[]\n onDOMBeforeInput?: (event: InputEvent) => void\n placeholder?: string\n readOnly?: boolean\n role?: string\n style?: React.CSSProperties\n renderElement?: (props: RenderElementProps) => JSX.Element\n renderLeaf?: (props: RenderLeafProps) => JSX.Element\n renderPlaceholder?: (props: RenderPlaceholderProps) => JSX.Element\n scrollSelectionIntoView?: (editor: ReactEditor, domRange: DOMRange) => void\n as?: React.ElementType\n disableDefaultStyles?: boolean\n} & React.TextareaHTMLAttributes<HTMLDivElement>\n\n/**\n * Editable.\n */\n\nexport const Editable = forwardRef(\n (props: EditableProps, forwardedRef: ForwardedRef<HTMLDivElement>) => {\n const defaultRenderPlaceholder = useCallback(\n (props: RenderPlaceholderProps) => <DefaultPlaceholder {...props} />,\n []\n )\n const {\n autoFocus,\n decorate = defaultDecorate,\n onDOMBeforeInput: propsOnDOMBeforeInput,\n placeholder,\n readOnly = false,\n renderElement,\n renderLeaf,\n renderPlaceholder = defaultRenderPlaceholder,\n scrollSelectionIntoView = defaultScrollSelectionIntoView,\n style: userStyle = {},\n as: Component = 'div',\n disableDefaultStyles = false,\n ...attributes\n } = props\n const editor = useSlate()\n // Rerender editor when composition status changed\n const [isComposing, setIsComposing] = useState(false)\n const ref = useRef<HTMLDivElement | null>(null)\n const deferredOperations = useRef<DeferredOperation[]>([])\n const [placeholderHeight, setPlaceholderHeight] = useState<\n number | undefined\n >()\n const processing = useRef(false)\n\n const { onUserInput, receivedUserInput } = useTrackUserInput()\n\n const [, forceRender] = useReducer(s => s + 1, 0)\n EDITOR_TO_FORCE_RENDER.set(editor, forceRender)\n\n // Update internal state on each render.\n IS_READ_ONLY.set(editor, readOnly)\n\n // Keep track of some state for the event handler logic.\n const state = useMemo(\n () => ({\n isDraggingInternally: false,\n isUpdatingSelection: false,\n latestElement: null as DOMElement | null,\n hasMarkPlaceholder: false,\n }),\n []\n )\n\n // The autoFocus TextareaHTMLAttribute doesn't do anything on a div, so it\n // needs to be manually focused.\n useEffect(() => {\n if (ref.current && autoFocus) {\n ref.current.focus()\n }\n }, [autoFocus])\n\n /**\n * The AndroidInputManager object has a cyclical dependency on onDOMSelectionChange\n *\n * It is defined as a reference to simplify hook dependencies and clarify that\n * it needs to be initialized.\n */\n const androidInputManagerRef = useRef<\n AndroidInputManager | null | undefined\n >()\n\n // Listen on the native `selectionchange` event to be able to update any time\n // the selection changes. This is required because React's `onSelect` is leaky\n // and non-standard so it doesn't fire until after a selection has been\n // released. This causes issues in situations where another change happens\n // while a selection is being dragged.\n const onDOMSelectionChange = useMemo(\n () =>\n throttle(() => {\n if (IS_NODE_MAP_DIRTY.get(editor)) {\n onDOMSelectionChange()\n return\n }\n\n const el = ReactEditor.toDOMNode(editor, editor)\n const root = el.getRootNode()\n\n if (!processing.current && IS_WEBKIT && root instanceof ShadowRoot) {\n processing.current = true\n\n const active = getActiveElement()\n\n if (active) {\n document.execCommand('indent')\n } else {\n Transforms.deselect(editor)\n }\n\n processing.current = false\n return\n }\n\n const androidInputManager = androidInputManagerRef.current\n if (\n (IS_ANDROID || !ReactEditor.isComposing(editor)) &&\n (!state.isUpdatingSelection || androidInputManager?.isFlushing()) &&\n !state.isDraggingInternally\n ) {\n const root = ReactEditor.findDocumentOrShadowRoot(editor)\n const { activeElement } = root\n const el = ReactEditor.toDOMNode(editor, editor)\n const domSelection = getSelection(root)\n\n if (activeElement === el) {\n state.latestElement = activeElement\n IS_FOCUSED.set(editor, true)\n } else {\n IS_FOCUSED.delete(editor)\n }\n\n if (!domSelection) {\n return Transforms.deselect(editor)\n }\n\n const { anchorNode, focusNode } = domSelection\n\n const anchorNodeSelectable =\n ReactEditor.hasEditableTarget(editor, anchorNode) ||\n ReactEditor.isTargetInsideNonReadonlyVoid(editor, anchorNode)\n\n const focusNodeInEditor = ReactEditor.hasTarget(editor, focusNode)\n\n if (anchorNodeSelectable && focusNodeInEditor) {\n const range = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: true,\n })\n\n if (range) {\n if (\n !ReactEditor.isComposing(editor) &&\n !androidInputManager?.hasPendingChanges() &&\n !androidInputManager?.isFlushing()\n ) {\n Transforms.select(editor, range)\n } else {\n androidInputManager?.handleUserSelect(range)\n }\n }\n }\n\n // Deselect the editor if the dom selection is not selectable in readonly mode\n if (readOnly && (!anchorNodeSelectable || !focusNodeInEditor)) {\n Transforms.deselect(editor)\n }\n }\n }, 100),\n [editor, readOnly, state]\n )\n\n const scheduleOnDOMSelectionChange = useMemo(\n () => debounce(onDOMSelectionChange, 0),\n [onDOMSelectionChange]\n )\n\n androidInputManagerRef.current = useAndroidInputManager({\n node: ref,\n onDOMSelectionChange,\n scheduleOnDOMSelectionChange,\n })\n\n useIsomorphicLayoutEffect(() => {\n // Update element-related weak maps with the DOM element ref.\n let window\n if (ref.current && (window = getDefaultView(ref.current))) {\n EDITOR_TO_WINDOW.set(editor, window)\n EDITOR_TO_ELEMENT.set(editor, ref.current)\n NODE_TO_ELEMENT.set(editor, ref.current)\n ELEMENT_TO_NODE.set(ref.current, editor)\n } else {\n NODE_TO_ELEMENT.delete(editor)\n }\n\n // Make sure the DOM selection state is in sync.\n const { selection } = editor\n const root = ReactEditor.findDocumentOrShadowRoot(editor)\n const domSelection = getSelection(root)\n\n if (\n !domSelection ||\n !ReactEditor.isFocused(editor) ||\n androidInputManagerRef.current?.hasPendingAction()\n ) {\n return\n }\n\n const setDomSelection = (forceChange?: boolean) => {\n const hasDomSelection = domSelection.type !== 'None'\n\n // If the DOM selection is properly unset, we're done.\n if (!selection && !hasDomSelection) {\n return\n }\n\n // Get anchorNode and focusNode\n const focusNode = domSelection.focusNode\n let anchorNode\n\n // COMPAT: In firefox the normal selection way does not work\n // (https://github.com/ianstormtaylor/slate/pull/5486#issue-1820720223)\n if (IS_FIREFOX && domSelection.rangeCount > 1) {\n const firstRange = domSelection.getRangeAt(0)\n const lastRange = domSelection.getRangeAt(domSelection.rangeCount - 1)\n\n // Right to left\n if (firstRange.startContainer === focusNode) {\n anchorNode = lastRange.endContainer\n } else {\n // Left to right\n anchorNode = firstRange.startContainer\n }\n } else {\n anchorNode = domSelection.anchorNode\n }\n\n // verify that the dom selection is in the editor\n const editorElement = EDITOR_TO_ELEMENT.get(editor)!\n let hasDomSelectionInEditor = false\n if (\n editorElement.contains(anchorNode) &&\n editorElement.contains(focusNode)\n ) {\n hasDomSelectionInEditor = true\n }\n\n // If the DOM selection is in the editor and the editor selection is already correct, we're done.\n if (\n hasDomSelection &&\n hasDomSelectionInEditor &&\n selection &&\n !forceChange\n ) {\n const slateRange = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: true,\n\n // domSelection is not necessarily a valid Slate range\n // (e.g. when clicking on contentEditable:false element)\n suppressThrow: true,\n })\n\n if (slateRange && Range.equals(slateRange, selection)) {\n if (!state.hasMarkPlaceholder) {\n return\n }\n\n // Ensure selection is inside the mark placeholder\n if (\n anchorNode?.parentElement?.hasAttribute(\n 'data-slate-mark-placeholder'\n )\n ) {\n return\n }\n }\n }\n\n // when <Editable/> is being controlled through external value\n // then its children might just change - DOM responds to it on its own\n // but Slate's value is not being updated through any operation\n // and thus it doesn't transform selection on its own\n if (selection && !ReactEditor.hasRange(editor, selection)) {\n editor.selection = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: true,\n })\n return\n }\n\n // Otherwise the DOM selection is out of sync, so update it.\n state.isUpdatingSelection = true\n\n let newDomRange: DOMRange | null = null\n\n try {\n newDomRange = selection && ReactEditor.toDOMRange(editor, selection)\n } catch (e) {\n // Ignore, dom and state might be out of sync\n }\n\n if (newDomRange) {\n if (ReactEditor.isComposing(editor) && !IS_ANDROID) {\n domSelection.collapseToEnd()\n } else if (Range.isBackward(selection!)) {\n domSelection.setBaseAndExtent(\n newDomRange.endContainer,\n newDomRange.endOffset,\n newDomRange.startContainer,\n newDomRange.startOffset\n )\n } else {\n domSelection.setBaseAndExtent(\n newDomRange.startContainer,\n newDomRange.startOffset,\n newDomRange.endContainer,\n newDomRange.endOffset\n )\n }\n scrollSelectionIntoView(editor, newDomRange)\n } else {\n domSelection.removeAllRanges()\n }\n\n return newDomRange\n }\n\n // In firefox if there is more then 1 range and we call setDomSelection we remove the ability to select more cells in a table\n if (domSelection.rangeCount <= 1) {\n setDomSelection()\n }\n\n const ensureSelection =\n androidInputManagerRef.current?.isFlushing() === 'action'\n\n if (!IS_ANDROID || !ensureSelection) {\n setTimeout(() => {\n state.isUpdatingSelection = false\n })\n return\n }\n\n let timeoutId: ReturnType<typeof setTimeout> | null = null\n const animationFrameId = requestAnimationFrame(() => {\n if (ensureSelection) {\n const ensureDomSelection = (forceChange?: boolean) => {\n try {\n const el = ReactEditor.toDOMNode(editor, editor)\n el.focus()\n\n setDomSelection(forceChange)\n } catch (e) {\n // Ignore, dom and state might be out of sync\n }\n }\n\n // Compat: Android IMEs try to force their selection by manually re-applying it even after we set it.\n // This essentially would make setting the slate selection during an update meaningless, so we force it\n // again here. We can't only do it in the setTimeout after the animation frame since that would cause a\n // visible flicker.\n ensureDomSelection()\n\n timeoutId = setTimeout(() => {\n // COMPAT: While setting the selection in an animation frame visually correctly sets the selection,\n // it doesn't update GBoards spellchecker state. We have to manually trigger a selection change after\n // the animation frame to ensure it displays the correct state.\n ensureDomSelection(true)\n state.isUpdatingSelection = false\n })\n }\n })\n\n return () => {\n cancelAnimationFrame(animationFrameId)\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n })\n\n // Listen on the native `beforeinput` event to get real \"Level 2\" events. This\n // is required because React's `beforeinput` is fake and never really attaches\n // to the real event sadly. (2019/11/01)\n // https://github.com/facebook/react/issues/11211\n const onDOMBeforeInput = useCallback(\n (event: InputEvent) => {\n const el = ReactEditor.toDOMNode(editor, editor)\n const root = el.getRootNode()\n\n if (processing?.current && IS_WEBKIT && root instanceof ShadowRoot) {\n const ranges = event.getTargetRanges()\n const range = ranges[0]\n\n const newRange = new window.Range()\n\n newRange.setStart(range.startContainer, range.startOffset)\n newRange.setEnd(range.endContainer, range.endOffset)\n\n // Translate the DOM Range into a Slate Range\n const slateRange = ReactEditor.toSlateRange(editor, newRange, {\n exactMatch: false,\n suppressThrow: false,\n })\n\n Transforms.select(editor, slateRange)\n\n event.preventDefault()\n event.stopImmediatePropagation()\n return\n }\n onUserInput()\n\n if (\n !readOnly &&\n ReactEditor.hasEditableTarget(editor, event.target) &&\n !isDOMEventHandled(event, propsOnDOMBeforeInput)\n ) {\n // COMPAT: BeforeInput events aren't cancelable on android, so we have to handle them differently using the android input manager.\n if (androidInputManagerRef.current) {\n return androidInputManagerRef.current.handleDOMBeforeInput(event)\n }\n\n // Some IMEs/Chrome extensions like e.g. Grammarly set the selection immediately before\n // triggering a `beforeinput` expecting the change to be applied to the immediately before\n // set selection.\n scheduleOnDOMSelectionChange.flush()\n onDOMSelectionChange.flush()\n\n const { selection } = editor\n const { inputType: type } = event\n const data = (event as any).dataTransfer || event.data || undefined\n\n const isCompositionChange =\n type === 'insertCompositionText' || type === 'deleteCompositionText'\n\n // COMPAT: use composition change events as a hint to where we should insert\n // composition text if we aren't composing to work around https://github.com/ianstormtaylor/slate/issues/5038\n if (isCompositionChange && ReactEditor.isComposing(editor)) {\n return\n }\n\n let native = false\n if (\n type === 'insertText' &&\n selection &&\n Range.isCollapsed(selection) &&\n // Only use native character insertion for single characters a-z or space for now.\n // Long-press events (hold a + press 4 = ä) to choose a special character otherwise\n // causes duplicate inserts.\n event.data &&\n event.data.length === 1 &&\n /[a-z ]/i.test(event.data) &&\n // Chrome has issues correctly editing the start of nodes: https://bugs.chromium.org/p/chromium/issues/detail?id=1249405\n // When there is an inline element, e.g. a link, and you select\n // right after it (the start of the next node).\n selection.anchor.offset !== 0\n ) {\n native = true\n\n // Skip native if there are marks, as\n // `insertText` will insert a node, not just text.\n if (editor.marks) {\n native = false\n }\n\n // If the NODE_MAP is dirty, we can't trust the selection anchor (eg ReactEditor.toDOMPoint)\n if (!IS_NODE_MAP_DIRTY.get(editor)) {\n // Chrome also has issues correctly editing the end of anchor elements: https://bugs.chromium.org/p/chromium/issues/detail?id=1259100\n // Therefore we don't allow native events to insert text at the end of anchor nodes.\n const { anchor } = selection\n\n const [node, offset] = ReactEditor.toDOMPoint(editor, anchor)\n const anchorNode = node.parentElement?.closest('a')\n\n const window = ReactEditor.getWindow(editor)\n\n if (\n native &&\n anchorNode &&\n ReactEditor.hasDOMNode(editor, anchorNode)\n ) {\n // Find the last text node inside the anchor.\n const lastText = window?.document\n .createTreeWalker(anchorNode, NodeFilter.SHOW_TEXT)\n .lastChild() as DOMText | null\n\n if (\n lastText === node &&\n lastText.textContent?.length === offset\n ) {\n native = false\n }\n }\n\n // Chrome has issues with the presence of tab characters inside elements with whiteSpace = 'pre'\n // causing abnormal insert behavior: https://bugs.chromium.org/p/chromium/issues/detail?id=1219139\n if (\n native &&\n node.parentElement &&\n window?.getComputedStyle(node.parentElement)?.whiteSpace ===\n 'pre'\n ) {\n const block = Editor.above(editor, {\n at: anchor.path,\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n })\n\n if (block && Node.string(block[0]).includes('\\t')) {\n native = false\n }\n }\n }\n }\n // COMPAT: For the deleting forward/backward input types we don't want\n // to change the selection because it is the range that will be deleted,\n // and those commands determine that for themselves.\n // If the NODE_MAP is dirty, we can't trust the selection anchor (eg ReactEditor.toDOMPoint via ReactEditor.toSlateRange)\n if (\n (!type.startsWith('delete') || type.startsWith('deleteBy')) &&\n !IS_NODE_MAP_DIRTY.get(editor)\n ) {\n const [targetRange] = (event as any).getTargetRanges()\n\n if (targetRange) {\n const range = ReactEditor.toSlateRange(editor, targetRange, {\n exactMatch: false,\n suppressThrow: false,\n })\n\n if (!selection || !Range.equals(selection, range)) {\n native = false\n\n const selectionRef =\n !isCompositionChange &&\n editor.selection &&\n Editor.rangeRef(editor, editor.selection)\n\n Transforms.select(editor, range)\n\n if (selectionRef) {\n EDITOR_TO_USER_SELECTION.set(editor, selectionRef)\n }\n }\n }\n }\n\n // Composition change types occur while a user is composing text and can't be\n // cancelled. Let them through and wait for the composition to end.\n if (isCompositionChange) {\n return\n }\n\n if (!native) {\n event.preventDefault()\n }\n\n // COMPAT: If the selection is expanded, even if the command seems like\n // a delete forward/backward command it should delete the selection.\n if (\n selection &&\n Range.isExpanded(selection) &&\n type.startsWith('delete')\n ) {\n const direction = type.endsWith('Backward') ? 'backward' : 'forward'\n Editor.deleteFragment(editor, { direction })\n return\n }\n\n switch (type) {\n case 'deleteByComposition':\n case 'deleteByCut':\n case 'deleteByDrag': {\n Editor.deleteFragment(editor)\n break\n }\n\n case 'deleteContent':\n case 'deleteContentForward': {\n Editor.deleteForward(editor)\n break\n }\n\n case 'deleteContentBackward': {\n Editor.deleteBackward(editor)\n break\n }\n\n case 'deleteEntireSoftLine': {\n Editor.deleteBackward(editor, { unit: 'line' })\n Editor.deleteForward(editor, { unit: 'line' })\n break\n }\n\n case 'deleteHardLineBackward': {\n Editor.deleteBackward(editor, { unit: 'block' })\n break\n }\n\n case 'deleteSoftLineBackward': {\n Editor.deleteBackward(editor, { unit: 'line' })\n break\n }\n\n case 'deleteHardLineForward': {\n Editor.deleteForward(editor, { unit: 'block' })\n break\n }\n\n case 'deleteSoftLineForward': {\n Editor.deleteForward(editor, { unit: 'line' })\n break\n }\n\n case 'deleteWordBackward': {\n Editor.deleteBackward(editor, { unit: 'word' })\n break\n }\n\n case 'deleteWordForward': {\n Editor.deleteForward(editor, { unit: 'word' })\n break\n }\n\n case 'insertLineBreak':\n Editor.insertSoftBreak(editor)\n break\n\n case 'insertParagraph': {\n Editor.insertBreak(editor)\n break\n }\n\n case 'insertFromComposition':\n case 'insertFromDrop':\n case 'insertFromPaste':\n case 'insertFromYank':\n case 'insertReplacementText':\n case 'insertText': {\n if (type === 'insertFromComposition') {\n // COMPAT: in Safari, `compositionend` is dispatched after the\n // `beforeinput` for \"insertFromComposition\". But if we wait for it\n // then we will abort because we're still composing and the selection\n // won't be updated properly.\n // https://www.w3.org/TR/input-events-2/\n if (ReactEditor.isComposing(editor)) {\n setIsComposing(false)\n IS_COMPOSING.set(editor, false)\n }\n }\n\n // use a weak comparison instead of 'instanceof' to allow\n // programmatic access of paste events coming from external windows\n // like cypress where cy.window does not work realibly\n if (data?.constructor.name === 'DataTransfer') {\n ReactEditor.insertData(editor, data)\n } else if (typeof data === 'string') {\n // Only insertText operations use the native functionality, for now.\n // Potentially expand to single character deletes, as well.\n if (native) {\n deferredOperations.current.push(() =>\n Editor.insertText(editor, data)\n )\n } else {\n Editor.insertText(editor, data)\n }\n }\n\n break\n }\n }\n\n // Restore the actual user section if nothing manually set it.\n const toRestore = EDITOR_TO_USER_SELECTION.get(editor)?.unref()\n EDITOR_TO_USER_SELECTION.delete(editor)\n\n if (\n toRestore &&\n (!editor.selection || !Range.equals(editor.selection, toRestore))\n ) {\n Transforms.select(editor, toRestore)\n }\n }\n },\n [\n editor,\n onDOMSelectionChange,\n onUserInput,\n propsOnDOMBeforeInput,\n readOnly,\n scheduleOnDOMSelectionChange,\n ]\n )\n\n const callbackRef = useCallback(\n (node: HTMLDivElement | null) => {\n if (node == null) {\n onDOMSelectionChange.cancel()\n scheduleOnDOMSelectionChange.cancel()\n\n EDITOR_TO_ELEMENT.delete(editor)\n NODE_TO_ELEMENT.delete(editor)\n\n if (ref.current && HAS_BEFORE_INPUT_SUPPORT) {\n // @ts-ignore The `beforeinput` event isn't recognized.\n ref.current.removeEventListener('beforeinput', onDOMBeforeInput)\n }\n } else {\n // Attach a native DOM event handler for `beforeinput` events, because React's\n // built-in `onBeforeInput` is actually a leaky polyfill that doesn't expose\n // real `beforeinput` events sadly... (2019/11/04)\n // https://github.com/facebook/react/issues/11211\n if (HAS_BEFORE_INPUT_SUPPORT) {\n // @ts-ignore The `beforeinput` event isn't recognized.\n node.addEventListener('beforeinput', onDOMBeforeInput)\n }\n }\n\n ref.current = node\n if (typeof forwardedRef === 'function') {\n forwardedRef(node)\n } else if (forwardedRef) {\n forwardedRef.current = node\n }\n },\n [\n onDOMSelectionChange,\n scheduleOnDOMSelectionChange,\n editor,\n onDOMBeforeInput,\n forwardedRef,\n ]\n )\n\n useIsomorphicLayoutEffect(() => {\n const window = ReactEditor.getWindow(editor)\n\n // COMPAT: In Chrome, `selectionchange` events can fire when <input> and\n // <textarea> elements are appended to the DOM, causing\n // `editor.selection` to be overwritten in some circumstances.\n // (2025/01/16) https://issues.chromium.org/issues/389368412\n const onSelectionChange = ({ target }: Event) => {\n const targetElement = target instanceof HTMLElement ? target : null\n const targetTagName = targetElement?.tagName\n if (targetTagName === 'INPUT' || targetTagName === 'TEXTAREA') {\n return\n }\n scheduleOnDOMSelectionChange()\n }\n\n // Attach a native DOM event handler for `selectionchange`, because React's\n // built-in `onSelect` handler doesn't fire for all selection changes. It's\n // a leaky polyfill that only fires on keypresses or clicks. Instead, we\n // want to fire for any change to the selection inside the editor.\n // (2019/11/04) https://github.com/facebook/react/issues/5785\n window.document.addEventListener('selectionchange', onSelectionChange)\n\n // Listen for dragend and drop globally. In Firefox, if a drop handler\n // initiates an operation that causes the originally dragged element to\n // unmount, that element will not emit a dragend event. (2024/06/21)\n const stoppedDragging = () => {\n state.isDraggingInternally = false\n }\n window.document.addEventListener('dragend', stoppedDragging)\n window.document.addEventListener('drop', stoppedDragging)\n\n return () => {\n window.document.removeEventListener(\n 'selectionchange',\n onSelectionChange\n )\n window.document.removeEventListener('dragend', stoppedDragging)\n window.document.removeEventListener('drop', stoppedDragging)\n }\n }, [scheduleOnDOMSelectionChange, state])\n\n const decorations = decorate([editor, []])\n\n const showPlaceholder =\n placeholder &&\n editor.children.length === 1 &&\n Array.from(Node.texts(editor)).length === 1 &&\n Node.string(editor) === '' &&\n !isComposing\n\n const placeHolderResizeHandler = useCallback(\n (placeholderEl: HTMLElement | null) => {\n if (placeholderEl && showPlaceholder) {\n setPlaceholderHeight(placeholderEl.getBoundingClientRect()?.height)\n } else {\n setPlaceholderHeight(undefined)\n }\n },\n [showPlaceholder]\n )\n\n if (showPlaceholder) {\n const start = Editor.start(editor, [])\n decorations.push({\n [PLACEHOLDER_SYMBOL]: true,\n placeholder,\n onPlaceholderResize: placeHolderResizeHandler,\n anchor: start,\n focus: start,\n })\n }\n\n const { marks } = editor\n state.hasMarkPlaceholder = false\n\n if (editor.selection && Range.isCollapsed(editor.selection) && marks) {\n const { anchor } = editor.selection\n const leaf = Node.leaf(editor, anchor.path)\n const { text, ...rest } = leaf\n\n // While marks isn't a 'complete' text, we can still use loose Text.equals\n // here which only compares marks anyway.\n if (!Text.equals(leaf, marks as Text, { loose: true })) {\n state.hasMarkPlaceholder = true\n\n const unset = Object.fromEntries(\n Object.keys(rest).map(mark => [mark, null])\n )\n\n decorations.push({\n [MARK_PLACEHOLDER_SYMBOL]: true,\n ...unset,\n ...marks,\n\n anchor,\n focus: anchor,\n })\n }\n }\n\n // Update EDITOR_TO_MARK_PLACEHOLDER_MARKS in setTimeout useEffect to ensure we don't set it\n // before we receive the composition end event.\n useEffect(() => {\n setTimeout(() => {\n const { selection } = editor\n if (selection) {\n const { anchor } = selection\n const text = Node.leaf(editor, anchor.path)\n\n // While marks isn't a 'complete' text, we can still use loose Text.equals\n // here which only compares marks anyway.\n if (marks && !Text.equals(text, marks as Text, { loose: true })) {\n EDITOR_TO_PENDING_INSERTION_MARKS.set(editor, marks)\n return\n }\n }\n\n EDITOR_TO_PENDING_INSERTION_MARKS.delete(editor)\n })\n })\n\n return (\n <ReadOnlyContext.Provider value={readOnly}>\n <ComposingContext.Provider value={isComposing}>\n <DecorateContext.Provider value={decorate}>\n <RestoreDOM node={ref} receivedUserInput={receivedUserInput}>\n <Component\n role={readOnly ? undefined : 'textbox'}\n aria-multiline={readOnly ? undefined : true}\n {...attributes}\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we'd\n // have to use hacks to make these replacement-based features work.\n // For SSR situations HAS_BEFORE_INPUT_SUPPORT is false and results in prop\n // mismatch warning app moves to browser. Pass-through consumer props when\n // not CAN_USE_DOM (SSR) and default to falsy value\n spellCheck={\n HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM\n ? attributes.spellCheck\n : false\n }\n autoCorrect={\n HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM\n ? attributes.autoCorrect\n : 'false'\n }\n autoCapitalize={\n HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM\n ? attributes.autoCapitalize\n : 'false'\n }\n data-slate-editor\n data-slate-node=\"value\"\n // explicitly set this\n contentEditable={!readOnly}\n // in some cases, a decoration needs access to the range / selection to decorate a text node,\n // then you will select the whole text node when you select part the of text\n // this magic zIndex=\"-1\" will fix it\n zindex={-1}\n suppressContentEditableWarning\n ref={callbackRef}\n style={{\n ...(disableDefaultStyles\n ? {}\n : {\n // Allow positioning relative to the editable element.\n position: 'relative',\n // Preserve adjacent whitespace and new lines.\n whiteSpace: 'pre-wrap',\n // Allow words to break if they are too long.\n wordWrap: 'break-word',\n // Make the minimum height that of the placeholder.\n ...(placeholderHeight\n ? { minHeight: placeholderHeight }\n : {}),\n }),\n // Allow for passed-in styles to override anything.\n ...userStyle,\n }}\n onBeforeInput={useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to React's leaky polyfill instead just for it. It\n // only works for the `insertText` input type.\n if (\n !HAS_BEFORE_INPUT_SUPPORT &&\n !readOnly &&\n !isEventHandled(event, attributes.onBeforeInput) &&\n ReactEditor.hasSelectableTarget(editor, event.target)\n ) {\n event.preventDefault()\n if (!ReactEditor.isComposing(editor)) {\n const text = (event as any).data as string\n Editor.insertText(editor, text)\n }\n }\n },\n [attributes.onBeforeInput, editor, readOnly]\n )}\n onInput={useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (isEventHandled(event, attributes.onInput)) {\n return\n }\n\n if (androidInputManagerRef.current) {\n androidInputManagerRef.current.handleInput()\n return\n }\n\n // Flush native operations, as native events will have propogated\n // and we can correctly compare DOM text values in components\n // to stop rendering, so that browser functions like autocorrect\n // and spellcheck work as expected.\n for (const op of deferredOperations.current) {\n op()\n }\n deferredOperations.current = []\n\n // COMPAT: Since `beforeinput` doesn't fully `preventDefault`,\n // there's a chance that content might be placed in the browser's undo stack.\n // This means undo can be triggered even when the div is not focused,\n // and it only triggers the input event for the node. (2024/10/09)\n if (!ReactEditor.isFocused(editor)) {\n const native = event.nativeEvent as InputEvent\n const maybeHistoryEditor: any = editor\n if (\n native.inputType === 'historyUndo' &&\n typeof maybeHistoryEditor.undo === 'function'\n ) {\n maybeHistoryEditor.undo()\n return\n }\n if (\n native.inputType === 'historyRedo' &&\n typeof maybeHistoryEditor.redo === 'function'\n ) {\n maybeHistoryEditor.redo()\n return\n }\n }\n },\n [attributes.onInput, editor]\n )}\n onBlur={useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n if (\n readOnly ||\n state.isUpdatingSelection ||\n !ReactEditor.hasSelectableTarget(editor, event.target) ||\n isEventHandled(event, attributes.onBlur)\n ) {\n return\n }\n\n // COMPAT: If the current `activeElement` is still the previous\n // one, this is due to the window being blurred when the tab\n // itself becomes unfocused, so we want to abort early to allow to\n // editor to stay focused when the tab becomes focused again.\n const root = ReactEditor.findDocumentOrShadowRoot(editor)\n if (state.latestElement === root.activeElement) {\n return\n }\n\n const { relatedTarget } = event\n const el = ReactEditor.toDOMNode(editor, editor)\n\n // COMPAT: The event should be ignored if the focus is returning\n // to the editor from an embedded editable element (eg. an <input>\n // element inside a void node).\n if (relatedTarget === el) {\n return\n }\n\n // COMPAT: The event should be ignored if the focus is moving from\n // the editor to inside a void node's spacer element.\n if (\n isDOMElement(relatedTarget) &&\n relatedTarget.hasAttribute('data-slate-spacer')\n ) {\n return\n }\n\n // COMPAT: The event should be ignored if the focus is moving to a\n // non- editable section of an element that isn't a void node (eg.\n // a list item of the check list example).\n if (\n relatedTarget != null &&\n isDOMNode(relatedTarget) &&\n ReactEditor.hasDOMNode(editor, relatedTarget)\n ) {\n const node = ReactEditor.toSlateNode(\n editor,\n relatedTarget\n )\n\n if (Element.isElement(node) && !editor.isVoid(node)) {\n return\n }\n }\n\n // COMPAT: Safari doesn't always remove the selection even if the content-\n // editable element no longer has focus. Refer to:\n // https://stackoverflow.com/questions/12353247/force-contenteditable-div-to-stop-accepting-input-after-it-loses-focus-under-web\n if (IS_WEBKIT) {\n const domSelection = getSelection(root)\n domSelection?.removeAllRanges()\n }\n\n IS_FOCUSED.delete(editor)\n },\n [\n readOnly,\n state.isUpdatingSelection,\n state.latestElement,\n editor,\n attributes.onBlur,\n ]\n )}\n onClick={useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n if (\n ReactEditor.hasTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onClick) &&\n isDOMNode(event.target)\n ) {\n const node = ReactEditor.toSlateNode(editor, event.target)\n const path = ReactEditor.findPath(editor, node)\n\n // At this time, the Slate document may be arbitrarily different,\n // because onClick handlers can change the document before we get here.\n // Therefore we must check that this path actually exists,\n // and that it still refers to the same node.\n if (\n !Editor.hasPath(editor, path) ||\n Node.get(editor, path) !== node\n ) {\n return\n }\n\n if (event.detail === TRIPLE_CLICK && path.length >= 1) {\n let blockPath = path\n if (\n !(\n Element.isElement(node) &&\n Editor.isBlock(editor, node)\n )\n ) {\n const block = Editor.above(editor, {\n match: n =>\n Element.isElement(n) && Editor.isBlock(editor, n),\n at: path,\n })\n\n blockPath = block?.[1] ?? path.slice(0, 1)\n }\n\n const range = Editor.range(editor, blockPath)\n Transforms.select(editor, range)\n return\n }\n\n if (readOnly) {\n return\n }\n\n const start = Editor.start(editor, path)\n const end = Editor.end(editor, path)\n const startVoid = Editor.void(editor, { at: start })\n const endVoid = Editor.void(editor, { at: end })\n\n if (\n startVoid &&\n endVoid &&\n Path.equals(startVoid[1], endVoid[1])\n ) {\n const range = Editor.range(editor, start)\n Transforms.select(editor, range)\n }\n }\n },\n [editor, attributes.onClick, readOnly]\n )}\n onCompositionEnd={useCallback(\n (event: React.CompositionEvent<HTMLDivElement>) => {\n if (ReactEditor.hasSelectableTarget(editor, event.target)) {\n if (ReactEditor.isComposing(editor)) {\n Promise.resolve().then(() => {\n setIsComposing(false)\n IS_COMPOSING.set(editor, false)\n })\n }\n\n androidInputManagerRef.current?.handleCompositionEnd(\n event\n )\n\n if (\n isEventHandled(event, attributes.onCompositionEnd) ||\n IS_ANDROID\n ) {\n return\n }\n\n // COMPAT: In Chrome, `beforeinput` events for compositions\n // aren't correct and never fire the \"insertFromComposition\"\n // type that we need. So instead, insert whenever a composition\n // ends since it will already have been committed to the DOM.\n if (\n !IS_WEBKIT &&\n !IS_FIREFOX_LEGACY &&\n !IS_IOS &&\n !IS_WECHATBROWSER &&\n !IS_UC_MOBILE &&\n event.data\n ) {\n const placeholderMarks =\n EDITOR_TO_PENDING_INSERTION_MARKS.get(editor)\n EDITOR_TO_PENDING_INSERTION_MARKS.delete(editor)\n\n // Ensure we insert text with the marks the user was actually seeing\n if (placeholderMarks !== undefined) {\n EDITOR_TO_USER_MARKS.set(editor, editor.marks)\n editor.marks = placeholderMarks\n }\n\n Editor.insertText(editor, event.data)\n\n const userMarks = EDITOR_TO_USER_MARKS.get(editor)\n EDITOR_TO_USER_MARKS.delete(editor)\n if (userMarks !== undefined) {\n editor.marks = userMarks\n }\n }\n }\n },\n [attributes.onCompositionEnd, editor]\n )}\n onCompositionUpdate={useCallback(\n (event: React.CompositionEvent<HTMLDivElement>) => {\n if (\n ReactEditor.hasSelectableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onCompositionUpdate)\n ) {\n if (!ReactEditor.isComposing(editor)) {\n setIsComposing(true)\n IS_COMPOSING.set(editor, true)\n }\n }\n },\n [attributes.onCompositionUpdate, editor]\n )}\n onCompositionStart={useCallback(\n (event: React.CompositionEvent<HTMLDivElement>) => {\n if (ReactEditor.hasSelectableTarget(editor, event.target)) {\n androidInputManagerRef.current?.handleCompositionStart(\n event\n )\n\n if (\n isEventHandled(event, attributes.onCompositionStart) ||\n IS_ANDROID\n ) {\n return\n }\n\n setIsComposing(true)\n\n const { selection } = editor\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor)\n return\n }\n }\n },\n [attributes.onCompositionStart, editor]\n )}\n onCopy={useCallback(\n (event: React.ClipboardEvent<HTMLDivElement>) => {\n if (\n ReactEditor.hasSelectableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onCopy) &&\n !isDOMEventTargetInput(event)\n ) {\n event.preventDefault()\n ReactEditor.setFragmentData(\n editor,\n event.clipboardData,\n 'copy'\n )\n }\n },\n [attributes.onCopy, editor]\n )}\n onCut={useCallback(\n (event: React.ClipboardEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasSelectableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onCut) &&\n !isDOMEventTargetInput(event)\n ) {\n event.preventDefault()\n ReactEditor.setFragmentData(\n editor,\n event.clipboardData,\n 'cut'\n )\n const { selection } = editor\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Editor.deleteFragment(editor)\n } else {\n const node = Node.parent(\n editor,\n selection.anchor.path\n )\n if (Editor.isVoid(editor, node)) {\n Transforms.delete(editor)\n }\n }\n }\n }\n },\n [readOnly, editor, attributes.onCut]\n )}\n onDragOver={useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (\n ReactEditor.hasTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onDragOver)\n ) {\n // Only when the target is void, call `preventDefault` to signal\n // that drops are allowed. Editable content is droppable by\n // default, and calling `preventDefault` hides the cursor.\n const node = ReactEditor.toSlateNode(editor, event.target)\n\n if (\n Element.isElement(node) &&\n Editor.isVoid(editor, node)\n ) {\n event.preventDefault()\n }\n }\n },\n [attributes.onDragOver, editor]\n )}\n onDragStart={useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onDragStart)\n ) {\n const node = ReactEditor.toSlateNode(editor, event.target)\n const path = ReactEditor.findPath(editor, node)\n const voidMatch =\n (Element.isElement(node) &&\n Editor.isVoid(editor, node)) ||\n Editor.void(editor, { at: path, voids: true })\n\n // If starting a drag on a void node, make sure it is selected\n // so that it shows up in the selection's fragment.\n if (voidMatch) {\n const range = Editor.range(editor, path)\n Transforms.select(editor, range)\n }\n\n state.isDraggingInternally = true\n\n ReactEditor.setFragmentData(\n editor,\n event.dataTransfer,\n 'drag'\n )\n }\n },\n [readOnly, editor, attributes.onDragStart, state]\n )}\n onDrop={useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onDrop)\n ) {\n event.preventDefault()\n\n // Keep a reference to the dragged range before updating selection\n const draggedRange = editor.selection\n\n // Find the range where the drop happened\n const range = ReactEditor.findEventRange(editor, event)\n const data = event.dataTransfer\n\n Transforms.select(editor, range)\n\n if (state.isDraggingInternally) {\n if (\n draggedRange &&\n !Range.equals(draggedRange, range) &&\n !Editor.void(editor, { at: range, voids: true })\n ) {\n Transforms.delete(editor, {\n at: draggedRange,\n })\n }\n }\n\n ReactEditor.insertData(editor, data)\n\n // When dragging from another source into the editor, it's possible\n // that the current editor does not have focus.\n if (!ReactEditor.isFocused(editor)) {\n ReactEditor.focus(editor)\n }\n }\n },\n [readOnly, editor, attributes.onDrop, state]\n )}\n onDragEnd={useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n state.isDraggingInternally &&\n attributes.onDragEnd &&\n ReactEditor.hasTarget(editor, event.target)\n ) {\n attributes.onDragEnd(event)\n }\n },\n [readOnly, state, attributes, editor]\n )}\n onFocus={useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n !state.isUpdatingSelection &&\n ReactEditor.hasEditableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onFocus)\n ) {\n const el = ReactEditor.toDOMNode(editor, editor)\n const root = ReactEditor.findDocumentOrShadowRoot(editor)\n state.latestElement = root.activeElement\n\n // COMPAT: If the editor has nested editable elements, the focus\n // can go to them. In Firefox, this must be prevented because it\n // results in issues with keyboard navigation. (2017/03/30)\n if (IS_FIREFOX && event.target !== el) {\n el.focus()\n return\n }\n\n IS_FOCUSED.set(editor, true)\n }\n },\n [readOnly, state, editor, attributes.onFocus]\n )}\n onKeyDown={useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasEditableTarget(editor, event.target)\n ) {\n androidInputManagerRef.current?.handleKeyDown(event)\n\n const { nativeEvent } = event\n\n // COMPAT: The composition end event isn't fired reliably in all browsers,\n // so we sometimes might end up stuck in a composition state even though we\n // aren't composing any more.\n if (\n ReactEditor.isComposing(editor) &&\n nativeEvent.isComposing === false\n ) {\n IS_COMPOSING.set(editor, false)\n setIsComposing(false)\n }\n\n if (\n isEventHandled(event, attributes.onKeyDown) ||\n ReactEditor.isComposing(editor)\n ) {\n return\n }\n\n const { selection } = editor\n const element =\n editor.children[\n selection !== null ? selection.focus.path[0] : 0\n ]\n const isRTL = getDirection(Node.string(element)) === 'rtl'\n\n // COMPAT: Since we prevent the default behavior on\n // `beforeinput` events, the browser doesn't think there's ever\n // any history stack to undo or redo, so we have to manage these\n // hotkeys ourselves. (2019/11/06)\n if (Hotkeys.isRedo(nativeEvent)) {\n event.preventDefault()\n const maybeHistoryEditor: any = editor\n\n if (typeof maybeHistoryEditor.redo === 'function') {\n maybeHistoryEditor.redo()\n }\n\n return\n }\n\n if (Hotkeys.isUndo(nativeEvent)) {\n event.preventDefault()\n const maybeHistoryEditor: any = editor\n\n if (typeof maybeHistoryEditor.undo === 'function') {\n maybeHistoryEditor.undo()\n }\n\n return\n }\n\n // COMPAT: Certain browsers don't handle the selection updates\n // properly. In Chrome, the selection isn't properly extended.\n // And in Firefox, the selection isn't properly collapsed.\n // (2017/10/17)\n if (Hotkeys.isMoveLineBackward(nativeEvent)) {\n event.preventDefault()\n Transforms.move(editor, { unit: 'line', reverse: true })\n return\n }\n\n if (Hotkeys.isMoveLineForward(nativeEvent)) {\n event.preventDefault()\n Transforms.move(editor, { unit: 'line' })\n return\n }\n\n if (Hotkeys.isExtendLineBackward(nativeEvent)) {\n event.preventDefault()\n Transforms.move(editor, {\n unit: 'line',\n edge: 'focus',\n reverse: true,\n })\n return\n }\n\n if (Hotkeys.isExtendLineForward(nativeEvent)) {\n event.preventDefault()\n Transforms.move(editor, { unit: 'line', edge: 'focus' })\n return\n }\n\n // COMPAT: If a void node is selected, or a zero-width text node\n // adjacent to an inline is selected, we need to handle these\n // hotkeys manually because browsers won't be able to skip over\n // the void node with the zero-width space not being an empty\n // string.\n if (Hotkeys.isMoveBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.move(editor, { reverse: !isRTL })\n } else {\n Transforms.collapse(editor, {\n edge: isRTL ? 'end' : 'start',\n })\n }\n\n return\n }\n\n if (Hotkeys.isMoveForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.move(editor, { reverse: isRTL })\n } else {\n Transforms.collapse(editor, {\n edge: isRTL ? 'start' : 'end',\n })\n }\n\n return\n }\n\n if (Hotkeys.isMoveWordBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.collapse(editor, { edge: 'focus' })\n }\n\n Transforms.move(editor, {\n unit: 'word',\n reverse: !isRTL,\n })\n return\n }\n\n if (Hotkeys.isMoveWordForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.collapse(editor, { edge: 'focus' })\n }\n\n Transforms.move(editor, {\n unit: 'word',\n reverse: isRTL,\n })\n return\n }\n\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to guessing at the input intention for hotkeys.\n // COMPAT: In iOS, some of these hotkeys are handled in the\n if (!HAS_BEFORE_INPUT_SUPPORT) {\n // We don't have a core behavior for these, but they change the\n // DOM if we don't prevent them, so we have to.\n if (\n Hotkeys.isBold(nativeEvent) ||\n Hotkeys.isItalic(nativeEvent) ||\n Hotkeys.isTransposeCharacter(nativeEvent)\n ) {\n event.preventDefault()\n return\n }\n\n if (Hotkeys.isSoftBreak(nativeEvent)) {\n event.preventDefault()\n Editor.insertSoftBreak(editor)\n return\n }\n\n if (Hotkeys.isSplitBlock(nativeEvent)) {\n event.preventDefault()\n Editor.insertBreak(editor)\n return\n }\n\n if (Hotkeys.isDeleteBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward',\n })\n } else {\n Editor.deleteBackward(editor)\n }\n\n return\n }\n\n if (Hotkeys.isDeleteForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward',\n })\n } else {\n Editor.deleteForward(editor)\n }\n\n return\n }\n\n if (Hotkeys.isDeleteLineBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward',\n })\n } else {\n Editor.deleteBackward(editor, { unit: 'line' })\n }\n\n return\n }\n\n if (Hotkeys.isDeleteLineForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward',\n })\n } else {\n Editor.deleteForward(editor, { unit: 'line' })\n }\n\n return\n }\n\n if (Hotkeys.isDeleteWordBackward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward',\n })\n } else {\n Editor.deleteBackward(editor, { unit: 'word' })\n }\n\n return\n }\n\n if (Hotkeys.isDeleteWordForward(nativeEvent)) {\n event.preventDefault()\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward',\n })\n } else {\n Editor.deleteForward(editor, { unit: 'word' })\n }\n\n return\n }\n } else {\n if (IS_CHROME || IS_WEBKIT) {\n // COMPAT: Chrome and Safari support `beforeinput` event but do not fire\n // an event when deleting backwards in a selected void inline node\n if (\n selection &&\n (Hotkeys.isDeleteBackward(nativeEvent) ||\n Hotkeys.isDeleteForward(nativeEvent)) &&\n Range.isCollapsed(selection)\n ) {\n const currentNode = Node.parent(\n editor,\n selection.anchor.path\n )\n\n if (\n Element.isElement(currentNode) &&\n Editor.isVoid(editor, currentNode) &&\n (Editor.isInline(editor, currentNode) ||\n Editor.isBlock(editor, currentNode))\n ) {\n event.preventDefault()\n Editor.deleteBackward(editor, { unit: 'block' })\n\n return\n }\n }\n }\n }\n }\n },\n [readOnly, editor, attributes.onKeyDown]\n )}\n onPaste={useCallback(\n (event: React.ClipboardEvent<HTMLDivElement>) => {\n if (\n !readOnly &&\n ReactEditor.hasEditableTarget(editor, event.target) &&\n !isEventHandled(event, attributes.onPaste)\n ) {\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to React's `onPaste` here instead.\n // COMPAT: Firefox, Chrome and Safari don't emit `beforeinput` events\n // when \"paste without formatting\" is used, so fallback. (2020/02/20)\n // COMPAT: Safari InputEvents generated by pasting won't include\n // application/x-slate-fragment items, so use the\n // ClipboardEvent here. (2023/03/15)\n if (\n !HAS_BEFORE_INPUT_SUPPORT ||\n isPlainTextOnlyPaste(event.nativeEvent) ||\n IS_WEBKIT\n ) {\n event.preventDefault()\n ReactEditor.insertData(editor, event.clipboardData)\n }\n }\n },\n [readOnly, editor, attributes.onPaste]\n )}\n >\n <Children\n decorations={decorations}\n node={editor}\n renderElement={renderElement}\n renderPlaceholder={renderPlaceholder}\n renderLeaf={renderLeaf}\n selection={editor.selection}\n />\n </Component>\n </RestoreDOM>\n </DecorateContext.Provider>\n </ComposingContext.Provider>\n </ReadOnlyContext.Provider>\n )\n }\n)\n\n/**\n * The props that get passed to renderPlaceholder\n */\nexport type RenderPlaceholderProps = {\n children: any\n attributes: {\n 'data-slate-placeholder': boolean\n dir?: 'rtl'\n contentEditable: boolean\n ref: React.RefCallback<any>\n style: React.CSSProperties\n }\n}\n\n/**\n * The default placeholder element\n */\n\nexport const DefaultPlaceholder = ({\n attributes,\n children,\n}: RenderPlaceholderProps) => (\n // COMPAT: Artificially add a line-break to the end on the placeholder element\n // to prevent Android IMEs to pick up its content in autocorrect and to auto-capitalize the first letter\n <span {...attributes}>\n {children}\n {IS_ANDROID && <br />}\n </span>\n)\n\n/**\n * A default memoized decorate function.\n */\n\nexport const defaultDecorate: (entry: NodeEntry) => DecoratedRange[] = () => []\n\n/**\n * A default implement to scroll dom range into view.\n */\n\nconst defaultScrollSelectionIntoView = (\n editor: ReactEditor,\n domRange: DOMRange\n) => {\n // This was affecting the selection of multiple blocks and dragging behavior,\n // so enabled only if the selection has been collapsed.\n if (\n domRange.getBoundingClientRect &&\n (!editor.selection ||\n (editor.selection && Range.isCollapsed(editor.selection)))\n ) {\n const leafEl = domRange.startContainer.parentElement!\n leafEl.getBoundingClientRect = domRange.getBoundingClientRect.bind(domRange)\n scrollIntoView(leafEl, {\n scrollMode: 'if-needed',\n })\n\n // @ts-expect-error an unorthodox delete D:\n delete leafEl.getBoundingClientRect\n }\n}\n\n/**\n * Check if an event is overrided by a handler.\n */\n\nexport const isEventHandled = <\n EventType extends React.SyntheticEvent<unknown, unknown>,\n>(\n event: EventType,\n handler?: (event: EventType) => void | boolean\n) => {\n if (!handler) {\n return false\n }\n // The custom event handler may return a boolean to specify whether the event\n // shall be treated as being handled or not.\n const shouldTreatEventAsHandled = handler(event)\n\n if (shouldTreatEventAsHandled != null) {\n return shouldTreatEventAsHandled\n }\n\n return event.isDefaultPrevented() || event.isPropagationStopped()\n}\n\n/**\n * Check if the event's target is an input element\n */\nexport const isDOMEventTargetInput = <\n EventType extends React.SyntheticEvent<unknown, unknown>,\n>(\n event: EventType\n) => {\n return (\n isDOMNode(event.target) &&\n (event.target instanceof HTMLInputElement ||\n event.target instanceof HTMLTextAreaElement)\n )\n}\n\n/**\n * Check if a DOM event is overrided by a handler.\n */\n\nexport const isDOMEventHandled = <E extends Event>(\n event: E,\n handler?: (event: E) => void | boolean\n) => {\n if (!handler) {\n return false\n }\n\n // The custom event handler may return a boolean to specify whether the event\n // shall be treated as being handled or not.\n const shouldTreatEventAsHandled = handler(event)\n\n if (shouldTreatEventAsHandled != null) {\n return shouldTreatEventAsHandled\n }\n\n return event.defaultPrevented\n}\n","import { createContext, useContext } from 'react'\n\n/**\n * A React context for sharing the `focused` state of the editor.\n */\n\nexport const FocusedContext = createContext(false)\n\n/**\n * Get the current `focused` state of the editor.\n */\n\nexport const useFocused = (): boolean => {\n return useContext(FocusedContext)\n}\n","import {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useReducer,\n useRef,\n} from 'react'\nimport { Editor } from 'slate'\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect'\n\nfunction isError(error: any): error is Error {\n return error instanceof Error\n}\n\ntype EditorChangeHandler = (editor: Editor) => void\n/**\n * A React context for sharing the editor selector context in a way to control rerenders\n */\n\nexport const SlateSelectorContext = createContext<{\n getSlate: () => Editor\n addEventListener: (callback: EditorChangeHandler) => () => void\n}>({} as any)\n\nconst refEquality = (a: any, b: any) => a === b\n\n/**\n * use redux style selectors to prevent rerendering on every keystroke.\n * Bear in mind rerendering can only prevented if the returned value is a value type or for reference types (e.g. objects and arrays) add a custom equality function.\n *\n * Example:\n * ```\n * const isSelectionActive = useSlateSelector(editor => Boolean(editor.selection));\n * ```\n */\nexport function useSlateSelector<T>(\n selector: (editor: Editor) => T,\n equalityFn: (a: T, b: T) => boolean = refEquality\n) {\n const [, forceRender] = useReducer(s => s + 1, 0)\n const context = useContext(SlateSelectorContext)\n if (!context) {\n throw new Error(\n `The \\`useSlateSelector\\` hook must be used inside the <Slate> component's context.`\n )\n }\n const { getSlate, addEventListener } = context\n\n const latestSubscriptionCallbackError = useRef<Error | undefined>()\n const latestSelector = useRef<(editor: Editor) => T>(() => null as any)\n const latestSelectedState = useRef<T>(null as any as T)\n let selectedState: T\n\n try {\n if (\n selector !== latestSelector.current ||\n latestSubscriptionCallbackError.current\n ) {\n selectedState = selector(getSlate())\n } else {\n selectedState = latestSelectedState.current\n }\n } catch (err) {\n if (latestSubscriptionCallbackError.current && isError(err)) {\n err.message += `\\nThe error may be correlated with this previous error:\\n${latestSubscriptionCallbackError.current.stack}\\n\\n`\n }\n\n throw err\n }\n useIsomorphicLayoutEffect(() => {\n latestSelector.current = selector\n latestSelectedState.current = selectedState\n latestSubscriptionCallbackError.current = undefined\n })\n\n useIsomorphicLayoutEffect(\n () => {\n function checkForUpdates() {\n try {\n const newSelectedState = latestSelector.current(getSlate())\n\n if (equalityFn(newSelectedState, latestSelectedState.current)) {\n return\n }\n\n latestSelectedState.current = newSelectedState\n } catch (err) {\n // we ignore all errors here, since when the component\n // is re-rendered, the selectors are called again, and\n // will throw again, if neither props nor store state\n // changed\n if (err instanceof Error) {\n latestSubscriptionCallbackError.current = err\n } else {\n latestSubscriptionCallbackError.current = new Error(String(err))\n }\n }\n\n forceRender()\n }\n\n const unsubscribe = addEventListener(checkForUpdates)\n\n checkForUpdates()\n\n return () => unsubscribe()\n },\n // don't rerender on equalityFn change since we want to be able to define it inline\n [addEventListener, getSlate]\n )\n\n return selectedState\n}\n\n/**\n * Create selector context with editor updating on every editor change\n */\nexport function useSelectorContext(editor: Editor) {\n const eventListeners = useRef<EditorChangeHandler[]>([]).current\n const slateRef = useRef<{\n editor: Editor\n }>({\n editor,\n }).current\n const onChange = useCallback(\n (editor: Editor) => {\n slateRef.editor = editor\n eventListeners.forEach((listener: EditorChangeHandler) =>\n listener(editor)\n )\n },\n [eventListeners, slateRef]\n )\n\n const selectorContext = useMemo(() => {\n return {\n getSlate: () => slateRef.editor,\n addEventListener: (callback: EditorChangeHandler) => {\n eventListeners.push(callback)\n return () => {\n eventListeners.splice(eventListeners.indexOf(callback), 1)\n }\n },\n }\n }, [eventListeners, slateRef])\n return { selectorContext, onChange }\n}\n","import React from 'react'\n\nexport const REACT_MAJOR_VERSION = parseInt(React.version.split('.')[0], 10)\n","import React, { useCallback, useEffect, useState } from 'react'\nimport { Descendant, Editor, Node, Operation, Scrubber, Selection } from 'slate'\nimport { EDITOR_TO_ON_CHANGE } from 'slate-dom'\nimport { FocusedContext } from '../hooks/use-focused'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { SlateContext, SlateContextValue } from '../hooks/use-slate'\nimport {\n useSelectorContext,\n SlateSelectorContext,\n} from '../hooks/use-slate-selector'\nimport { EditorContext } from '../hooks/use-slate-static'\nimport { ReactEditor } from '../plugin/react-editor'\nimport { REACT_MAJOR_VERSION } from '../utils/environment'\n\n/**\n * A wrapper around the provider to handle `onChange` events, because the editor\n * is a mutable singleton so it won't ever register as \"changed\" otherwise.\n */\n\nexport const Slate = (props: {\n editor: ReactEditor\n initialValue: Descendant[]\n children: React.ReactNode\n onChange?: (value: Descendant[]) => void\n onSelectionChange?: (selection: Selection) => void\n onValueChange?: (value: Descendant[]) => void\n}) => {\n const {\n editor,\n children,\n onChange,\n onSelectionChange,\n onValueChange,\n initialValue,\n ...rest\n } = props\n\n const [context, setContext] = React.useState<SlateContextValue>(() => {\n if (!Node.isNodeList(initialValue)) {\n throw new Error(\n `[Slate] initialValue is invalid! Expected a list of elements but got: ${Scrubber.stringify(\n initialValue\n )}`\n )\n }\n if (!Editor.isEditor(editor)) {\n throw new Error(\n `[Slate] editor is invalid! You passed: ${Scrubber.stringify(editor)}`\n )\n }\n editor.children = initialValue\n Object.assign(editor, rest)\n return { v: 0, editor }\n })\n\n const { selectorContext, onChange: handleSelectorChange } =\n useSelectorContext(editor)\n\n const onContextChange = useCallback(\n (options?: { operation?: Operation }) => {\n if (onChange) {\n onChange(editor.children)\n }\n\n switch (options?.operation?.type) {\n case 'set_selection':\n onSelectionChange?.(editor.selection)\n break\n default:\n onValueChange?.(editor.children)\n }\n\n setContext(prevContext => ({\n v: prevContext.v + 1,\n editor,\n }))\n handleSelectorChange(editor)\n },\n [editor, handleSelectorChange, onChange, onSelectionChange, onValueChange]\n )\n\n useEffect(() => {\n EDITOR_TO_ON_CHANGE.set(editor, onContextChange)\n\n return () => {\n EDITOR_TO_ON_CHANGE.set(editor, () => {})\n }\n }, [editor, onContextChange])\n\n const [isFocused, setIsFocused] = useState(ReactEditor.isFocused(editor))\n\n useEffect(() => {\n setIsFocused(ReactEditor.isFocused(editor))\n }, [editor])\n\n useIsomorphicLayoutEffect(() => {\n const fn = () => setIsFocused(ReactEditor.isFocused(editor))\n if (REACT_MAJOR_VERSION >= 17) {\n // In React >= 17 onFocus and onBlur listen to the focusin and focusout events during the bubbling phase.\n // Therefore in order for <Editable />'s handlers to run first, which is necessary for ReactEditor.isFocused(editor)\n // to return the correct value, we have to listen to the focusin and focusout events without useCapture here.\n document.addEventListener('focusin', fn)\n document.addEventListener('focusout', fn)\n return () => {\n document.removeEventListener('focusin', fn)\n document.removeEventListener('focusout', fn)\n }\n } else {\n document.addEventListener('focus', fn, true)\n document.addEventListener('blur', fn, true)\n return () => {\n document.removeEventListener('focus', fn, true)\n document.removeEventListener('blur', fn, true)\n }\n }\n }, [])\n\n return (\n <SlateSelectorContext.Provider value={selectorContext}>\n <SlateContext.Provider value={context}>\n <EditorContext.Provider value={context.editor}>\n <FocusedContext.Provider value={isFocused}>\n {children}\n </FocusedContext.Provider>\n </EditorContext.Provider>\n </SlateContext.Provider>\n </SlateSelectorContext.Provider>\n )\n}\n","import { useContext } from 'react'\n\nimport { EditorContext } from './use-slate-static'\n\n/**\n * Get the current editor object from the React context.\n * @deprecated Use useSlateStatic instead.\n */\n\nexport const useEditor = () => {\n const editor = useContext(EditorContext)\n\n if (!editor) {\n throw new Error(\n `The \\`useEditor\\` hook must be used inside the <Slate> component's context.`\n )\n }\n\n return editor\n}\n","import { BaseSelection, Range } from 'slate'\n\nimport { useSlateSelector } from './use-slate-selector'\n\n/**\n * Get the current slate selection.\n * Only triggers a rerender when the selection actually changes\n */\nexport const useSlateSelection = () => {\n return useSlateSelector(editor => editor.selection, isSelectionEqual)\n}\n\nconst isSelectionEqual = (a: BaseSelection, b: BaseSelection) => {\n if (!a && !b) return true\n if (!a || !b) return false\n return Range.equals(a, b)\n}\n","import ReactDOM from 'react-dom'\nimport { BaseEditor } from 'slate'\nimport { withDOM } from 'slate-dom'\nimport { ReactEditor } from './react-editor'\nimport { REACT_MAJOR_VERSION } from '../utils/environment'\n\n/**\n * `withReact` adds React and DOM specific behaviors to the editor.\n *\n * If you are using TypeScript, you must extend Slate's CustomTypes to use\n * this plugin.\n *\n * See https://docs.slatejs.org/concepts/11-typescript to learn how.\n */\nexport const withReact = <T extends BaseEditor>(\n editor: T,\n clipboardFormatKey = 'x-slate-fragment'\n): T & ReactEditor => {\n let e = editor as T & ReactEditor\n\n e = withDOM(e, clipboardFormatKey)\n\n const { onChange } = e\n\n e.onChange = options => {\n // COMPAT: React < 18 doesn't batch `setState` hook calls, which means\n // that the children and selection can get out of sync for one render\n // pass. So we have to use this unstable API to ensure it batches them.\n // (2019/12/03)\n // https://github.com/facebook/react/issues/14259#issuecomment-439702367\n const maybeBatchUpdates =\n REACT_MAJOR_VERSION < 18\n ? ReactDOM.unstable_batchedUpdates\n : (callback: () => void) => callback()\n\n maybeBatchUpdates(() => {\n onChange(options)\n })\n }\n\n return e\n}\n"],"names":["objectWithoutPropertiesLoose","toPrimitive","toPropertyKey","EditorContext","createContext","useSlateStatic","editor","useContext","Error","ReactEditor","DOMEditor","RESOLVE_DELAY","FLUSH_DELAY","debug","isDataTransfer","value","constructor","name","createAndroidInputManager","_ref","scheduleOnDOMSelectionChange","onDOMSelectionChange","flushing","compositionEndTimeoutId","flushTimeoutId","actionTimeoutId","idCounter","insertPositionHint","applyPendingSelection","pendingSelection","EDITOR_TO_PENDING_SELECTION","get","delete","selection","normalized","normalizeRange","Range","equals","Transforms","select","performAction","action","EDITOR_TO_PENDING_ACTION","at","target","Point","isPoint","normalizePoint","targetRange","Editor","range","run","flush","clearTimeout","hasPendingDiffs","hasPendingAction","setTimeout","selectionRef","rangeRef","affinity","EDITOR_TO_USER_MARKS","set","marks","EDITOR_TO_PENDING_DIFFS","scheduleSelectionChange","diff","_EDITOR_TO_PENDING_DI","_EDITOR_TO_PENDING_DI2","pendingMarks","EDITOR_TO_PENDING_INSERTION_MARKS","undefined","text","insertText","deleteFragment","filter","_ref2","id","verifyDiffState","cancel","unref","userMarks","onChange","handleCompositionEnd","_event","IS_COMPOSING","handleCompositionStart","updatePlaceholderVisibility","forceHide","arguments","length","placeholderElement","EDITOR_TO_PLACEHOLDER_ELEMENT","style","display","removeProperty","storeDiff","path","_EDITOR_TO_PENDING_DI3","pendingDiffs","Node","leaf","idx","findIndex","change","Path","normalizeStringDiff","push","merged","mergeStringDiffs","splice","_objectSpread","scheduleAction","handleDOMBeforeInput","event","_targetRange2","IS_NODE_MAP_DIRTY","inputType","type","data","dataTransfer","nativeTargetRange","getTargetRanges","toSlateRange","exactMatch","suppressThrow","window","getWindow","domSelection","getSelection","canStoreDiff","startsWith","isExpanded","start","end","edges","offset","next","match","Text","isText","anchor","focus","direction","endsWith","relevantPendingDiffs","find","diffs","applyStringDiff","point","handleUserSelect","isCollapsed","targetNode","deleteForward","_nativeTargetRange","nativeCollapsed","isDOMSelection","collapsed","deleteBackward","unit","insertSoftBreak","insertBreak","insertData","replace","test","slice","includes","parts","split","forEach","line","i","hintPosition","search","diffPosition","scheduleFlush","_EDITOR_TO_PENDING_DI4","hasPendingChanges","isFlushing","pathChanged","parentPathChanged","handleInput","handleKeyDown","_","handleDomMutations","mutations","some","mutation","isTrackedMutation","_EDITOR_TO_FORCE_REND","EDITOR_TO_FORCE_RENDER","useIsMounted","isMountedRef","useRef","useEffect","current","useIsomorphicLayoutEffect","CAN_USE_DOM","useLayoutEffect","useMutationObserver","node","callback","options","mutationObserver","useState","MutationObserver","takeRecords","observe","disconnect","MUTATION_OBSERVER_CONFIG","subtree","childList","characterData","useAndroidInputManager","IS_ANDROID","_objectWithoutProperties","_excluded","isMounted","inputManager","EDITOR_TO_SCHEDULE_FLUSH","String","props","isLast","parent","findPath","parentPath","isMarkPlaceholder","Boolean","MARK_PLACEHOLDER_SYMBOL","isVoid","React","createElement","ZeroWidthString","string","children","isInline","isLineBreak","TextString","isTrailing","ref","getTextContent","concat","initialText","textWithTrailing","textContent","MemoizedText","memo","forwardRef","attributes","IS_IOS","PLACEHOLDER_DELAY","disconnectPlaceholderResizeObserver","placeholderResizeObserver","releaseObserver","clearTimeoutRef","timeoutRef","Leaf","renderPlaceholder","renderLeaf","DefaultLeaf","placeholderRef","showPlaceholder","setShowPlaceholder","showPlaceholderTimeoutRef","callbackPlaceholderRef","useCallback","placeholderEl","_leaf$onPlaceholderRe","onPlaceholderResize","call","ResizeObserver","ResizeObserverPolyfill","_leaf$onPlaceholderRe2","leafIsPlaceholder","PLACEHOLDER_SYMBOL","placeholderProps","placeholder","position","top","pointerEvents","width","maxWidth","opacity","userSelect","textDecoration","WebkitUserModify","IS_WEBKIT","contentEditable","Fragment","MemoizedLeaf","prev","decorations","leaves","SlateText","key","findKey","callbackRef","span","KEY_TO_ELEMENT","EDITOR_TO_KEY_TO_ELEMENT","NODE_TO_ELEMENT","ELEMENT_TO_NODE","isTextDecorationsEqual","Element","element","renderElement","p","DefaultElement","readOnly","useReadOnly","useChildren","hasInlines","dir","getDirection","Tag","texts","height","color","outline","NODE_TO_INDEX","NODE_TO_PARENT","MemoizedElement","isElementDecorationsEqual","DecorateContext","useDecorate","SelectedContext","useSelected","decorate","isLeafBlock","isElement","n","sel","intersection","ds","dec","d","Provider","ElementComponent","TextComponent","ReadOnlyContext","SlateContext","useSlate","context","useSlateWithV","useTrackUserInput","receivedUserInput","animationFrameIdRef","onUserInput","cancelAnimationFrame","requestAnimationFrame","createRestoreDomManager","bufferedMutations","clear","registerMutations","trackedMutations","restoreDOM","reverse","removedNodes","insertBefore","nextSibling","addedNodes","removeChild","characterDataOldValue","RestoreDOMComponent","Component","_defineProperty","_this$mutationObserve","componentDidMount","manager","getSnapshotBeforeUpdate","_this$mutationObserve2","_this$mutationObserve3","_this$manager2","pendingMutations","_this$manager","componentDidUpdate","_this$manager3","componentWillUnmount","_this$mutationObserve4","render","RestoreDOM","ComposingContext","useComposing","Children","Editable","forwardedRef","defaultRenderPlaceholder","DefaultPlaceholder","autoFocus","defaultDecorate","onDOMBeforeInput","propsOnDOMBeforeInput","scrollSelectionIntoView","defaultScrollSelectionIntoView","userStyle","as","disableDefaultStyles","isComposing","setIsComposing","deferredOperations","placeholderHeight","setPlaceholderHeight","processing","forceRender","useReducer","s","IS_READ_ONLY","state","useMemo","isDraggingInternally","isUpdatingSelection","latestElement","hasMarkPlaceholder","androidInputManagerRef","throttle","el","toDOMNode","root","getRootNode","ShadowRoot","active","getActiveElement","document","execCommand","deselect","androidInputManager","findDocumentOrShadowRoot","activeElement","IS_FOCUSED","anchorNode","focusNode","anchorNodeSelectable","hasEditableTarget","isTargetInsideNonReadonlyVoid","focusNodeInEditor","hasTarget","debounce","_androidInputManagerR","_androidInputManagerR2","getDefaultView","EDITOR_TO_WINDOW","EDITOR_TO_ELEMENT","isFocused","setDomSelection","forceChange","hasDomSelection","IS_FIREFOX","rangeCount","firstRange","getRangeAt","lastRange","startContainer","endContainer","editorElement","hasDomSelectionInEditor","contains","slateRange","_anchorNode","parentElement","hasAttribute","hasRange","newDomRange","toDOMRange","e","collapseToEnd","isBackward","setBaseAndExtent","endOffset","startOffset","removeAllRanges","ensureSelection","timeoutId","animationFrameId","ensureDomSelection","ranges","newRange","setStart","setEnd","preventDefault","stopImmediatePropagation","isDOMEventHandled","_EDITOR_TO_USER_SELEC","isCompositionChange","native","_node$parentElement","_window$getComputedSt","toDOMPoint","closest","hasDOMNode","_lastText$textContent","lastText","createTreeWalker","NodeFilter","SHOW_TEXT","lastChild","getComputedStyle","whiteSpace","block","above","isBlock","EDITOR_TO_USER_SELECTION","toRestore","HAS_BEFORE_INPUT_SUPPORT","removeEventListener","addEventListener","onSelectionChange","targetElement","HTMLElement","targetTagName","tagName","stoppedDragging","Array","from","placeHolderResizeHandler","_placeholderEl$getBou","getBoundingClientRect","rest","_excluded2","loose","unset","Object","fromEntries","keys","map","mark","role","spellCheck","autoCorrect","autoCapitalize","zindex","suppressContentEditableWarning","wordWrap","minHeight","onBeforeInput","isEventHandled","hasSelectableTarget","onInput","op","nativeEvent","maybeHistoryEditor","undo","redo","onBlur","relatedTarget","isDOMElement","isDOMNode","toSlateNode","onClick","hasPath","detail","TRIPLE_CLICK","blockPath","_block$","startVoid","void","endVoid","onCompositionEnd","_androidInputManagerR3","Promise","resolve","then","IS_FIREFOX_LEGACY","IS_WECHATBROWSER","IS_UC_MOBILE","placeholderMarks","onCompositionUpdate","onCompositionStart","_androidInputManagerR4","onCopy","isDOMEventTargetInput","setFragmentData","clipboardData","onCut","onDragOver","onDragStart","voidMatch","voids","onDrop","draggedRange","findEventRange","onDragEnd","onFocus","onKeyDown","_androidInputManagerR5","isRTL","Hotkeys","isRedo","isUndo","isMoveLineBackward","move","isMoveLineForward","isExtendLineBackward","edge","isExtendLineForward","isMoveBackward","collapse","isMoveForward","isMoveWordBackward","isMoveWordForward","isBold","isItalic","isTransposeCharacter","isSoftBreak","isSplitBlock","isDeleteBackward","isDeleteForward","isDeleteLineBackward","isDeleteLineForward","isDeleteWordBackward","isDeleteWordForward","IS_CHROME","currentNode","onPaste","isPlainTextOnlyPaste","domRange","leafEl","bind","scrollIntoView","scrollMode","handler","shouldTreatEventAsHandled","isDefaultPrevented","isPropagationStopped","HTMLInputElement","HTMLTextAreaElement","defaultPrevented","FocusedContext","useFocused","isError","error","SlateSelectorContext","refEquality","a","b","useSlateSelector","selector","equalityFn","getSlate","latestSubscriptionCallbackError","latestSelector","latestSelectedState","selectedState","err","message","stack","checkForUpdates","newSelectedState","unsubscribe","useSelectorContext","eventListeners","slateRef","listener","selectorContext","indexOf","REACT_MAJOR_VERSION","parseInt","version","Slate","onValueChange","initialValue","setContext","isNodeList","Scrubber","stringify","isEditor","assign","v","handleSelectorChange","onContextChange","_options$operation","operation","prevContext","EDITOR_TO_ON_CHANGE","setIsFocused","fn","useEditor","useSlateSelection","isSelectionEqual","withReact","clipboardFormatKey","withDOM","maybeBatchUpdates","ReactDOM","unstable_batchedUpdates"],"mappings":";;;;;;;;;;;AAAe,SAAS,6BAA6B,CAAC,MAAM,EAAE,QAAQ,EAAE;AACxE,EAAE,IAAI,MAAM,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;AAChC,EAAE,IAAI,MAAM,GAAG,EAAE,CAAC;AAClB,EAAE,IAAI,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACvC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AACb,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC1C,IAAI,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACxB,IAAI,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CA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