@portabletext/editor 7.12.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@ import { a as getNodeChildren, i as getChildren, l as serializePath, n as parent
2
2
  import { C as getAncestors, S as hasNode, _ as comparePoints, a as isInline, b as isEditableContainer, c as isSpanNode, d as resolveChildEntryIndex, f as isAncestorPath, g as isAfterPoint, h as isBackwardRange, i as getEnclosingBlock, l as getSibling, m as rangeEdges, n as getEnclosingContainer, o as getBlock, p as isTextBlockNode, s as isBlock, t as getPathSubSchema, u as getNodes, v as comparePaths, x as resolveContainerAt, y as isObject } from "./get-path-sub-schema-CZd9VcVM.js";
3
3
  import { _ as getAncestor, a as getTextBlock, c as pathContains, d as isRange, f as isPoint, g as isLeafObject, h as getLeaf, i as getFirstChild, l as getSpan, m as isPath, n as getUnionSchema, o as rangeIntersects, p as isObject$1, r as getLastChild, s as isBeforePoint, t as getContainer, u as getText } from "./get-container-D1nM_ww9.js";
4
4
  import { a as parseBlocks, b as childAtTextOffset, c as parseSpan, d as getSelectionEndPoint, f as isSelectionCollapsed, g as isEqualSelectionPoints, h as getBlockKeyFromSelectionPoint, i as parseBlock, l as defaultKeyGenerator, m as getBlockEndPoint, n as isListBlock, o as parseInlineObject, p as getBlockStartPoint, r as parseAnnotation, s as parseMarkDefs, u as getSelectionStartPoint, v as blockOffsetToSpanSelectionPoint, x as textOffsetOfChild } from "./util.slice-blocks-B2fZcNok.js";
5
- import { A as isSelectingEntireBlocks, B as getFocusTextBlock, C as getActiveAnnotationsMarks, D as getSelectionStartPoint$1, E as getPreviousSpan, F as getSelectionStartBlock, H as getFocusSpan, I as getSelectionEndBlock, K as rangesOverlap, L as getFragment, M as isSelectionExpanded, N as isSelectionCollapsed$1, O as getNextSpan, P as isOverlappingSelection, R as getSelectedValue, S as getSelectedTextBlocks, U as getFocusInlineObject, V as getFocusBlock, W as getFocusChild, a as isActiveDecorator, b as isActiveAnnotation, c as getPreviousBlock, d as getFocusListBlock, f as getFocusBlockObject, i as isActiveListItem, j as getSelectedBlocks, k as getSelectionEndPoint$1, l as getNextBlock, n as isAtTheEndOfBlock, o as getSelectionStartChild, p as getCaretWordSelection, r as isActiveStyle, s as getSelectionEndChild, t as isAtTheStartOfBlock, u as getLastBlock, w as getMarkState, x as getActiveDecorators, y as getActiveAnnotations, z as getRootAcceptedTypes } from "./selector.is-at-the-start-of-block-D0boZbDu.js";
5
+ import { A as getSelectionEndPoint$1, B as getFocusBlock, C as getSelectedTextBlocks, D as getPreviousSpan, F as getSelectionEndBlock, G as rangesOverlap, H as getFocusInlineObject, I as getFragment, L as getSelectedValue, M as isSelectionCollapsed$1, N as isOverlappingSelection, O as getSelectionStartPoint$1, P as getSelectionStartBlock, R as getRootAcceptedTypes, S as getActiveDecorators, T as getMarkState, U as getFocusChild, V as getFocusSpan, a as isActiveListItem, b as getActiveAnnotations, c as getSelectionEndChild, d as getLastBlock, f as getFocusListBlock, i as isActiveStyle, j as isSelectionExpanded, k as getNextSpan, l as getPreviousBlock, m as getCaretWordSelection, n as isAtTheStartOfBlock, o as isActiveDecorator, p as getFocusBlockObject, r as isAtTheEndOfBlock, s as getSelectionStartChild, t as isSelectingEntireBlocks, u as getNextBlock, w as getActiveAnnotationsMarks, x as isActiveAnnotation, z as getFocusTextBlock } from "./selector.is-selecting-entire-blocks-DPnzucrd.js";
6
6
  import { n as isEmptyTextBlock, r as getTextBlockText, t as isEqualSelections } from "./util.is-equal-selections-N1hxVUbE.js";
7
7
  import { a as raise$1, i as forward, n as effect, t as defineBehavior } from "./behavior.types.behavior-BxSLb73I.js";
8
8
  import { n as EditorContext$1, t as useEditor } from "./use-editor-CwNeVwVC.js";
@@ -17,7 +17,6 @@ import rawDebug from "debug";
17
17
  import { and, assertEvent, assign, createActor, emit, enqueueActions, fromCallback, not, raise, setup } from "xstate";
18
18
  import { htmlToPortableText } from "@portabletext/html";
19
19
  import { toHTML } from "@portabletext/to-html";
20
- import { markdownToPortableText, portableTextToMarkdown } from "@portabletext/markdown";
21
20
  import { applyAll, diffMatchPatch, insert, set, setIfMissing, unset } from "@portabletext/patches";
22
21
  /**
23
22
  * Resolve the DOM node corresponding to a keyed path.
@@ -226,10 +225,10 @@ function isEditor(value) {
226
225
  function point(editor, at, options = {}) {
227
226
  let { edge = "start" } = options;
228
227
  if (isPath(at)) {
229
- let path, deepest = getLeaf(editor.snapshot, at, { edge: edge === "end" ? "end" : "start" });
228
+ let deepest = getLeaf(editor.snapshot, at, { edge: edge === "end" ? "end" : "start" });
230
229
  if (!deepest) throw Error(`Cannot get the ${edge} point in the node at path [${at}] because it has no ${edge} text node.`);
231
- let { node, path: nodePath } = deepest;
232
- if (path = nodePath, !isSpan({ schema: editor.snapshot.context.schema }, node) && !isTextBlockNode({ schema: editor.snapshot.context.schema }, node) && !isEditor(node)) return {
230
+ let { node, path: nodePath } = deepest, path = nodePath;
231
+ if (!isSpan({ schema: editor.snapshot.context.schema }, node) && !isTextBlockNode({ schema: editor.snapshot.context.schema }, node) && !isEditor(node)) return {
233
232
  path,
234
233
  offset: 0
235
234
  };
@@ -410,7 +409,7 @@ const IS_IOS = typeof navigator < "u" && typeof window < "u" && /iPad|iPhone|iPo
410
409
  if (suppressThrow) return null;
411
410
  throw Error(`Cannot map DOM position to an editor location: ${domPoint}`);
412
411
  }
413
- let { path, offset } = start(editor, nodePath);
412
+ let editorStartPoint = start(editor, nodePath), { path } = editorStartPoint, { offset } = editorStartPoint;
414
413
  return node.querySelector("[data-pt-marks]") || (offset = nearestOffset), {
415
414
  path,
416
415
  offset
@@ -471,10 +470,7 @@ const IS_IOS = typeof navigator < "u" && typeof window < "u" && /iPad|iPhone|iPo
471
470
  focusNode = domRange.focusNode;
472
471
  let firstRange = domRange.getRangeAt(0), lastRange = domRange.getRangeAt(domRange.rangeCount - 1);
473
472
  if (focusNode instanceof HTMLTableRowElement && firstRange.startContainer instanceof HTMLTableRowElement && lastRange.startContainer instanceof HTMLTableRowElement) {
474
- function getLastChildren(element) {
475
- return element.childElementCount > 0 ? getLastChildren(element.children[0]) : element;
476
- }
477
- let firstNodeRow = firstRange.startContainer, lastNodeRow = lastRange.startContainer, firstNode = getLastChildren(firstNodeRow.children[firstRange.startOffset]), lastNode = getLastChildren(lastNodeRow.children[lastRange.startOffset]);
473
+ let getLastChildren = (element) => element.childElementCount > 0 ? getLastChildren(element.children[0]) : element, firstNodeRow = firstRange.startContainer, lastNodeRow = lastRange.startContainer, firstNode = getLastChildren(firstNodeRow.children[firstRange.startOffset]), lastNode = getLastChildren(lastNodeRow.children[lastRange.startOffset]);
478
474
  focusOffset = 0, anchorNode = lastNode.childNodes.length > 0 ? lastNode.childNodes[0] ?? null : lastNode, focusNode = firstNode.childNodes.length > 0 ? firstNode.childNodes[0] ?? null : firstNode, anchorOffset = lastNode instanceof HTMLElement ? lastNode.innerHTML.length : 0;
479
475
  } else firstRange.startContainer === focusNode ? (anchorNode = lastRange.endContainer, anchorOffset = lastRange.endOffset, focusOffset = firstRange.startOffset) : (anchorNode = firstRange.startContainer, anchorOffset = firstRange.endOffset, focusOffset = lastRange.startOffset);
480
476
  } else anchorNode = domRange.anchorNode, anchorOffset = domRange.anchorOffset, focusNode = domRange.focusNode, focusOffset = domRange.focusOffset;
@@ -1158,64 +1154,60 @@ function transformPath(path, operation) {
1158
1154
  return path;
1159
1155
  }
1160
1156
  /**
1161
- * Transform a point by an operation. Returns the same `point` reference when
1162
- * the operation doesn't actually move the point, so callers can use referential
1157
+ * Map a point through one step. Returns the same `point` reference when the
1158
+ * step doesn't actually move the point, so callers can use referential
1163
1159
  * equality to detect "nothing changed."
1164
- *
1165
- * With keyed paths, most operations don't affect paths at all:
1166
- * - insert: no-op (new node has its own key, doesn't shift siblings)
1167
- * - unset (node removal): invalidates if the point is at or inside the removed node
1168
- * - unset (property removal): collapses offset when `text` is unset from a span
1169
- * - insert.text: adjusts offset if in the same span
1170
- * - remove.text: adjusts offset if in the same span
1171
- * - set: updates keyed segments when `_key` changes, clamps offset when `text` changes
1172
- * - set.selection: no-op
1173
1160
  */
1174
- function transformPoint$1(point, op, options = {}) {
1161
+ function mapPointThroughStep(step, point, options = {}) {
1175
1162
  if (point === null) return null;
1176
1163
  let { affinity = "forward" } = options;
1177
- switch (op.type) {
1178
- case "insert.text": return pathEquals(op.path, point.path) && (op.offset < point.offset || op.offset === point.offset && affinity === "forward") ? {
1164
+ switch (step.type) {
1165
+ case "insert.text": return pathEquals(step.path, point.path) && (step.offset < point.offset || step.offset === point.offset && affinity === "forward") ? {
1179
1166
  path: point.path,
1180
- offset: point.offset + op.text.length
1167
+ offset: point.offset + step.text.length
1181
1168
  } : point;
1182
- case "remove.text": return pathEquals(op.path, point.path) && op.offset <= point.offset ? {
1169
+ case "remove.text": return pathEquals(step.path, point.path) && step.offset <= point.offset ? {
1183
1170
  path: point.path,
1184
- offset: point.offset - Math.min(point.offset - op.offset, op.text.length)
1171
+ offset: point.offset - Math.min(point.offset - step.offset, step.text.length)
1185
1172
  } : point;
1186
- case "set": {
1187
- let propertyName = op.path[op.path.length - 1], nodePath = op.path.slice(0, -1), path = point.path, offset = point.offset;
1188
- if (propertyName === "_key" && typeof op.value == "string") {
1189
- let oldKey = op.inverse?.type === "set" && typeof op.inverse.value == "string" ? op.inverse.value : void 0;
1190
- if (oldKey) {
1191
- let newPath;
1192
- for (let i = 0; i < path.length; i++) {
1193
- let segment = path[i];
1194
- isKeyedSegment(segment) && segment._key === oldKey && (newPath === void 0 && (newPath = [...path]), newPath[i] = { _key: op.value });
1195
- }
1196
- newPath !== void 0 && (path = newPath);
1197
- }
1198
- }
1199
- if (propertyName === "text" && pathEquals(nodePath, path) && (op.value == null || typeof op.value != "string" ? offset = 0 : offset > op.value.length && (offset = op.value.length)), propertyName === "children" && Array.isArray(op.value)) {
1200
- let remappedPoint = remapPointThroughChildrenReplacement(point, op.path, op.value, op.inverse?.type === "set" && Array.isArray(op.inverse.value) ? op.inverse.value : void 0);
1201
- remappedPoint && (path = remappedPoint.path, offset = remappedPoint.offset);
1202
- }
1203
- return path === point.path && offset === point.offset ? point : {
1204
- path,
1173
+ case "set.text": {
1174
+ if (!pathEquals(step.path, point.path)) return point;
1175
+ let offset = point.offset > step.text.length ? step.text.length : point.offset;
1176
+ return offset === point.offset ? point : {
1177
+ path: point.path,
1205
1178
  offset
1206
1179
  };
1207
1180
  }
1208
- case "unset": {
1209
- let lastSegment = op.path[op.path.length - 1];
1210
- if (isKeyedSegment(lastSegment)) return pathContains(op.path, point.path) ? null : point;
1211
- let propertyName = lastSegment, nodePath = op.path.slice(0, -1);
1212
- return propertyName === "text" && pathEquals(nodePath, point.path) && point.offset !== 0 ? {
1213
- path: point.path,
1214
- offset: 0
1215
- } : point;
1181
+ case "rekey": {
1182
+ let path;
1183
+ for (let i = 0; i < point.path.length; i++) {
1184
+ let segment = point.path[i];
1185
+ isKeyedSegment(segment) && segment._key === step.oldKey && (path === void 0 && (path = [...point.path]), path[i] = { _key: step.newKey });
1186
+ }
1187
+ return path === void 0 ? point : {
1188
+ path,
1189
+ offset: point.offset
1190
+ };
1216
1191
  }
1217
- default: return point;
1192
+ case "replace.children": return remapPointThroughChildrenReplacement(point, step.path, step.newChildren, step.oldChildren) ?? point;
1193
+ case "remove.node": return pathContains(step.path, point.path) ? null : point;
1194
+ case "unset.text": return pathEquals(step.path, point.path) && point.offset !== 0 ? {
1195
+ path: point.path,
1196
+ offset: 0
1197
+ } : point;
1198
+ }
1199
+ }
1200
+ /**
1201
+ * Map a point through a batch of steps, in order. A step that invalidates
1202
+ * the point (a node removal) short-circuits the remaining steps.
1203
+ */
1204
+ function mapPointThroughSteps(steps, point, options = {}) {
1205
+ let current = point;
1206
+ for (let step of steps) {
1207
+ if (current === null) return null;
1208
+ current = mapPointThroughStep(step, current, options);
1218
1209
  }
1210
+ return current;
1219
1211
  }
1220
1212
  /**
1221
1213
  * Map a point through a wholesale children replacement via its text
@@ -1223,13 +1215,12 @@ function transformPoint$1(point, op, options = {}) {
1223
1215
  * untransformed) unless every precondition holds: the point addresses
1224
1216
  * a direct child of the node whose children were replaced, that
1225
1217
  * child's key is gone from the new children (identity did not
1226
- * survive), the old children are known (the op's inverse), and the
1227
- * old and new children carry identical concatenated span text, the
1228
- * condition that makes offset mapping lossless.
1218
+ * survive), and the old and new children carry identical concatenated
1219
+ * span text, the condition that makes offset mapping lossless.
1229
1220
  *
1230
1221
  * Spans are detected structurally (`text` being a string) rather than
1231
- * through the schema: `transformPoint` is deliberately schema-free,
1232
- * and text-carrying children are the only ones that occupy offsets.
1222
+ * through the schema: this mapper is deliberately schema-free, and
1223
+ * text-carrying children are the only ones that occupy offsets.
1233
1224
  *
1234
1225
  * The offset arithmetic is shared with the snapshot-aware block-offset
1235
1226
  * utils through `utils/util.child-text-offset.ts`, so the boundary
@@ -1244,7 +1235,7 @@ function transformPoint$1(point, op, options = {}) {
1244
1235
  * deeper inside such blocks fail the direct-child path guard.
1245
1236
  */
1246
1237
  function remapPointThroughChildrenReplacement(point, childrenPath, newChildren, oldChildren) {
1247
- if (!oldChildren || point.path.length !== childrenPath.length + 1 || !pathEquals(point.path.slice(0, childrenPath.length), childrenPath)) return;
1238
+ if (point.path.length !== childrenPath.length + 1 || !pathEquals(point.path.slice(0, childrenPath.length), childrenPath)) return;
1248
1239
  let pointSegment = point.path[point.path.length - 1];
1249
1240
  if (!isKeyedSegment(pointSegment) || newChildren.some((child) => childKey(child) === pointSegment._key)) return;
1250
1241
  let nodeTextOffset = textOffsetOfChild(oldChildren, childText, pointSegment._key, point.offset);
@@ -1276,6 +1267,76 @@ function concatenatedText(children) {
1276
1267
  return text;
1277
1268
  }
1278
1269
  /**
1270
+ * Transform a point by an operation. Returns the same `point` reference when
1271
+ * the operation doesn't actually move the point, so callers can use referential
1272
+ * equality to detect "nothing changed."
1273
+ *
1274
+ * With keyed paths, most operations don't affect paths at all:
1275
+ * - insert: no-op (new node has its own key, doesn't shift siblings)
1276
+ * - unset (node removal): invalidates if the point is at or inside the removed node
1277
+ * - unset (property removal): collapses offset when `text` is unset from a span
1278
+ * - insert.text: adjusts offset if in the same span
1279
+ * - remove.text: adjusts offset if in the same span
1280
+ * - set: updates keyed segments when `_key` changes, clamps offset when `text` changes
1281
+ * - set.selection: no-op
1282
+ */
1283
+ function transformPoint$1(point, op, options = {}) {
1284
+ return mapPointThroughSteps(operationToSteps(op), point, options);
1285
+ }
1286
+ function operationToSteps(op) {
1287
+ switch (op.type) {
1288
+ case "insert.text": return [{
1289
+ type: "insert.text",
1290
+ path: op.path,
1291
+ offset: op.offset,
1292
+ text: op.text
1293
+ }];
1294
+ case "remove.text": return [{
1295
+ type: "remove.text",
1296
+ path: op.path,
1297
+ offset: op.offset,
1298
+ text: op.text
1299
+ }];
1300
+ case "set": {
1301
+ let propertyName = op.path[op.path.length - 1], nodePath = op.path.slice(0, -1);
1302
+ if (propertyName === "_key" && typeof op.value == "string") {
1303
+ let oldKey = op.inverse?.type === "set" && typeof op.inverse.value == "string" ? op.inverse.value : void 0;
1304
+ return oldKey ? [{
1305
+ type: "rekey",
1306
+ oldKey,
1307
+ newKey: op.value
1308
+ }] : [];
1309
+ }
1310
+ if (propertyName === "text") return [{
1311
+ type: "set.text",
1312
+ path: nodePath,
1313
+ text: typeof op.value == "string" ? op.value : ""
1314
+ }];
1315
+ if (propertyName === "children" && Array.isArray(op.value)) {
1316
+ let oldChildren = op.inverse?.type === "set" && Array.isArray(op.inverse.value) ? op.inverse.value : void 0;
1317
+ return oldChildren === void 0 ? [] : [{
1318
+ type: "replace.children",
1319
+ path: op.path,
1320
+ oldChildren,
1321
+ newChildren: op.value
1322
+ }];
1323
+ }
1324
+ return [];
1325
+ }
1326
+ case "unset": {
1327
+ let lastSegment = op.path[op.path.length - 1];
1328
+ return isKeyedSegment(lastSegment) ? [{
1329
+ type: "remove.node",
1330
+ path: op.path
1331
+ }] : lastSegment === "text" ? [{
1332
+ type: "unset.text",
1333
+ path: op.path.slice(0, -1)
1334
+ }] : [];
1335
+ }
1336
+ default: return [];
1337
+ }
1338
+ }
1339
+ /**
1279
1340
  * Check whether a text diff was applied in a way we can perform the pending action on /
1280
1341
  * recover the pending selection.
1281
1342
  */
@@ -1997,7 +2058,7 @@ const DecorateContext = createContext({}), useDecorations = (node, path, parentD
1997
2058
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ new Set(), $[0] = t0) : t0 = $[0];
1998
2059
  let eventListeners = useRef(t0), latestDecorate = useRef(decorateProp), t1, t2;
1999
2060
  $[1] === decorateProp ? (t1 = $[2], t2 = $[3]) : (t1 = () => {
2000
- latestDecorate.current = decorateProp, eventListeners.current.forEach(_temp$5);
2061
+ latestDecorate.current = decorateProp, eventListeners.current.forEach(_temp$4);
2001
2062
  }, t2 = [decorateProp], $[1] = decorateProp, $[2] = t1, $[3] = t2), useIsomorphicLayoutEffect(t1, t2);
2002
2063
  let t3;
2003
2064
  $[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = (entry) => latestDecorate.current(entry), $[4] = t3) : t3 = $[4];
@@ -2011,7 +2072,7 @@ const DecorateContext = createContext({}), useDecorations = (node, path, parentD
2011
2072
  addEventListener
2012
2073
  }, $[6] = t5) : t5 = $[6], t5;
2013
2074
  };
2014
- function _temp$5(listener) {
2075
+ function _temp$4(listener) {
2015
2076
  listener();
2016
2077
  }
2017
2078
  const rtlRange = "֑-߿יִ-﷽ﹰ-ﻼ", ltrRange = "A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿", rtl = RegExp(`^[^${ltrRange}]*[${rtlRange}]`), ltr = RegExp(`^[^${rtlRange}]*[${ltrRange}]`);
@@ -2024,19 +2085,13 @@ function getDirection(value) {
2024
2085
  * or an editable container) and threads decorations + children through the
2025
2086
  * `renderElement` callback.
2026
2087
  *
2027
- * Two pipeline-aware signals:
2028
- * - `isContainer` (prop): this element resolves as an editable container at
2029
- * this position. Governs the `data-pt-block="container"` literal.
2030
- * Resolved by `useChildren` at dispatch time (avoids a second
2031
- * `isEditableContainer` walk).
2032
- * - `NewPipelineContext` (context): this element renders inside a
2033
- * `registerNode`-shaped subtree. Governs the `data-slate-node="element"`
2034
- * strip on the outer attributes. Provided by `useChildren` (wrapping
2035
- * each new-pipeline child) and by `render.element.tsx` /
2036
- * `render.span.tsx` (around dispatch sites).
2088
+ * `isContainer` (prop): this element resolves as an editable container at
2089
+ * this position. Governs the `data-pt-block="container"` literal.
2090
+ * Resolved by `useChildren` at dispatch time (avoids a second
2091
+ * `isEditableContainer` walk).
2037
2092
  */
2038
2093
  const Element$1 = (props) => {
2039
- let $ = c(7), { decorations: parentDecorations, element, isContainer, renderElement, renderLeaf, renderText } = props, dataPath = serializePath(props.path), editor = useEngineStatic(), isInline$1 = isInline(editor.snapshot, props.path), isInNewPipeline = useContext(NewPipelineContext), decorations = useDecorations(element, props.path, parentDecorations), t0;
2094
+ let $ = c(7), { decorations: parentDecorations, element, isContainer, renderElement, renderLeaf, renderText } = props, dataPath = serializePath(props.path), editor = useEngineStatic(), isInline$1 = isInline(editor.snapshot, props.path), decorations = useDecorations(element, props.path, parentDecorations), t0;
2040
2095
  $[0] !== decorations || $[1] !== element || $[2] !== props.path || $[3] !== renderElement || $[4] !== renderLeaf || $[5] !== renderText ? (t0 = {
2041
2096
  decorations,
2042
2097
  node: element,
@@ -2048,10 +2103,7 @@ const Element$1 = (props) => {
2048
2103
  let children = useChildren(t0), attributes = isContainer ? {
2049
2104
  "data-pt-block": "container",
2050
2105
  "data-pt-path": dataPath
2051
- } : isInNewPipeline ? { "data-pt-path": dataPath } : {
2052
- "data-slate-node": "element",
2053
- "data-pt-path": dataPath
2054
- };
2106
+ } : { "data-pt-path": dataPath };
2055
2107
  if (!isInline$1 && isTextBlockNode({ schema: editor.snapshot.context.schema }, element)) {
2056
2108
  let text = getText(editor.snapshot, props.path), dir = text === void 0 ? void 0 : getDirection(text);
2057
2109
  dir === "rtl" && (attributes.dir = dir);
@@ -2063,52 +2115,31 @@ const Element$1 = (props) => {
2063
2115
  path: props.path
2064
2116
  });
2065
2117
  }, MemoizedElement = React.memo(Element$1, (prev, next) => prev.element === next.element && prev.isContainer === next.isContainer && pathEquals(prev.path, next.path) && prev.renderElement === next.renderElement && prev.renderText === next.renderText && prev.renderLeaf === next.renderLeaf && isElementDecorationsEqual(prev.decorations, next.decorations)), ReadOnlyContext = createContext(!1), useReadOnly = () => useContext(ReadOnlyContext), ObjectNodeComponent = (props) => {
2066
- let $ = c(3), { isInline, objectNode, path, renderElement } = props, dataPath = serializePath(path), readOnly = useReadOnly(), isInNewPipeline = useContext(NewPipelineContext), attributes = isInNewPipeline ? { "data-pt-path": dataPath } : {
2067
- "data-slate-node": "element",
2068
- "data-slate-void": !0,
2069
- "data-pt-path": dataPath
2070
- };
2118
+ let $ = c(4), { isInline, objectNode, path, renderElement } = props, dataPath = serializePath(path), readOnly = useReadOnly(), attributes = { "data-pt-path": dataPath };
2071
2119
  isInline && !readOnly && (attributes.contentEditable = !1);
2072
2120
  let Tag = isInline ? "span" : "div", t0;
2073
- return $[0] !== Tag || $[1] !== isInNewPipeline ? (t0 = isInNewPipeline ? /* @__PURE__ */ jsx(Tag, {
2074
- "data-pt-spacer": !0,
2075
- style: {
2076
- height: "0",
2077
- color: "transparent",
2078
- outline: "none",
2079
- position: "absolute"
2080
- },
2081
- children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx("span", {
2082
- "data-pt-marks": !0,
2083
- children: /* @__PURE__ */ jsx("span", {
2084
- "data-pt-zero-width": !0,
2085
- children: ""
2086
- })
2087
- }) })
2088
- }) : /* @__PURE__ */ jsx(Tag, {
2089
- "data-slate-spacer": !0,
2090
- "data-pt-spacer": !0,
2091
- style: {
2092
- height: "0",
2093
- color: "transparent",
2094
- outline: "none",
2095
- position: "absolute"
2096
- },
2121
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
2122
+ height: "0",
2123
+ color: "transparent",
2124
+ outline: "none",
2125
+ position: "absolute"
2126
+ }, $[0] = t0) : t0 = $[0];
2127
+ let t1;
2128
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx("span", {
2129
+ "data-pt-marks": !0,
2097
2130
  children: /* @__PURE__ */ jsx("span", {
2098
- "data-slate-node": "text",
2099
- children: /* @__PURE__ */ jsx("span", {
2100
- "data-slate-leaf": !0,
2101
- "data-pt-marks": !0,
2102
- children: /* @__PURE__ */ jsx("span", {
2103
- "data-slate-zero-width": "z",
2104
- "data-pt-zero-width": !0,
2105
- children: ""
2106
- })
2107
- })
2131
+ "data-pt-zero-width": !0,
2132
+ children: ""
2108
2133
  })
2109
- }), $[0] = Tag, $[1] = isInNewPipeline, $[2] = t0) : t0 = $[2], renderElement({
2134
+ }) }), $[1] = t1) : t1 = $[1];
2135
+ let t2;
2136
+ return $[2] === Tag ? t2 = $[3] : (t2 = /* @__PURE__ */ jsx(Tag, {
2137
+ "data-pt-spacer": !0,
2138
+ style: t0,
2139
+ children: t1
2140
+ }), $[2] = Tag, $[3] = t2), renderElement({
2110
2141
  attributes,
2111
- children: t0,
2142
+ children: t2,
2112
2143
  element: objectNode,
2113
2144
  path
2114
2145
  });
@@ -2317,51 +2348,36 @@ const EngineString = (props) => {
2317
2348
  }) : /* @__PURE__ */ jsx(TextString, { text: leafText });
2318
2349
  }, TextString = (props) => {
2319
2350
  "use no memo";
2320
- let { text, isTrailing = !1 } = props, isInNewPipeline = useContext(NewPipelineContext), ref = useRef(null), getTextContent = () => `${text ?? ""}${isTrailing ? "\n" : ""}`, [initialText] = useState(getTextContent);
2351
+ let { text, isTrailing = !1 } = props, ref = useRef(null), getTextContent = () => `${text ?? ""}${isTrailing ? "\n" : ""}`, [initialText] = useState(getTextContent);
2321
2352
  return useIsomorphicLayoutEffect(() => {
2322
2353
  let textWithTrailing = getTextContent();
2323
2354
  ref.current && ref.current.textContent !== textWithTrailing && (ref.current.textContent = textWithTrailing);
2324
2355
  }), /* @__PURE__ */ jsx(MemoizedText$1, {
2325
2356
  ref,
2326
- isInNewPipeline,
2327
2357
  children: initialText
2328
2358
  });
2329
2359
  }, MemoizedText$1 = memo(forwardRef((props, ref) => {
2330
- let $ = c(6);
2331
- if (props.isInNewPipeline) {
2332
- let t0;
2333
- return $[0] !== props.children || $[1] !== ref ? (t0 = /* @__PURE__ */ jsx("span", {
2334
- "data-pt-text": !0,
2335
- ref,
2336
- children: props.children
2337
- }), $[0] = props.children, $[1] = ref, $[2] = t0) : t0 = $[2], t0;
2338
- }
2339
- let t0;
2340
- return $[3] !== props.children || $[4] !== ref ? (t0 = /* @__PURE__ */ jsx("span", {
2341
- "data-slate-string": !0,
2360
+ let $ = c(3), t0;
2361
+ return $[0] !== props.children || $[1] !== ref ? (t0 = /* @__PURE__ */ jsx("span", {
2342
2362
  "data-pt-text": !0,
2343
2363
  ref,
2344
2364
  children: props.children
2345
- }), $[3] = props.children, $[4] = ref, $[5] = t0) : t0 = $[5], t0;
2365
+ }), $[0] = props.children, $[1] = ref, $[2] = t0) : t0 = $[2], t0;
2346
2366
  })), ZeroWidthString = (props) => {
2347
- let $ = c(10), { isLineBreak: t0 } = props, isLineBreak = t0 !== void 0 && t0, isInNewPipeline = useContext(NewPipelineContext), engineValue = isLineBreak ? "n" : "z", t1;
2348
- $[0] !== engineValue || $[1] !== isInNewPipeline || $[2] !== isLineBreak ? (t1 = isInNewPipeline ? {
2367
+ let $ = c(8), { isLineBreak: t0 } = props, isLineBreak = t0 !== void 0 && t0, t1;
2368
+ $[0] === isLineBreak ? t1 = $[1] : (t1 = {
2349
2369
  "data-pt-zero-width": !0,
2350
2370
  ...isLineBreak ? { "data-pt-line-break": !0 } : {}
2351
- } : {
2352
- "data-slate-zero-width": engineValue,
2353
- "data-pt-zero-width": !0,
2354
- ...isLineBreak ? { "data-pt-line-break": !0 } : {}
2355
- }, $[0] = engineValue, $[1] = isInNewPipeline, $[2] = isLineBreak, $[3] = t1) : t1 = $[3];
2371
+ }, $[0] = isLineBreak, $[1] = t1);
2356
2372
  let attributes = t1, t2 = !IS_ANDROID || !isLineBreak ? "" : null, t3;
2357
- $[4] === isLineBreak ? t3 = $[5] : (t3 = isLineBreak ? /* @__PURE__ */ jsx("br", {}) : null, $[4] = isLineBreak, $[5] = t3);
2373
+ $[2] === isLineBreak ? t3 = $[3] : (t3 = isLineBreak ? /* @__PURE__ */ jsx("br", {}) : null, $[2] = isLineBreak, $[3] = t3);
2358
2374
  let t4;
2359
- return $[6] !== attributes || $[7] !== t2 || $[8] !== t3 ? (t4 = /* @__PURE__ */ jsxs("span", {
2375
+ return $[4] !== attributes || $[5] !== t2 || $[6] !== t3 ? (t4 = /* @__PURE__ */ jsxs("span", {
2360
2376
  ...attributes,
2361
2377
  children: [t2, t3]
2362
- }), $[6] = attributes, $[7] = t2, $[8] = t3, $[9] = t4) : t4 = $[9], t4;
2378
+ }), $[4] = attributes, $[5] = t2, $[6] = t3, $[7] = t4) : t4 = $[7], t4;
2363
2379
  }, defaultRenderLeaf = (props) => /* @__PURE__ */ jsx(DefaultLeaf, { ...props }), Leaf = (props) => {
2364
- let $ = c(14), { leaf, isLast, text, path, parent, renderLeaf: t0, leafPosition } = props, renderLeaf = t0 === void 0 ? defaultRenderLeaf : t0, isInNewPipeline = useContext(NewPipelineContext), t1;
2380
+ let $ = c(13), { leaf, isLast, text, path, parent, renderLeaf: t0, leafPosition } = props, renderLeaf = t0 === void 0 ? defaultRenderLeaf : t0, t1;
2365
2381
  $[0] !== isLast || $[1] !== leaf || $[2] !== parent || $[3] !== path || $[4] !== text ? (t1 = /* @__PURE__ */ jsx(EngineString, {
2366
2382
  isLast,
2367
2383
  leaf,
@@ -2370,17 +2386,14 @@ const EngineString = (props) => {
2370
2386
  text
2371
2387
  }), $[0] = isLast, $[1] = leaf, $[2] = parent, $[3] = path, $[4] = text, $[5] = t1) : t1 = $[5];
2372
2388
  let children = t1, t2;
2373
- return $[6] !== children || $[7] !== isInNewPipeline || $[8] !== leaf || $[9] !== leafPosition || $[10] !== path || $[11] !== renderLeaf || $[12] !== text ? (t2 = renderLeaf({
2374
- attributes: isInNewPipeline ? { "data-pt-marks": !0 } : {
2375
- "data-slate-leaf": !0,
2376
- "data-pt-marks": !0
2377
- },
2389
+ return $[6] !== children || $[7] !== leaf || $[8] !== leafPosition || $[9] !== path || $[10] !== renderLeaf || $[11] !== text ? (t2 = renderLeaf({
2390
+ attributes: { "data-pt-marks": !0 },
2378
2391
  children,
2379
2392
  leaf,
2380
2393
  text,
2381
2394
  path,
2382
2395
  leafPosition
2383
- }), $[6] = children, $[7] = isInNewPipeline, $[8] = leaf, $[9] = leafPosition, $[10] = path, $[11] = renderLeaf, $[12] = text, $[13] = t2) : t2 = $[13], t2;
2396
+ }), $[6] = children, $[7] = leaf, $[8] = leafPosition, $[9] = path, $[10] = renderLeaf, $[11] = text, $[12] = t2) : t2 = $[12], t2;
2384
2397
  }, MemoizedLeaf = React.memo(Leaf, (prev, next) => next.parent === prev.parent && next.isLast === prev.isLast && next.renderLeaf === prev.renderLeaf && next.text === prev.text && textEquals(next.leaf, prev.leaf)), DefaultLeaf = (props) => {
2385
2398
  let $ = c(3), { attributes, children } = props, t0;
2386
2399
  return $[0] !== attributes || $[1] !== children ? (t0 = /* @__PURE__ */ jsx("span", {
@@ -2388,30 +2401,30 @@ const EngineString = (props) => {
2388
2401
  children
2389
2402
  }), $[0] = attributes, $[1] = children, $[2] = t0) : t0 = $[2], t0;
2390
2403
  }, defaultRenderText = (props) => /* @__PURE__ */ jsx(DefaultText, { ...props }), Text = (props) => {
2391
- let $ = c(3), { decorations: parentDecorations, isLast, parent, path, renderLeaf, renderText: t0, text } = props, renderText = t0 === void 0 ? defaultRenderText : t0, decorations = useDecorations(text, path, parentDecorations), t1;
2404
+ let $ = c(11), { decorations: parentDecorations, isLast, parent, path, renderLeaf, renderText: t0, text } = props, renderText = t0 === void 0 ? defaultRenderText : t0, decorations = useDecorations(text, path, parentDecorations), t1;
2392
2405
  $[0] !== decorations || $[1] !== text ? (t1 = getTextDecorations(text, decorations), $[0] = decorations, $[1] = text, $[2] = t1) : t1 = $[2];
2393
- let decoratedLeaves = t1, children = [];
2394
- for (let i = 0; i < decoratedLeaves.length; i++) {
2395
- let { leaf, position } = decoratedLeaves[i];
2396
- children.push(/* @__PURE__ */ jsx(MemoizedLeaf, {
2397
- isLast: isLast && i === decoratedLeaves.length - 1,
2398
- leaf,
2399
- leafPosition: position,
2400
- text,
2401
- path,
2402
- parent,
2403
- renderLeaf
2404
- }, `${text._key}-${i}`));
2405
- }
2406
- let dataPath = serializePath(path);
2407
- return renderText({
2408
- text,
2409
- children,
2410
- attributes: useContext(NewPipelineContext) ? { "data-pt-path": dataPath } : {
2411
- "data-slate-node": "text",
2412
- "data-pt-path": dataPath
2406
+ let decoratedLeaves = t1, t2;
2407
+ if ($[3] !== decoratedLeaves || $[4] !== isLast || $[5] !== parent || $[6] !== path || $[7] !== renderLeaf || $[8] !== renderText || $[9] !== text) {
2408
+ let children = [];
2409
+ for (let i = 0; i < decoratedLeaves.length; i++) {
2410
+ let { leaf, position } = decoratedLeaves[i];
2411
+ children.push(/* @__PURE__ */ jsx(MemoizedLeaf, {
2412
+ isLast: isLast && i === decoratedLeaves.length - 1,
2413
+ leaf,
2414
+ leafPosition: position,
2415
+ text,
2416
+ path,
2417
+ parent,
2418
+ renderLeaf
2419
+ }, `${text._key}-${i}`));
2413
2420
  }
2414
- });
2421
+ t2 = renderText({
2422
+ text,
2423
+ children,
2424
+ attributes: { "data-pt-path": serializePath(path) }
2425
+ }), $[3] = decoratedLeaves, $[4] = isLast, $[5] = parent, $[6] = path, $[7] = renderLeaf, $[8] = renderText, $[9] = text, $[10] = t2;
2426
+ } else t2 = $[10];
2427
+ return t2;
2415
2428
  }, MemoizedText = React.memo(Text, (prev, next) => next.parent === prev.parent && next.isLast === prev.isLast && pathEquals(next.path, prev.path) && next.renderText === prev.renderText && next.renderLeaf === prev.renderLeaf && next.text === prev.text && isTextDecorationsEqual(next.decorations, prev.decorations)), DefaultText = (props) => {
2416
2429
  let $ = c(3), { attributes, children } = props, t0;
2417
2430
  return $[0] !== attributes || $[1] !== children ? (t0 = /* @__PURE__ */ jsx("span", {
@@ -2565,16 +2578,6 @@ const useChildren = (props) => {
2565
2578
  function useRegistrationsSelector(selector, equalityFn = refEquality) {
2566
2579
  return useChannelSelector(selector, equalityFn, "registrations");
2567
2580
  }
2568
- /**
2569
- * `useEngineSelector` scoped to the 'listIndex' channel: the selector
2570
- * re-runs on its component's renders and when a flush contained a
2571
- * structural operation (the same signal that invalidates
2572
- * `listIndexMap`), not on text or selection changes. Only for
2573
- * selectors that read `getListIndexMap`.
2574
- */
2575
- function useListIndexSelector(selector, equalityFn = refEquality) {
2576
- return useChannelSelector(selector, equalityFn, "listIndex");
2577
- }
2578
2581
  function useChannelSelector(selector, equalityFn, channel) {
2579
2582
  let context = useContext(EngineSelectorContext);
2580
2583
  if (!context) throw Error("The `useEngineSelector` hook must be used inside the <Engine> component's context.");
@@ -2597,16 +2600,14 @@ function useChannelSelector(selector, equalityFn, channel) {
2597
2600
  * keystroke and selection move dominated per-event cost.
2598
2601
  */
2599
2602
  function useSelectorContext() {
2600
- let eventListeners = useRef(/* @__PURE__ */ new Set()), registrationListeners = useRef(/* @__PURE__ */ new Set()), listIndexListeners = useRef(/* @__PURE__ */ new Set()), onChange = useCallback((changed) => {
2603
+ let eventListeners = useRef(/* @__PURE__ */ new Set()), registrationListeners = useRef(/* @__PURE__ */ new Set()), onChange = useCallback((changed) => {
2601
2604
  eventListeners.current.forEach((listener) => {
2602
2605
  listener();
2603
2606
  }), changed.registrations && registrationListeners.current.forEach((listener) => {
2604
2607
  listener();
2605
- }), changed.listIndex && listIndexListeners.current.forEach((listener) => {
2606
- listener();
2607
2608
  });
2608
2609
  }, []), addEventListener = useCallback((callbackProp, channel) => {
2609
- let listeners = channel === "registrations" ? registrationListeners.current : channel === "listIndex" ? listIndexListeners.current : eventListeners.current;
2610
+ let listeners = channel === "registrations" ? registrationListeners.current : eventListeners.current;
2610
2611
  return listeners.add(callbackProp), () => {
2611
2612
  listeners.delete(callbackProp);
2612
2613
  };
@@ -3164,9 +3165,7 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({ children }) => /* @__PU
3164
3165
  spellCheck: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.spellCheck : !1,
3165
3166
  autoCorrect: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.autoCorrect : "false",
3166
3167
  autoCapitalize: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.autoCapitalize : "false",
3167
- "data-slate-editor": !0,
3168
3168
  "data-pt-editor": !0,
3169
- "data-slate-node": "value",
3170
3169
  "data-pt-path": "",
3171
3170
  contentEditable: !readOnly,
3172
3171
  zindex: -1,
@@ -3960,153 +3959,7 @@ function getDragSelection({ eventSelection, snapshot }) {
3960
3959
  }
3961
3960
  return dragSelection;
3962
3961
  }
3963
- function createEditorPriority(config) {
3964
- return {
3965
- id: defaultKeyGenerator(),
3966
- name: config?.name,
3967
- reference: config?.reference
3968
- };
3969
- }
3970
- const corePriority = createEditorPriority({ name: "core" });
3971
- function createDropPositionBehaviorsConfig({ setDropPosition }) {
3972
- return [{
3973
- behavior: defineBehavior({
3974
- on: "drag.dragover",
3975
- guard: ({ snapshot, event }) => {
3976
- let dropFocusBlock = getFocusBlock({
3977
- ...snapshot,
3978
- context: {
3979
- ...snapshot.context,
3980
- selection: event.position.selection
3981
- }
3982
- });
3983
- if (!dropFocusBlock) return !1;
3984
- let dragOrigin = event.dragOrigin;
3985
- if (!dragOrigin) return !1;
3986
- let dragSelection = getDragSelection({
3987
- eventSelection: dragOrigin.selection,
3988
- snapshot
3989
- });
3990
- return getSelectedBlocks({
3991
- ...snapshot,
3992
- context: {
3993
- ...snapshot.context,
3994
- selection: dragSelection
3995
- }
3996
- }).some((draggedBlock) => draggedBlock.node._key === dropFocusBlock.node._key) || !isSelectingEntireBlocks({
3997
- ...snapshot,
3998
- context: {
3999
- ...snapshot.context,
4000
- selection: dragSelection
4001
- }
4002
- }) ? !1 : { dropFocusBlock };
4003
- },
4004
- actions: [({ event }, { dropFocusBlock }) => [{
4005
- type: "effect",
4006
- effect: () => {
4007
- setDropPosition({
4008
- path: dropFocusBlock.path,
4009
- position: event.position.block
4010
- });
4011
- }
4012
- }]]
4013
- }),
4014
- priority: createEditorPriority({ reference: {
4015
- priority: corePriority,
4016
- importance: "lower"
4017
- } })
4018
- }, {
4019
- behavior: defineBehavior({
4020
- on: "drag.*",
4021
- guard: ({ event }) => event.type !== "drag.dragover",
4022
- actions: [({ event }) => [{
4023
- type: "effect",
4024
- effect: () => {
4025
- setDropPosition(void 0);
4026
- }
4027
- }, forward(event)]]
4028
- }),
4029
- priority: createEditorPriority({ reference: {
4030
- priority: corePriority,
4031
- importance: "lower"
4032
- } })
4033
- }];
4034
- }
4035
- const EditorActorContext = createContext({});
4036
- /**
4037
- * Returns the `position` of a drop hover when the hover targets the given
4038
- * element path; `undefined` otherwise.
4039
- *
4040
- * Path-based match — works at any depth. Comparing by `_key` alone is
4041
- * ambiguous because keys are sibling-unique, not tree-unique: two blocks
4042
- * at different depths can share the same `_key` and a key-only match
4043
- * would paint the indicator on both.
4044
- */
4045
- function resolveElementDropPosition(dropPosition, elementPath) {
4046
- if (dropPosition && pathEquals(dropPosition.path, elementPath)) return dropPosition.position;
4047
- }
4048
- const DropPositionStoreContext = createContext({
4049
- subscribe: () => () => {},
4050
- getSnapshot: () => void 0
4051
- });
4052
- /**
4053
- * Holds the current drag drop position in a single store and registers the
4054
- * core drop-position behavior. Consumers attach via {@link useElementDropPosition}
4055
- * and re-render only when the position at their own path flips.
4056
- *
4057
- * Why not thread `dropPosition` through `renderElement`? It changes on every
4058
- * `dragover` (pointer-move frequency), so feeding it to `renderElement`'s
4059
- * `useCallback` deps hands Slate a new render function each tick and re-renders
4060
- * the entire element tree. The per-path store re-renders only the blocks
4061
- * gaining or losing the indicator. Mirrors `SelectionStateProvider`.
4062
- */
4063
- function DropPositionStateProvider(t0) {
4064
- let $ = c(6), { children } = t0, editorActor = useContext(EditorActorContext), [initialSubscribers] = useState(_temp$4), subscribersRef = useRef(initialSubscribers), stateRef = useRef(void 0), t1, t2;
4065
- $[0] === editorActor ? (t1 = $[1], t2 = $[2]) : (t1 = () => {
4066
- let behaviorConfigs = createDropPositionBehaviorsConfig({ setDropPosition: (next) => {
4067
- let prev = stateRef.current;
4068
- if (!(prev === next || prev !== void 0 && next !== void 0 && prev.position === next.position && pathEquals(prev.path, next.path))) {
4069
- stateRef.current = next;
4070
- for (let callback of subscribersRef.current) callback();
4071
- }
4072
- } });
4073
- for (let behaviorConfig of behaviorConfigs) editorActor.send({
4074
- type: "add behavior",
4075
- behaviorConfig
4076
- });
4077
- return () => {
4078
- for (let behaviorConfig_0 of behaviorConfigs) editorActor.send({
4079
- type: "remove behavior",
4080
- behaviorConfig: behaviorConfig_0
4081
- });
4082
- };
4083
- }, t2 = [editorActor], $[0] = editorActor, $[1] = t1, $[2] = t2), useEffect(t1, t2);
4084
- let t3;
4085
- $[3] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
4086
- subscribe: (callback_0) => (subscribersRef.current.add(callback_0), () => {
4087
- subscribersRef.current.delete(callback_0);
4088
- }),
4089
- getSnapshot: () => stateRef.current
4090
- }, $[3] = t3) : t3 = $[3];
4091
- let store = t3, t4;
4092
- return $[4] === children ? t4 = $[5] : (t4 = /* @__PURE__ */ jsx(DropPositionStoreContext.Provider, {
4093
- value: store,
4094
- children
4095
- }), $[4] = children, $[5] = t4), t4;
4096
- }
4097
- /**
4098
- * Subscribe to the drop position at `path`: `'start'`, `'end'`, or `undefined`
4099
- * when no drag is hovering this block. Re-renders only when this block's slice
4100
- * flips, not when the position moves between other blocks.
4101
- */
4102
- function _temp$4() {
4103
- return /* @__PURE__ */ new Set();
4104
- }
4105
- function useElementDropPosition(path) {
4106
- let $ = c(3), store = useContext(DropPositionStoreContext), t0;
4107
- return $[0] !== path || $[1] !== store ? (t0 = () => resolveElementDropPosition(store.getSnapshot(), path), $[0] = path, $[1] = store, $[2] = t0) : t0 = $[2], useSyncExternalStore(store.subscribe, t0);
4108
- }
4109
- const IS_MAC = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.userAgent), modifiers = {
3962
+ const EditorActorContext = createContext({}), IS_MAC = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.userAgent), modifiers = {
4110
3963
  alt: "altKey",
4111
3964
  control: "ctrlKey",
4112
3965
  meta: "metaKey",
@@ -4612,11 +4465,10 @@ function renderDefaultDecorator(props) {
4612
4465
  return props.children;
4613
4466
  }
4614
4467
  /**
4615
- * Engine-default wrapper for Annotation marks: identity. The engine
4616
- * always anchors the annotated text in a `<span ref>` outside this
4617
- * render, kept for structural parity with the legacy `renderAnnotation`
4618
- * path (which hands that anchor to consumers as `editorElementRef`);
4619
- * the render itself owns no markup by default.
4468
+ * Engine-default wrapper for Annotation marks: identity. For a markDef
4469
+ * whose `_type` is a schema-known annotation, the engine anchors the
4470
+ * annotated text in a `<span ref>` outside this render, whether or not
4471
+ * a render is registered; the render itself owns no markup by default.
4620
4472
  */
4621
4473
  function renderDefaultAnnotation(props) {
4622
4474
  return props.children;
@@ -4677,51 +4529,6 @@ function renderDefaultInlineObject(props) {
4677
4529
  })]
4678
4530
  });
4679
4531
  }
4680
- function RenderDefaultBlockObject(props) {
4681
- let $ = c(4), t0;
4682
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { userSelect: "none" }, $[0] = t0) : t0 = $[0];
4683
- let t1;
4684
- return $[1] !== props.blockObject._key || $[2] !== props.blockObject._type ? (t1 = /* @__PURE__ */ jsxs("div", {
4685
- style: t0,
4686
- children: [
4687
- "[",
4688
- props.blockObject._type,
4689
- ": ",
4690
- props.blockObject._key,
4691
- "]"
4692
- ]
4693
- }), $[1] = props.blockObject._key, $[2] = props.blockObject._type, $[3] = t1) : t1 = $[3], t1;
4694
- }
4695
- function RenderDefaultInlineObject(props) {
4696
- let $ = c(4), t0;
4697
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { userSelect: "none" }, $[0] = t0) : t0 = $[0];
4698
- let t1;
4699
- return $[1] !== props.inlineObject._key || $[2] !== props.inlineObject._type ? (t1 = /* @__PURE__ */ jsxs("span", {
4700
- style: t0,
4701
- children: [
4702
- "[",
4703
- props.inlineObject._type,
4704
- ": ",
4705
- props.inlineObject._key,
4706
- "]"
4707
- ]
4708
- }), $[1] = props.inlineObject._key, $[2] = props.inlineObject._type, $[3] = t1) : t1 = $[3], t1;
4709
- }
4710
- function DropIndicator() {
4711
- let $ = c(1), t0;
4712
- return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx("div", {
4713
- contentEditable: !1,
4714
- className: "pt-drop-indicator",
4715
- style: {
4716
- position: "absolute",
4717
- width: "100%",
4718
- height: 1,
4719
- borderBottom: "1px solid currentColor",
4720
- zIndex: 5
4721
- },
4722
- children: /* @__PURE__ */ jsx("span", {})
4723
- }), $[0] = t0) : t0 = $[0], t0;
4724
- }
4725
4532
  const emptySet$1 = /* @__PURE__ */ new Set(), emptyState = {
4726
4533
  focusedLeafPath: void 0,
4727
4534
  selectedLeafPaths: emptySet$1,
@@ -4893,14 +4700,14 @@ function SelectionStateProvider(t0) {
4893
4700
  children
4894
4701
  }), $[8] = children, $[9] = t5), t5;
4895
4702
  }
4703
+ function _temp$3() {
4704
+ return /* @__PURE__ */ new Set();
4705
+ }
4896
4706
  /**
4897
4707
  * Subscribe to whether a container at `serializedPath` is currently
4898
4708
  * focused. Re-renders only when this boolean flips - not when other
4899
4709
  * containers' focused state changes.
4900
4710
  */
4901
- function _temp$3() {
4902
- return /* @__PURE__ */ new Set();
4903
- }
4904
4711
  function useIsFocusedContainer(serializedPath) {
4905
4712
  let $ = c(3), store = useContext(SelectionStateStoreContext), t0;
4906
4713
  return $[0] !== serializedPath || $[1] !== store ? (t0 = () => store.getSnapshot().focusedContainerPath === serializedPath, $[0] = serializedPath, $[1] = store, $[2] = t0) : t0 = $[2], useSyncExternalStore(store.subscribe, t0);
@@ -4930,103 +4737,28 @@ function useIsSelectedLeaf(serializedPath) {
4930
4737
  return $[0] !== serializedPath || $[1] !== store ? (t0 = () => store.getSnapshot().selectedLeafPaths.has(serializedPath), $[0] = serializedPath, $[1] = store, $[2] = t0) : t0 = $[2], useSyncExternalStore(store.subscribe, t0);
4931
4738
  }
4932
4739
  function RenderBlockObject(props) {
4933
- let $ = c(50), blockObjectRef = useRef(null), t0;
4740
+ let $ = c(11), t0;
4934
4741
  $[0] === props.path ? t0 = $[1] : (t0 = serializePath(props.path), $[0] = props.path, $[1] = t0);
4935
- let serializedPath = t0, selected = useIsSelectedLeaf(serializedPath), focused = useIsFocusedLeaf(serializedPath), dropPosition = useElementDropPosition(props.path), t1;
4936
- if ($[2] !== props.element || $[3] !== props.schema.blockObjects) {
4937
- let t2;
4938
- $[5] === props.element ? t2 = $[6] : (t2 = (schemaType) => schemaType.name === props.element._type, $[5] = props.element, $[6] = t2), t1 = props.schema.blockObjects.find(t2), $[2] = props.element, $[3] = props.schema.blockObjects, $[4] = t1;
4939
- } else t1 = $[4];
4940
- let blockObjectSchemaType = t1;
4941
- blockObjectSchemaType || console.error(`Unable to find Block Object "${props.element._type}" in Schema`);
4942
- let t2;
4943
- $[7] !== props.blockObject || $[8] !== props.element ? (t2 = props.blockObject ?? {
4944
- _key: props.element._key,
4945
- _type: props.element._type
4946
- }, $[7] = props.blockObject, $[8] = props.element, $[9] = t2) : t2 = $[9];
4947
- let blockObject = t2;
4948
- if (props.blockObjectConfig) {
4949
- let t3;
4950
- if ($[10] !== focused || $[11] !== props.attributes || $[12] !== props.blockObjectConfig.blockObject.render || $[13] !== props.children || $[14] !== props.element || $[15] !== props.path || $[16] !== props.readOnly || $[17] !== selected) {
4951
- let { "data-slate-node": _slateNode, "data-slate-void": _slateVoid, ...ptAttributes } = props.attributes, render = props.blockObjectConfig.blockObject.render, renderProps = {
4952
- attributes: {
4953
- ...ptAttributes,
4954
- "data-pt-block": "object"
4955
- },
4956
- children: props.children,
4957
- focused,
4958
- node: props.element,
4959
- path: props.path,
4960
- readOnly: props.readOnly,
4961
- renderDefault: renderDefaultBlockObject,
4962
- selected
4963
- };
4964
- t3 = render ? render(renderProps) : renderDefaultBlockObject(renderProps), $[10] = focused, $[11] = props.attributes, $[12] = props.blockObjectConfig.blockObject.render, $[13] = props.children, $[14] = props.element, $[15] = props.path, $[16] = props.readOnly, $[17] = selected, $[18] = t3;
4965
- } else t3 = $[18];
4966
- return t3;
4967
- }
4968
- let innerContent;
4969
- if (props.legacy.renderBlock && blockObjectSchemaType) {
4970
- let t3;
4971
- $[19] === props.element._key ? t3 = $[20] : (t3 = [{ _key: props.element._key }], $[19] = props.element._key, $[20] = t3);
4972
- let t4;
4973
- $[21] === blockObject ? t4 = $[22] : (t4 = /* @__PURE__ */ jsx(RenderDefaultBlockObject, { blockObject }), $[21] = blockObject, $[22] = t4);
4974
- let t5;
4975
- $[23] !== blockObject || $[24] !== blockObjectSchemaType || $[25] !== focused || $[26] !== props.legacy.renderBlock || $[27] !== selected || $[28] !== t3 || $[29] !== t4 ? (t5 = /* @__PURE__ */ jsx(RenderBlock$1, {
4976
- renderBlock: props.legacy.renderBlock,
4977
- editorElementRef: blockObjectRef,
4742
+ let serializedPath = t0, selected = useIsSelectedLeaf(serializedPath), focused = useIsFocusedLeaf(serializedPath);
4743
+ props.schema.blockObjects.find((schemaType) => schemaType.name === props.element._type) || console.error(`Unable to find Block Object "${props.element._type}" in Schema`);
4744
+ let render = props.blockObjectConfig?.blockObject.render, t1;
4745
+ if ($[2] !== focused || $[3] !== props.attributes || $[4] !== props.children || $[5] !== props.element || $[6] !== props.path || $[7] !== props.readOnly || $[8] !== render || $[9] !== selected) {
4746
+ let renderProps = {
4747
+ attributes: {
4748
+ ...props.attributes,
4749
+ "data-pt-block": "object"
4750
+ },
4751
+ children: props.children,
4978
4752
  focused,
4979
- path: t3,
4980
- schemaType: blockObjectSchemaType,
4981
- selected,
4982
- value: blockObject,
4983
- children: t4
4984
- }), $[23] = blockObject, $[24] = blockObjectSchemaType, $[25] = focused, $[26] = props.legacy.renderBlock, $[27] = selected, $[28] = t3, $[29] = t4, $[30] = t5) : t5 = $[30], innerContent = t5;
4985
- } else {
4986
- let t3;
4987
- $[31] === blockObject ? t3 = $[32] : (t3 = /* @__PURE__ */ jsx(RenderDefaultBlockObject, { blockObject }), $[31] = blockObject, $[32] = t3), innerContent = t3;
4988
- }
4989
- let t3;
4990
- $[33] !== props.attributes || $[34] !== props.element._key || $[35] !== props.element._type ? (t3 = {
4991
- ...props.attributes,
4992
- className: "pt-block pt-object-block",
4993
- "data-block-key": props.element._key,
4994
- "data-block-name": props.element._type,
4995
- "data-block-type": "object",
4996
- "data-pt-block": "object"
4997
- }, $[33] = props.attributes, $[34] = props.element._key, $[35] = props.element._type, $[36] = t3) : t3 = $[36];
4998
- let attributes = t3, t4;
4999
- $[37] === dropPosition ? t4 = $[38] : (t4 = dropPosition === "start" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null, $[37] = dropPosition, $[38] = t4);
5000
- let t5 = !props.readOnly, t6;
5001
- $[39] !== innerContent || $[40] !== t5 ? (t6 = /* @__PURE__ */ jsx("div", {
5002
- ref: blockObjectRef,
5003
- contentEditable: !1,
5004
- draggable: t5,
5005
- children: innerContent
5006
- }), $[39] = innerContent, $[40] = t5, $[41] = t6) : t6 = $[41];
5007
- let t7;
5008
- $[42] === dropPosition ? t7 = $[43] : (t7 = dropPosition === "end" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null, $[42] = dropPosition, $[43] = t7);
5009
- let t8;
5010
- return $[44] !== attributes || $[45] !== props.children || $[46] !== t4 || $[47] !== t6 || $[48] !== t7 ? (t8 = /* @__PURE__ */ jsxs("div", {
5011
- ...attributes,
5012
- children: [
5013
- t4,
5014
- props.children,
5015
- t6,
5016
- t7
5017
- ]
5018
- }), $[44] = attributes, $[45] = props.children, $[46] = t4, $[47] = t6, $[48] = t7, $[49] = t8) : t8 = $[49], t8;
5019
- }
5020
- function RenderBlock$1({ renderBlock, children, editorElementRef, focused, path, schemaType, selected, value }) {
5021
- return renderBlock({
5022
- children,
5023
- editorElementRef,
5024
- focused,
5025
- path,
5026
- schemaType,
5027
- selected,
5028
- value
5029
- });
4753
+ node: props.element,
4754
+ path: props.path,
4755
+ readOnly: props.readOnly,
4756
+ renderDefault: renderDefaultBlockObject,
4757
+ selected
4758
+ };
4759
+ t1 = render ? render(renderProps) : renderDefaultBlockObject(renderProps), $[2] = focused, $[3] = props.attributes, $[4] = props.children, $[5] = props.element, $[6] = props.path, $[7] = props.readOnly, $[8] = render, $[9] = selected, $[10] = t1;
4760
+ } else t1 = $[10];
4761
+ return t1;
5030
4762
  }
5031
4763
  function RenderContainer(props) {
5032
4764
  let $ = c(11), t0;
@@ -5059,348 +4791,38 @@ function useBlockSubSchema(path) {
5059
4791
  return $[0] !== editor.snapshot || $[1] !== path ? (t0 = getPathSubSchema(editor.snapshot, path), $[0] = editor.snapshot, $[1] = path, $[2] = t0) : t0 = $[2], t0;
5060
4792
  }
5061
4793
  function RenderInlineObject(props) {
5062
- let $ = c(41), inlineObjectRef = useRef(null), subSchema = useBlockSubSchema(props.path), t0;
5063
- if ($[0] !== props.element || $[1] !== subSchema.inlineObjects) {
5064
- let t1;
5065
- $[3] === props.element ? t1 = $[4] : (t1 = (schemaType) => schemaType.name === props.element._type, $[3] = props.element, $[4] = t1), t0 = subSchema.inlineObjects.find(t1), $[0] = props.element, $[1] = subSchema.inlineObjects, $[2] = t0;
5066
- } else t0 = $[2];
5067
- let inlineObjectSchemaType = t0;
5068
- inlineObjectSchemaType || console.error(`Unable to find Inline Object "${props.element._type}" in Schema`);
5069
- let t1;
5070
- $[5] === props.path ? t1 = $[6] : (t1 = serializePath(props.path), $[5] = props.path, $[6] = t1);
5071
- let serializedPath = t1, selected = useIsSelectedLeaf(serializedPath), focused = useIsFocusedLeaf(serializedPath), inlineObject = props.element;
5072
- if (props.inlineObjectConfig) {
5073
- let render = props.inlineObjectConfig.inlineObject.render, t2;
5074
- if ($[7] !== focused || $[8] !== props.attributes || $[9] !== props.children || $[10] !== props.element || $[11] !== props.path || $[12] !== props.readOnly || $[13] !== render || $[14] !== selected) {
5075
- let renderProps = {
5076
- attributes: {
5077
- ...props.attributes,
5078
- "data-pt-inline": "object"
5079
- },
5080
- children: props.children,
5081
- focused,
5082
- node: props.element,
5083
- path: props.path,
5084
- readOnly: props.readOnly,
5085
- renderDefault: renderDefaultInlineObject,
5086
- selected
5087
- };
5088
- t2 = render ? render(renderProps) : renderDefaultInlineObject(renderProps), $[7] = focused, $[8] = props.attributes, $[9] = props.children, $[10] = props.element, $[11] = props.path, $[12] = props.readOnly, $[13] = render, $[14] = selected, $[15] = t2;
5089
- } else t2 = $[15];
5090
- return t2;
5091
- }
5092
- let innerContent;
5093
- if (props.legacy.renderChild && inlineObjectSchemaType) {
5094
- let t2;
5095
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[16] = t2) : t2 = $[16];
5096
- let t3;
5097
- $[17] === inlineObject ? t3 = $[18] : (t3 = /* @__PURE__ */ jsx(RenderDefaultInlineObject, { inlineObject }), $[17] = inlineObject, $[18] = t3);
5098
- let t4;
5099
- $[19] !== focused || $[20] !== inlineObject || $[21] !== inlineObjectSchemaType || $[22] !== props.legacy.renderChild || $[23] !== props.path || $[24] !== selected || $[25] !== t3 ? (t4 = /* @__PURE__ */ jsx(RenderChild$1, {
5100
- renderChild: props.legacy.renderChild,
5101
- annotations: t2,
5102
- editorElementRef: inlineObjectRef,
5103
- selected,
4794
+ let $ = c(11);
4795
+ useBlockSubSchema(props.path).inlineObjects.find((schemaType) => schemaType.name === props.element._type) || console.error(`Unable to find Inline Object "${props.element._type}" in Schema`);
4796
+ let t0;
4797
+ $[0] === props.path ? t0 = $[1] : (t0 = serializePath(props.path), $[0] = props.path, $[1] = t0);
4798
+ let serializedPath = t0, selected = useIsSelectedLeaf(serializedPath), focused = useIsFocusedLeaf(serializedPath), render = props.inlineObjectConfig?.inlineObject.render, t1;
4799
+ if ($[2] !== focused || $[3] !== props.attributes || $[4] !== props.children || $[5] !== props.element || $[6] !== props.path || $[7] !== props.readOnly || $[8] !== render || $[9] !== selected) {
4800
+ let renderProps = {
4801
+ attributes: {
4802
+ ...props.attributes,
4803
+ "data-pt-inline": "object"
4804
+ },
4805
+ children: props.children,
5104
4806
  focused,
4807
+ node: props.element,
5105
4808
  path: props.path,
5106
- schemaType: inlineObjectSchemaType,
5107
- value: inlineObject,
5108
- children: t3
5109
- }), $[19] = focused, $[20] = inlineObject, $[21] = inlineObjectSchemaType, $[22] = props.legacy.renderChild, $[23] = props.path, $[24] = selected, $[25] = t3, $[26] = t4) : t4 = $[26], innerContent = t4;
5110
- } else {
5111
- let t2;
5112
- $[27] === inlineObject ? t2 = $[28] : (t2 = /* @__PURE__ */ jsx(RenderDefaultInlineObject, { inlineObject }), $[27] = inlineObject, $[28] = t2), innerContent = t2;
5113
- }
5114
- let t2;
5115
- $[29] !== inlineObject._key || $[30] !== inlineObject._type || $[31] !== props.attributes ? (t2 = {
5116
- ...props.attributes,
5117
- className: "pt-inline-object",
5118
- "data-child-key": inlineObject._key,
5119
- "data-child-name": inlineObject._type,
5120
- "data-child-type": "object",
5121
- "data-pt-inline": "object"
5122
- }, $[29] = inlineObject._key, $[30] = inlineObject._type, $[31] = props.attributes, $[32] = t2) : t2 = $[32];
5123
- let attributes = t2, t3;
5124
- $[33] === Symbol.for("react.memo_cache_sentinel") ? (t3 = { display: "inline-block" }, $[33] = t3) : t3 = $[33];
5125
- let t4 = !props.readOnly, t5;
5126
- $[34] !== innerContent || $[35] !== t4 ? (t5 = /* @__PURE__ */ jsx("span", {
5127
- ref: inlineObjectRef,
5128
- style: t3,
5129
- draggable: t4,
5130
- children: innerContent
5131
- }), $[34] = innerContent, $[35] = t4, $[36] = t5) : t5 = $[36];
5132
- let t6;
5133
- return $[37] !== attributes || $[38] !== props.children || $[39] !== t5 ? (t6 = /* @__PURE__ */ jsxs("span", {
5134
- ...attributes,
5135
- children: [props.children, t5]
5136
- }), $[37] = attributes, $[38] = props.children, $[39] = t5, $[40] = t6) : t6 = $[40], t6;
5137
- }
5138
- function RenderChild$1({ renderChild, annotations, children, editorElementRef, focused, path, schemaType, selected, value }) {
5139
- return renderChild({
5140
- annotations,
5141
- children,
5142
- editorElementRef,
5143
- focused,
5144
- path,
5145
- schemaType,
5146
- selected,
5147
- value
5148
- });
5149
- }
5150
- const levelIndexMaps = /* @__PURE__ */ new Map();
5151
- /**
5152
- * Mutates both maps in place. Used for initial engine population and tests.
5153
- *
5154
- * During operation application `blockIndexMap` is maintained incrementally by
5155
- * `transform-block-index-map` helpers; only `listIndexMap` needs a full
5156
- * rebuild per op (see `buildListIndexMap`).
5157
- */
5158
- function buildIndexMaps(context, { blockIndexMap, listIndexMap }) {
5159
- blockIndexMap.clear();
5160
- for (let blockIndex = 0; blockIndex < context.value.length; blockIndex++) {
5161
- let block = context.value.at(blockIndex);
5162
- if (block === void 0 || block._key === void 0) continue;
5163
- let blockPath = [{ _key: block._key }], blockKey = serializePath(blockPath);
5164
- blockIndexMap.has(blockKey) || blockIndexMap.set(blockKey, blockIndex), collectDescendantIndexes(context, block, blockPath, void 0, blockIndexMap);
5165
- }
5166
- buildListIndexMap(context, listIndexMap);
5167
- }
5168
- /**
5169
- * Mutates `listIndexMap` in place. Recomputes list-item indices for every
5170
- * root block. Called lazily by `getListIndexMap` when the map is read after
5171
- * a structural change, and once at startup by `buildIndexMaps`.
5172
- */
5173
- function buildListIndexMap(context, listIndexMap) {
5174
- listIndexMap.clear(), levelIndexMaps.clear();
5175
- let previousListItem;
5176
- for (let blockIndex = 0; blockIndex < context.value.length; blockIndex++) {
5177
- let block = context.value.at(blockIndex);
5178
- if (block === void 0) continue;
5179
- let blockPath = [{ _key: block._key }];
5180
- if (!isTextBlockNode(context, block)) {
5181
- levelIndexMaps.clear(), previousListItem = void 0;
5182
- continue;
5183
- }
5184
- if (block.listItem === void 0 || block.level === void 0) {
5185
- levelIndexMaps.clear(), previousListItem = void 0;
5186
- continue;
5187
- }
5188
- if (!previousListItem) {
5189
- let levelIndexMap = levelIndexMaps.get(block.listItem) ?? /* @__PURE__ */ new Map();
5190
- levelIndexMap.set(block.level, 1), levelIndexMaps.set(block.listItem, levelIndexMap), listIndexMap.set(serializePath(blockPath), 1), previousListItem = {
5191
- listItem: block.listItem,
5192
- level: block.level
5193
- };
5194
- continue;
5195
- }
5196
- if (previousListItem.listItem === block.listItem && previousListItem.level < block.level) {
5197
- let levelIndexMap = levelIndexMaps.get(block.listItem) ?? /* @__PURE__ */ new Map();
5198
- levelIndexMap.set(block.level, 1), levelIndexMaps.set(block.listItem, levelIndexMap), listIndexMap.set(serializePath(blockPath), 1), previousListItem = {
5199
- listItem: block.listItem,
5200
- level: block.level
5201
- };
5202
- continue;
5203
- }
5204
- levelIndexMaps.forEach((levelIndexMap, listItem) => {
5205
- if (listItem === block.listItem) return;
5206
- let levelsToDelete = [];
5207
- levelIndexMap.forEach((_, level) => {
5208
- level >= block.level && levelsToDelete.push(level);
5209
- }), levelsToDelete.forEach((level) => {
5210
- levelIndexMap.delete(level);
5211
- });
5212
- });
5213
- let levelIndexMap = levelIndexMaps.get(block.listItem) ?? /* @__PURE__ */ new Map(), levelCounter = levelIndexMap.get(block.level) ?? 0;
5214
- levelIndexMap.set(block.level, levelCounter + 1), levelIndexMaps.set(block.listItem, levelIndexMap), listIndexMap.set(serializePath(blockPath), levelCounter + 1), previousListItem = {
5215
- listItem: block.listItem,
5216
- level: block.level
4809
+ readOnly: props.readOnly,
4810
+ renderDefault: renderDefaultInlineObject,
4811
+ selected
5217
4812
  };
5218
- }
5219
- }
5220
- /**
5221
- * Return `listIndexMap`, rebuilding it first if a structural operation has
5222
- * marked it dirty since the last read. The renderer is the only reader, so
5223
- * deferring the rebuild to read time turns a per-operation O(value) walk
5224
- * into at most one rebuild per render.
5225
- */
5226
- function getListIndexMap(editor) {
5227
- return editor.listIndexMapDirty &&= (buildListIndexMap(editor.snapshot.context, editor.listIndexMap), !1), editor.listIndexMap;
5228
- }
5229
- function collectDescendantIndexes(context, node, nodePath, parent, blockIndexMap) {
5230
- let result = getNodeChildren(context, node, parent);
5231
- if (result) for (let i = 0; i < result.children.length; i++) {
5232
- let child = result.children[i];
5233
- if (!child._key) continue;
5234
- let childSegment = { _key: child._key }, childPath = [
5235
- ...nodePath,
5236
- result.fieldName,
5237
- childSegment
5238
- ], childKey = serializePath(childPath);
5239
- blockIndexMap.has(childKey) || blockIndexMap.set(childKey, i), collectDescendantIndexes(context, child, childPath, result.parent, blockIndexMap);
5240
- }
4813
+ t1 = render ? render(renderProps) : renderDefaultInlineObject(renderProps), $[2] = focused, $[3] = props.attributes, $[4] = props.children, $[5] = props.element, $[6] = props.path, $[7] = props.readOnly, $[8] = render, $[9] = selected, $[10] = t1;
4814
+ } else t1 = $[10];
4815
+ return t1;
5241
4816
  }
5242
4817
  function RenderTextBlock(props) {
5243
- let $ = c(79), blockRef = useRef(null), t0;
5244
- $[0] === props.schema.block.fields ? t0 = $[1] : (t0 = props.schema.block.fields ?? [], $[0] = props.schema.block.fields, $[1] = t0);
4818
+ let $ = c(5), t0;
4819
+ $[0] === props.children ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("div", { children: props.children }), $[0] = props.children, $[1] = t0);
5245
4820
  let t1;
5246
- $[2] !== props.schema.block.name || $[3] !== t0 ? (t1 = {
5247
- name: props.schema.block.name,
5248
- fields: t0
5249
- }, $[2] = props.schema.block.name, $[3] = t0, $[4] = t1) : t1 = $[4];
5250
- let schemaType = t1, t2;
5251
- $[5] === props.path ? t2 = $[6] : (t2 = serializePath(props.path), $[5] = props.path, $[6] = t2);
5252
- let serializedPath = t2, selected = useIsSelectedContainer(serializedPath), focused = useIsFocusedContainer(serializedPath), dropPosition = useElementDropPosition(props.path), t3;
5253
- $[7] === serializedPath ? t3 = $[8] : (t3 = (editor) => getListIndexMap(editor).get(serializedPath), $[7] = serializedPath, $[8] = t3);
5254
- let listIndex = useListIndexSelector(t3), subSchema = useBlockSubSchema(props.path), children = props.children;
5255
- if (props.legacy.renderStyle && props.textBlock.style) {
5256
- let t4;
5257
- $[9] !== props.textBlock.style || $[10] !== subSchema ? (t4 = props.textBlock.style === void 0 ? void 0 : subSchema.styles.find((style) => style.value === props.textBlock.style), $[9] = props.textBlock.style, $[10] = subSchema, $[11] = t4) : t4 = $[11];
5258
- let styleSchemaType = t4;
5259
- if (styleSchemaType) {
5260
- let t5;
5261
- $[12] === props.textBlock._key ? t5 = $[13] : (t5 = [{ _key: props.textBlock._key }], $[12] = props.textBlock._key, $[13] = t5);
5262
- let t6;
5263
- $[14] !== children || $[15] !== focused || $[16] !== props.legacy.renderStyle || $[17] !== props.textBlock || $[18] !== selected || $[19] !== styleSchemaType || $[20] !== t5 ? (t6 = /* @__PURE__ */ jsx(RenderStyle, {
5264
- renderStyle: props.legacy.renderStyle,
5265
- block: props.textBlock,
5266
- editorElementRef: blockRef,
5267
- focused,
5268
- path: t5,
5269
- schemaType: styleSchemaType,
5270
- selected,
5271
- value: props.textBlock.style,
5272
- children
5273
- }), $[14] = children, $[15] = focused, $[16] = props.legacy.renderStyle, $[17] = props.textBlock, $[18] = selected, $[19] = styleSchemaType, $[20] = t5, $[21] = t6) : t6 = $[21], children = t6;
5274
- } else console.error(`Unable to find Schema type for text block style ${props.textBlock.style}`);
5275
- }
5276
- if (props.legacy.renderListItem && props.textBlock.listItem) {
5277
- let t4;
5278
- if ($[22] !== props.textBlock.listItem || $[23] !== subSchema.lists) {
5279
- let t5;
5280
- $[25] === props.textBlock.listItem ? t5 = $[26] : (t5 = (list) => list.value === props.textBlock.listItem, $[25] = props.textBlock.listItem, $[26] = t5), t4 = subSchema.lists.find(t5), $[22] = props.textBlock.listItem, $[23] = subSchema.lists, $[24] = t4;
5281
- } else t4 = $[24];
5282
- let listItemSchemaType = t4;
5283
- if (listItemSchemaType) {
5284
- let t5 = props.textBlock.level ?? 1, t6;
5285
- $[27] === props.textBlock._key ? t6 = $[28] : (t6 = [{ _key: props.textBlock._key }], $[27] = props.textBlock._key, $[28] = t6);
5286
- let t7;
5287
- $[29] !== children || $[30] !== focused || $[31] !== listItemSchemaType || $[32] !== props.legacy.renderListItem || $[33] !== props.textBlock || $[34] !== selected || $[35] !== t5 || $[36] !== t6 ? (t7 = /* @__PURE__ */ jsx(RenderListItem, {
5288
- renderListItem: props.legacy.renderListItem,
5289
- block: props.textBlock,
5290
- editorElementRef: blockRef,
5291
- focused,
5292
- level: t5,
5293
- path: t6,
5294
- selected,
5295
- value: props.textBlock.listItem,
5296
- schemaType: listItemSchemaType,
5297
- children
5298
- }), $[29] = children, $[30] = focused, $[31] = listItemSchemaType, $[32] = props.legacy.renderListItem, $[33] = props.textBlock, $[34] = selected, $[35] = t5, $[36] = t6, $[37] = t7) : t7 = $[37], children = t7;
5299
- } else console.error(`Unable to find Schema type for text block list item ${props.textBlock.listItem}`);
5300
- }
5301
- let t4 = props.attributes, t5;
5302
- $[38] === props.textBlock.style ? t5 = $[39] : (t5 = props.textBlock.style ? [`pt-text-block-style-${props.textBlock.style}`] : [], $[38] = props.textBlock.style, $[39] = t5);
5303
- let t6;
5304
- $[40] !== props.textBlock.level || $[41] !== props.textBlock.listItem ? (t6 = props.textBlock.listItem ? [
5305
- "pt-list-item",
5306
- `pt-list-item-${props.textBlock.listItem}`,
5307
- `pt-list-item-level-${props.textBlock.level ?? 1}`
5308
- ] : [], $[40] = props.textBlock.level, $[41] = props.textBlock.listItem, $[42] = t6) : t6 = $[42];
5309
- let t7;
5310
- $[43] !== t5 || $[44] !== t6 ? (t7 = [
5311
- "pt-block",
5312
- "pt-text-block",
5313
- ...t5,
5314
- ...t6
5315
- ], $[43] = t5, $[44] = t6, $[45] = t7) : t7 = $[45];
5316
- let t8 = t7.join(" "), t9;
5317
- $[46] === props.textBlock.listItem ? t9 = $[47] : (t9 = props.textBlock.listItem === void 0 ? {} : { "data-list-item": props.textBlock.listItem }, $[46] = props.textBlock.listItem, $[47] = t9);
5318
- let t10;
5319
- $[48] === props.textBlock.level ? t10 = $[49] : (t10 = props.textBlock.level === void 0 ? {} : { "data-level": props.textBlock.level }, $[48] = props.textBlock.level, $[49] = t10);
5320
- let t11;
5321
- $[50] === props.textBlock.style ? t11 = $[51] : (t11 = props.textBlock.style === void 0 ? {} : { "data-style": props.textBlock.style }, $[50] = props.textBlock.style, $[51] = t11);
5322
- let t12;
5323
- $[52] === listIndex ? t12 = $[53] : (t12 = listIndex === void 0 ? {} : { "data-list-index": listIndex }, $[52] = listIndex, $[53] = t12);
5324
- let t13;
5325
- $[54] === dropPosition ? t13 = $[55] : (t13 = dropPosition === "start" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null, $[54] = dropPosition, $[55] = t13);
5326
- let t14;
5327
- $[56] !== children || $[57] !== focused || $[58] !== props.legacy.renderBlock || $[59] !== props.textBlock || $[60] !== schemaType || $[61] !== selected ? (t14 = props.legacy.renderBlock ? /* @__PURE__ */ jsx(RenderBlock, {
5328
- renderBlock: props.legacy.renderBlock,
5329
- editorElementRef: blockRef,
5330
- focused,
5331
- level: props.textBlock.level,
5332
- listItem: props.textBlock.listItem,
5333
- path: [{ _key: props.textBlock._key }],
5334
- selected,
5335
- schemaType,
5336
- style: props.textBlock.style,
5337
- value: props.textBlock,
5338
- children
5339
- }) : children, $[56] = children, $[57] = focused, $[58] = props.legacy.renderBlock, $[59] = props.textBlock, $[60] = schemaType, $[61] = selected, $[62] = t14) : t14 = $[62];
5340
- let t15;
5341
- $[63] === t14 ? t15 = $[64] : (t15 = /* @__PURE__ */ jsx("div", {
5342
- ref: blockRef,
5343
- children: t14
5344
- }), $[63] = t14, $[64] = t15);
5345
- let t16;
5346
- $[65] === dropPosition ? t16 = $[66] : (t16 = dropPosition === "end" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null, $[65] = dropPosition, $[66] = t16);
5347
- let t17;
5348
- return $[67] !== props.attributes || $[68] !== props.textBlock._key || $[69] !== props.textBlock._type || $[70] !== t10 || $[71] !== t11 || $[72] !== t12 || $[73] !== t13 || $[74] !== t15 || $[75] !== t16 || $[76] !== t8 || $[77] !== t9 ? (t17 = /* @__PURE__ */ jsxs("div", {
5349
- ...t4,
5350
- className: t8,
5351
- "data-block-key": props.textBlock._key,
5352
- "data-block-name": props.textBlock._type,
5353
- "data-block-type": "text",
4821
+ return $[2] !== props.attributes || $[3] !== t0 ? (t1 = /* @__PURE__ */ jsx("div", {
4822
+ ...props.attributes,
5354
4823
  "data-pt-block": "text",
5355
- ...t9,
5356
- ...t10,
5357
- ...t11,
5358
- ...t12,
5359
- children: [
5360
- t13,
5361
- t15,
5362
- t16
5363
- ]
5364
- }), $[67] = props.attributes, $[68] = props.textBlock._key, $[69] = props.textBlock._type, $[70] = t10, $[71] = t11, $[72] = t12, $[73] = t13, $[74] = t15, $[75] = t16, $[76] = t8, $[77] = t9, $[78] = t17) : t17 = $[78], t17;
5365
- }
5366
- function RenderBlock({ renderBlock, children, editorElementRef, focused, level, listItem, path, selected, style, schemaType, value }) {
5367
- return renderBlock({
5368
- children,
5369
- editorElementRef,
5370
- focused,
5371
- level,
5372
- listItem,
5373
- path,
5374
- selected,
5375
- style,
5376
- schemaType,
5377
- value
5378
- });
5379
- }
5380
- function RenderListItem({ renderListItem, block, children, editorElementRef, focused, level, path, schemaType, selected, value }) {
5381
- return renderListItem({
5382
- block,
5383
- children,
5384
- editorElementRef,
5385
- focused,
5386
- level,
5387
- path,
5388
- schemaType,
5389
- selected,
5390
- value
5391
- });
5392
- }
5393
- function RenderStyle({ renderStyle, block, children, editorElementRef, focused, path, schemaType, selected, value }) {
5394
- return renderStyle({
5395
- block,
5396
- children,
5397
- editorElementRef,
5398
- focused,
5399
- path,
5400
- schemaType,
5401
- selected,
5402
- value
5403
- });
4824
+ children: t0
4825
+ }), $[2] = props.attributes, $[3] = t0, $[4] = t1) : t1 = $[4], t1;
5404
4826
  }
5405
4827
  /**
5406
4828
  * Reference-equality comparator for fixed-length tuples. Each slot is
@@ -5414,7 +4836,7 @@ function tupleRefEqual(previous, next) {
5414
4836
  return !0;
5415
4837
  }
5416
4838
  function RenderElement(props) {
5417
- let $ = c(75), parentContainer = useContext(ParentContainerContext), parentTextBlock = useContext(ParentTextBlockContext), isInNewPipeline = useContext(NewPipelineContext), engineStatic = useEngineStatic(), schema = props.schema, type = props.element._type, t0;
4839
+ let $ = c(52), parentContainer = useContext(ParentContainerContext), parentTextBlock = useContext(ParentTextBlockContext), isInNewPipeline = useContext(NewPipelineContext), engineStatic = useEngineStatic(), schema = props.schema, type = props.element._type, t0;
5418
4840
  $[0] !== parentContainer || $[1] !== type ? (t0 = findBlockPositionalOverride(parentContainer, type), $[0] = parentContainer, $[1] = type, $[2] = t0) : t0 = $[2];
5419
4841
  let blockPositionalOverride = t0, t1;
5420
4842
  $[3] !== parentTextBlock || $[4] !== type ? (t1 = findInlinePositionalOverride(parentTextBlock, type), $[3] = parentTextBlock, $[4] = type, $[5] = t1) : t1 = $[5];
@@ -5511,123 +4933,68 @@ function RenderElement(props) {
5511
4933
  }
5512
4934
  if (isTextBlock({ schema }, props.element)) {
5513
4935
  let rendered;
5514
- if ($[18] !== isInNewPipeline || $[19] !== props.attributes || $[20] !== props.children || $[21] !== props.element || $[22] !== props.legacy || $[23] !== props.path || $[24] !== props.readOnly || $[25] !== renderableTextBlockConfig || $[26] !== schema) {
5515
- let { "data-slate-node": _sn, ...rest } = props.attributes;
5516
- if (renderableTextBlockConfig?.textBlock.render) rendered = /* @__PURE__ */ jsx(RenderTextBlockConfig, {
5517
- attributes: {
5518
- ...rest,
5519
- "data-pt-block": "text"
5520
- },
4936
+ if (renderableTextBlockConfig?.textBlock.render) {
4937
+ let t8;
4938
+ $[18] === props.attributes ? t8 = $[19] : (t8 = {
4939
+ ...props.attributes,
4940
+ "data-pt-block": "text"
4941
+ }, $[18] = props.attributes, $[19] = t8);
4942
+ let t9;
4943
+ $[20] !== props.children || $[21] !== props.element || $[22] !== props.path || $[23] !== props.readOnly || $[24] !== renderableTextBlockConfig.textBlock.render || $[25] !== t8 ? (t9 = /* @__PURE__ */ jsx(RenderTextBlockConfig, {
4944
+ attributes: t8,
5521
4945
  render: renderableTextBlockConfig.textBlock.render,
5522
4946
  node: props.element,
5523
4947
  path: props.path,
5524
4948
  readOnly: props.readOnly,
5525
4949
  children: props.children
5526
- });
5527
- else if (isInNewPipeline) rendered = renderDefaultTextBlock({
4950
+ }), $[20] = props.children, $[21] = props.element, $[22] = props.path, $[23] = props.readOnly, $[24] = renderableTextBlockConfig.textBlock.render, $[25] = t8, $[26] = t9) : t9 = $[26], rendered = t9;
4951
+ } else if (isInNewPipeline) {
4952
+ let t8;
4953
+ $[27] !== props.attributes || $[28] !== props.children ? (t8 = renderDefaultTextBlock({
5528
4954
  attributes: {
5529
- ...rest,
4955
+ ...props.attributes,
5530
4956
  "data-pt-block": "text"
5531
4957
  },
5532
4958
  children: props.children
5533
- });
5534
- else {
5535
- let t8;
5536
- $[28] !== props.attributes || $[29] !== props.children || $[30] !== props.element || $[31] !== props.legacy || $[32] !== props.path || $[33] !== props.readOnly || $[34] !== schema ? (t8 = /* @__PURE__ */ jsx(RenderTextBlock, {
5537
- attributes: props.attributes,
5538
- element: props.element,
5539
- legacy: props.legacy,
5540
- path: props.path,
5541
- readOnly: props.readOnly,
5542
- schema,
5543
- textBlock: props.element,
5544
- children: props.children
5545
- }), $[28] = props.attributes, $[29] = props.children, $[30] = props.element, $[31] = props.legacy, $[32] = props.path, $[33] = props.readOnly, $[34] = schema, $[35] = t8) : t8 = $[35], rendered = t8;
5546
- }
5547
- $[18] = isInNewPipeline, $[19] = props.attributes, $[20] = props.children, $[21] = props.element, $[22] = props.legacy, $[23] = props.path, $[24] = props.readOnly, $[25] = renderableTextBlockConfig, $[26] = schema, $[27] = rendered;
5548
- } else rendered = $[27];
4959
+ }), $[27] = props.attributes, $[28] = props.children, $[29] = t8) : t8 = $[29], rendered = t8;
4960
+ } else {
4961
+ let t8;
4962
+ $[30] !== props.attributes || $[31] !== props.children ? (t8 = /* @__PURE__ */ jsx(RenderTextBlock, {
4963
+ attributes: props.attributes,
4964
+ children: props.children
4965
+ }), $[30] = props.attributes, $[31] = props.children, $[32] = t8) : t8 = $[32], rendered = t8;
4966
+ }
5549
4967
  if (textBlockScope) {
5550
4968
  let t8;
5551
- return $[36] !== rendered || $[37] !== textBlockScope ? (t8 = /* @__PURE__ */ jsx(ParentTextBlockContext.Provider, {
4969
+ return $[33] !== rendered || $[34] !== textBlockScope ? (t8 = /* @__PURE__ */ jsx(ParentTextBlockContext.Provider, {
5552
4970
  value: textBlockScope,
5553
4971
  children: rendered
5554
- }), $[36] = rendered, $[37] = textBlockScope, $[38] = t8) : t8 = $[38], t8;
4972
+ }), $[33] = rendered, $[34] = textBlockScope, $[35] = t8) : t8 = $[35], t8;
5555
4973
  }
5556
4974
  return rendered;
5557
4975
  }
5558
4976
  if (isInline(engineStatic.snapshot, props.path)) {
5559
- if (isInNewPipeline && !inlineObjectConfig) {
5560
- let rest_0;
5561
- if ($[39] !== props.attributes) {
5562
- let { "data-slate-node": _sn_0, "data-slate-void": _sv, ...t8 } = props.attributes;
5563
- rest_0 = t8, $[39] = props.attributes, $[40] = rest_0;
5564
- } else rest_0 = $[40];
5565
- let t8;
5566
- $[41] !== props.element._key || $[42] !== props.element._type ? (t8 = /* @__PURE__ */ jsxs("span", {
5567
- contentEditable: !1,
5568
- children: [
5569
- "[",
5570
- props.element._type,
5571
- ": ",
5572
- props.element._key,
5573
- "]"
5574
- ]
5575
- }), $[41] = props.element._key, $[42] = props.element._type, $[43] = t8) : t8 = $[43];
5576
- let t9;
5577
- return $[44] !== props.children || $[45] !== rest_0 || $[46] !== t8 ? (t9 = /* @__PURE__ */ jsxs("span", {
5578
- ...rest_0,
5579
- "data-pt-inline": "object",
5580
- children: [props.children, t8]
5581
- }), $[44] = props.children, $[45] = rest_0, $[46] = t8, $[47] = t9) : t9 = $[47], t9;
5582
- }
5583
4977
  let t8;
5584
- return $[48] !== inlineObjectConfig || $[49] !== props.attributes || $[50] !== props.children || $[51] !== props.element || $[52] !== props.legacy || $[53] !== props.path || $[54] !== props.readOnly || $[55] !== schema ? (t8 = /* @__PURE__ */ jsx(RenderInlineObject, {
4978
+ return $[36] !== inlineObjectConfig || $[37] !== props.attributes || $[38] !== props.children || $[39] !== props.element || $[40] !== props.path || $[41] !== props.readOnly || $[42] !== schema ? (t8 = /* @__PURE__ */ jsx(RenderInlineObject, {
5585
4979
  attributes: props.attributes,
5586
4980
  element: props.element,
5587
4981
  inlineObjectConfig,
5588
- legacy: props.legacy,
5589
4982
  path: props.path,
5590
4983
  readOnly: props.readOnly,
5591
4984
  schema,
5592
4985
  children: props.children
5593
- }), $[48] = inlineObjectConfig, $[49] = props.attributes, $[50] = props.children, $[51] = props.element, $[52] = props.legacy, $[53] = props.path, $[54] = props.readOnly, $[55] = schema, $[56] = t8) : t8 = $[56], t8;
5594
- }
5595
- if (isInNewPipeline && !blockObjectConfig) {
5596
- let rest_1;
5597
- if ($[57] !== props.attributes) {
5598
- let { "data-slate-node": _sn_1, "data-slate-void": _sv_0, ...t8 } = props.attributes;
5599
- rest_1 = t8, $[57] = props.attributes, $[58] = rest_1;
5600
- } else rest_1 = $[58];
5601
- let t8;
5602
- $[59] !== props.element._key || $[60] !== props.element._type ? (t8 = /* @__PURE__ */ jsxs("div", {
5603
- contentEditable: !1,
5604
- children: [
5605
- "[",
5606
- props.element._type,
5607
- ": ",
5608
- props.element._key,
5609
- "]"
5610
- ]
5611
- }), $[59] = props.element._key, $[60] = props.element._type, $[61] = t8) : t8 = $[61];
5612
- let t9;
5613
- return $[62] !== props.children || $[63] !== rest_1 || $[64] !== t8 ? (t9 = /* @__PURE__ */ jsxs("div", {
5614
- ...rest_1,
5615
- "data-pt-block": "object",
5616
- children: [props.children, t8]
5617
- }), $[62] = props.children, $[63] = rest_1, $[64] = t8, $[65] = t9) : t9 = $[65], t9;
4986
+ }), $[36] = inlineObjectConfig, $[37] = props.attributes, $[38] = props.children, $[39] = props.element, $[40] = props.path, $[41] = props.readOnly, $[42] = schema, $[43] = t8) : t8 = $[43], t8;
5618
4987
  }
5619
4988
  let t8;
5620
- return $[66] !== blockObjectConfig || $[67] !== props.attributes || $[68] !== props.children || $[69] !== props.element || $[70] !== props.legacy || $[71] !== props.path || $[72] !== props.readOnly || $[73] !== schema ? (t8 = /* @__PURE__ */ jsx(RenderBlockObject, {
4989
+ return $[44] !== blockObjectConfig || $[45] !== props.attributes || $[46] !== props.children || $[47] !== props.element || $[48] !== props.path || $[49] !== props.readOnly || $[50] !== schema ? (t8 = /* @__PURE__ */ jsx(RenderBlockObject, {
5621
4990
  attributes: props.attributes,
5622
- blockObject: props.element,
5623
4991
  element: props.element,
5624
4992
  blockObjectConfig,
5625
- legacy: props.legacy,
5626
4993
  path: props.path,
5627
4994
  readOnly: props.readOnly,
5628
4995
  schema,
5629
4996
  children: props.children
5630
- }), $[66] = blockObjectConfig, $[67] = props.attributes, $[68] = props.children, $[69] = props.element, $[70] = props.legacy, $[71] = props.path, $[72] = props.readOnly, $[73] = schema, $[74] = t8) : t8 = $[74], t8;
4997
+ }), $[44] = blockObjectConfig, $[45] = props.attributes, $[46] = props.children, $[47] = props.element, $[48] = props.path, $[49] = props.readOnly, $[50] = schema, $[51] = t8) : t8 = $[51], t8;
5631
4998
  }
5632
4999
  /**
5633
5000
  * Renders a text block via a registered `defineTextBlock` config whose
@@ -5689,6 +5056,9 @@ function useSpanConfig(node, _path) {
5689
5056
  function useDecoratorConfigs() {
5690
5057
  return useRegistrationsSelector(_temp$2);
5691
5058
  }
5059
+ function _temp$2(engine) {
5060
+ return engine.decorators;
5061
+ }
5692
5062
  /**
5693
5063
  * Hook: the engine's registered GLOBAL annotation map. Positional
5694
5064
  * (in-parent) annotation overrides are a separate layer: the caller
@@ -5700,9 +5070,6 @@ function useDecoratorConfigs() {
5700
5070
  * span's marks resolve to a variable number of annotation `markDef`s
5701
5071
  * per render.
5702
5072
  */
5703
- function _temp$2(engine) {
5704
- return engine.decorators;
5705
- }
5706
5073
  function useAnnotationConfigs() {
5707
5074
  return useRegistrationsSelector(_temp2$1);
5708
5075
  }
@@ -5710,167 +5077,86 @@ function _temp2$1(engine) {
5710
5077
  return engine.annotations;
5711
5078
  }
5712
5079
  function RenderSpan(props) {
5713
- let $ = c(33), schema = props.schema, spanRef = useRef(null), t0;
5714
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
5715
- let t1;
5716
- $[1] === schema.span.name ? t1 = $[2] : (t1 = {
5717
- name: schema.span.name,
5718
- fields: t0
5719
- }, $[1] = schema.span.name, $[2] = t1);
5720
- let schemaType = t1, parent = props.children.props.parent, block = parent && isTextBlock({ schema }, parent) ? parent : void 0, t2;
5721
- $[3] !== block?.children || $[4] !== props.leaf._key ? (t2 = block?.children.find((_child) => _child._key === props.leaf._key), $[3] = block?.children, $[4] = props.leaf._key, $[5] = t2) : t2 = $[5];
5722
- let child = t2, subSchema = useBlockSubSchema(props.path), spanConfig = useSpanConfig(child ?? props.leaf, props.path), decoratorConfigs = useDecoratorConfigs(), annotationConfigs = useAnnotationConfigs(), parentTextBlock = useContext(ParentTextBlockContext), isInNewPipeline = useContext(NewPipelineContext), t3;
5723
- $[6] === props.path ? t3 = $[7] : (t3 = serializePath(props.path), $[6] = props.path, $[7] = t3);
5724
- let serializedPath = t3, focused = useIsFocusedLeaf(serializedPath), selected = useIsSelectedLeaf(serializedPath), t4 = subSchema.decorators, children, t5;
5725
- if ($[8] !== annotationConfigs || $[9] !== block || $[10] !== child || $[11] !== decoratorConfigs || $[12] !== focused || $[13] !== isInNewPipeline || $[14] !== parentTextBlock || $[15] !== props.attributes || $[16] !== props.children || $[17] !== props.leaf || $[18] !== props.path || $[19] !== props.readOnly || $[20] !== props.renderAnnotation || $[21] !== props.renderChild || $[22] !== props.renderDecorator || $[23] !== schemaType || $[24] !== selected || $[25] !== spanConfig || $[26] !== subSchema.annotations || $[27] !== subSchema.decorators) {
5726
- t5 = Symbol.for("react.early_return_sentinel");
5727
- bb0: {
5728
- let decoratorSchemaTypes = t4.map(_temp$1), decorators = [...new Set((props.leaf.marks ?? []).filter((mark) => decoratorSchemaTypes.includes(mark)))], annotationMarkDefs = (props.leaf.marks ?? []).flatMap((mark_0) => {
5729
- if (decoratorSchemaTypes.includes(mark_0)) return [];
5730
- let markDef_0 = block?.markDefs?.find((markDef) => markDef._key === mark_0);
5731
- return markDef_0 ? [markDef_0] : [];
5732
- });
5733
- children = props.children;
5734
- for (let mark_1 of decorators) {
5735
- let decoratorSchemaType = subSchema.decorators.find((dec) => dec.name === mark_1);
5736
- if (!decoratorSchemaType) continue;
5737
- let globalDecoratorConfig = decoratorConfigs.get(mark_1) ?? decoratorConfigs.get("*"), positionalDecorator = findPositionalDecoratorOverride(parentTextBlock, mark_1), decoratorConfig = positionalDecorator ? positionalDecorator.decorator.render === void 0 ? globalDecoratorConfig : positionalDecorator : globalDecoratorConfig;
5738
- if (decoratorConfig) {
5739
- let render = decoratorConfig.decorator.render, renderProps = {
5740
- children,
5741
- decorator: mark_1,
5742
- focused,
5743
- path: props.path,
5744
- readOnly: props.readOnly,
5745
- renderDefault: renderDefaultDecorator,
5746
- selected
5747
- };
5748
- children = render ? render(renderProps) : renderDefaultDecorator(renderProps);
5749
- continue;
5750
- }
5751
- props.renderDecorator && (children = /* @__PURE__ */ jsx(RenderDecorator, {
5752
- renderDecorator: props.renderDecorator,
5753
- editorElementRef: spanRef,
5080
+ let $ = c(30), schema = props.schema, spanRef = useRef(null), parent = props.children.props.parent, block = parent && isTextBlock({ schema }, parent) ? parent : void 0, t0;
5081
+ $[0] !== block?.children || $[1] !== props.leaf._key ? (t0 = block?.children.find((_child) => _child._key === props.leaf._key), $[0] = block?.children, $[1] = props.leaf._key, $[2] = t0) : t0 = $[2];
5082
+ let child = t0, subSchema = useBlockSubSchema(props.path), spanConfig = useSpanConfig(child ?? props.leaf, props.path), decoratorConfigs = useDecoratorConfigs(), annotationConfigs = useAnnotationConfigs(), parentTextBlock = useContext(ParentTextBlockContext), t1;
5083
+ $[3] === props.path ? t1 = $[4] : (t1 = serializePath(props.path), $[3] = props.path, $[4] = t1);
5084
+ let serializedPath = t1, focused = useIsFocusedLeaf(serializedPath), selected = useIsSelectedLeaf(serializedPath), children;
5085
+ if ($[5] !== annotationConfigs || $[6] !== block?.markDefs || $[7] !== decoratorConfigs || $[8] !== focused || $[9] !== parentTextBlock || $[10] !== props.children || $[11] !== props.leaf.marks || $[12] !== props.path || $[13] !== props.readOnly || $[14] !== selected || $[15] !== subSchema.annotations || $[16] !== subSchema.decorators) {
5086
+ let decoratorSchemaTypes = subSchema.decorators.map(_temp$1), decorators = [...new Set((props.leaf.marks ?? []).filter((mark) => decoratorSchemaTypes.includes(mark)))], annotationMarkDefs = (props.leaf.marks ?? []).flatMap((mark_0) => {
5087
+ if (decoratorSchemaTypes.includes(mark_0)) return [];
5088
+ let markDef_0 = block?.markDefs?.find((markDef) => markDef._key === mark_0);
5089
+ return markDef_0 ? [markDef_0] : [];
5090
+ });
5091
+ children = props.children;
5092
+ for (let mark_1 of decorators) {
5093
+ if (!subSchema.decorators.find((dec) => dec.name === mark_1)) continue;
5094
+ let globalDecoratorConfig = decoratorConfigs.get(mark_1) ?? decoratorConfigs.get("*"), positionalDecorator = findPositionalDecoratorOverride(parentTextBlock, mark_1), decoratorConfig = positionalDecorator ? positionalDecorator.decorator.render === void 0 ? globalDecoratorConfig : positionalDecorator : globalDecoratorConfig;
5095
+ if (decoratorConfig) {
5096
+ let render = decoratorConfig.decorator.render, renderProps = {
5097
+ children,
5098
+ decorator: mark_1,
5754
5099
  focused,
5755
5100
  path: props.path,
5756
- selected,
5757
- schemaType: decoratorSchemaType,
5758
- value: mark_1,
5759
- children
5760
- }));
5761
- }
5762
- for (let annotationMarkDef of annotationMarkDefs) {
5763
- let annotationSchemaType = subSchema.annotations.find((t) => t.name === annotationMarkDef._type);
5764
- if (annotationSchemaType) {
5765
- let globalAnnotationConfig = annotationConfigs.get(annotationMarkDef._type) ?? annotationConfigs.get("*"), positionalAnnotation = findPositionalAnnotationOverride(parentTextBlock, annotationMarkDef._type), annotationConfig = positionalAnnotation ? positionalAnnotation.annotation.render === void 0 ? globalAnnotationConfig : positionalAnnotation : globalAnnotationConfig;
5766
- if (annotationConfig) {
5767
- let render_0 = annotationConfig.annotation.render, renderProps_0 = {
5768
- children,
5769
- focused,
5770
- annotation: annotationMarkDef,
5771
- path: props.path,
5772
- readOnly: props.readOnly,
5773
- renderDefault: renderDefaultAnnotation,
5774
- selected
5775
- };
5776
- children = /* @__PURE__ */ jsx("span", {
5777
- ref: spanRef,
5778
- children: render_0 ? render_0(renderProps_0) : renderDefaultAnnotation(renderProps_0)
5779
- });
5780
- continue;
5781
- }
5782
- children = block && props.renderAnnotation ? /* @__PURE__ */ jsx("span", {
5783
- ref: spanRef,
5784
- children: /* @__PURE__ */ jsx(RenderAnnotation, {
5785
- renderAnnotation: props.renderAnnotation,
5786
- block,
5787
- editorElementRef: spanRef,
5788
- focused,
5789
- path: props.path,
5790
- selected,
5791
- schemaType: annotationSchemaType,
5792
- value: annotationMarkDef,
5793
- children
5794
- })
5795
- }) : /* @__PURE__ */ jsx("span", {
5796
- ref: spanRef,
5797
- children
5798
- });
5799
- }
5101
+ readOnly: props.readOnly,
5102
+ renderDefault: renderDefaultDecorator,
5103
+ selected
5104
+ };
5105
+ children = render ? render(renderProps) : renderDefaultDecorator(renderProps);
5800
5106
  }
5801
- if (block && props.renderChild && child && !spanConfig && !isInNewPipeline && (children = /* @__PURE__ */ jsx(RenderChild, {
5802
- renderChild: props.renderChild,
5803
- annotations: annotationMarkDefs,
5804
- editorElementRef: spanRef,
5805
- focused,
5806
- path: props.path,
5807
- schemaType,
5808
- selected,
5809
- value: child,
5810
- children
5811
- })), spanConfig) {
5812
- let render_1 = spanConfig.span.render, renderProps_1 = {
5813
- attributes: props.attributes,
5107
+ }
5108
+ for (let annotationMarkDef of annotationMarkDefs) if (subSchema.annotations.find((t) => t.name === annotationMarkDef._type)) {
5109
+ let globalAnnotationConfig = annotationConfigs.get(annotationMarkDef._type) ?? annotationConfigs.get("*"), positionalAnnotation = findPositionalAnnotationOverride(parentTextBlock, annotationMarkDef._type), annotationConfig = positionalAnnotation ? positionalAnnotation.annotation.render === void 0 ? globalAnnotationConfig : positionalAnnotation : globalAnnotationConfig;
5110
+ if (annotationConfig) {
5111
+ let render_0 = annotationConfig.annotation.render, renderProps_0 = {
5814
5112
  children,
5815
5113
  focused,
5816
- node: child ?? props.leaf,
5114
+ annotation: annotationMarkDef,
5817
5115
  path: props.path,
5818
5116
  readOnly: props.readOnly,
5819
- renderDefault: renderDefaultSpan,
5117
+ renderDefault: renderDefaultAnnotation,
5820
5118
  selected
5821
5119
  };
5822
- t5 = render_1 ? render_1(renderProps_1) : renderDefaultSpan(renderProps_1);
5823
- break bb0;
5120
+ children = /* @__PURE__ */ jsx("span", {
5121
+ ref: spanRef,
5122
+ children: render_0 ? render_0(renderProps_0) : renderDefaultAnnotation(renderProps_0)
5123
+ });
5124
+ continue;
5824
5125
  }
5126
+ children = /* @__PURE__ */ jsx("span", {
5127
+ ref: spanRef,
5128
+ children
5129
+ });
5825
5130
  }
5826
- $[8] = annotationConfigs, $[9] = block, $[10] = child, $[11] = decoratorConfigs, $[12] = focused, $[13] = isInNewPipeline, $[14] = parentTextBlock, $[15] = props.attributes, $[16] = props.children, $[17] = props.leaf, $[18] = props.path, $[19] = props.readOnly, $[20] = props.renderAnnotation, $[21] = props.renderChild, $[22] = props.renderDecorator, $[23] = schemaType, $[24] = selected, $[25] = spanConfig, $[26] = subSchema.annotations, $[27] = subSchema.decorators, $[28] = children, $[29] = t5;
5827
- } else children = $[28], t5 = $[29];
5828
- if (t5 !== Symbol.for("react.early_return_sentinel")) return t5;
5829
- let t6;
5830
- return $[30] !== children || $[31] !== props.attributes ? (t6 = /* @__PURE__ */ jsx("span", {
5131
+ $[5] = annotationConfigs, $[6] = block?.markDefs, $[7] = decoratorConfigs, $[8] = focused, $[9] = parentTextBlock, $[10] = props.children, $[11] = props.leaf.marks, $[12] = props.path, $[13] = props.readOnly, $[14] = selected, $[15] = subSchema.annotations, $[16] = subSchema.decorators, $[17] = children;
5132
+ } else children = $[17];
5133
+ if (spanConfig) {
5134
+ let render_1 = spanConfig.span.render, t2 = child ?? props.leaf, t3;
5135
+ if ($[18] !== children || $[19] !== focused || $[20] !== props.attributes || $[21] !== props.path || $[22] !== props.readOnly || $[23] !== render_1 || $[24] !== selected || $[25] !== t2) {
5136
+ let renderProps_1 = {
5137
+ attributes: props.attributes,
5138
+ children,
5139
+ focused,
5140
+ node: t2,
5141
+ path: props.path,
5142
+ readOnly: props.readOnly,
5143
+ renderDefault: renderDefaultSpan,
5144
+ selected
5145
+ };
5146
+ t3 = render_1 ? render_1(renderProps_1) : renderDefaultSpan(renderProps_1), $[18] = children, $[19] = focused, $[20] = props.attributes, $[21] = props.path, $[22] = props.readOnly, $[23] = render_1, $[24] = selected, $[25] = t2, $[26] = t3;
5147
+ } else t3 = $[26];
5148
+ return t3;
5149
+ }
5150
+ let t2;
5151
+ return $[27] !== children || $[28] !== props.attributes ? (t2 = /* @__PURE__ */ jsx("span", {
5831
5152
  ...props.attributes,
5832
5153
  ref: spanRef,
5833
5154
  children
5834
- }), $[30] = children, $[31] = props.attributes, $[32] = t6) : t6 = $[32], t6;
5155
+ }), $[27] = children, $[28] = props.attributes, $[29] = t2) : t2 = $[29], t2;
5835
5156
  }
5836
5157
  function _temp$1(decorator) {
5837
5158
  return decorator.name;
5838
5159
  }
5839
- function RenderAnnotation({ renderAnnotation, block, children, editorElementRef, focused, path, schemaType, selected, value }) {
5840
- return renderAnnotation({
5841
- block,
5842
- children,
5843
- editorElementRef,
5844
- focused,
5845
- path,
5846
- schemaType,
5847
- selected,
5848
- value
5849
- });
5850
- }
5851
- function RenderDecorator({ renderDecorator, children, editorElementRef, focused, path, schemaType, selected, value }) {
5852
- return renderDecorator({
5853
- children,
5854
- editorElementRef,
5855
- focused,
5856
- path,
5857
- schemaType,
5858
- selected,
5859
- value
5860
- });
5861
- }
5862
- function RenderChild({ renderChild, annotations, children, editorElementRef, focused, path, schemaType, selected, value }) {
5863
- return renderChild({
5864
- annotations,
5865
- children,
5866
- editorElementRef,
5867
- focused,
5868
- path,
5869
- schemaType,
5870
- selected,
5871
- value
5872
- });
5873
- }
5874
5160
  const PLACEHOLDER_STYLE = {
5875
5161
  position: "absolute",
5876
5162
  userSelect: "none",
@@ -5904,29 +5190,12 @@ function RenderLeaf(props) {
5904
5190
  return renderedSpan;
5905
5191
  }
5906
5192
  function RenderText(props) {
5907
- let $ = c(10);
5908
- if (useContext(NewPipelineContext)) {
5909
- let t0 = props.attributes, rest;
5910
- if ($[0] !== t0) {
5911
- let { "data-slate-node": _sn, ...t1 } = t0;
5912
- rest = t1, $[0] = t0, $[1] = rest;
5913
- } else rest = $[1];
5914
- let t1;
5915
- return $[2] !== props.children || $[3] !== rest ? (t1 = /* @__PURE__ */ jsx("span", {
5916
- ...rest,
5917
- "data-pt-inline": "span",
5918
- children: props.children
5919
- }), $[2] = props.children, $[3] = rest, $[4] = t1) : t1 = $[4], t1;
5920
- }
5921
- let t0;
5922
- return $[5] !== props.attributes || $[6] !== props.children || $[7] !== props.text._key || $[8] !== props.text._type ? (t0 = /* @__PURE__ */ jsx("span", {
5193
+ let $ = c(3), t0;
5194
+ return $[0] !== props.attributes || $[1] !== props.children ? (t0 = /* @__PURE__ */ jsx("span", {
5923
5195
  ...props.attributes,
5924
- "data-child-key": props.text._key,
5925
- "data-child-name": props.text._type,
5926
- "data-child-type": "span",
5927
5196
  "data-pt-inline": "span",
5928
5197
  children: props.children
5929
- }), $[5] = props.attributes, $[6] = props.children, $[7] = props.text._key, $[8] = props.text._type, $[9] = t0) : t0 = $[9], t0;
5198
+ }), $[0] = props.attributes, $[1] = props.children, $[2] = t0) : t0 = $[2], t0;
5930
5199
  }
5931
5200
  /**
5932
5201
  * A React context for sharing the editor object.
@@ -6013,62 +5282,51 @@ function validateSelection(editorEngine, editorElement) {
6013
5282
  * @group Components
6014
5283
  */
6015
5284
  const PortableTextEditable = forwardRef(function PortableTextEditable(props, forwardedRef) {
6016
- let $ = c(179), hotkeys, onBeforeInput, onBlur, onClick, onCopy, onCut, onDrag, onDragEnd, onDragEnter, onDragLeave, onDragOver, onDragStart, onDrop, onFocus, onPaste, propsSelection, rangeDecorations, renderAnnotation, renderBlock, renderChild, renderDecorator, renderListItem, renderPlaceholder, renderStyle, restProps, scrollSelectionIntoView;
6017
- $[0] === props ? (hotkeys = $[1], onBeforeInput = $[2], onBlur = $[3], onClick = $[4], onCopy = $[5], onCut = $[6], onDrag = $[7], onDragEnd = $[8], onDragEnter = $[9], onDragLeave = $[10], onDragOver = $[11], onDragStart = $[12], onDrop = $[13], onFocus = $[14], onPaste = $[15], propsSelection = $[16], rangeDecorations = $[17], renderAnnotation = $[18], renderBlock = $[19], renderChild = $[20], renderDecorator = $[21], renderListItem = $[22], renderPlaceholder = $[23], renderStyle = $[24], restProps = $[25], scrollSelectionIntoView = $[26]) : ({hotkeys, onBlur, onFocus, onBeforeInput, onPaste, onCopy, onCut, onClick, onDragStart, onDrag, onDragEnd, onDragEnter, onDragOver, onDrop, onDragLeave, rangeDecorations, renderAnnotation, renderBlock, renderChild, renderDecorator, renderListItem, renderPlaceholder, renderStyle, selection: propsSelection, scrollSelectionIntoView, ...restProps} = props, $[0] = props, $[1] = hotkeys, $[2] = onBeforeInput, $[3] = onBlur, $[4] = onClick, $[5] = onCopy, $[6] = onCut, $[7] = onDrag, $[8] = onDragEnd, $[9] = onDragEnter, $[10] = onDragLeave, $[11] = onDragOver, $[12] = onDragStart, $[13] = onDrop, $[14] = onFocus, $[15] = onPaste, $[16] = propsSelection, $[17] = rangeDecorations, $[18] = renderAnnotation, $[19] = renderBlock, $[20] = renderChild, $[21] = renderDecorator, $[22] = renderListItem, $[23] = renderPlaceholder, $[24] = renderStyle, $[25] = restProps, $[26] = scrollSelectionIntoView);
5285
+ let $ = c(163), hotkeys, onBeforeInput, onBlur, onClick, onCopy, onCut, onDrag, onDragEnd, onDragEnter, onDragLeave, onDragOver, onDragStart, onDrop, onFocus, onPaste, propsSelection, rangeDecorations, renderPlaceholder, restProps, scrollSelectionIntoView;
5286
+ $[0] === props ? (hotkeys = $[1], onBeforeInput = $[2], onBlur = $[3], onClick = $[4], onCopy = $[5], onCut = $[6], onDrag = $[7], onDragEnd = $[8], onDragEnter = $[9], onDragLeave = $[10], onDragOver = $[11], onDragStart = $[12], onDrop = $[13], onFocus = $[14], onPaste = $[15], propsSelection = $[16], rangeDecorations = $[17], renderPlaceholder = $[18], restProps = $[19], scrollSelectionIntoView = $[20]) : ({hotkeys, onBlur, onFocus, onBeforeInput, onPaste, onCopy, onCut, onClick, onDragStart, onDrag, onDragEnd, onDragEnter, onDragOver, onDrop, onDragLeave, rangeDecorations, renderPlaceholder, selection: propsSelection, scrollSelectionIntoView, ...restProps} = props, $[0] = props, $[1] = hotkeys, $[2] = onBeforeInput, $[3] = onBlur, $[4] = onClick, $[5] = onCopy, $[6] = onCut, $[7] = onDrag, $[8] = onDragEnd, $[9] = onDragEnter, $[10] = onDragLeave, $[11] = onDragOver, $[12] = onDragStart, $[13] = onDrop, $[14] = onFocus, $[15] = onPaste, $[16] = propsSelection, $[17] = rangeDecorations, $[18] = renderPlaceholder, $[19] = restProps, $[20] = scrollSelectionIntoView);
6018
5287
  let portableTextEditor = usePortableTextEditor(), [hasInvalidValue, setHasInvalidValue] = useState(!1), editorActor = useContext(EditorActorContext), relay = useContext(RelayContext), editorEngine = useEngine(), schema = editorEngine.snapshot.context.schema, readOnly = useSelector(editorActor, _temp), t0;
6019
- $[27] === editorEngine ? t0 = $[28] : (t0 = { input: { editorEngine } }, $[27] = editorEngine, $[28] = t0);
5288
+ $[21] === editorEngine ? t0 = $[22] : (t0 = { input: { editorEngine } }, $[21] = editorEngine, $[22] = t0);
6020
5289
  let validateSelectionActor = useActorRef(validateSelectionMachine, t0), t1;
6021
- $[29] === rangeDecorations ? t1 = $[30] : (t1 = rangeDecorations ?? [], $[29] = rangeDecorations, $[30] = t1);
5290
+ $[23] === rangeDecorations ? t1 = $[24] : (t1 = rangeDecorations ?? [], $[23] = rangeDecorations, $[24] = t1);
6022
5291
  let t2;
6023
- $[31] === editorActor ? t2 = $[32] : (t2 = editorActor.getSnapshot().matches({ setup: "setting up" }), $[31] = editorActor, $[32] = t2);
5292
+ $[25] === editorActor ? t2 = $[26] : (t2 = editorActor.getSnapshot().matches({ setup: "setting up" }), $[25] = editorActor, $[26] = t2);
6024
5293
  let t3 = !t2, t4;
6025
- $[33] !== editorEngine || $[34] !== readOnly || $[35] !== schema || $[36] !== t1 || $[37] !== t3 ? (t4 = { input: {
5294
+ $[27] !== editorEngine || $[28] !== readOnly || $[29] !== schema || $[30] !== t1 || $[31] !== t3 ? (t4 = { input: {
6026
5295
  rangeDecorations: t1,
6027
5296
  readOnly,
6028
5297
  schema,
6029
5298
  editorEngine,
6030
5299
  skipSetup: t3
6031
- } }, $[33] = editorEngine, $[34] = readOnly, $[35] = schema, $[36] = t1, $[37] = t3, $[38] = t4) : t4 = $[38];
5300
+ } }, $[27] = editorEngine, $[28] = readOnly, $[29] = schema, $[30] = t1, $[31] = t3, $[32] = t4) : t4 = $[32];
6032
5301
  let rangeDecorationsActor = useActorRef(rangeDecorationsMachine, t4), decorate = useSelector(rangeDecorationsActor, _temp2), t5, t6;
6033
- $[39] !== rangeDecorationsActor || $[40] !== readOnly ? (t5 = () => {
5302
+ $[33] !== rangeDecorationsActor || $[34] !== readOnly ? (t5 = () => {
6034
5303
  rangeDecorationsActor.send({
6035
5304
  type: "update read only",
6036
5305
  readOnly
6037
5306
  });
6038
- }, t6 = [rangeDecorationsActor, readOnly], $[39] = rangeDecorationsActor, $[40] = readOnly, $[41] = t5, $[42] = t6) : (t5 = $[41], t6 = $[42]), useEffect(t5, t6);
5307
+ }, t6 = [rangeDecorationsActor, readOnly], $[33] = rangeDecorationsActor, $[34] = readOnly, $[35] = t5, $[36] = t6) : (t5 = $[35], t6 = $[36]), useEffect(t5, t6);
6039
5308
  let t7, t8;
6040
- $[43] !== rangeDecorations || $[44] !== rangeDecorationsActor ? (t7 = () => {
5309
+ $[37] !== rangeDecorations || $[38] !== rangeDecorationsActor ? (t7 = () => {
6041
5310
  rangeDecorationsActor.send({
6042
5311
  type: "range decorations updated",
6043
5312
  rangeDecorations: rangeDecorations ?? []
6044
5313
  });
6045
- }, t8 = [rangeDecorationsActor, rangeDecorations], $[43] = rangeDecorations, $[44] = rangeDecorationsActor, $[45] = t7, $[46] = t8) : (t7 = $[45], t8 = $[46]), useEffect(t7, t8);
5314
+ }, t8 = [rangeDecorationsActor, rangeDecorations], $[37] = rangeDecorations, $[38] = rangeDecorationsActor, $[39] = t7, $[40] = t8) : (t7 = $[39], t8 = $[40]), useEffect(t7, t8);
6046
5315
  let t9;
6047
- $[47] !== renderBlock || $[48] !== renderChild || $[49] !== renderListItem || $[50] !== renderStyle ? (t9 = {
6048
- renderBlock,
6049
- renderChild,
6050
- renderListItem,
6051
- renderStyle
6052
- }, $[47] = renderBlock, $[48] = renderChild, $[49] = renderListItem, $[50] = renderStyle, $[51] = t9) : t9 = $[51];
6053
- let legacy = t9, t10;
6054
- $[52] !== legacy || $[53] !== readOnly || $[54] !== schema ? (t10 = (eProps) => /* @__PURE__ */ jsx(RenderElement, {
5316
+ $[41] !== readOnly || $[42] !== schema ? (t9 = (eProps) => /* @__PURE__ */ jsx(RenderElement, {
6055
5317
  ...eProps,
6056
- legacy,
6057
5318
  readOnly,
6058
5319
  schema
6059
- }), $[52] = legacy, $[53] = readOnly, $[54] = schema, $[55] = t10) : t10 = $[55];
6060
- let renderElement = t10, t11;
6061
- $[56] !== readOnly || $[57] !== renderAnnotation || $[58] !== renderChild || $[59] !== renderDecorator || $[60] !== renderPlaceholder || $[61] !== schema ? (t11 = (leafProps) => /* @__PURE__ */ jsx(RenderLeaf, {
5320
+ }), $[41] = readOnly, $[42] = schema, $[43] = t9) : t9 = $[43];
5321
+ let renderElement = t9, t10;
5322
+ $[44] !== readOnly || $[45] !== renderPlaceholder || $[46] !== schema ? (t10 = (leafProps) => /* @__PURE__ */ jsx(RenderLeaf, {
6062
5323
  ...leafProps,
6063
5324
  readOnly,
6064
- renderAnnotation,
6065
- renderChild,
6066
- renderDecorator,
6067
5325
  renderPlaceholder,
6068
5326
  schema
6069
- }), $[56] = readOnly, $[57] = renderAnnotation, $[58] = renderChild, $[59] = renderDecorator, $[60] = renderPlaceholder, $[61] = schema, $[62] = t11) : t11 = $[62];
6070
- let renderLeaf = t11, renderText = _temp3, t12;
6071
- $[63] !== editorActor || $[64] !== editorEngine || $[65] !== propsSelection ? (t12 = () => {
5327
+ }), $[44] = readOnly, $[45] = renderPlaceholder, $[46] = schema, $[47] = t10) : t10 = $[47];
5328
+ let renderLeaf = t10, renderText = _temp3, t11;
5329
+ $[48] !== editorActor || $[49] !== editorEngine || $[50] !== propsSelection ? (t11 = () => {
6072
5330
  if (propsSelection) {
6073
5331
  debug.selection.enabled && debug.selection(`Selection from props ${safeStringify(propsSelection)}`);
6074
5332
  let resolvedSelection = resolveSelection(editorEngine, propsSelection);
@@ -6077,9 +5335,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6077
5335
  selection: resolvedSelection
6078
5336
  }), editorEngine.onChange());
6079
5337
  }
6080
- }, $[63] = editorActor, $[64] = editorEngine, $[65] = propsSelection, $[66] = t12) : t12 = $[66];
6081
- let restoreSelectionFromProps = t12, t13, t14;
6082
- $[67] !== editorActor || $[68] !== rangeDecorationsActor || $[69] !== restoreSelectionFromProps ? (t13 = () => {
5338
+ }, $[48] = editorActor, $[49] = editorEngine, $[50] = propsSelection, $[51] = t11) : t11 = $[51];
5339
+ let restoreSelectionFromProps = t11, t12, t13;
5340
+ $[52] !== editorActor || $[53] !== rangeDecorationsActor || $[54] !== restoreSelectionFromProps ? (t12 = () => {
6083
5341
  let onReady = editorActor.on("ready", () => {
6084
5342
  rangeDecorationsActor.send({ type: "ready" }), restoreSelectionFromProps();
6085
5343
  }), onInvalidValue = editorActor.on("invalid value", () => {
@@ -6090,21 +5348,21 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6090
5348
  return () => {
6091
5349
  onReady.unsubscribe(), onInvalidValue.unsubscribe(), onValueChanged.unsubscribe();
6092
5350
  };
6093
- }, t14 = [
5351
+ }, t13 = [
6094
5352
  rangeDecorationsActor,
6095
5353
  editorActor,
6096
5354
  restoreSelectionFromProps
6097
- ], $[67] = editorActor, $[68] = rangeDecorationsActor, $[69] = restoreSelectionFromProps, $[70] = t13, $[71] = t14) : (t13 = $[70], t14 = $[71]), useEffect(t13, t14);
6098
- let t15, t16;
6099
- $[72] !== hasInvalidValue || $[73] !== propsSelection || $[74] !== restoreSelectionFromProps ? (t15 = () => {
5355
+ ], $[52] = editorActor, $[53] = rangeDecorationsActor, $[54] = restoreSelectionFromProps, $[55] = t12, $[56] = t13) : (t12 = $[55], t13 = $[56]), useEffect(t12, t13);
5356
+ let t14, t15;
5357
+ $[57] !== hasInvalidValue || $[58] !== propsSelection || $[59] !== restoreSelectionFromProps ? (t14 = () => {
6100
5358
  propsSelection && !hasInvalidValue && restoreSelectionFromProps();
6101
- }, t16 = [
5359
+ }, t15 = [
6102
5360
  hasInvalidValue,
6103
5361
  propsSelection,
6104
5362
  restoreSelectionFromProps
6105
- ], $[72] = hasInvalidValue, $[73] = propsSelection, $[74] = restoreSelectionFromProps, $[75] = t15, $[76] = t16) : (t15 = $[75], t16 = $[76]), useEffect(t15, t16);
6106
- let t17;
6107
- $[77] !== editorActor || $[78] !== editorEngine || $[79] !== onCopy ? (t17 = (event) => {
5363
+ ], $[57] = hasInvalidValue, $[58] = propsSelection, $[59] = restoreSelectionFromProps, $[60] = t14, $[61] = t15) : (t14 = $[60], t15 = $[61]), useEffect(t14, t15);
5364
+ let t16;
5365
+ $[62] !== editorActor || $[63] !== editorEngine || $[64] !== onCopy ? (t16 = (event) => {
6108
5366
  if (DOMEditor.hasSelectableTarget(editorEngine, event.target)) {
6109
5367
  if (onCopy) onCopy(event) !== void 0 && event.preventDefault();
6110
5368
  else if (event.nativeEvent.clipboardData) {
@@ -6126,9 +5384,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6126
5384
  });
6127
5385
  }
6128
5386
  }
6129
- }, $[77] = editorActor, $[78] = editorEngine, $[79] = onCopy, $[80] = t17) : t17 = $[80];
6130
- let handleCopy = t17, t18;
6131
- $[81] !== editorActor || $[82] !== editorEngine || $[83] !== onCut ? (t18 = (event_0) => {
5387
+ }, $[62] = editorActor, $[63] = editorEngine, $[64] = onCopy, $[65] = t16) : t16 = $[65];
5388
+ let handleCopy = t16, t17;
5389
+ $[66] !== editorActor || $[67] !== editorEngine || $[68] !== onCut ? (t17 = (event_0) => {
6132
5390
  if (DOMEditor.hasSelectableTarget(editorEngine, event_0.target)) {
6133
5391
  if (onCut) onCut(event_0) !== void 0 && event_0.preventDefault();
6134
5392
  else if (event_0.nativeEvent.clipboardData) {
@@ -6150,16 +5408,16 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6150
5408
  });
6151
5409
  }
6152
5410
  }
6153
- }, $[81] = editorActor, $[82] = editorEngine, $[83] = onCut, $[84] = t18) : t18 = $[84];
6154
- let handleCut = t18, t19;
6155
- $[85] !== editorActor || $[86] !== editorEngine || $[87] !== onPaste || $[88] !== portableTextEditor || $[89] !== relay ? (t19 = (event_1) => {
5411
+ }, $[66] = editorActor, $[67] = editorEngine, $[68] = onCut, $[69] = t17) : t17 = $[69];
5412
+ let handleCut = t17, t18;
5413
+ $[70] !== editorActor || $[71] !== editorEngine || $[72] !== onPaste || $[73] !== portableTextEditor ? (t18 = (event_1) => {
6156
5414
  let value = editorEngine.snapshot.context.value, path = editorEngine.snapshot.context.selection?.focus.path || [], onPasteResult = onPaste?.({
6157
5415
  event: event_1,
6158
5416
  value,
6159
5417
  path,
6160
5418
  schemaTypes: portableTextEditor.schemaTypes
6161
5419
  });
6162
- if (onPasteResult || !editorEngine.snapshot.context.selection) event_1.preventDefault(), relay.send({ type: "loading" }), Promise.resolve(onPasteResult).then((result_1) => {
5420
+ if (onPasteResult || !editorEngine.snapshot.context.selection) event_1.preventDefault(), Promise.resolve(onPasteResult).then((result_1) => {
6163
5421
  if (debug.behaviors("Custom paste function from client resolved", result_1), !result_1 || !result_1.insert) {
6164
5422
  debug.behaviors("No result from custom paste handler, pasting normally");
6165
5423
  let selection_1 = editorEngine.snapshot.context.selection, position_1 = selection_1 ? { selection: selection_1 } : void 0;
@@ -6195,9 +5453,7 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6195
5453
  },
6196
5454
  editor: editorEngine
6197
5455
  }) : console.warn("Your onPaste function returned something unexpected:", result_1);
6198
- }).catch(_temp5).finally(() => {
6199
- relay.send({ type: "done loading" });
6200
- });
5456
+ }).catch(_temp5);
6201
5457
  else if (event_1.nativeEvent.clipboardData) {
6202
5458
  event_1.preventDefault(), event_1.stopPropagation();
6203
5459
  let selection_2 = editorEngine.snapshot.context.selection, position_2 = selection_2 ? { selection: selection_2 } : void 0;
@@ -6217,16 +5473,16 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6217
5473
  });
6218
5474
  }
6219
5475
  debug.behaviors("No result from custom paste handler, pasting normally");
6220
- }, $[85] = editorActor, $[86] = editorEngine, $[87] = onPaste, $[88] = portableTextEditor, $[89] = relay, $[90] = t19) : t19 = $[90];
6221
- let handlePaste = t19, t20;
6222
- $[91] !== editorEngine || $[92] !== onFocus || $[93] !== relay ? (t20 = (event_2) => {
5476
+ }, $[70] = editorActor, $[71] = editorEngine, $[72] = onPaste, $[73] = portableTextEditor, $[74] = t18) : t18 = $[74];
5477
+ let handlePaste = t18, t19;
5478
+ $[75] !== editorEngine || $[76] !== onFocus || $[77] !== relay ? (t19 = (event_2) => {
6223
5479
  onFocus && onFocus(event_2), event_2.isDefaultPrevented() || (relay.send({
6224
5480
  type: "focused",
6225
5481
  event: event_2
6226
5482
  }), !editorEngine.snapshot.context.selection && editorEngine.snapshot.context.value.length === 1 && isEmptyTextBlock(editorEngine.snapshot.context, editorEngine.snapshot.context.value.at(0)) && (editorEngine.select(start(editorEngine, [])), editorEngine.onChange()));
6227
- }, $[91] = editorEngine, $[92] = onFocus, $[93] = relay, $[94] = t20) : t20 = $[94];
6228
- let handleOnFocus = t20, t21;
6229
- $[95] !== editorActor || $[96] !== editorEngine || $[97] !== onClick ? (t21 = (event_3) => {
5483
+ }, $[75] = editorEngine, $[76] = onFocus, $[77] = relay, $[78] = t19) : t19 = $[78];
5484
+ let handleOnFocus = t19, t20;
5485
+ $[79] !== editorActor || $[80] !== editorEngine || $[81] !== onClick ? (t20 = (event_3) => {
6230
5486
  if (onClick && onClick(event_3), event_3.isDefaultPrevented() || event_3.isPropagationStopped()) return;
6231
5487
  let position_3 = getEventPosition({
6232
5488
  editorActor,
@@ -6242,20 +5498,20 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6242
5498
  editor: editorEngine,
6243
5499
  nativeEvent: event_3
6244
5500
  });
6245
- }, $[95] = editorActor, $[96] = editorEngine, $[97] = onClick, $[98] = t21) : t21 = $[98];
6246
- let handleClick = t21, t22;
6247
- $[99] !== onBlur || $[100] !== relay ? (t22 = (event_4) => {
5501
+ }, $[79] = editorActor, $[80] = editorEngine, $[81] = onClick, $[82] = t20) : t20 = $[82];
5502
+ let handleClick = t20, t21;
5503
+ $[83] !== onBlur || $[84] !== relay ? (t21 = (event_4) => {
6248
5504
  onBlur && onBlur(event_4), event_4.isPropagationStopped() || relay.send({
6249
5505
  type: "blurred",
6250
5506
  event: event_4
6251
5507
  });
6252
- }, $[99] = onBlur, $[100] = relay, $[101] = t22) : t22 = $[101];
6253
- let handleOnBlur = t22, t23;
6254
- $[102] === onBeforeInput ? t23 = $[103] : (t23 = (event_5) => {
5508
+ }, $[83] = onBlur, $[84] = relay, $[85] = t21) : t21 = $[85];
5509
+ let handleOnBlur = t21, t22;
5510
+ $[86] === onBeforeInput ? t22 = $[87] : (t22 = (event_5) => {
6255
5511
  onBeforeInput && onBeforeInput(event_5);
6256
- }, $[102] = onBeforeInput, $[103] = t23);
6257
- let handleOnBeforeInput = t23, t24;
6258
- $[104] !== editorActor || $[105] !== editorEngine || $[106] !== hotkeys || $[107] !== portableTextEditor || $[108] !== props ? (t24 = (event_6) => {
5512
+ }, $[86] = onBeforeInput, $[87] = t22);
5513
+ let handleOnBeforeInput = t22, t23;
5514
+ $[88] !== editorActor || $[89] !== editorEngine || $[90] !== hotkeys || $[91] !== portableTextEditor || $[92] !== props ? (t23 = (event_6) => {
6259
5515
  props.onKeyDown && props.onKeyDown(event_6), event_6.isDefaultPrevented() || performHotkey({
6260
5516
  editorActor,
6261
5517
  editor: editorEngine,
@@ -6278,9 +5534,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6278
5534
  editor: editorEngine,
6279
5535
  nativeEvent: event_6
6280
5536
  });
6281
- }, $[104] = editorActor, $[105] = editorEngine, $[106] = hotkeys, $[107] = portableTextEditor, $[108] = props, $[109] = t24) : t24 = $[109];
6282
- let handleKeyDown = t24, t25;
6283
- $[110] !== editorActor || $[111] !== editorEngine || $[112] !== props ? (t25 = (event_7) => {
5537
+ }, $[88] = editorActor, $[89] = editorEngine, $[90] = hotkeys, $[91] = portableTextEditor, $[92] = props, $[93] = t23) : t23 = $[93];
5538
+ let handleKeyDown = t23, t24;
5539
+ $[94] !== editorActor || $[95] !== editorEngine || $[96] !== props ? (t24 = (event_7) => {
6284
5540
  props.onKeyUp && props.onKeyUp(event_7), event_7.isDefaultPrevented() || editorActor.send({
6285
5541
  type: "behavior event",
6286
5542
  behaviorEvent: {
@@ -6297,24 +5553,24 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6297
5553
  editor: editorEngine,
6298
5554
  nativeEvent: event_7
6299
5555
  });
6300
- }, $[110] = editorActor, $[111] = editorEngine, $[112] = props, $[113] = t25) : t25 = $[113];
6301
- let handleKeyUp = t25, t26;
5556
+ }, $[94] = editorActor, $[95] = editorEngine, $[96] = props, $[97] = t24) : t24 = $[97];
5557
+ let handleKeyUp = t24, t25;
6302
5558
  bb0: {
6303
5559
  if (scrollSelectionIntoView === void 0) {
6304
- t26 = void 0;
5560
+ t25 = void 0;
6305
5561
  break bb0;
6306
5562
  }
6307
5563
  if (scrollSelectionIntoView === null) {
6308
- t26 = noop;
5564
+ t25 = noop;
6309
5565
  break bb0;
6310
5566
  }
6311
- let t27;
6312
- $[114] !== portableTextEditor || $[115] !== scrollSelectionIntoView ? (t27 = (_editor, domRange) => {
5567
+ let t26;
5568
+ $[98] !== portableTextEditor || $[99] !== scrollSelectionIntoView ? (t26 = (_editor, domRange) => {
6313
5569
  scrollSelectionIntoView(portableTextEditor, domRange);
6314
- }, $[114] = portableTextEditor, $[115] = scrollSelectionIntoView, $[116] = t27) : t27 = $[116], t26 = t27;
5570
+ }, $[98] = portableTextEditor, $[99] = scrollSelectionIntoView, $[100] = t26) : t26 = $[100], t25 = t26;
6315
5571
  }
6316
- let scrollSelectionIntoViewToEngine = t26, t27, t28;
6317
- $[117] !== editorActor || $[118] !== editorEngine ? (t27 = () => {
5572
+ let scrollSelectionIntoViewToEngine = t25, t26, t27;
5573
+ $[101] !== editorActor || $[102] !== editorEngine ? (t26 = () => {
6318
5574
  let window = DOMEditor.getWindow(editorEngine), onDragEnd_0 = () => {
6319
5575
  editorActor.send({ type: "dragend" });
6320
5576
  }, onDrop_0 = () => {
@@ -6323,9 +5579,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6323
5579
  return window.document.addEventListener("dragend", onDragEnd_0), window.document.addEventListener("drop", onDrop_0), () => {
6324
5580
  window.document.removeEventListener("dragend", onDragEnd_0), window.document.removeEventListener("drop", onDrop_0);
6325
5581
  };
6326
- }, t28 = [editorEngine, editorActor], $[117] = editorActor, $[118] = editorEngine, $[119] = t27, $[120] = t28) : (t27 = $[119], t28 = $[120]), useEffect(t27, t28);
6327
- let t29;
6328
- $[121] !== editorActor || $[122] !== editorEngine || $[123] !== onDragStart || $[124] !== readOnly ? (t29 = (event_8) => {
5582
+ }, t27 = [editorEngine, editorActor], $[101] = editorActor, $[102] = editorEngine, $[103] = t26, $[104] = t27) : (t26 = $[103], t27 = $[104]), useEffect(t26, t27);
5583
+ let t28;
5584
+ $[105] !== editorActor || $[106] !== editorEngine || $[107] !== onDragStart || $[108] !== readOnly ? (t28 = (event_8) => {
6329
5585
  if (readOnly || !DOMEditor.hasTarget(editorEngine, event_8.target) || (onDragStart?.(event_8), event_8.isDefaultPrevented() || event_8.isPropagationStopped())) return;
6330
5586
  let position_4 = getEventPosition({
6331
5587
  editorActor,
@@ -6359,9 +5615,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6359
5615
  },
6360
5616
  editor: editorEngine
6361
5617
  }), !0;
6362
- }, $[121] = editorActor, $[122] = editorEngine, $[123] = onDragStart, $[124] = readOnly, $[125] = t29) : t29 = $[125];
6363
- let handleDragStart = t29, t30;
6364
- $[126] !== editorActor || $[127] !== editorEngine || $[128] !== onDrag ? (t30 = (event_9) => {
5618
+ }, $[105] = editorActor, $[106] = editorEngine, $[107] = onDragStart, $[108] = readOnly, $[109] = t28) : t28 = $[109];
5619
+ let handleDragStart = t28, t29;
5620
+ $[110] !== editorActor || $[111] !== editorEngine || $[112] !== onDrag ? (t29 = (event_9) => {
6365
5621
  if (onDrag?.(event_9), !(event_9.isDefaultPrevented() || event_9.isPropagationStopped()) && getEventPosition({
6366
5622
  editorActor,
6367
5623
  editorEngine,
@@ -6374,9 +5630,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6374
5630
  },
6375
5631
  editor: editorEngine
6376
5632
  }), !0;
6377
- }, $[126] = editorActor, $[127] = editorEngine, $[128] = onDrag, $[129] = t30) : t30 = $[129];
6378
- let handleDrag = t30, t31;
6379
- $[130] !== editorActor || $[131] !== editorEngine || $[132] !== onDragEnd ? (t31 = (event_10) => {
5633
+ }, $[110] = editorActor, $[111] = editorEngine, $[112] = onDrag, $[113] = t29) : t29 = $[113];
5634
+ let handleDrag = t29, t30;
5635
+ $[114] !== editorActor || $[115] !== editorEngine || $[116] !== onDragEnd ? (t30 = (event_10) => {
6380
5636
  if (onDragEnd?.(event_10), !(event_10.isDefaultPrevented() || event_10.isPropagationStopped())) return editorActor.send({
6381
5637
  type: "behavior event",
6382
5638
  behaviorEvent: {
@@ -6385,9 +5641,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6385
5641
  },
6386
5642
  editor: editorEngine
6387
5643
  }), !0;
6388
- }, $[130] = editorActor, $[131] = editorEngine, $[132] = onDragEnd, $[133] = t31) : t31 = $[133];
6389
- let handleDragEnd = t31, t32;
6390
- $[134] !== editorActor || $[135] !== editorEngine || $[136] !== onDragEnter ? (t32 = (event_11) => {
5644
+ }, $[114] = editorActor, $[115] = editorEngine, $[116] = onDragEnd, $[117] = t30) : t30 = $[117];
5645
+ let handleDragEnd = t30, t31;
5646
+ $[118] !== editorActor || $[119] !== editorEngine || $[120] !== onDragEnter ? (t31 = (event_11) => {
6391
5647
  if (onDragEnter?.(event_11), event_11.isDefaultPrevented() || event_11.isPropagationStopped()) return;
6392
5648
  let position_6 = getEventPosition({
6393
5649
  editorActor,
@@ -6403,9 +5659,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6403
5659
  },
6404
5660
  editor: editorEngine
6405
5661
  }), !0;
6406
- }, $[134] = editorActor, $[135] = editorEngine, $[136] = onDragEnter, $[137] = t32) : t32 = $[137];
6407
- let handleDragEnter = t32, t33;
6408
- $[138] !== editorActor || $[139] !== editorEngine || $[140] !== onDragOver ? (t33 = (event_12) => {
5662
+ }, $[118] = editorActor, $[119] = editorEngine, $[120] = onDragEnter, $[121] = t31) : t31 = $[121];
5663
+ let handleDragEnter = t31, t32;
5664
+ $[122] !== editorActor || $[123] !== editorEngine || $[124] !== onDragOver ? (t32 = (event_12) => {
6409
5665
  if (onDragOver?.(event_12), event_12.isDefaultPrevented() || event_12.isPropagationStopped()) return;
6410
5666
  let position_7 = getEventPosition({
6411
5667
  editorActor,
@@ -6423,9 +5679,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6423
5679
  editor: editorEngine,
6424
5680
  nativeEvent: event_12
6425
5681
  }), !0;
6426
- }, $[138] = editorActor, $[139] = editorEngine, $[140] = onDragOver, $[141] = t33) : t33 = $[141];
6427
- let handleDragOver = t33, t34;
6428
- $[142] !== editorActor || $[143] !== editorEngine || $[144] !== onDrop ? (t34 = (event_13) => {
5682
+ }, $[122] = editorActor, $[123] = editorEngine, $[124] = onDragOver, $[125] = t32) : t32 = $[125];
5683
+ let handleDragOver = t32, t33;
5684
+ $[126] !== editorActor || $[127] !== editorEngine || $[128] !== onDrop ? (t33 = (event_13) => {
6429
5685
  if (onDrop?.(event_13), event_13.isDefaultPrevented() || event_13.isPropagationStopped()) return;
6430
5686
  let position_8 = getEventPosition({
6431
5687
  editorActor,
@@ -6447,9 +5703,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6447
5703
  editor: editorEngine,
6448
5704
  nativeEvent: event_13
6449
5705
  }), !0;
6450
- }, $[142] = editorActor, $[143] = editorEngine, $[144] = onDrop, $[145] = t34) : t34 = $[145];
6451
- let handleDrop = t34, t35;
6452
- $[146] !== editorActor || $[147] !== editorEngine || $[148] !== onDragLeave ? (t35 = (event_14) => {
5706
+ }, $[126] = editorActor, $[127] = editorEngine, $[128] = onDrop, $[129] = t33) : t33 = $[129];
5707
+ let handleDrop = t33, t34;
5708
+ $[130] !== editorActor || $[131] !== editorEngine || $[132] !== onDragLeave ? (t34 = (event_14) => {
6453
5709
  if (onDragLeave?.(event_14), !(event_14.isDefaultPrevented() || event_14.isPropagationStopped()) && getEventPosition({
6454
5710
  editorActor,
6455
5711
  editorEngine,
@@ -6462,9 +5718,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6462
5718
  },
6463
5719
  editor: editorEngine
6464
5720
  }), !0;
6465
- }, $[146] = editorActor, $[147] = editorEngine, $[148] = onDragLeave, $[149] = t35) : t35 = $[149];
6466
- let handleDragLeave = t35, t36;
6467
- $[150] !== forwardedRef || $[151] !== validateSelectionActor ? (t36 = (editorElement) => {
5721
+ }, $[130] = editorActor, $[131] = editorEngine, $[132] = onDragLeave, $[133] = t34) : t34 = $[133];
5722
+ let handleDragLeave = t34, t35;
5723
+ $[134] !== forwardedRef || $[135] !== validateSelectionActor ? (t35 = (editorElement) => {
6468
5724
  if (typeof forwardedRef == "function" ? forwardedRef(editorElement) : forwardedRef && (forwardedRef.current = editorElement), editorElement) {
6469
5725
  let mutationObserver = new MutationObserver(() => {
6470
5726
  validateSelectionActor.send({
@@ -6482,17 +5738,17 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6482
5738
  mutationObserver.disconnect();
6483
5739
  };
6484
5740
  }
6485
- }, $[150] = forwardedRef, $[151] = validateSelectionActor, $[152] = t36) : t36 = $[152];
6486
- let callbackRef = t36;
5741
+ }, $[134] = forwardedRef, $[135] = validateSelectionActor, $[136] = t35) : t35 = $[136];
5742
+ let callbackRef = t35;
6487
5743
  if (!portableTextEditor) return null;
6488
- let t37;
6489
- return $[153] !== callbackRef || $[154] !== decorate || $[155] !== editorActor || $[156] !== handleClick || $[157] !== handleCopy || $[158] !== handleCut || $[159] !== handleDrag || $[160] !== handleDragEnd || $[161] !== handleDragEnter || $[162] !== handleDragLeave || $[163] !== handleDragOver || $[164] !== handleDragStart || $[165] !== handleDrop || $[166] !== handleKeyDown || $[167] !== handleKeyUp || $[168] !== handleOnBeforeInput || $[169] !== handleOnBlur || $[170] !== handleOnFocus || $[171] !== handlePaste || $[172] !== hasInvalidValue || $[173] !== readOnly || $[174] !== renderElement || $[175] !== renderLeaf || $[176] !== restProps || $[177] !== scrollSelectionIntoViewToEngine ? (t37 = hasInvalidValue ? null : /* @__PURE__ */ jsx(SelectionStateProvider, { children: /* @__PURE__ */ jsx(DropPositionStateProvider, { children: /* @__PURE__ */ jsx(Editable, {
5744
+ let t36;
5745
+ return $[137] !== callbackRef || $[138] !== decorate || $[139] !== editorActor || $[140] !== handleClick || $[141] !== handleCopy || $[142] !== handleCut || $[143] !== handleDrag || $[144] !== handleDragEnd || $[145] !== handleDragEnter || $[146] !== handleDragLeave || $[147] !== handleDragOver || $[148] !== handleDragStart || $[149] !== handleDrop || $[150] !== handleKeyDown || $[151] !== handleKeyUp || $[152] !== handleOnBeforeInput || $[153] !== handleOnBlur || $[154] !== handleOnFocus || $[155] !== handlePaste || $[156] !== hasInvalidValue || $[157] !== readOnly || $[158] !== renderElement || $[159] !== renderLeaf || $[160] !== restProps || $[161] !== scrollSelectionIntoViewToEngine ? (t36 = hasInvalidValue ? null : /* @__PURE__ */ jsx(SelectionStateProvider, { children: /* @__PURE__ */ jsx(Editable, {
6490
5746
  ...restProps,
6491
5747
  ref: callbackRef,
6492
5748
  editorActor,
6493
5749
  "data-read-only": readOnly,
6494
5750
  autoFocus: !1,
6495
- className: restProps.className || "pt-editable",
5751
+ className: restProps.className,
6496
5752
  decorate,
6497
5753
  onBlur: handleOnBlur,
6498
5754
  onCopy: handleCopy,
@@ -6515,7 +5771,7 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
6515
5771
  renderLeaf,
6516
5772
  renderText,
6517
5773
  scrollSelectionIntoView: scrollSelectionIntoViewToEngine
6518
- }) }) }), $[153] = callbackRef, $[154] = decorate, $[155] = editorActor, $[156] = handleClick, $[157] = handleCopy, $[158] = handleCut, $[159] = handleDrag, $[160] = handleDragEnd, $[161] = handleDragEnter, $[162] = handleDragLeave, $[163] = handleDragOver, $[164] = handleDragStart, $[165] = handleDrop, $[166] = handleKeyDown, $[167] = handleKeyUp, $[168] = handleOnBeforeInput, $[169] = handleOnBlur, $[170] = handleOnFocus, $[171] = handlePaste, $[172] = hasInvalidValue, $[173] = readOnly, $[174] = renderElement, $[175] = renderLeaf, $[176] = restProps, $[177] = scrollSelectionIntoViewToEngine, $[178] = t37) : t37 = $[178], t37;
5774
+ }) }), $[137] = callbackRef, $[138] = decorate, $[139] = editorActor, $[140] = handleClick, $[141] = handleCopy, $[142] = handleCut, $[143] = handleDrag, $[144] = handleDragEnd, $[145] = handleDragEnter, $[146] = handleDragLeave, $[147] = handleDragOver, $[148] = handleDragStart, $[149] = handleDrop, $[150] = handleKeyDown, $[151] = handleKeyUp, $[152] = handleOnBeforeInput, $[153] = handleOnBlur, $[154] = handleOnFocus, $[155] = handlePaste, $[156] = hasInvalidValue, $[157] = readOnly, $[158] = renderElement, $[159] = renderLeaf, $[160] = restProps, $[161] = scrollSelectionIntoViewToEngine, $[162] = t36) : t36 = $[162], t36;
6519
5775
  });
6520
5776
  PortableTextEditable.displayName = "ForwardRef(PortableTextEditable)";
6521
5777
  function noop() {}
@@ -6540,11 +5796,8 @@ function _temp5(error) {
6540
5796
  */
6541
5797
  const Engine = (props) => {
6542
5798
  let { editor, children } = props, { selectorContext, onChange: handleSelectorChange } = useSelectorContext(), onContextChange = useCallback(() => {
6543
- let pending = editor.selectorChannelsPending, registrations = pending.registrations, listIndex = pending.listIndex;
6544
- pending.registrations = !1, pending.listIndex = !1, handleSelectorChange({
6545
- registrations,
6546
- listIndex
6547
- });
5799
+ let pending = editor.selectorChannelsPending, registrations = pending.registrations;
5800
+ pending.registrations = !1, handleSelectorChange({ registrations });
6548
5801
  }, [editor, handleSelectorChange]);
6549
5802
  return useEffect(() => (editor.onContextChange = onContextChange, () => {
6550
5803
  editor.onContextChange = () => {};
@@ -6711,50 +5964,6 @@ const converterJson = defineConverter({
6711
5964
  mimeType: "text/html"
6712
5965
  };
6713
5966
  }
6714
- }), converterTextMarkdown = defineConverter({
6715
- mimeType: "text/markdown",
6716
- serialize: ({ snapshot, event }) => {
6717
- if (!snapshot.context.selection) return {
6718
- type: "serialization.failure",
6719
- mimeType: "text/markdown",
6720
- reason: "No selection",
6721
- originEvent: event.originEvent
6722
- };
6723
- let blocks = getFragment(snapshot).map((entry) => entry.node);
6724
- return {
6725
- type: "serialization.success",
6726
- data: portableTextToMarkdown(blocks),
6727
- mimeType: "text/markdown",
6728
- originEvent: event.originEvent
6729
- };
6730
- },
6731
- deserialize: ({ snapshot, event }) => {
6732
- let parsedBlocks = markdownToPortableText(event.data, {
6733
- keyGenerator: snapshot.context.keyGenerator,
6734
- schema: snapshot.context.schema
6735
- }).flatMap((block) => {
6736
- let parsedBlock = parseBlock({
6737
- keyGenerator: snapshot.context.keyGenerator,
6738
- block,
6739
- options: {
6740
- normalize: !1,
6741
- removeUnusedMarkDefs: !0,
6742
- validateFields: !1
6743
- },
6744
- schema: snapshot.context.schema
6745
- });
6746
- return parsedBlock ? [parsedBlock] : [];
6747
- });
6748
- return parsedBlocks.length === 0 ? {
6749
- type: "deserialization.failure",
6750
- mimeType: "text/markdown",
6751
- reason: "No blocks deserialized"
6752
- } : {
6753
- type: "deserialization.success",
6754
- data: parsedBlocks,
6755
- mimeType: "text/markdown"
6756
- };
6757
- }
6758
5967
  }), converterTextPlain = defineConverter({
6759
5968
  mimeType: "text/plain",
6760
5969
  serialize: ({ snapshot, event }) => snapshot.context.selection ? {
@@ -6811,10 +6020,17 @@ function escapeHtml(str) {
6811
6020
  const coreConverters = [
6812
6021
  converterJson,
6813
6022
  converterPortableText,
6814
- converterTextMarkdown,
6815
6023
  converterTextHtml,
6816
6024
  converterTextPlain
6817
6025
  ];
6026
+ function createEditorPriority(config) {
6027
+ return {
6028
+ id: defaultKeyGenerator(),
6029
+ name: config?.name,
6030
+ reference: config?.reference
6031
+ };
6032
+ }
6033
+ const corePriority = createEditorPriority({ name: "core" });
6818
6034
  function isListItemActive({ editor, listItem }) {
6819
6035
  if (!editor.snapshot.context.selection) return !1;
6820
6036
  let [selStart, selEnd] = rangeEdges(editor.snapshot.context.selection, editor.snapshot.context), selectedBlocks = [...getNodes(editor.snapshot, {
@@ -9079,6 +8295,33 @@ var BlockIndexMap = class extends Map {
9079
8295
  return key.startsWith("[_key==") ? super.has(key) : super.has(serializePath([{ _key: key }]));
9080
8296
  }
9081
8297
  };
8298
+ /**
8299
+ * Mutates `blockIndexMap` in place. Used for initial engine population and
8300
+ * tests. During operation application the map is maintained incrementally
8301
+ * by `transform-block-index-map` helpers.
8302
+ */
8303
+ function buildIndexMaps(context, { blockIndexMap }) {
8304
+ blockIndexMap.clear();
8305
+ for (let blockIndex = 0; blockIndex < context.value.length; blockIndex++) {
8306
+ let block = context.value.at(blockIndex);
8307
+ if (block === void 0 || block._key === void 0) continue;
8308
+ let blockPath = [{ _key: block._key }], blockKey = serializePath(blockPath);
8309
+ blockIndexMap.has(blockKey) || blockIndexMap.set(blockKey, blockIndex), collectDescendantIndexes(context, block, blockPath, void 0, blockIndexMap);
8310
+ }
8311
+ }
8312
+ function collectDescendantIndexes(context, node, nodePath, parent, blockIndexMap) {
8313
+ let result = getNodeChildren(context, node, parent);
8314
+ if (result) for (let i = 0; i < result.children.length; i++) {
8315
+ let child = result.children[i];
8316
+ if (!child._key) continue;
8317
+ let childSegment = { _key: child._key }, childPath = [
8318
+ ...nodePath,
8319
+ result.fieldName,
8320
+ childSegment
8321
+ ], childKey = serializePath(childPath);
8322
+ blockIndexMap.has(childKey) || blockIndexMap.set(childKey, i), collectDescendantIndexes(context, child, childPath, result.parent, blockIndexMap);
8323
+ }
8324
+ }
9082
8325
  function withRemoteChanges(editor, fn) {
9083
8326
  let prev = editor.isProcessingRemoteChanges;
9084
8327
  editor.isProcessingRemoteChanges = !0, fn(), editor.isProcessingRemoteChanges = prev;
@@ -10069,10 +9312,7 @@ function transformBlockIndexMap(map, op, beforeValue, afterValue, context) {
10069
9312
  schema: context.schema,
10070
9313
  value: afterValue,
10071
9314
  containers: context.containers
10072
- }, {
10073
- blockIndexMap: map,
10074
- listIndexMap: /* @__PURE__ */ new Map()
10075
- });
9315
+ }, { blockIndexMap: map });
10076
9316
  return;
10077
9317
  }
10078
9318
  let lastSegment = op.path[op.path.length - 1];
@@ -10396,12 +9636,6 @@ function invalidateVerifiedGroups(groups, operation) {
10396
9636
  * incrementally per operation so the operation pipeline (which resolves
10397
9637
  * keyed paths through it) never observes a stale map.
10398
9638
  *
10399
- * `listIndexMap` is only consumed by the text-block renderer, never by
10400
- * operations or selectors, so it is invalidated here and rebuilt lazily
10401
- * on read (`getListIndexMap`) instead of per operation. List-item
10402
- * numbering depends on block adjacency that any structural op can disturb
10403
- * non-locally, so any structural op marks it dirty.
10404
- *
10405
9639
  * `verifiedUniqueChildGroups` is invalidated per structural op so per-node
10406
9640
  * duplicate-key normalization can skip groups whose membership is unchanged
10407
9641
  * (see `invalidateVerifiedGroups`).
@@ -10414,7 +9648,7 @@ function subscribeUpdateValue(context, editor) {
10414
9648
  operation.type !== "set.selection" && operation.type !== "insert.text" && operation.type !== "remove.text" && (transformBlockIndexMap(editor.blockIndexMap, operation, event.beforeValue, editor.snapshot.context.value, {
10415
9649
  schema: context.schema,
10416
9650
  containers: editor.snapshot.context.containers
10417
- }), editor.listIndexMapDirty = !0, editor.selectorChannelsPending.listIndex = !0, invalidateVerifiedGroups(editor.verifiedUniqueChildGroups, operation));
9651
+ }), invalidateVerifiedGroups(editor.verifiedUniqueChildGroups, operation));
10418
9652
  });
10419
9653
  return () => {
10420
9654
  unsubscribeNormalizationLog?.(), unsubscribeIndexMaps();
@@ -10446,10 +9680,7 @@ function createEditorEngine(config) {
10446
9680
  }, editor.containers = /* @__PURE__ */ new Map(), editor.annotations = /* @__PURE__ */ new Map(), editor.blockObjects = /* @__PURE__ */ new Map(), editor.decorators = /* @__PURE__ */ new Map(), editor.inlineObjects = /* @__PURE__ */ new Map(), editor.spans = /* @__PURE__ */ new Map(), editor.textBlocks = /* @__PURE__ */ new Map(), editor.decoratedRanges = [], editor.blockIndexMap = blockIndexMap, editor.history = {
10447
9681
  undos: [],
10448
9682
  redos: []
10449
- }, editor.listIndexMap = /* @__PURE__ */ new Map(), editor.listIndexMapDirty = !1, editor.selectorChannelsPending = {
10450
- registrations: !1,
10451
- listIndex: !1
10452
- }, editor.verifiedUniqueChildGroups = /* @__PURE__ */ new Set(), editor.remotePatches = [], editor.undoStepId = void 0, editor.isDeferringMutations = !1, editor.lastSyncedValue = void 0, editor.isNormalizingNode = !1, editor.isPatching = !0, editor.isPerformingBehaviorOperation = !1, editor.isProcessingRemoteChanges = !1, editor.isRedoing = !1, editor.isUndoing = !1, editor.withHistory = !0;
9683
+ }, editor.selectorChannelsPending = { registrations: !1 }, editor.verifiedUniqueChildGroups = /* @__PURE__ */ new Set(), editor.remotePatches = [], editor.undoStepId = void 0, editor.isDeferringMutations = !1, editor.lastSyncedValue = void 0, editor.isNormalizingNode = !1, editor.isPatching = !0, editor.isPerformingBehaviorOperation = !1, editor.isProcessingRemoteChanges = !1, editor.isRedoing = !1, editor.isUndoing = !1, editor.withHistory = !0;
10453
9684
  let editorEngine = plugins(withDOM(editor), { editorActor: config.editorActor });
10454
9685
  return subscribeUpdateValue(context, editorEngine), subscribePatchGeneration({
10455
9686
  editorActor: config.editorActor,
@@ -10466,10 +9697,7 @@ function createEditorEngine(config) {
10466
9697
  schema: context.schema,
10467
9698
  value: editorEngine.snapshot.context.value,
10468
9699
  containers: editorEngine.snapshot.context.containers
10469
- }, {
10470
- blockIndexMap: editorEngine.blockIndexMap,
10471
- listIndexMap: editorEngine.listIndexMap
10472
- }), config.subscriptions.push(() => {
9700
+ }, { blockIndexMap: editorEngine.blockIndexMap }), config.subscriptions.push(() => {
10473
9701
  let subscription = config.editorActor.subscribe(() => {
10474
9702
  editorEngine.snapshot = {
10475
9703
  ...editorEngine.snapshot,
@@ -11281,13 +10509,19 @@ const coreDndBehaviors = [
11281
10509
  ...snapshot.context,
11282
10510
  selection: dragSelection
11283
10511
  }
11284
- }, draggingEntireBlocks = isSelectingEntireBlocks(dragSnapshot), movedInlineObjectKey = !draggingEntireBlocks && isCollapsedRange(dragSelection) ? getFocusInlineObject(dragSnapshot)?.node._key : void 0, draggedNodes = getFragment(dragSnapshot), fittedBlocks = fitBlocksToDestination({
10512
+ }, draggingEntireBlocks = isSelectingEntireBlocks(dragSnapshot), movedInlineObjectKey = !draggingEntireBlocks && isCollapsedRange(dragSelection) ? getFocusInlineObject(dragSnapshot)?.node._key : void 0, draggedNodes = getFragment(dragSnapshot), dropSnapshot = {
11285
10513
  ...snapshot,
11286
10514
  context: {
11287
10515
  ...snapshot.context,
11288
10516
  selection: dropPosition
11289
10517
  }
11290
- }, event.data);
10518
+ }, fittedBlocks = fitBlocksToDestination(dropSnapshot, event.data), focusTextBlock = getFocusTextBlock(dropSnapshot), droppedInsideTextBlock = isCollapsedRange(dropPosition) && focusTextBlock !== void 0 && !isEmptyTextBlock(snapshot.context, focusTextBlock.node) && getFocusInlineObject(dropSnapshot) === void 0 && !isEqualSelectionPoints(dropPosition.focus, getBlockStartPoint({
10519
+ context: snapshot.context,
10520
+ block: focusTextBlock
10521
+ })) && !isEqualSelectionPoints(dropPosition.focus, getBlockEndPoint({
10522
+ context: snapshot.context,
10523
+ block: focusTextBlock
10524
+ })) && fittedBlocks.length > 0;
11291
10525
  return !droppingOnDragOrigin && {
11292
10526
  dropPosition,
11293
10527
  draggingEntireBlocks,
@@ -11295,10 +10529,11 @@ const coreDndBehaviors = [
11295
10529
  dragOrigin,
11296
10530
  originEvent: event.originEvent,
11297
10531
  fittedBlocks,
11298
- movedInlineObjectKey
10532
+ movedInlineObjectKey,
10533
+ droppedInsideTextBlock
11299
10534
  };
11300
10535
  },
11301
- actions: [(_, { draggingEntireBlocks, draggedNodes, dragOrigin, dropPosition, originEvent, fittedBlocks, movedInlineObjectKey }) => {
10536
+ actions: [(_, { draggingEntireBlocks, draggedNodes, dragOrigin, dropPosition, originEvent, fittedBlocks, movedInlineObjectKey, droppedInsideTextBlock }) => {
11302
10537
  if (fittedBlocks.length === 0) return [];
11303
10538
  let movedInlineObjectPath = movedInlineObjectKey ? [
11304
10539
  ...dropPosition.anchor.path.slice(0, -2),
@@ -11329,7 +10564,7 @@ const coreDndBehaviors = [
11329
10564
  raise$1({
11330
10565
  type: "insert.blocks",
11331
10566
  blocks: fittedBlocks,
11332
- placement: draggingEntireBlocks ? originEvent.position.block === "start" ? "before" : originEvent.position.block === "end" ? "after" : "auto" : "auto",
10567
+ placement: draggingEntireBlocks ? droppedInsideTextBlock ? "auto" : originEvent.position.block === "start" ? "before" : "after" : "auto",
11333
10568
  select: movedInlineObjectSelection ? "none" : void 0
11334
10569
  }),
11335
10570
  ...movedInlineObjectSelection ? [raise$1({
@@ -14187,6 +13422,16 @@ const abstractDeserializeBehaviors = [
14187
13422
  originEvent: event.originEvent
14188
13423
  })]]
14189
13424
  }),
13425
+ defineBehavior({
13426
+ on: "deserialize.data",
13427
+ guard: ({ snapshot, event }) => !snapshot.context.converters.find((converter) => converter.mimeType === event.mimeType),
13428
+ actions: [({ event }) => [raise$1({
13429
+ type: "deserialization.failure",
13430
+ mimeType: event.mimeType,
13431
+ reason: "no converter or Behavior handled the mime type",
13432
+ originEvent: event.originEvent
13433
+ })]]
13434
+ }),
14190
13435
  defineBehavior({
14191
13436
  on: "deserialization.success",
14192
13437
  actions: [({ snapshot, event }) => [raise$1({
@@ -17141,11 +16386,9 @@ function createInternalEditor(config) {
17141
16386
  }, { batch: !0 }) : relay.on(type, (event) => {
17142
16387
  switch (event.type) {
17143
16388
  case "blurred":
17144
- case "done loading":
17145
16389
  case "editable":
17146
16390
  case "focused":
17147
16391
  case "invalid value":
17148
- case "loading":
17149
16392
  case "mutation":
17150
16393
  case "operation":
17151
16394
  case "patch":
@@ -17282,7 +16525,14 @@ function createActors(config) {
17282
16525
  */
17283
16526
  var PortableTextEditor = class {
17284
16527
  constructor(config) {
17285
- _defineProperty(this, "schemaTypes", void 0), _defineProperty(this, "editable", void 0), _defineProperty(this, "setEditable", (editable) => {
16528
+ _defineProperty(
16529
+ this,
16530
+ /**
16531
+ * A lookup table for all the relevant schema types for this portable text type.
16532
+ */
16533
+ "schemaTypes",
16534
+ void 0
16535
+ ), _defineProperty(this, "editable", void 0), _defineProperty(this, "setEditable", (editable) => {
17286
16536
  this.editable = {
17287
16537
  ...this.editable,
17288
16538
  ...editable
@@ -17633,6 +16883,6 @@ function defineTextBlock(config) {
17633
16883
  ...config
17634
16884
  };
17635
16885
  }
17636
- export { EditorProvider, PortableTextEditable, PortableTextEditor, defineAnnotation, defineBlockObject, defineContainer, defineDecorator, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator, resolveContainerAt, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
16886
+ export { EditorProvider, PortableTextEditable, PortableTextEditor, defineAnnotation, defineBlockObject, defineContainer, defineDecorator, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
17637
16887
 
17638
16888
  //# sourceMappingURL=index.js.map