@portabletext/editor 7.12.0 → 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/README.md +1 -1
- package/lib/{behavior.types.action-DH6ujvaH.d.ts → behavior.types.action-Dzc2_Hey.d.ts} +88 -363
- package/lib/behavior.types.action-Dzc2_Hey.d.ts.map +1 -0
- package/lib/behavior.types.behavior-BxSLb73I.js.map +1 -1
- package/lib/behaviors/index.d.ts +1 -1
- package/lib/get-container-D1nM_ww9.js.map +1 -1
- package/lib/get-parent-Ci5241qs.js.map +1 -1
- package/lib/get-path-sub-schema-CZd9VcVM.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +520 -1262
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +1 -4
- package/lib/plugins/index.d.ts.map +1 -1
- package/lib/plugins/index.js +0 -3
- package/lib/plugins/index.js.map +1 -1
- package/lib/{selector.is-at-the-start-of-block-D0boZbDu.js → selector.is-selecting-entire-blocks-DPnzucrd.js} +19 -41
- package/lib/selector.is-selecting-entire-blocks-DPnzucrd.js.map +1 -0
- package/lib/selectors/index.d.ts +1 -1
- package/lib/selectors/index.js +28 -2
- package/lib/selectors/index.js.map +1 -1
- package/lib/traversal/index.d.ts +1 -1
- package/lib/traversal/index.js.map +1 -1
- package/lib/use-editor-CwNeVwVC.js.map +1 -1
- package/lib/util.is-equal-selections-N1hxVUbE.js.map +1 -1
- package/lib/util.slice-blocks-B2fZcNok.js.map +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +15 -25
- package/lib/behavior.types.action-DH6ujvaH.d.ts.map +0 -1
- package/lib/selector.is-at-the-start-of-block-D0boZbDu.js.map +0 -1
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
|
|
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
|
|
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 (
|
|
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 } =
|
|
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
|
-
|
|
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;
|
|
@@ -530,12 +526,12 @@ function end(editor, at) {
|
|
|
530
526
|
* Get the distance to the end of the first character in a string of text.
|
|
531
527
|
*/
|
|
532
528
|
const getCharacterDistance = (str, isRTL = !1) => {
|
|
533
|
-
let isLTR = !isRTL, codepoints = isRTL ? codepointsIteratorRTL(str) : str, left = CodepointType.None, right = CodepointType.None, distance = 0, gb11 = null, gb12Or13 = null;
|
|
529
|
+
let isLTR = !isRTL, codepoints = isRTL ? codepointsIteratorRTL(str) : str, left = CodepointType.None, right = CodepointType.None, distance = 0, gb11 = null, gb12Or13 = null, gb9c = null;
|
|
534
530
|
for (let char of codepoints) {
|
|
535
531
|
let code = char.codePointAt(0);
|
|
536
532
|
if (!code) break;
|
|
537
533
|
let type = getCodepointType(char, code);
|
|
538
|
-
if ([left, right] = isLTR ? [right, type] : [type, left], intersects(left, CodepointType.ZWJ) && intersects(right, CodepointType.ExtPict) && (gb11 = endsWithEmojiZWJ(isLTR ? str.substring(0, distance) : str.substring(0, str.length - distance)), !gb11) || intersects(left, CodepointType.RI) && intersects(right, CodepointType.RI) && (gb12Or13 = gb12Or13 === null ? isLTR ? !0 : endsWithOddNumberOfRIs(str.substring(0, str.length - distance)) : !gb12Or13, !gb12Or13) || left !== CodepointType.None && right !== CodepointType.None && isBoundaryPair(left, right)) break;
|
|
534
|
+
if ([left, right] = isLTR ? [right, type] : [type, left], intersects(left, CodepointType.ZWJ) && intersects(right, CodepointType.ExtPict) && (gb11 = endsWithEmojiZWJ(isLTR ? str.substring(0, distance) : str.substring(0, str.length - distance)), !gb11) || intersects(left, CodepointType.RI) && intersects(right, CodepointType.RI) && (gb12Or13 = gb12Or13 === null ? isLTR ? !0 : endsWithOddNumberOfRIs(str.substring(0, str.length - distance)) : !gb12Or13, !gb12Or13) || intersects(left, CodepointType.InCBLinker | CodepointType.InCBExtend) && intersects(right, CodepointType.InCBConsonant) && (gb9c = endsWithConjunctLinker(isLTR ? str.substring(0, distance) : str.substring(0, str.length - distance)), !gb9c) || left !== CodepointType.None && right !== CodepointType.None && isBoundaryPair(left, right)) break;
|
|
539
535
|
distance += char.length;
|
|
540
536
|
}
|
|
541
537
|
return distance || 1;
|
|
@@ -588,10 +584,13 @@ const getCharacterDistance = (str, isRTL = !1) => {
|
|
|
588
584
|
LV: 256,
|
|
589
585
|
LVT: 512,
|
|
590
586
|
ExtPict: 1024,
|
|
591
|
-
Any: 2048
|
|
592
|
-
|
|
587
|
+
Any: 2048,
|
|
588
|
+
InCBConsonant: 4096,
|
|
589
|
+
InCBExtend: 8192,
|
|
590
|
+
InCBLinker: 16384
|
|
591
|
+
}, reExtend = /^[\p{Gr_Ext}\p{EMod}]$/u, rePrepend = /^[\u0600-\u0605\u06DD\u070F\u0890-\u0891\u08E2\u0D4E\u{110BD}\u{110CD}\u{111C2}-\u{111C3}\u{1193F}\u{11941}\u{11A3A}\u{11A84}-\u{11A89}\u{11D46}]$/u, reSpacingMark = /^[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E-\u094F\u0982-\u0983\u09BF-\u09C0\u09C7-\u09C8\u09CB-\u09CC\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB-\u0ACC\u0B02-\u0B03\u0B40\u0B47-\u0B48\u0B4B-\u0B4C\u0BBF\u0BC1-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0C01-\u0C03\u0C41-\u0C44\u0C82-\u0C83\u0CBE\u0CC0-\u0CC1\u0CC3-\u0CC4\u0CC7-\u0CC8\u0CCA-\u0CCB\u0D02-\u0D03\u0D3F-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D82-\u0D83\u0DD0-\u0DD1\u0DD8-\u0DDE\u0DF2-\u0DF3\u0E33\u0EB3\u0F3E-\u0F3F\u0F7F\u1031\u103B-\u103C\u1056-\u1057\u1084\u1715\u1734\u17B6\u17BE-\u17C5\u17C7-\u17C8\u1923-\u1926\u1929-\u192B\u1930-\u1931\u1933-\u1938\u1A19-\u1A1A\u1A55\u1A57\u1A6D-\u1A72\u1B04\u1B3B\u1B3D-\u1B41\u1B43-\u1B44\u1B82\u1BA1\u1BA6-\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2-\u1BF3\u1C24-\u1C2B\u1C34-\u1C35\u1CE1\u1CF7\uA823-\uA824\uA827\uA880-\uA881\uA8B4-\uA8C3\uA952-\uA953\uA983\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BE-\uA9C0\uAA2F-\uAA30\uAA33-\uAA34\uAA4D\uAAEB\uAAEE-\uAAEF\uAAF5\uABE3-\uABE4\uABE6-\uABE7\uABE9-\uABEA\uABEC\u{11000}\u{11002}\u{11082}\u{110B0}-\u{110B2}\u{110B7}-\u{110B8}\u{1112C}\u{11145}-\u{11146}\u{11182}\u{111B3}-\u{111B5}\u{111BF}-\u{111C0}\u{111CE}\u{1122C}-\u{1122E}\u{11232}-\u{11233}\u{11235}\u{112E0}-\u{112E2}\u{11302}-\u{11303}\u{1133F}\u{11341}-\u{11344}\u{11347}-\u{11348}\u{1134B}-\u{1134D}\u{11362}-\u{11363}\u{11435}-\u{11437}\u{11440}-\u{11441}\u{11445}\u{114B1}-\u{114B2}\u{114B9}\u{114BB}-\u{114BC}\u{114BE}\u{114C1}\u{115B0}-\u{115B1}\u{115B8}-\u{115BB}\u{115BE}\u{11630}-\u{11632}\u{1163B}-\u{1163C}\u{1163E}\u{116AC}\u{116AE}-\u{116AF}\u{116B6}\u{11726}\u{1182C}-\u{1182E}\u{11838}\u{11931}-\u{11935}\u{11937}-\u{11938}\u{1193D}\u{11940}\u{11942}\u{119D1}-\u{119D3}\u{119DC}-\u{119DF}\u{119E4}\u{11A39}\u{11A57}-\u{11A58}\u{11A97}\u{11C2F}\u{11C3E}\u{11CA9}\u{11CB1}\u{11CB4}\u{11D8A}-\u{11D8E}\u{11D93}-\u{11D94}\u{11D96}\u{11EF5}-\u{11EF6}\u{16F51}-\u{16F87}\u{16FF0}-\u{16FF1}\u{1D166}\u{1D16D}]$/u, reL = /^[\u1100-\u115F\uA960-\uA97C]$/u, reV = /^[\u1160-\u11A7\uD7B0-\uD7C6]$/u, reT = /^[\u11A8-\u11FF\uD7CB-\uD7FB]$/u, reLV = /^[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788]$/u, reLVT = /^[\uAC01-\uAC1B\uAC1D-\uAC37\uAC39-\uAC53\uAC55-\uAC6F\uAC71-\uAC8B\uAC8D-\uACA7\uACA9-\uACC3\uACC5-\uACDF\uACE1-\uACFB\uACFD-\uAD17\uAD19-\uAD33\uAD35-\uAD4F\uAD51-\uAD6B\uAD6D-\uAD87\uAD89-\uADA3\uADA5-\uADBF\uADC1-\uADDB\uADDD-\uADF7\uADF9-\uAE13\uAE15-\uAE2F\uAE31-\uAE4B\uAE4D-\uAE67\uAE69-\uAE83\uAE85-\uAE9F\uAEA1-\uAEBB\uAEBD-\uAED7\uAED9-\uAEF3\uAEF5-\uAF0F\uAF11-\uAF2B\uAF2D-\uAF47\uAF49-\uAF63\uAF65-\uAF7F\uAF81-\uAF9B\uAF9D-\uAFB7\uAFB9-\uAFD3\uAFD5-\uAFEF\uAFF1-\uB00B\uB00D-\uB027\uB029-\uB043\uB045-\uB05F\uB061-\uB07B\uB07D-\uB097\uB099-\uB0B3\uB0B5-\uB0CF\uB0D1-\uB0EB\uB0ED-\uB107\uB109-\uB123\uB125-\uB13F\uB141-\uB15B\uB15D-\uB177\uB179-\uB193\uB195-\uB1AF\uB1B1-\uB1CB\uB1CD-\uB1E7\uB1E9-\uB203\uB205-\uB21F\uB221-\uB23B\uB23D-\uB257\uB259-\uB273\uB275-\uB28F\uB291-\uB2AB\uB2AD-\uB2C7\uB2C9-\uB2E3\uB2E5-\uB2FF\uB301-\uB31B\uB31D-\uB337\uB339-\uB353\uB355-\uB36F\uB371-\uB38B\uB38D-\uB3A7\uB3A9-\uB3C3\uB3C5-\uB3DF\uB3E1-\uB3FB\uB3FD-\uB417\uB419-\uB433\uB435-\uB44F\uB451-\uB46B\uB46D-\uB487\uB489-\uB4A3\uB4A5-\uB4BF\uB4C1-\uB4DB\uB4DD-\uB4F7\uB4F9-\uB513\uB515-\uB52F\uB531-\uB54B\uB54D-\uB567\uB569-\uB583\uB585-\uB59F\uB5A1-\uB5BB\uB5BD-\uB5D7\uB5D9-\uB5F3\uB5F5-\uB60F\uB611-\uB62B\uB62D-\uB647\uB649-\uB663\uB665-\uB67F\uB681-\uB69B\uB69D-\uB6B7\uB6B9-\uB6D3\uB6D5-\uB6EF\uB6F1-\uB70B\uB70D-\uB727\uB729-\uB743\uB745-\uB75F\uB761-\uB77B\uB77D-\uB797\uB799-\uB7B3\uB7B5-\uB7CF\uB7D1-\uB7EB\uB7ED-\uB807\uB809-\uB823\uB825-\uB83F\uB841-\uB85B\uB85D-\uB877\uB879-\uB893\uB895-\uB8AF\uB8B1-\uB8CB\uB8CD-\uB8E7\uB8E9-\uB903\uB905-\uB91F\uB921-\uB93B\uB93D-\uB957\uB959-\uB973\uB975-\uB98F\uB991-\uB9AB\uB9AD-\uB9C7\uB9C9-\uB9E3\uB9E5-\uB9FF\uBA01-\uBA1B\uBA1D-\uBA37\uBA39-\uBA53\uBA55-\uBA6F\uBA71-\uBA8B\uBA8D-\uBAA7\uBAA9-\uBAC3\uBAC5-\uBADF\uBAE1-\uBAFB\uBAFD-\uBB17\uBB19-\uBB33\uBB35-\uBB4F\uBB51-\uBB6B\uBB6D-\uBB87\uBB89-\uBBA3\uBBA5-\uBBBF\uBBC1-\uBBDB\uBBDD-\uBBF7\uBBF9-\uBC13\uBC15-\uBC2F\uBC31-\uBC4B\uBC4D-\uBC67\uBC69-\uBC83\uBC85-\uBC9F\uBCA1-\uBCBB\uBCBD-\uBCD7\uBCD9-\uBCF3\uBCF5-\uBD0F\uBD11-\uBD2B\uBD2D-\uBD47\uBD49-\uBD63\uBD65-\uBD7F\uBD81-\uBD9B\uBD9D-\uBDB7\uBDB9-\uBDD3\uBDD5-\uBDEF\uBDF1-\uBE0B\uBE0D-\uBE27\uBE29-\uBE43\uBE45-\uBE5F\uBE61-\uBE7B\uBE7D-\uBE97\uBE99-\uBEB3\uBEB5-\uBECF\uBED1-\uBEEB\uBEED-\uBF07\uBF09-\uBF23\uBF25-\uBF3F\uBF41-\uBF5B\uBF5D-\uBF77\uBF79-\uBF93\uBF95-\uBFAF\uBFB1-\uBFCB\uBFCD-\uBFE7\uBFE9-\uC003\uC005-\uC01F\uC021-\uC03B\uC03D-\uC057\uC059-\uC073\uC075-\uC08F\uC091-\uC0AB\uC0AD-\uC0C7\uC0C9-\uC0E3\uC0E5-\uC0FF\uC101-\uC11B\uC11D-\uC137\uC139-\uC153\uC155-\uC16F\uC171-\uC18B\uC18D-\uC1A7\uC1A9-\uC1C3\uC1C5-\uC1DF\uC1E1-\uC1FB\uC1FD-\uC217\uC219-\uC233\uC235-\uC24F\uC251-\uC26B\uC26D-\uC287\uC289-\uC2A3\uC2A5-\uC2BF\uC2C1-\uC2DB\uC2DD-\uC2F7\uC2F9-\uC313\uC315-\uC32F\uC331-\uC34B\uC34D-\uC367\uC369-\uC383\uC385-\uC39F\uC3A1-\uC3BB\uC3BD-\uC3D7\uC3D9-\uC3F3\uC3F5-\uC40F\uC411-\uC42B\uC42D-\uC447\uC449-\uC463\uC465-\uC47F\uC481-\uC49B\uC49D-\uC4B7\uC4B9-\uC4D3\uC4D5-\uC4EF\uC4F1-\uC50B\uC50D-\uC527\uC529-\uC543\uC545-\uC55F\uC561-\uC57B\uC57D-\uC597\uC599-\uC5B3\uC5B5-\uC5CF\uC5D1-\uC5EB\uC5ED-\uC607\uC609-\uC623\uC625-\uC63F\uC641-\uC65B\uC65D-\uC677\uC679-\uC693\uC695-\uC6AF\uC6B1-\uC6CB\uC6CD-\uC6E7\uC6E9-\uC703\uC705-\uC71F\uC721-\uC73B\uC73D-\uC757\uC759-\uC773\uC775-\uC78F\uC791-\uC7AB\uC7AD-\uC7C7\uC7C9-\uC7E3\uC7E5-\uC7FF\uC801-\uC81B\uC81D-\uC837\uC839-\uC853\uC855-\uC86F\uC871-\uC88B\uC88D-\uC8A7\uC8A9-\uC8C3\uC8C5-\uC8DF\uC8E1-\uC8FB\uC8FD-\uC917\uC919-\uC933\uC935-\uC94F\uC951-\uC96B\uC96D-\uC987\uC989-\uC9A3\uC9A5-\uC9BF\uC9C1-\uC9DB\uC9DD-\uC9F7\uC9F9-\uCA13\uCA15-\uCA2F\uCA31-\uCA4B\uCA4D-\uCA67\uCA69-\uCA83\uCA85-\uCA9F\uCAA1-\uCABB\uCABD-\uCAD7\uCAD9-\uCAF3\uCAF5-\uCB0F\uCB11-\uCB2B\uCB2D-\uCB47\uCB49-\uCB63\uCB65-\uCB7F\uCB81-\uCB9B\uCB9D-\uCBB7\uCBB9-\uCBD3\uCBD5-\uCBEF\uCBF1-\uCC0B\uCC0D-\uCC27\uCC29-\uCC43\uCC45-\uCC5F\uCC61-\uCC7B\uCC7D-\uCC97\uCC99-\uCCB3\uCCB5-\uCCCF\uCCD1-\uCCEB\uCCED-\uCD07\uCD09-\uCD23\uCD25-\uCD3F\uCD41-\uCD5B\uCD5D-\uCD77\uCD79-\uCD93\uCD95-\uCDAF\uCDB1-\uCDCB\uCDCD-\uCDE7\uCDE9-\uCE03\uCE05-\uCE1F\uCE21-\uCE3B\uCE3D-\uCE57\uCE59-\uCE73\uCE75-\uCE8F\uCE91-\uCEAB\uCEAD-\uCEC7\uCEC9-\uCEE3\uCEE5-\uCEFF\uCF01-\uCF1B\uCF1D-\uCF37\uCF39-\uCF53\uCF55-\uCF6F\uCF71-\uCF8B\uCF8D-\uCFA7\uCFA9-\uCFC3\uCFC5-\uCFDF\uCFE1-\uCFFB\uCFFD-\uD017\uD019-\uD033\uD035-\uD04F\uD051-\uD06B\uD06D-\uD087\uD089-\uD0A3\uD0A5-\uD0BF\uD0C1-\uD0DB\uD0DD-\uD0F7\uD0F9-\uD113\uD115-\uD12F\uD131-\uD14B\uD14D-\uD167\uD169-\uD183\uD185-\uD19F\uD1A1-\uD1BB\uD1BD-\uD1D7\uD1D9-\uD1F3\uD1F5-\uD20F\uD211-\uD22B\uD22D-\uD247\uD249-\uD263\uD265-\uD27F\uD281-\uD29B\uD29D-\uD2B7\uD2B9-\uD2D3\uD2D5-\uD2EF\uD2F1-\uD30B\uD30D-\uD327\uD329-\uD343\uD345-\uD35F\uD361-\uD37B\uD37D-\uD397\uD399-\uD3B3\uD3B5-\uD3CF\uD3D1-\uD3EB\uD3ED-\uD407\uD409-\uD423\uD425-\uD43F\uD441-\uD45B\uD45D-\uD477\uD479-\uD493\uD495-\uD4AF\uD4B1-\uD4CB\uD4CD-\uD4E7\uD4E9-\uD503\uD505-\uD51F\uD521-\uD53B\uD53D-\uD557\uD559-\uD573\uD575-\uD58F\uD591-\uD5AB\uD5AD-\uD5C7\uD5C9-\uD5E3\uD5E5-\uD5FF\uD601-\uD61B\uD61D-\uD637\uD639-\uD653\uD655-\uD66F\uD671-\uD68B\uD68D-\uD6A7\uD6A9-\uD6C3\uD6C5-\uD6DF\uD6E1-\uD6FB\uD6FD-\uD717\uD719-\uD733\uD735-\uD74F\uD751-\uD76B\uD76D-\uD787\uD789-\uD7A3]$/u, reExtPict = /^\p{ExtPict}$/u, inCBConsonantClass = String.raw`\u0915-\u0939\u0958-\u095F\u0978-\u097F\u0995-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC-\u09DD\u09DF\u09F0-\u09F1\u0A95-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0AF9\u0B15-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B5C-\u0B5D\u0B5F\u0B71\u0C15-\u0C28\u0C2A-\u0C39\u0C58-\u0C5A\u0D15-\u0D3A\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u1780-\u17B3\u1A20-\u1A54\u1B0B-\u1B0C\u1B13-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBB-\u1BBD\uA989-\uA98B\uA98F-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA60-\uAA6F\uAA71-\uAA73\uAA7A\uAA7E-\uAA7F\uAAE0-\uAAEA\uABC0-\uABDA\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{11900}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}-\u{11916}\u{11918}-\u{1192F}\u{11A00}\u{11A0B}-\u{11A32}\u{11A50}\u{11A5C}-\u{11A83}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}`, inCBExtendClass = String.raw`\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u0951-\u0957\u0962-\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09D7\u09E2-\u09E3\u09FE\u0A01-\u0A02\u0A3C\u0A41-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A70-\u0A71\u0A75\u0A81-\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7-\u0AC8\u0AE2-\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B55-\u0B56\u0B57\u0B62-\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4C\u0C55-\u0C56\u0C62-\u0C63\u0C81\u0CBC\u0CBF\u0CC0\u0CC2\u0CC6\u0CC7-\u0CC8\u0CCA-\u0CCB\u0CCC-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0D00-\u0D01\u0D3B-\u0D3C\u0D3E\u0D41-\u0D44\u0D57\u0D62-\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u103A\u103D-\u103E\u1058-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1715\u1732-\u1733\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D1\u17D3\u17DD\u180B-\u180D\u180F\u1885-\u1886\u18A9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193B\u1A17-\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1ABE\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B03\u1B34\u1B35\u1B36-\u1B3A\u1B3B\u1B3C\u1B3D\u1B42\u1B43\u1B6B-\u1B73\u1B80-\u1B81\u1BA2-\u1BA5\u1BA8-\u1BA9\u1BAA\u1BAC-\u1BAD\u1BE6\u1BE8-\u1BE9\u1BED\u1BEF-\u1BF1\u1BF2-\u1BF3\u1C2C-\u1C33\u1C36-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DFF\u200D\u20D0-\u20DC\u20DD-\u20E0\u20E1\u20E2-\u20E4\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u302E-\u302F\u3099-\u309A\uA66F\uA670-\uA672\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA825-\uA826\uA82C\uA8C4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA953\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC-\uA9BD\uA9E5\uAA29-\uAA2E\uAA31-\uAA32\uAA35-\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEC-\uAAED\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E-\uFF9F\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}-\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10AE5}-\u{10AE6}\u{10D24}-\u{10D27}\u{10D69}-\u{10D6D}\u{10EAB}-\u{10EAC}\u{10EFA}-\u{10EFF}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11001}\u{11038}-\u{11046}\u{11070}\u{11073}-\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}-\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11132}\u{11134}\u{11173}\u{11180}-\u{11181}\u{111B6}-\u{111BE}\u{111C0}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11235}\u{11236}-\u{11237}\u{1123E}\u{11241}\u{112DF}\u{112E3}-\u{112EA}\u{11300}-\u{11301}\u{1133B}-\u{1133C}\u{1133E}\u{11340}\u{1134D}\u{11357}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{113B8}\u{113BB}-\u{113C0}\u{113C2}\u{113C5}\u{113C7}-\u{113C9}\u{113CE}\u{113CF}\u{113D2}\u{113E1}-\u{113E2}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B0}\u{114B3}-\u{114B8}\u{114BA}\u{114BD}\u{114BF}-\u{114C0}\u{114C2}-\u{114C3}\u{115AF}\u{115B2}-\u{115B5}\u{115BC}-\u{115BD}\u{115BF}-\u{115C0}\u{115DC}-\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}-\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B6}\u{116B7}\u{1171D}\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}-\u{1183A}\u{11930}\u{1193B}-\u{1193C}\u{1193D}\u{11943}\u{119D4}-\u{119D7}\u{119DA}-\u{119DB}\u{119E0}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11B60}\u{11B62}-\u{11B64}\u{11B66}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C3F}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}-\u{11CB3}\u{11CB5}-\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}-\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}-\u{11D91}\u{11D95}\u{11D97}\u{11EF3}-\u{11EF4}\u{11F00}-\u{11F01}\u{11F36}-\u{11F3A}\u{11F40}\u{11F41}\u{11F5A}\u{13440}\u{13447}-\u{13455}\u{1611E}-\u{16129}\u{1612D}-\u{1612F}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE4}\u{16FF0}-\u{16FF1}\u{1BC9D}-\u{1BC9E}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D165}-\u{1D166}\u{1D167}-\u{1D169}\u{1D16D}-\u{1D172}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}-\u{1E024}\u{1E026}-\u{1E02A}\u{1E08F}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E4EC}-\u{1E4EF}\u{1E5EE}-\u{1E5EF}\u{1E6E3}\u{1E6E6}\u{1E6EE}-\u{1E6EF}\u{1E6F5}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{1F3FB}-\u{1F3FF}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}`, inCBLinkerClass = String.raw`\u094D\u09CD\u0ACD\u0B4D\u0C4D\u0D4D\u1039\u17D2\u1A60\u1B44\u1BAB\uA9C0\uAAF6\u{10A3F}\u{11133}\u{113D0}\u{1193E}\u{11A47}\u{11A99}\u{11F42}`, reInCBConsonant = RegExp(`^[${inCBConsonantClass}]$`, "u"), reInCBExtend = RegExp(`^[${inCBExtendClass}]$`, "u"), reInCBLinker = RegExp(`^[${inCBLinkerClass}]$`, "u"), getCodepointType = (char, code) => {
|
|
593
592
|
let type = CodepointType.Any;
|
|
594
|
-
return char.search(reExtend) !== -1 && (type |= CodepointType.Extend), code === 8205 && (type |= CodepointType.ZWJ), code >= 127462 && code <= 127487 && (type |= CodepointType.RI), char.search(rePrepend) !== -1 && (type |= CodepointType.Prepend), char.search(reSpacingMark) !== -1 && (type |= CodepointType.SpacingMark), char.search(reL) !== -1 && (type |= CodepointType.L), char.search(reV) !== -1 && (type |= CodepointType.V), char.search(reT) !== -1 && (type |= CodepointType.T), char.search(reLV) !== -1 && (type |= CodepointType.LV), char.search(reLVT) !== -1 && (type |= CodepointType.LVT), char.search(reExtPict) !== -1 && (type |= CodepointType.ExtPict), type;
|
|
593
|
+
return char.search(reExtend) !== -1 && (type |= CodepointType.Extend), code === 8205 && (type |= CodepointType.ZWJ), code >= 127462 && code <= 127487 && (type |= CodepointType.RI), char.search(rePrepend) !== -1 && (type |= CodepointType.Prepend), char.search(reSpacingMark) !== -1 && (type |= CodepointType.SpacingMark), char.search(reL) !== -1 && (type |= CodepointType.L), char.search(reV) !== -1 && (type |= CodepointType.V), char.search(reT) !== -1 && (type |= CodepointType.T), char.search(reLV) !== -1 && (type |= CodepointType.LV), char.search(reLVT) !== -1 && (type |= CodepointType.LVT), char.search(reExtPict) !== -1 && (type |= CodepointType.ExtPict), char.search(reInCBConsonant) !== -1 && (type |= CodepointType.InCBConsonant), char.search(reInCBExtend) !== -1 && (type |= CodepointType.InCBExtend), char.search(reInCBLinker) !== -1 && (type |= CodepointType.InCBLinker), type;
|
|
595
594
|
};
|
|
596
595
|
function intersects(x, y) {
|
|
597
596
|
return (x & y) !== 0;
|
|
@@ -603,13 +602,14 @@ const NonBoundaryPairs = [
|
|
|
603
602
|
[CodepointType.Any, CodepointType.Extend | CodepointType.ZWJ],
|
|
604
603
|
[CodepointType.Any, CodepointType.SpacingMark],
|
|
605
604
|
[CodepointType.Prepend, CodepointType.Any],
|
|
605
|
+
[CodepointType.InCBLinker | CodepointType.InCBExtend, CodepointType.InCBConsonant],
|
|
606
606
|
[CodepointType.ZWJ, CodepointType.ExtPict],
|
|
607
607
|
[CodepointType.RI, CodepointType.RI]
|
|
608
608
|
];
|
|
609
609
|
function isBoundaryPair(left, right) {
|
|
610
610
|
return NonBoundaryPairs.findIndex((r) => intersects(left, r[0]) && intersects(right, r[1])) === -1;
|
|
611
611
|
}
|
|
612
|
-
const endingEmojiZWJ = /\p{ExtPict}[\p{Gr_Ext}\p{EMod}]*\u200D$/u, endsWithEmojiZWJ = (str) => str.search(endingEmojiZWJ) !== -1, endingRIs = /\p{RI}+$/gu, endsWithOddNumberOfRIs = (str) => {
|
|
612
|
+
const endingEmojiZWJ = /\p{ExtPict}[\p{Gr_Ext}\p{EMod}]*\u200D$/u, endsWithEmojiZWJ = (str) => str.search(endingEmojiZWJ) !== -1, endingConjunctLinker = RegExp(`[${inCBConsonantClass}](?:[${inCBExtendClass}${inCBLinkerClass}])*[${inCBLinkerClass}](?:[${inCBExtendClass}${inCBLinkerClass}])*$`, "u"), endsWithConjunctLinker = (str) => str.search(endingConjunctLinker) !== -1, endingRIs = /\p{RI}+$/gu, endsWithOddNumberOfRIs = (str) => {
|
|
613
613
|
let match = str.match(endingRIs);
|
|
614
614
|
return match !== null && match[0].length / 2 % 2 == 1;
|
|
615
615
|
};
|
|
@@ -1154,64 +1154,60 @@ function transformPath(path, operation) {
|
|
|
1154
1154
|
return path;
|
|
1155
1155
|
}
|
|
1156
1156
|
/**
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
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
|
|
1159
1159
|
* equality to detect "nothing changed."
|
|
1160
|
-
*
|
|
1161
|
-
* With keyed paths, most operations don't affect paths at all:
|
|
1162
|
-
* - insert: no-op (new node has its own key, doesn't shift siblings)
|
|
1163
|
-
* - unset (node removal): invalidates if the point is at or inside the removed node
|
|
1164
|
-
* - unset (property removal): collapses offset when `text` is unset from a span
|
|
1165
|
-
* - insert.text: adjusts offset if in the same span
|
|
1166
|
-
* - remove.text: adjusts offset if in the same span
|
|
1167
|
-
* - set: updates keyed segments when `_key` changes, clamps offset when `text` changes
|
|
1168
|
-
* - set.selection: no-op
|
|
1169
1160
|
*/
|
|
1170
|
-
function
|
|
1161
|
+
function mapPointThroughStep(step, point, options = {}) {
|
|
1171
1162
|
if (point === null) return null;
|
|
1172
1163
|
let { affinity = "forward" } = options;
|
|
1173
|
-
switch (
|
|
1174
|
-
case "insert.text": return pathEquals(
|
|
1164
|
+
switch (step.type) {
|
|
1165
|
+
case "insert.text": return pathEquals(step.path, point.path) && (step.offset < point.offset || step.offset === point.offset && affinity === "forward") ? {
|
|
1175
1166
|
path: point.path,
|
|
1176
|
-
offset: point.offset +
|
|
1167
|
+
offset: point.offset + step.text.length
|
|
1177
1168
|
} : point;
|
|
1178
|
-
case "remove.text": return pathEquals(
|
|
1169
|
+
case "remove.text": return pathEquals(step.path, point.path) && step.offset <= point.offset ? {
|
|
1179
1170
|
path: point.path,
|
|
1180
|
-
offset: point.offset - Math.min(point.offset -
|
|
1171
|
+
offset: point.offset - Math.min(point.offset - step.offset, step.text.length)
|
|
1181
1172
|
} : point;
|
|
1182
|
-
case "set": {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
let newPath;
|
|
1188
|
-
for (let i = 0; i < path.length; i++) {
|
|
1189
|
-
let segment = path[i];
|
|
1190
|
-
isKeyedSegment(segment) && segment._key === oldKey && (newPath === void 0 && (newPath = [...path]), newPath[i] = { _key: op.value });
|
|
1191
|
-
}
|
|
1192
|
-
newPath !== void 0 && (path = newPath);
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
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)) {
|
|
1196
|
-
let remappedPoint = remapPointThroughChildrenReplacement(point, op.path, op.value, op.inverse?.type === "set" && Array.isArray(op.inverse.value) ? op.inverse.value : void 0);
|
|
1197
|
-
remappedPoint && (path = remappedPoint.path, offset = remappedPoint.offset);
|
|
1198
|
-
}
|
|
1199
|
-
return path === point.path && offset === point.offset ? point : {
|
|
1200
|
-
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,
|
|
1201
1178
|
offset
|
|
1202
1179
|
};
|
|
1203
1180
|
}
|
|
1204
|
-
case "
|
|
1205
|
-
let
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
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
|
+
};
|
|
1212
1191
|
}
|
|
1213
|
-
|
|
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);
|
|
1214
1209
|
}
|
|
1210
|
+
return current;
|
|
1215
1211
|
}
|
|
1216
1212
|
/**
|
|
1217
1213
|
* Map a point through a wholesale children replacement via its text
|
|
@@ -1219,13 +1215,12 @@ function transformPoint$1(point, op, options = {}) {
|
|
|
1219
1215
|
* untransformed) unless every precondition holds: the point addresses
|
|
1220
1216
|
* a direct child of the node whose children were replaced, that
|
|
1221
1217
|
* child's key is gone from the new children (identity did not
|
|
1222
|
-
* survive), the old
|
|
1223
|
-
*
|
|
1224
|
-
* 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.
|
|
1225
1220
|
*
|
|
1226
1221
|
* Spans are detected structurally (`text` being a string) rather than
|
|
1227
|
-
* through the schema:
|
|
1228
|
-
*
|
|
1222
|
+
* through the schema: this mapper is deliberately schema-free, and
|
|
1223
|
+
* text-carrying children are the only ones that occupy offsets.
|
|
1229
1224
|
*
|
|
1230
1225
|
* The offset arithmetic is shared with the snapshot-aware block-offset
|
|
1231
1226
|
* utils through `utils/util.child-text-offset.ts`, so the boundary
|
|
@@ -1240,7 +1235,7 @@ function transformPoint$1(point, op, options = {}) {
|
|
|
1240
1235
|
* deeper inside such blocks fail the direct-child path guard.
|
|
1241
1236
|
*/
|
|
1242
1237
|
function remapPointThroughChildrenReplacement(point, childrenPath, newChildren, oldChildren) {
|
|
1243
|
-
if (
|
|
1238
|
+
if (point.path.length !== childrenPath.length + 1 || !pathEquals(point.path.slice(0, childrenPath.length), childrenPath)) return;
|
|
1244
1239
|
let pointSegment = point.path[point.path.length - 1];
|
|
1245
1240
|
if (!isKeyedSegment(pointSegment) || newChildren.some((child) => childKey(child) === pointSegment._key)) return;
|
|
1246
1241
|
let nodeTextOffset = textOffsetOfChild(oldChildren, childText, pointSegment._key, point.offset);
|
|
@@ -1272,6 +1267,76 @@ function concatenatedText(children) {
|
|
|
1272
1267
|
return text;
|
|
1273
1268
|
}
|
|
1274
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
|
+
/**
|
|
1275
1340
|
* Check whether a text diff was applied in a way we can perform the pending action on /
|
|
1276
1341
|
* recover the pending selection.
|
|
1277
1342
|
*/
|
|
@@ -1993,7 +2058,7 @@ const DecorateContext = createContext({}), useDecorations = (node, path, parentD
|
|
|
1993
2058
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ new Set(), $[0] = t0) : t0 = $[0];
|
|
1994
2059
|
let eventListeners = useRef(t0), latestDecorate = useRef(decorateProp), t1, t2;
|
|
1995
2060
|
$[1] === decorateProp ? (t1 = $[2], t2 = $[3]) : (t1 = () => {
|
|
1996
|
-
latestDecorate.current = decorateProp, eventListeners.current.forEach(_temp$
|
|
2061
|
+
latestDecorate.current = decorateProp, eventListeners.current.forEach(_temp$4);
|
|
1997
2062
|
}, t2 = [decorateProp], $[1] = decorateProp, $[2] = t1, $[3] = t2), useIsomorphicLayoutEffect(t1, t2);
|
|
1998
2063
|
let t3;
|
|
1999
2064
|
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = (entry) => latestDecorate.current(entry), $[4] = t3) : t3 = $[4];
|
|
@@ -2007,7 +2072,7 @@ const DecorateContext = createContext({}), useDecorations = (node, path, parentD
|
|
|
2007
2072
|
addEventListener
|
|
2008
2073
|
}, $[6] = t5) : t5 = $[6], t5;
|
|
2009
2074
|
};
|
|
2010
|
-
function _temp$
|
|
2075
|
+
function _temp$4(listener) {
|
|
2011
2076
|
listener();
|
|
2012
2077
|
}
|
|
2013
2078
|
const rtlRange = "֑-߿יִ-﷽ﹰ-ﻼ", ltrRange = "A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--", rtl = RegExp(`^[^${ltrRange}]*[${rtlRange}]`), ltr = RegExp(`^[^${rtlRange}]*[${ltrRange}]`);
|
|
@@ -2020,19 +2085,13 @@ function getDirection(value) {
|
|
|
2020
2085
|
* or an editable container) and threads decorations + children through the
|
|
2021
2086
|
* `renderElement` callback.
|
|
2022
2087
|
*
|
|
2023
|
-
*
|
|
2024
|
-
*
|
|
2025
|
-
*
|
|
2026
|
-
*
|
|
2027
|
-
* `isEditableContainer` walk).
|
|
2028
|
-
* - `NewPipelineContext` (context): this element renders inside a
|
|
2029
|
-
* `registerNode`-shaped subtree. Governs the `data-slate-node="element"`
|
|
2030
|
-
* strip on the outer attributes. Provided by `useChildren` (wrapping
|
|
2031
|
-
* each new-pipeline child) and by `render.element.tsx` /
|
|
2032
|
-
* `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).
|
|
2033
2092
|
*/
|
|
2034
2093
|
const Element$1 = (props) => {
|
|
2035
|
-
let $ = c(7), { decorations: parentDecorations, element, isContainer, renderElement, renderLeaf, renderText } = props, dataPath = serializePath(props.path), editor = useEngineStatic(), isInline$1 = isInline(editor.snapshot, props.path),
|
|
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;
|
|
2036
2095
|
$[0] !== decorations || $[1] !== element || $[2] !== props.path || $[3] !== renderElement || $[4] !== renderLeaf || $[5] !== renderText ? (t0 = {
|
|
2037
2096
|
decorations,
|
|
2038
2097
|
node: element,
|
|
@@ -2044,10 +2103,7 @@ const Element$1 = (props) => {
|
|
|
2044
2103
|
let children = useChildren(t0), attributes = isContainer ? {
|
|
2045
2104
|
"data-pt-block": "container",
|
|
2046
2105
|
"data-pt-path": dataPath
|
|
2047
|
-
} :
|
|
2048
|
-
"data-slate-node": "element",
|
|
2049
|
-
"data-pt-path": dataPath
|
|
2050
|
-
};
|
|
2106
|
+
} : { "data-pt-path": dataPath };
|
|
2051
2107
|
if (!isInline$1 && isTextBlockNode({ schema: editor.snapshot.context.schema }, element)) {
|
|
2052
2108
|
let text = getText(editor.snapshot, props.path), dir = text === void 0 ? void 0 : getDirection(text);
|
|
2053
2109
|
dir === "rtl" && (attributes.dir = dir);
|
|
@@ -2059,52 +2115,31 @@ const Element$1 = (props) => {
|
|
|
2059
2115
|
path: props.path
|
|
2060
2116
|
});
|
|
2061
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) => {
|
|
2062
|
-
let $ = c(
|
|
2063
|
-
"data-slate-node": "element",
|
|
2064
|
-
"data-slate-void": !0,
|
|
2065
|
-
"data-pt-path": dataPath
|
|
2066
|
-
};
|
|
2118
|
+
let $ = c(4), { isInline, objectNode, path, renderElement } = props, dataPath = serializePath(path), readOnly = useReadOnly(), attributes = { "data-pt-path": dataPath };
|
|
2067
2119
|
isInline && !readOnly && (attributes.contentEditable = !1);
|
|
2068
2120
|
let Tag = isInline ? "span" : "div", t0;
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
"data-pt-marks": !0,
|
|
2079
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
2080
|
-
"data-pt-zero-width": !0,
|
|
2081
|
-
children: ""
|
|
2082
|
-
})
|
|
2083
|
-
}) })
|
|
2084
|
-
}) : /* @__PURE__ */ jsx(Tag, {
|
|
2085
|
-
"data-slate-spacer": !0,
|
|
2086
|
-
"data-pt-spacer": !0,
|
|
2087
|
-
style: {
|
|
2088
|
-
height: "0",
|
|
2089
|
-
color: "transparent",
|
|
2090
|
-
outline: "none",
|
|
2091
|
-
position: "absolute"
|
|
2092
|
-
},
|
|
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,
|
|
2093
2130
|
children: /* @__PURE__ */ jsx("span", {
|
|
2094
|
-
"data-
|
|
2095
|
-
children:
|
|
2096
|
-
"data-slate-leaf": !0,
|
|
2097
|
-
"data-pt-marks": !0,
|
|
2098
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
2099
|
-
"data-slate-zero-width": "z",
|
|
2100
|
-
"data-pt-zero-width": !0,
|
|
2101
|
-
children: ""
|
|
2102
|
-
})
|
|
2103
|
-
})
|
|
2131
|
+
"data-pt-zero-width": !0,
|
|
2132
|
+
children: ""
|
|
2104
2133
|
})
|
|
2105
|
-
})
|
|
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({
|
|
2106
2141
|
attributes,
|
|
2107
|
-
children:
|
|
2142
|
+
children: t2,
|
|
2108
2143
|
element: objectNode,
|
|
2109
2144
|
path
|
|
2110
2145
|
});
|
|
@@ -2313,51 +2348,36 @@ const EngineString = (props) => {
|
|
|
2313
2348
|
}) : /* @__PURE__ */ jsx(TextString, { text: leafText });
|
|
2314
2349
|
}, TextString = (props) => {
|
|
2315
2350
|
"use no memo";
|
|
2316
|
-
let { text, isTrailing = !1 } = props,
|
|
2351
|
+
let { text, isTrailing = !1 } = props, ref = useRef(null), getTextContent = () => `${text ?? ""}${isTrailing ? "\n" : ""}`, [initialText] = useState(getTextContent);
|
|
2317
2352
|
return useIsomorphicLayoutEffect(() => {
|
|
2318
2353
|
let textWithTrailing = getTextContent();
|
|
2319
2354
|
ref.current && ref.current.textContent !== textWithTrailing && (ref.current.textContent = textWithTrailing);
|
|
2320
2355
|
}), /* @__PURE__ */ jsx(MemoizedText$1, {
|
|
2321
2356
|
ref,
|
|
2322
|
-
isInNewPipeline,
|
|
2323
2357
|
children: initialText
|
|
2324
2358
|
});
|
|
2325
2359
|
}, MemoizedText$1 = memo(forwardRef((props, ref) => {
|
|
2326
|
-
let $ = c(
|
|
2327
|
-
|
|
2328
|
-
let t0;
|
|
2329
|
-
return $[0] !== props.children || $[1] !== ref ? (t0 = /* @__PURE__ */ jsx("span", {
|
|
2330
|
-
"data-pt-text": !0,
|
|
2331
|
-
ref,
|
|
2332
|
-
children: props.children
|
|
2333
|
-
}), $[0] = props.children, $[1] = ref, $[2] = t0) : t0 = $[2], t0;
|
|
2334
|
-
}
|
|
2335
|
-
let t0;
|
|
2336
|
-
return $[3] !== props.children || $[4] !== ref ? (t0 = /* @__PURE__ */ jsx("span", {
|
|
2337
|
-
"data-slate-string": !0,
|
|
2360
|
+
let $ = c(3), t0;
|
|
2361
|
+
return $[0] !== props.children || $[1] !== ref ? (t0 = /* @__PURE__ */ jsx("span", {
|
|
2338
2362
|
"data-pt-text": !0,
|
|
2339
2363
|
ref,
|
|
2340
2364
|
children: props.children
|
|
2341
|
-
}), $[
|
|
2365
|
+
}), $[0] = props.children, $[1] = ref, $[2] = t0) : t0 = $[2], t0;
|
|
2342
2366
|
})), ZeroWidthString = (props) => {
|
|
2343
|
-
let $ = c(
|
|
2344
|
-
$[0]
|
|
2367
|
+
let $ = c(8), { isLineBreak: t0 } = props, isLineBreak = t0 !== void 0 && t0, t1;
|
|
2368
|
+
$[0] === isLineBreak ? t1 = $[1] : (t1 = {
|
|
2345
2369
|
"data-pt-zero-width": !0,
|
|
2346
2370
|
...isLineBreak ? { "data-pt-line-break": !0 } : {}
|
|
2347
|
-
}
|
|
2348
|
-
"data-slate-zero-width": engineValue,
|
|
2349
|
-
"data-pt-zero-width": !0,
|
|
2350
|
-
...isLineBreak ? { "data-pt-line-break": !0 } : {}
|
|
2351
|
-
}, $[0] = engineValue, $[1] = isInNewPipeline, $[2] = isLineBreak, $[3] = t1) : t1 = $[3];
|
|
2371
|
+
}, $[0] = isLineBreak, $[1] = t1);
|
|
2352
2372
|
let attributes = t1, t2 = !IS_ANDROID || !isLineBreak ? "" : null, t3;
|
|
2353
|
-
$[
|
|
2373
|
+
$[2] === isLineBreak ? t3 = $[3] : (t3 = isLineBreak ? /* @__PURE__ */ jsx("br", {}) : null, $[2] = isLineBreak, $[3] = t3);
|
|
2354
2374
|
let t4;
|
|
2355
|
-
return $[
|
|
2375
|
+
return $[4] !== attributes || $[5] !== t2 || $[6] !== t3 ? (t4 = /* @__PURE__ */ jsxs("span", {
|
|
2356
2376
|
...attributes,
|
|
2357
2377
|
children: [t2, t3]
|
|
2358
|
-
}), $[
|
|
2378
|
+
}), $[4] = attributes, $[5] = t2, $[6] = t3, $[7] = t4) : t4 = $[7], t4;
|
|
2359
2379
|
}, defaultRenderLeaf = (props) => /* @__PURE__ */ jsx(DefaultLeaf, { ...props }), Leaf = (props) => {
|
|
2360
|
-
let $ = c(
|
|
2380
|
+
let $ = c(13), { leaf, isLast, text, path, parent, renderLeaf: t0, leafPosition } = props, renderLeaf = t0 === void 0 ? defaultRenderLeaf : t0, t1;
|
|
2361
2381
|
$[0] !== isLast || $[1] !== leaf || $[2] !== parent || $[3] !== path || $[4] !== text ? (t1 = /* @__PURE__ */ jsx(EngineString, {
|
|
2362
2382
|
isLast,
|
|
2363
2383
|
leaf,
|
|
@@ -2366,17 +2386,14 @@ const EngineString = (props) => {
|
|
|
2366
2386
|
text
|
|
2367
2387
|
}), $[0] = isLast, $[1] = leaf, $[2] = parent, $[3] = path, $[4] = text, $[5] = t1) : t1 = $[5];
|
|
2368
2388
|
let children = t1, t2;
|
|
2369
|
-
return $[6] !== children || $[7] !==
|
|
2370
|
-
attributes:
|
|
2371
|
-
"data-slate-leaf": !0,
|
|
2372
|
-
"data-pt-marks": !0
|
|
2373
|
-
},
|
|
2389
|
+
return $[6] !== children || $[7] !== leaf || $[8] !== leafPosition || $[9] !== path || $[10] !== renderLeaf || $[11] !== text ? (t2 = renderLeaf({
|
|
2390
|
+
attributes: { "data-pt-marks": !0 },
|
|
2374
2391
|
children,
|
|
2375
2392
|
leaf,
|
|
2376
2393
|
text,
|
|
2377
2394
|
path,
|
|
2378
2395
|
leafPosition
|
|
2379
|
-
}), $[6] = children, $[7] =
|
|
2396
|
+
}), $[6] = children, $[7] = leaf, $[8] = leafPosition, $[9] = path, $[10] = renderLeaf, $[11] = text, $[12] = t2) : t2 = $[12], t2;
|
|
2380
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) => {
|
|
2381
2398
|
let $ = c(3), { attributes, children } = props, t0;
|
|
2382
2399
|
return $[0] !== attributes || $[1] !== children ? (t0 = /* @__PURE__ */ jsx("span", {
|
|
@@ -2384,30 +2401,30 @@ const EngineString = (props) => {
|
|
|
2384
2401
|
children
|
|
2385
2402
|
}), $[0] = attributes, $[1] = children, $[2] = t0) : t0 = $[2], t0;
|
|
2386
2403
|
}, defaultRenderText = (props) => /* @__PURE__ */ jsx(DefaultText, { ...props }), Text = (props) => {
|
|
2387
|
-
let $ = c(
|
|
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;
|
|
2388
2405
|
$[0] !== decorations || $[1] !== text ? (t1 = getTextDecorations(text, decorations), $[0] = decorations, $[1] = text, $[2] = t1) : t1 = $[2];
|
|
2389
|
-
let decoratedLeaves = t1,
|
|
2390
|
-
|
|
2391
|
-
let
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
return renderText({
|
|
2404
|
-
text,
|
|
2405
|
-
children,
|
|
2406
|
-
attributes: useContext(NewPipelineContext) ? { "data-pt-path": dataPath } : {
|
|
2407
|
-
"data-slate-node": "text",
|
|
2408
|
-
"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}`));
|
|
2409
2420
|
}
|
|
2410
|
-
|
|
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;
|
|
2411
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) => {
|
|
2412
2429
|
let $ = c(3), { attributes, children } = props, t0;
|
|
2413
2430
|
return $[0] !== attributes || $[1] !== children ? (t0 = /* @__PURE__ */ jsx("span", {
|
|
@@ -2561,16 +2578,6 @@ const useChildren = (props) => {
|
|
|
2561
2578
|
function useRegistrationsSelector(selector, equalityFn = refEquality) {
|
|
2562
2579
|
return useChannelSelector(selector, equalityFn, "registrations");
|
|
2563
2580
|
}
|
|
2564
|
-
/**
|
|
2565
|
-
* `useEngineSelector` scoped to the 'listIndex' channel: the selector
|
|
2566
|
-
* re-runs on its component's renders and when a flush contained a
|
|
2567
|
-
* structural operation (the same signal that invalidates
|
|
2568
|
-
* `listIndexMap`), not on text or selection changes. Only for
|
|
2569
|
-
* selectors that read `getListIndexMap`.
|
|
2570
|
-
*/
|
|
2571
|
-
function useListIndexSelector(selector, equalityFn = refEquality) {
|
|
2572
|
-
return useChannelSelector(selector, equalityFn, "listIndex");
|
|
2573
|
-
}
|
|
2574
2581
|
function useChannelSelector(selector, equalityFn, channel) {
|
|
2575
2582
|
let context = useContext(EngineSelectorContext);
|
|
2576
2583
|
if (!context) throw Error("The `useEngineSelector` hook must be used inside the <Engine> component's context.");
|
|
@@ -2593,16 +2600,14 @@ function useChannelSelector(selector, equalityFn, channel) {
|
|
|
2593
2600
|
* keystroke and selection move dominated per-event cost.
|
|
2594
2601
|
*/
|
|
2595
2602
|
function useSelectorContext() {
|
|
2596
|
-
let eventListeners = useRef(/* @__PURE__ */ new Set()), registrationListeners = useRef(/* @__PURE__ */ new Set()),
|
|
2603
|
+
let eventListeners = useRef(/* @__PURE__ */ new Set()), registrationListeners = useRef(/* @__PURE__ */ new Set()), onChange = useCallback((changed) => {
|
|
2597
2604
|
eventListeners.current.forEach((listener) => {
|
|
2598
2605
|
listener();
|
|
2599
2606
|
}), changed.registrations && registrationListeners.current.forEach((listener) => {
|
|
2600
2607
|
listener();
|
|
2601
|
-
}), changed.listIndex && listIndexListeners.current.forEach((listener) => {
|
|
2602
|
-
listener();
|
|
2603
2608
|
});
|
|
2604
2609
|
}, []), addEventListener = useCallback((callbackProp, channel) => {
|
|
2605
|
-
let listeners = channel === "registrations" ? registrationListeners.current :
|
|
2610
|
+
let listeners = channel === "registrations" ? registrationListeners.current : eventListeners.current;
|
|
2606
2611
|
return listeners.add(callbackProp), () => {
|
|
2607
2612
|
listeners.delete(callbackProp);
|
|
2608
2613
|
};
|
|
@@ -3160,9 +3165,7 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({ children }) => /* @__PU
|
|
|
3160
3165
|
spellCheck: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.spellCheck : !1,
|
|
3161
3166
|
autoCorrect: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.autoCorrect : "false",
|
|
3162
3167
|
autoCapitalize: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.autoCapitalize : "false",
|
|
3163
|
-
"data-slate-editor": !0,
|
|
3164
3168
|
"data-pt-editor": !0,
|
|
3165
|
-
"data-slate-node": "value",
|
|
3166
3169
|
"data-pt-path": "",
|
|
3167
3170
|
contentEditable: !readOnly,
|
|
3168
3171
|
zindex: -1,
|
|
@@ -3956,153 +3959,7 @@ function getDragSelection({ eventSelection, snapshot }) {
|
|
|
3956
3959
|
}
|
|
3957
3960
|
return dragSelection;
|
|
3958
3961
|
}
|
|
3959
|
-
|
|
3960
|
-
return {
|
|
3961
|
-
id: defaultKeyGenerator(),
|
|
3962
|
-
name: config?.name,
|
|
3963
|
-
reference: config?.reference
|
|
3964
|
-
};
|
|
3965
|
-
}
|
|
3966
|
-
const corePriority = createEditorPriority({ name: "core" });
|
|
3967
|
-
function createDropPositionBehaviorsConfig({ setDropPosition }) {
|
|
3968
|
-
return [{
|
|
3969
|
-
behavior: defineBehavior({
|
|
3970
|
-
on: "drag.dragover",
|
|
3971
|
-
guard: ({ snapshot, event }) => {
|
|
3972
|
-
let dropFocusBlock = getFocusBlock({
|
|
3973
|
-
...snapshot,
|
|
3974
|
-
context: {
|
|
3975
|
-
...snapshot.context,
|
|
3976
|
-
selection: event.position.selection
|
|
3977
|
-
}
|
|
3978
|
-
});
|
|
3979
|
-
if (!dropFocusBlock) return !1;
|
|
3980
|
-
let dragOrigin = event.dragOrigin;
|
|
3981
|
-
if (!dragOrigin) return !1;
|
|
3982
|
-
let dragSelection = getDragSelection({
|
|
3983
|
-
eventSelection: dragOrigin.selection,
|
|
3984
|
-
snapshot
|
|
3985
|
-
});
|
|
3986
|
-
return getSelectedBlocks({
|
|
3987
|
-
...snapshot,
|
|
3988
|
-
context: {
|
|
3989
|
-
...snapshot.context,
|
|
3990
|
-
selection: dragSelection
|
|
3991
|
-
}
|
|
3992
|
-
}).some((draggedBlock) => draggedBlock.node._key === dropFocusBlock.node._key) || !isSelectingEntireBlocks({
|
|
3993
|
-
...snapshot,
|
|
3994
|
-
context: {
|
|
3995
|
-
...snapshot.context,
|
|
3996
|
-
selection: dragSelection
|
|
3997
|
-
}
|
|
3998
|
-
}) ? !1 : { dropFocusBlock };
|
|
3999
|
-
},
|
|
4000
|
-
actions: [({ event }, { dropFocusBlock }) => [{
|
|
4001
|
-
type: "effect",
|
|
4002
|
-
effect: () => {
|
|
4003
|
-
setDropPosition({
|
|
4004
|
-
path: dropFocusBlock.path,
|
|
4005
|
-
position: event.position.block
|
|
4006
|
-
});
|
|
4007
|
-
}
|
|
4008
|
-
}]]
|
|
4009
|
-
}),
|
|
4010
|
-
priority: createEditorPriority({ reference: {
|
|
4011
|
-
priority: corePriority,
|
|
4012
|
-
importance: "lower"
|
|
4013
|
-
} })
|
|
4014
|
-
}, {
|
|
4015
|
-
behavior: defineBehavior({
|
|
4016
|
-
on: "drag.*",
|
|
4017
|
-
guard: ({ event }) => event.type !== "drag.dragover",
|
|
4018
|
-
actions: [({ event }) => [{
|
|
4019
|
-
type: "effect",
|
|
4020
|
-
effect: () => {
|
|
4021
|
-
setDropPosition(void 0);
|
|
4022
|
-
}
|
|
4023
|
-
}, forward(event)]]
|
|
4024
|
-
}),
|
|
4025
|
-
priority: createEditorPriority({ reference: {
|
|
4026
|
-
priority: corePriority,
|
|
4027
|
-
importance: "lower"
|
|
4028
|
-
} })
|
|
4029
|
-
}];
|
|
4030
|
-
}
|
|
4031
|
-
const EditorActorContext = createContext({});
|
|
4032
|
-
/**
|
|
4033
|
-
* Returns the `position` of a drop hover when the hover targets the given
|
|
4034
|
-
* element path; `undefined` otherwise.
|
|
4035
|
-
*
|
|
4036
|
-
* Path-based match — works at any depth. Comparing by `_key` alone is
|
|
4037
|
-
* ambiguous because keys are sibling-unique, not tree-unique: two blocks
|
|
4038
|
-
* at different depths can share the same `_key` and a key-only match
|
|
4039
|
-
* would paint the indicator on both.
|
|
4040
|
-
*/
|
|
4041
|
-
function resolveElementDropPosition(dropPosition, elementPath) {
|
|
4042
|
-
if (dropPosition && pathEquals(dropPosition.path, elementPath)) return dropPosition.position;
|
|
4043
|
-
}
|
|
4044
|
-
const DropPositionStoreContext = createContext({
|
|
4045
|
-
subscribe: () => () => {},
|
|
4046
|
-
getSnapshot: () => void 0
|
|
4047
|
-
});
|
|
4048
|
-
/**
|
|
4049
|
-
* Holds the current drag drop position in a single store and registers the
|
|
4050
|
-
* core drop-position behavior. Consumers attach via {@link useElementDropPosition}
|
|
4051
|
-
* and re-render only when the position at their own path flips.
|
|
4052
|
-
*
|
|
4053
|
-
* Why not thread `dropPosition` through `renderElement`? It changes on every
|
|
4054
|
-
* `dragover` (pointer-move frequency), so feeding it to `renderElement`'s
|
|
4055
|
-
* `useCallback` deps hands Slate a new render function each tick and re-renders
|
|
4056
|
-
* the entire element tree. The per-path store re-renders only the blocks
|
|
4057
|
-
* gaining or losing the indicator. Mirrors `SelectionStateProvider`.
|
|
4058
|
-
*/
|
|
4059
|
-
function DropPositionStateProvider(t0) {
|
|
4060
|
-
let $ = c(6), { children } = t0, editorActor = useContext(EditorActorContext), [initialSubscribers] = useState(_temp$4), subscribersRef = useRef(initialSubscribers), stateRef = useRef(void 0), t1, t2;
|
|
4061
|
-
$[0] === editorActor ? (t1 = $[1], t2 = $[2]) : (t1 = () => {
|
|
4062
|
-
let behaviorConfigs = createDropPositionBehaviorsConfig({ setDropPosition: (next) => {
|
|
4063
|
-
let prev = stateRef.current;
|
|
4064
|
-
if (!(prev === next || prev !== void 0 && next !== void 0 && prev.position === next.position && pathEquals(prev.path, next.path))) {
|
|
4065
|
-
stateRef.current = next;
|
|
4066
|
-
for (let callback of subscribersRef.current) callback();
|
|
4067
|
-
}
|
|
4068
|
-
} });
|
|
4069
|
-
for (let behaviorConfig of behaviorConfigs) editorActor.send({
|
|
4070
|
-
type: "add behavior",
|
|
4071
|
-
behaviorConfig
|
|
4072
|
-
});
|
|
4073
|
-
return () => {
|
|
4074
|
-
for (let behaviorConfig_0 of behaviorConfigs) editorActor.send({
|
|
4075
|
-
type: "remove behavior",
|
|
4076
|
-
behaviorConfig: behaviorConfig_0
|
|
4077
|
-
});
|
|
4078
|
-
};
|
|
4079
|
-
}, t2 = [editorActor], $[0] = editorActor, $[1] = t1, $[2] = t2), useEffect(t1, t2);
|
|
4080
|
-
let t3;
|
|
4081
|
-
$[3] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
|
|
4082
|
-
subscribe: (callback_0) => (subscribersRef.current.add(callback_0), () => {
|
|
4083
|
-
subscribersRef.current.delete(callback_0);
|
|
4084
|
-
}),
|
|
4085
|
-
getSnapshot: () => stateRef.current
|
|
4086
|
-
}, $[3] = t3) : t3 = $[3];
|
|
4087
|
-
let store = t3, t4;
|
|
4088
|
-
return $[4] === children ? t4 = $[5] : (t4 = /* @__PURE__ */ jsx(DropPositionStoreContext.Provider, {
|
|
4089
|
-
value: store,
|
|
4090
|
-
children
|
|
4091
|
-
}), $[4] = children, $[5] = t4), t4;
|
|
4092
|
-
}
|
|
4093
|
-
/**
|
|
4094
|
-
* Subscribe to the drop position at `path`: `'start'`, `'end'`, or `undefined`
|
|
4095
|
-
* when no drag is hovering this block. Re-renders only when this block's slice
|
|
4096
|
-
* flips, not when the position moves between other blocks.
|
|
4097
|
-
*/
|
|
4098
|
-
function _temp$4() {
|
|
4099
|
-
return /* @__PURE__ */ new Set();
|
|
4100
|
-
}
|
|
4101
|
-
function useElementDropPosition(path) {
|
|
4102
|
-
let $ = c(3), store = useContext(DropPositionStoreContext), t0;
|
|
4103
|
-
return $[0] !== path || $[1] !== store ? (t0 = () => resolveElementDropPosition(store.getSnapshot(), path), $[0] = path, $[1] = store, $[2] = t0) : t0 = $[2], useSyncExternalStore(store.subscribe, t0);
|
|
4104
|
-
}
|
|
4105
|
-
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 = {
|
|
4106
3963
|
alt: "altKey",
|
|
4107
3964
|
control: "ctrlKey",
|
|
4108
3965
|
meta: "metaKey",
|
|
@@ -4608,11 +4465,10 @@ function renderDefaultDecorator(props) {
|
|
|
4608
4465
|
return props.children;
|
|
4609
4466
|
}
|
|
4610
4467
|
/**
|
|
4611
|
-
* Engine-default wrapper for Annotation marks: identity.
|
|
4612
|
-
*
|
|
4613
|
-
*
|
|
4614
|
-
*
|
|
4615
|
-
* 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.
|
|
4616
4472
|
*/
|
|
4617
4473
|
function renderDefaultAnnotation(props) {
|
|
4618
4474
|
return props.children;
|
|
@@ -4673,51 +4529,6 @@ function renderDefaultInlineObject(props) {
|
|
|
4673
4529
|
})]
|
|
4674
4530
|
});
|
|
4675
4531
|
}
|
|
4676
|
-
function RenderDefaultBlockObject(props) {
|
|
4677
|
-
let $ = c(4), t0;
|
|
4678
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { userSelect: "none" }, $[0] = t0) : t0 = $[0];
|
|
4679
|
-
let t1;
|
|
4680
|
-
return $[1] !== props.blockObject._key || $[2] !== props.blockObject._type ? (t1 = /* @__PURE__ */ jsxs("div", {
|
|
4681
|
-
style: t0,
|
|
4682
|
-
children: [
|
|
4683
|
-
"[",
|
|
4684
|
-
props.blockObject._type,
|
|
4685
|
-
": ",
|
|
4686
|
-
props.blockObject._key,
|
|
4687
|
-
"]"
|
|
4688
|
-
]
|
|
4689
|
-
}), $[1] = props.blockObject._key, $[2] = props.blockObject._type, $[3] = t1) : t1 = $[3], t1;
|
|
4690
|
-
}
|
|
4691
|
-
function RenderDefaultInlineObject(props) {
|
|
4692
|
-
let $ = c(4), t0;
|
|
4693
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { userSelect: "none" }, $[0] = t0) : t0 = $[0];
|
|
4694
|
-
let t1;
|
|
4695
|
-
return $[1] !== props.inlineObject._key || $[2] !== props.inlineObject._type ? (t1 = /* @__PURE__ */ jsxs("span", {
|
|
4696
|
-
style: t0,
|
|
4697
|
-
children: [
|
|
4698
|
-
"[",
|
|
4699
|
-
props.inlineObject._type,
|
|
4700
|
-
": ",
|
|
4701
|
-
props.inlineObject._key,
|
|
4702
|
-
"]"
|
|
4703
|
-
]
|
|
4704
|
-
}), $[1] = props.inlineObject._key, $[2] = props.inlineObject._type, $[3] = t1) : t1 = $[3], t1;
|
|
4705
|
-
}
|
|
4706
|
-
function DropIndicator() {
|
|
4707
|
-
let $ = c(1), t0;
|
|
4708
|
-
return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx("div", {
|
|
4709
|
-
contentEditable: !1,
|
|
4710
|
-
className: "pt-drop-indicator",
|
|
4711
|
-
style: {
|
|
4712
|
-
position: "absolute",
|
|
4713
|
-
width: "100%",
|
|
4714
|
-
height: 1,
|
|
4715
|
-
borderBottom: "1px solid currentColor",
|
|
4716
|
-
zIndex: 5
|
|
4717
|
-
},
|
|
4718
|
-
children: /* @__PURE__ */ jsx("span", {})
|
|
4719
|
-
}), $[0] = t0) : t0 = $[0], t0;
|
|
4720
|
-
}
|
|
4721
4532
|
const emptySet$1 = /* @__PURE__ */ new Set(), emptyState = {
|
|
4722
4533
|
focusedLeafPath: void 0,
|
|
4723
4534
|
selectedLeafPaths: emptySet$1,
|
|
@@ -4889,14 +4700,14 @@ function SelectionStateProvider(t0) {
|
|
|
4889
4700
|
children
|
|
4890
4701
|
}), $[8] = children, $[9] = t5), t5;
|
|
4891
4702
|
}
|
|
4703
|
+
function _temp$3() {
|
|
4704
|
+
return /* @__PURE__ */ new Set();
|
|
4705
|
+
}
|
|
4892
4706
|
/**
|
|
4893
4707
|
* Subscribe to whether a container at `serializedPath` is currently
|
|
4894
4708
|
* focused. Re-renders only when this boolean flips - not when other
|
|
4895
4709
|
* containers' focused state changes.
|
|
4896
4710
|
*/
|
|
4897
|
-
function _temp$3() {
|
|
4898
|
-
return /* @__PURE__ */ new Set();
|
|
4899
|
-
}
|
|
4900
4711
|
function useIsFocusedContainer(serializedPath) {
|
|
4901
4712
|
let $ = c(3), store = useContext(SelectionStateStoreContext), t0;
|
|
4902
4713
|
return $[0] !== serializedPath || $[1] !== store ? (t0 = () => store.getSnapshot().focusedContainerPath === serializedPath, $[0] = serializedPath, $[1] = store, $[2] = t0) : t0 = $[2], useSyncExternalStore(store.subscribe, t0);
|
|
@@ -4926,103 +4737,28 @@ function useIsSelectedLeaf(serializedPath) {
|
|
|
4926
4737
|
return $[0] !== serializedPath || $[1] !== store ? (t0 = () => store.getSnapshot().selectedLeafPaths.has(serializedPath), $[0] = serializedPath, $[1] = store, $[2] = t0) : t0 = $[2], useSyncExternalStore(store.subscribe, t0);
|
|
4927
4738
|
}
|
|
4928
4739
|
function RenderBlockObject(props) {
|
|
4929
|
-
let $ = c(
|
|
4740
|
+
let $ = c(11), t0;
|
|
4930
4741
|
$[0] === props.path ? t0 = $[1] : (t0 = serializePath(props.path), $[0] = props.path, $[1] = t0);
|
|
4931
|
-
let serializedPath = t0, selected = useIsSelectedLeaf(serializedPath), focused = useIsFocusedLeaf(serializedPath)
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
_type: props.element._type
|
|
4942
|
-
}, $[7] = props.blockObject, $[8] = props.element, $[9] = t2) : t2 = $[9];
|
|
4943
|
-
let blockObject = t2;
|
|
4944
|
-
if (props.blockObjectConfig) {
|
|
4945
|
-
let t3;
|
|
4946
|
-
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) {
|
|
4947
|
-
let { "data-slate-node": _slateNode, "data-slate-void": _slateVoid, ...ptAttributes } = props.attributes, render = props.blockObjectConfig.blockObject.render, renderProps = {
|
|
4948
|
-
attributes: {
|
|
4949
|
-
...ptAttributes,
|
|
4950
|
-
"data-pt-block": "object"
|
|
4951
|
-
},
|
|
4952
|
-
children: props.children,
|
|
4953
|
-
focused,
|
|
4954
|
-
node: props.element,
|
|
4955
|
-
path: props.path,
|
|
4956
|
-
readOnly: props.readOnly,
|
|
4957
|
-
renderDefault: renderDefaultBlockObject,
|
|
4958
|
-
selected
|
|
4959
|
-
};
|
|
4960
|
-
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;
|
|
4961
|
-
} else t3 = $[18];
|
|
4962
|
-
return t3;
|
|
4963
|
-
}
|
|
4964
|
-
let innerContent;
|
|
4965
|
-
if (props.legacy.renderBlock && blockObjectSchemaType) {
|
|
4966
|
-
let t3;
|
|
4967
|
-
$[19] === props.element._key ? t3 = $[20] : (t3 = [{ _key: props.element._key }], $[19] = props.element._key, $[20] = t3);
|
|
4968
|
-
let t4;
|
|
4969
|
-
$[21] === blockObject ? t4 = $[22] : (t4 = /* @__PURE__ */ jsx(RenderDefaultBlockObject, { blockObject }), $[21] = blockObject, $[22] = t4);
|
|
4970
|
-
let t5;
|
|
4971
|
-
$[23] !== blockObject || $[24] !== blockObjectSchemaType || $[25] !== focused || $[26] !== props.legacy.renderBlock || $[27] !== selected || $[28] !== t3 || $[29] !== t4 ? (t5 = /* @__PURE__ */ jsx(RenderBlock$1, {
|
|
4972
|
-
renderBlock: props.legacy.renderBlock,
|
|
4973
|
-
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,
|
|
4974
4752
|
focused,
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
}
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
}
|
|
4985
|
-
let t3;
|
|
4986
|
-
$[33] !== props.attributes || $[34] !== props.element._key || $[35] !== props.element._type ? (t3 = {
|
|
4987
|
-
...props.attributes,
|
|
4988
|
-
className: "pt-block pt-object-block",
|
|
4989
|
-
"data-block-key": props.element._key,
|
|
4990
|
-
"data-block-name": props.element._type,
|
|
4991
|
-
"data-block-type": "object",
|
|
4992
|
-
"data-pt-block": "object"
|
|
4993
|
-
}, $[33] = props.attributes, $[34] = props.element._key, $[35] = props.element._type, $[36] = t3) : t3 = $[36];
|
|
4994
|
-
let attributes = t3, t4;
|
|
4995
|
-
$[37] === dropPosition ? t4 = $[38] : (t4 = dropPosition === "start" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null, $[37] = dropPosition, $[38] = t4);
|
|
4996
|
-
let t5 = !props.readOnly, t6;
|
|
4997
|
-
$[39] !== innerContent || $[40] !== t5 ? (t6 = /* @__PURE__ */ jsx("div", {
|
|
4998
|
-
ref: blockObjectRef,
|
|
4999
|
-
contentEditable: !1,
|
|
5000
|
-
draggable: t5,
|
|
5001
|
-
children: innerContent
|
|
5002
|
-
}), $[39] = innerContent, $[40] = t5, $[41] = t6) : t6 = $[41];
|
|
5003
|
-
let t7;
|
|
5004
|
-
$[42] === dropPosition ? t7 = $[43] : (t7 = dropPosition === "end" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null, $[42] = dropPosition, $[43] = t7);
|
|
5005
|
-
let t8;
|
|
5006
|
-
return $[44] !== attributes || $[45] !== props.children || $[46] !== t4 || $[47] !== t6 || $[48] !== t7 ? (t8 = /* @__PURE__ */ jsxs("div", {
|
|
5007
|
-
...attributes,
|
|
5008
|
-
children: [
|
|
5009
|
-
t4,
|
|
5010
|
-
props.children,
|
|
5011
|
-
t6,
|
|
5012
|
-
t7
|
|
5013
|
-
]
|
|
5014
|
-
}), $[44] = attributes, $[45] = props.children, $[46] = t4, $[47] = t6, $[48] = t7, $[49] = t8) : t8 = $[49], t8;
|
|
5015
|
-
}
|
|
5016
|
-
function RenderBlock$1({ renderBlock, children, editorElementRef, focused, path, schemaType, selected, value }) {
|
|
5017
|
-
return renderBlock({
|
|
5018
|
-
children,
|
|
5019
|
-
editorElementRef,
|
|
5020
|
-
focused,
|
|
5021
|
-
path,
|
|
5022
|
-
schemaType,
|
|
5023
|
-
selected,
|
|
5024
|
-
value
|
|
5025
|
-
});
|
|
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;
|
|
5026
4762
|
}
|
|
5027
4763
|
function RenderContainer(props) {
|
|
5028
4764
|
let $ = c(11), t0;
|
|
@@ -5055,348 +4791,38 @@ function useBlockSubSchema(path) {
|
|
|
5055
4791
|
return $[0] !== editor.snapshot || $[1] !== path ? (t0 = getPathSubSchema(editor.snapshot, path), $[0] = editor.snapshot, $[1] = path, $[2] = t0) : t0 = $[2], t0;
|
|
5056
4792
|
}
|
|
5057
4793
|
function RenderInlineObject(props) {
|
|
5058
|
-
let $ = c(
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
if ($[7] !== focused || $[8] !== props.attributes || $[9] !== props.children || $[10] !== props.element || $[11] !== props.path || $[12] !== props.readOnly || $[13] !== render || $[14] !== selected) {
|
|
5071
|
-
let renderProps = {
|
|
5072
|
-
attributes: {
|
|
5073
|
-
...props.attributes,
|
|
5074
|
-
"data-pt-inline": "object"
|
|
5075
|
-
},
|
|
5076
|
-
children: props.children,
|
|
5077
|
-
focused,
|
|
5078
|
-
node: props.element,
|
|
5079
|
-
path: props.path,
|
|
5080
|
-
readOnly: props.readOnly,
|
|
5081
|
-
renderDefault: renderDefaultInlineObject,
|
|
5082
|
-
selected
|
|
5083
|
-
};
|
|
5084
|
-
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;
|
|
5085
|
-
} else t2 = $[15];
|
|
5086
|
-
return t2;
|
|
5087
|
-
}
|
|
5088
|
-
let innerContent;
|
|
5089
|
-
if (props.legacy.renderChild && inlineObjectSchemaType) {
|
|
5090
|
-
let t2;
|
|
5091
|
-
$[16] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[16] = t2) : t2 = $[16];
|
|
5092
|
-
let t3;
|
|
5093
|
-
$[17] === inlineObject ? t3 = $[18] : (t3 = /* @__PURE__ */ jsx(RenderDefaultInlineObject, { inlineObject }), $[17] = inlineObject, $[18] = t3);
|
|
5094
|
-
let t4;
|
|
5095
|
-
$[19] !== focused || $[20] !== inlineObject || $[21] !== inlineObjectSchemaType || $[22] !== props.legacy.renderChild || $[23] !== props.path || $[24] !== selected || $[25] !== t3 ? (t4 = /* @__PURE__ */ jsx(RenderChild$1, {
|
|
5096
|
-
renderChild: props.legacy.renderChild,
|
|
5097
|
-
annotations: t2,
|
|
5098
|
-
editorElementRef: inlineObjectRef,
|
|
5099
|
-
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,
|
|
5100
4806
|
focused,
|
|
4807
|
+
node: props.element,
|
|
5101
4808
|
path: props.path,
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
}), $[19] = focused, $[20] = inlineObject, $[21] = inlineObjectSchemaType, $[22] = props.legacy.renderChild, $[23] = props.path, $[24] = selected, $[25] = t3, $[26] = t4) : t4 = $[26], innerContent = t4;
|
|
5106
|
-
} else {
|
|
5107
|
-
let t2;
|
|
5108
|
-
$[27] === inlineObject ? t2 = $[28] : (t2 = /* @__PURE__ */ jsx(RenderDefaultInlineObject, { inlineObject }), $[27] = inlineObject, $[28] = t2), innerContent = t2;
|
|
5109
|
-
}
|
|
5110
|
-
let t2;
|
|
5111
|
-
$[29] !== inlineObject._key || $[30] !== inlineObject._type || $[31] !== props.attributes ? (t2 = {
|
|
5112
|
-
...props.attributes,
|
|
5113
|
-
className: "pt-inline-object",
|
|
5114
|
-
"data-child-key": inlineObject._key,
|
|
5115
|
-
"data-child-name": inlineObject._type,
|
|
5116
|
-
"data-child-type": "object",
|
|
5117
|
-
"data-pt-inline": "object"
|
|
5118
|
-
}, $[29] = inlineObject._key, $[30] = inlineObject._type, $[31] = props.attributes, $[32] = t2) : t2 = $[32];
|
|
5119
|
-
let attributes = t2, t3;
|
|
5120
|
-
$[33] === Symbol.for("react.memo_cache_sentinel") ? (t3 = { display: "inline-block" }, $[33] = t3) : t3 = $[33];
|
|
5121
|
-
let t4 = !props.readOnly, t5;
|
|
5122
|
-
$[34] !== innerContent || $[35] !== t4 ? (t5 = /* @__PURE__ */ jsx("span", {
|
|
5123
|
-
ref: inlineObjectRef,
|
|
5124
|
-
style: t3,
|
|
5125
|
-
draggable: t4,
|
|
5126
|
-
children: innerContent
|
|
5127
|
-
}), $[34] = innerContent, $[35] = t4, $[36] = t5) : t5 = $[36];
|
|
5128
|
-
let t6;
|
|
5129
|
-
return $[37] !== attributes || $[38] !== props.children || $[39] !== t5 ? (t6 = /* @__PURE__ */ jsxs("span", {
|
|
5130
|
-
...attributes,
|
|
5131
|
-
children: [props.children, t5]
|
|
5132
|
-
}), $[37] = attributes, $[38] = props.children, $[39] = t5, $[40] = t6) : t6 = $[40], t6;
|
|
5133
|
-
}
|
|
5134
|
-
function RenderChild$1({ renderChild, annotations, children, editorElementRef, focused, path, schemaType, selected, value }) {
|
|
5135
|
-
return renderChild({
|
|
5136
|
-
annotations,
|
|
5137
|
-
children,
|
|
5138
|
-
editorElementRef,
|
|
5139
|
-
focused,
|
|
5140
|
-
path,
|
|
5141
|
-
schemaType,
|
|
5142
|
-
selected,
|
|
5143
|
-
value
|
|
5144
|
-
});
|
|
5145
|
-
}
|
|
5146
|
-
const levelIndexMaps = /* @__PURE__ */ new Map();
|
|
5147
|
-
/**
|
|
5148
|
-
* Mutates both maps in place. Used for initial engine population and tests.
|
|
5149
|
-
*
|
|
5150
|
-
* During operation application `blockIndexMap` is maintained incrementally by
|
|
5151
|
-
* `transform-block-index-map` helpers; only `listIndexMap` needs a full
|
|
5152
|
-
* rebuild per op (see `buildListIndexMap`).
|
|
5153
|
-
*/
|
|
5154
|
-
function buildIndexMaps(context, { blockIndexMap, listIndexMap }) {
|
|
5155
|
-
blockIndexMap.clear();
|
|
5156
|
-
for (let blockIndex = 0; blockIndex < context.value.length; blockIndex++) {
|
|
5157
|
-
let block = context.value.at(blockIndex);
|
|
5158
|
-
if (block === void 0 || block._key === void 0) continue;
|
|
5159
|
-
let blockPath = [{ _key: block._key }], blockKey = serializePath(blockPath);
|
|
5160
|
-
blockIndexMap.has(blockKey) || blockIndexMap.set(blockKey, blockIndex), collectDescendantIndexes(context, block, blockPath, void 0, blockIndexMap);
|
|
5161
|
-
}
|
|
5162
|
-
buildListIndexMap(context, listIndexMap);
|
|
5163
|
-
}
|
|
5164
|
-
/**
|
|
5165
|
-
* Mutates `listIndexMap` in place. Recomputes list-item indices for every
|
|
5166
|
-
* root block. Called lazily by `getListIndexMap` when the map is read after
|
|
5167
|
-
* a structural change, and once at startup by `buildIndexMaps`.
|
|
5168
|
-
*/
|
|
5169
|
-
function buildListIndexMap(context, listIndexMap) {
|
|
5170
|
-
listIndexMap.clear(), levelIndexMaps.clear();
|
|
5171
|
-
let previousListItem;
|
|
5172
|
-
for (let blockIndex = 0; blockIndex < context.value.length; blockIndex++) {
|
|
5173
|
-
let block = context.value.at(blockIndex);
|
|
5174
|
-
if (block === void 0) continue;
|
|
5175
|
-
let blockPath = [{ _key: block._key }];
|
|
5176
|
-
if (!isTextBlockNode(context, block)) {
|
|
5177
|
-
levelIndexMaps.clear(), previousListItem = void 0;
|
|
5178
|
-
continue;
|
|
5179
|
-
}
|
|
5180
|
-
if (block.listItem === void 0 || block.level === void 0) {
|
|
5181
|
-
levelIndexMaps.clear(), previousListItem = void 0;
|
|
5182
|
-
continue;
|
|
5183
|
-
}
|
|
5184
|
-
if (!previousListItem) {
|
|
5185
|
-
let levelIndexMap = levelIndexMaps.get(block.listItem) ?? /* @__PURE__ */ new Map();
|
|
5186
|
-
levelIndexMap.set(block.level, 1), levelIndexMaps.set(block.listItem, levelIndexMap), listIndexMap.set(serializePath(blockPath), 1), previousListItem = {
|
|
5187
|
-
listItem: block.listItem,
|
|
5188
|
-
level: block.level
|
|
5189
|
-
};
|
|
5190
|
-
continue;
|
|
5191
|
-
}
|
|
5192
|
-
if (previousListItem.listItem === block.listItem && previousListItem.level < block.level) {
|
|
5193
|
-
let levelIndexMap = levelIndexMaps.get(block.listItem) ?? /* @__PURE__ */ new Map();
|
|
5194
|
-
levelIndexMap.set(block.level, 1), levelIndexMaps.set(block.listItem, levelIndexMap), listIndexMap.set(serializePath(blockPath), 1), previousListItem = {
|
|
5195
|
-
listItem: block.listItem,
|
|
5196
|
-
level: block.level
|
|
5197
|
-
};
|
|
5198
|
-
continue;
|
|
5199
|
-
}
|
|
5200
|
-
levelIndexMaps.forEach((levelIndexMap, listItem) => {
|
|
5201
|
-
if (listItem === block.listItem) return;
|
|
5202
|
-
let levelsToDelete = [];
|
|
5203
|
-
levelIndexMap.forEach((_, level) => {
|
|
5204
|
-
level >= block.level && levelsToDelete.push(level);
|
|
5205
|
-
}), levelsToDelete.forEach((level) => {
|
|
5206
|
-
levelIndexMap.delete(level);
|
|
5207
|
-
});
|
|
5208
|
-
});
|
|
5209
|
-
let levelIndexMap = levelIndexMaps.get(block.listItem) ?? /* @__PURE__ */ new Map(), levelCounter = levelIndexMap.get(block.level) ?? 0;
|
|
5210
|
-
levelIndexMap.set(block.level, levelCounter + 1), levelIndexMaps.set(block.listItem, levelIndexMap), listIndexMap.set(serializePath(blockPath), levelCounter + 1), previousListItem = {
|
|
5211
|
-
listItem: block.listItem,
|
|
5212
|
-
level: block.level
|
|
4809
|
+
readOnly: props.readOnly,
|
|
4810
|
+
renderDefault: renderDefaultInlineObject,
|
|
4811
|
+
selected
|
|
5213
4812
|
};
|
|
5214
|
-
|
|
5215
|
-
}
|
|
5216
|
-
|
|
5217
|
-
* Return `listIndexMap`, rebuilding it first if a structural operation has
|
|
5218
|
-
* marked it dirty since the last read. The renderer is the only reader, so
|
|
5219
|
-
* deferring the rebuild to read time turns a per-operation O(value) walk
|
|
5220
|
-
* into at most one rebuild per render.
|
|
5221
|
-
*/
|
|
5222
|
-
function getListIndexMap(editor) {
|
|
5223
|
-
return editor.listIndexMapDirty &&= (buildListIndexMap(editor.snapshot.context, editor.listIndexMap), !1), editor.listIndexMap;
|
|
5224
|
-
}
|
|
5225
|
-
function collectDescendantIndexes(context, node, nodePath, parent, blockIndexMap) {
|
|
5226
|
-
let result = getNodeChildren(context, node, parent);
|
|
5227
|
-
if (result) for (let i = 0; i < result.children.length; i++) {
|
|
5228
|
-
let child = result.children[i];
|
|
5229
|
-
if (!child._key) continue;
|
|
5230
|
-
let childSegment = { _key: child._key }, childPath = [
|
|
5231
|
-
...nodePath,
|
|
5232
|
-
result.fieldName,
|
|
5233
|
-
childSegment
|
|
5234
|
-
], childKey = serializePath(childPath);
|
|
5235
|
-
blockIndexMap.has(childKey) || blockIndexMap.set(childKey, i), collectDescendantIndexes(context, child, childPath, result.parent, blockIndexMap);
|
|
5236
|
-
}
|
|
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;
|
|
5237
4816
|
}
|
|
5238
4817
|
function RenderTextBlock(props) {
|
|
5239
|
-
let $ = c(
|
|
5240
|
-
$[0] === props.
|
|
4818
|
+
let $ = c(5), t0;
|
|
4819
|
+
$[0] === props.children ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("div", { children: props.children }), $[0] = props.children, $[1] = t0);
|
|
5241
4820
|
let t1;
|
|
5242
|
-
$[2] !== props.
|
|
5243
|
-
|
|
5244
|
-
fields: t0
|
|
5245
|
-
}, $[2] = props.schema.block.name, $[3] = t0, $[4] = t1) : t1 = $[4];
|
|
5246
|
-
let schemaType = t1, t2;
|
|
5247
|
-
$[5] === props.path ? t2 = $[6] : (t2 = serializePath(props.path), $[5] = props.path, $[6] = t2);
|
|
5248
|
-
let serializedPath = t2, selected = useIsSelectedContainer(serializedPath), focused = useIsFocusedContainer(serializedPath), dropPosition = useElementDropPosition(props.path), t3;
|
|
5249
|
-
$[7] === serializedPath ? t3 = $[8] : (t3 = (editor) => getListIndexMap(editor).get(serializedPath), $[7] = serializedPath, $[8] = t3);
|
|
5250
|
-
let listIndex = useListIndexSelector(t3), subSchema = useBlockSubSchema(props.path), children = props.children;
|
|
5251
|
-
if (props.legacy.renderStyle && props.textBlock.style) {
|
|
5252
|
-
let t4;
|
|
5253
|
-
$[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];
|
|
5254
|
-
let styleSchemaType = t4;
|
|
5255
|
-
if (styleSchemaType) {
|
|
5256
|
-
let t5;
|
|
5257
|
-
$[12] === props.textBlock._key ? t5 = $[13] : (t5 = [{ _key: props.textBlock._key }], $[12] = props.textBlock._key, $[13] = t5);
|
|
5258
|
-
let t6;
|
|
5259
|
-
$[14] !== children || $[15] !== focused || $[16] !== props.legacy.renderStyle || $[17] !== props.textBlock || $[18] !== selected || $[19] !== styleSchemaType || $[20] !== t5 ? (t6 = /* @__PURE__ */ jsx(RenderStyle, {
|
|
5260
|
-
renderStyle: props.legacy.renderStyle,
|
|
5261
|
-
block: props.textBlock,
|
|
5262
|
-
editorElementRef: blockRef,
|
|
5263
|
-
focused,
|
|
5264
|
-
path: t5,
|
|
5265
|
-
schemaType: styleSchemaType,
|
|
5266
|
-
selected,
|
|
5267
|
-
value: props.textBlock.style,
|
|
5268
|
-
children
|
|
5269
|
-
}), $[14] = children, $[15] = focused, $[16] = props.legacy.renderStyle, $[17] = props.textBlock, $[18] = selected, $[19] = styleSchemaType, $[20] = t5, $[21] = t6) : t6 = $[21], children = t6;
|
|
5270
|
-
} else console.error(`Unable to find Schema type for text block style ${props.textBlock.style}`);
|
|
5271
|
-
}
|
|
5272
|
-
if (props.legacy.renderListItem && props.textBlock.listItem) {
|
|
5273
|
-
let t4;
|
|
5274
|
-
if ($[22] !== props.textBlock.listItem || $[23] !== subSchema.lists) {
|
|
5275
|
-
let t5;
|
|
5276
|
-
$[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;
|
|
5277
|
-
} else t4 = $[24];
|
|
5278
|
-
let listItemSchemaType = t4;
|
|
5279
|
-
if (listItemSchemaType) {
|
|
5280
|
-
let t5 = props.textBlock.level ?? 1, t6;
|
|
5281
|
-
$[27] === props.textBlock._key ? t6 = $[28] : (t6 = [{ _key: props.textBlock._key }], $[27] = props.textBlock._key, $[28] = t6);
|
|
5282
|
-
let t7;
|
|
5283
|
-
$[29] !== children || $[30] !== focused || $[31] !== listItemSchemaType || $[32] !== props.legacy.renderListItem || $[33] !== props.textBlock || $[34] !== selected || $[35] !== t5 || $[36] !== t6 ? (t7 = /* @__PURE__ */ jsx(RenderListItem, {
|
|
5284
|
-
renderListItem: props.legacy.renderListItem,
|
|
5285
|
-
block: props.textBlock,
|
|
5286
|
-
editorElementRef: blockRef,
|
|
5287
|
-
focused,
|
|
5288
|
-
level: t5,
|
|
5289
|
-
path: t6,
|
|
5290
|
-
selected,
|
|
5291
|
-
value: props.textBlock.listItem,
|
|
5292
|
-
schemaType: listItemSchemaType,
|
|
5293
|
-
children
|
|
5294
|
-
}), $[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;
|
|
5295
|
-
} else console.error(`Unable to find Schema type for text block list item ${props.textBlock.listItem}`);
|
|
5296
|
-
}
|
|
5297
|
-
let t4 = props.attributes, t5;
|
|
5298
|
-
$[38] === props.textBlock.style ? t5 = $[39] : (t5 = props.textBlock.style ? [`pt-text-block-style-${props.textBlock.style}`] : [], $[38] = props.textBlock.style, $[39] = t5);
|
|
5299
|
-
let t6;
|
|
5300
|
-
$[40] !== props.textBlock.level || $[41] !== props.textBlock.listItem ? (t6 = props.textBlock.listItem ? [
|
|
5301
|
-
"pt-list-item",
|
|
5302
|
-
`pt-list-item-${props.textBlock.listItem}`,
|
|
5303
|
-
`pt-list-item-level-${props.textBlock.level ?? 1}`
|
|
5304
|
-
] : [], $[40] = props.textBlock.level, $[41] = props.textBlock.listItem, $[42] = t6) : t6 = $[42];
|
|
5305
|
-
let t7;
|
|
5306
|
-
$[43] !== t5 || $[44] !== t6 ? (t7 = [
|
|
5307
|
-
"pt-block",
|
|
5308
|
-
"pt-text-block",
|
|
5309
|
-
...t5,
|
|
5310
|
-
...t6
|
|
5311
|
-
], $[43] = t5, $[44] = t6, $[45] = t7) : t7 = $[45];
|
|
5312
|
-
let t8 = t7.join(" "), t9;
|
|
5313
|
-
$[46] === props.textBlock.listItem ? t9 = $[47] : (t9 = props.textBlock.listItem === void 0 ? {} : { "data-list-item": props.textBlock.listItem }, $[46] = props.textBlock.listItem, $[47] = t9);
|
|
5314
|
-
let t10;
|
|
5315
|
-
$[48] === props.textBlock.level ? t10 = $[49] : (t10 = props.textBlock.level === void 0 ? {} : { "data-level": props.textBlock.level }, $[48] = props.textBlock.level, $[49] = t10);
|
|
5316
|
-
let t11;
|
|
5317
|
-
$[50] === props.textBlock.style ? t11 = $[51] : (t11 = props.textBlock.style === void 0 ? {} : { "data-style": props.textBlock.style }, $[50] = props.textBlock.style, $[51] = t11);
|
|
5318
|
-
let t12;
|
|
5319
|
-
$[52] === listIndex ? t12 = $[53] : (t12 = listIndex === void 0 ? {} : { "data-list-index": listIndex }, $[52] = listIndex, $[53] = t12);
|
|
5320
|
-
let t13;
|
|
5321
|
-
$[54] === dropPosition ? t13 = $[55] : (t13 = dropPosition === "start" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null, $[54] = dropPosition, $[55] = t13);
|
|
5322
|
-
let t14;
|
|
5323
|
-
$[56] !== children || $[57] !== focused || $[58] !== props.legacy.renderBlock || $[59] !== props.textBlock || $[60] !== schemaType || $[61] !== selected ? (t14 = props.legacy.renderBlock ? /* @__PURE__ */ jsx(RenderBlock, {
|
|
5324
|
-
renderBlock: props.legacy.renderBlock,
|
|
5325
|
-
editorElementRef: blockRef,
|
|
5326
|
-
focused,
|
|
5327
|
-
level: props.textBlock.level,
|
|
5328
|
-
listItem: props.textBlock.listItem,
|
|
5329
|
-
path: [{ _key: props.textBlock._key }],
|
|
5330
|
-
selected,
|
|
5331
|
-
schemaType,
|
|
5332
|
-
style: props.textBlock.style,
|
|
5333
|
-
value: props.textBlock,
|
|
5334
|
-
children
|
|
5335
|
-
}) : children, $[56] = children, $[57] = focused, $[58] = props.legacy.renderBlock, $[59] = props.textBlock, $[60] = schemaType, $[61] = selected, $[62] = t14) : t14 = $[62];
|
|
5336
|
-
let t15;
|
|
5337
|
-
$[63] === t14 ? t15 = $[64] : (t15 = /* @__PURE__ */ jsx("div", {
|
|
5338
|
-
ref: blockRef,
|
|
5339
|
-
children: t14
|
|
5340
|
-
}), $[63] = t14, $[64] = t15);
|
|
5341
|
-
let t16;
|
|
5342
|
-
$[65] === dropPosition ? t16 = $[66] : (t16 = dropPosition === "end" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null, $[65] = dropPosition, $[66] = t16);
|
|
5343
|
-
let t17;
|
|
5344
|
-
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", {
|
|
5345
|
-
...t4,
|
|
5346
|
-
className: t8,
|
|
5347
|
-
"data-block-key": props.textBlock._key,
|
|
5348
|
-
"data-block-name": props.textBlock._type,
|
|
5349
|
-
"data-block-type": "text",
|
|
4821
|
+
return $[2] !== props.attributes || $[3] !== t0 ? (t1 = /* @__PURE__ */ jsx("div", {
|
|
4822
|
+
...props.attributes,
|
|
5350
4823
|
"data-pt-block": "text",
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
...t11,
|
|
5354
|
-
...t12,
|
|
5355
|
-
children: [
|
|
5356
|
-
t13,
|
|
5357
|
-
t15,
|
|
5358
|
-
t16
|
|
5359
|
-
]
|
|
5360
|
-
}), $[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;
|
|
5361
|
-
}
|
|
5362
|
-
function RenderBlock({ renderBlock, children, editorElementRef, focused, level, listItem, path, selected, style, schemaType, value }) {
|
|
5363
|
-
return renderBlock({
|
|
5364
|
-
children,
|
|
5365
|
-
editorElementRef,
|
|
5366
|
-
focused,
|
|
5367
|
-
level,
|
|
5368
|
-
listItem,
|
|
5369
|
-
path,
|
|
5370
|
-
selected,
|
|
5371
|
-
style,
|
|
5372
|
-
schemaType,
|
|
5373
|
-
value
|
|
5374
|
-
});
|
|
5375
|
-
}
|
|
5376
|
-
function RenderListItem({ renderListItem, block, children, editorElementRef, focused, level, path, schemaType, selected, value }) {
|
|
5377
|
-
return renderListItem({
|
|
5378
|
-
block,
|
|
5379
|
-
children,
|
|
5380
|
-
editorElementRef,
|
|
5381
|
-
focused,
|
|
5382
|
-
level,
|
|
5383
|
-
path,
|
|
5384
|
-
schemaType,
|
|
5385
|
-
selected,
|
|
5386
|
-
value
|
|
5387
|
-
});
|
|
5388
|
-
}
|
|
5389
|
-
function RenderStyle({ renderStyle, block, children, editorElementRef, focused, path, schemaType, selected, value }) {
|
|
5390
|
-
return renderStyle({
|
|
5391
|
-
block,
|
|
5392
|
-
children,
|
|
5393
|
-
editorElementRef,
|
|
5394
|
-
focused,
|
|
5395
|
-
path,
|
|
5396
|
-
schemaType,
|
|
5397
|
-
selected,
|
|
5398
|
-
value
|
|
5399
|
-
});
|
|
4824
|
+
children: t0
|
|
4825
|
+
}), $[2] = props.attributes, $[3] = t0, $[4] = t1) : t1 = $[4], t1;
|
|
5400
4826
|
}
|
|
5401
4827
|
/**
|
|
5402
4828
|
* Reference-equality comparator for fixed-length tuples. Each slot is
|
|
@@ -5410,7 +4836,7 @@ function tupleRefEqual(previous, next) {
|
|
|
5410
4836
|
return !0;
|
|
5411
4837
|
}
|
|
5412
4838
|
function RenderElement(props) {
|
|
5413
|
-
let $ = c(
|
|
4839
|
+
let $ = c(52), parentContainer = useContext(ParentContainerContext), parentTextBlock = useContext(ParentTextBlockContext), isInNewPipeline = useContext(NewPipelineContext), engineStatic = useEngineStatic(), schema = props.schema, type = props.element._type, t0;
|
|
5414
4840
|
$[0] !== parentContainer || $[1] !== type ? (t0 = findBlockPositionalOverride(parentContainer, type), $[0] = parentContainer, $[1] = type, $[2] = t0) : t0 = $[2];
|
|
5415
4841
|
let blockPositionalOverride = t0, t1;
|
|
5416
4842
|
$[3] !== parentTextBlock || $[4] !== type ? (t1 = findInlinePositionalOverride(parentTextBlock, type), $[3] = parentTextBlock, $[4] = type, $[5] = t1) : t1 = $[5];
|
|
@@ -5507,123 +4933,68 @@ function RenderElement(props) {
|
|
|
5507
4933
|
}
|
|
5508
4934
|
if (isTextBlock({ schema }, props.element)) {
|
|
5509
4935
|
let rendered;
|
|
5510
|
-
if (
|
|
5511
|
-
let
|
|
5512
|
-
|
|
5513
|
-
attributes
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
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,
|
|
5517
4945
|
render: renderableTextBlockConfig.textBlock.render,
|
|
5518
4946
|
node: props.element,
|
|
5519
4947
|
path: props.path,
|
|
5520
4948
|
readOnly: props.readOnly,
|
|
5521
4949
|
children: props.children
|
|
5522
|
-
});
|
|
5523
|
-
|
|
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({
|
|
5524
4954
|
attributes: {
|
|
5525
|
-
...
|
|
4955
|
+
...props.attributes,
|
|
5526
4956
|
"data-pt-block": "text"
|
|
5527
4957
|
},
|
|
5528
4958
|
children: props.children
|
|
5529
|
-
});
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
readOnly: props.readOnly,
|
|
5538
|
-
schema,
|
|
5539
|
-
textBlock: props.element,
|
|
5540
|
-
children: props.children
|
|
5541
|
-
}), $[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;
|
|
5542
|
-
}
|
|
5543
|
-
$[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;
|
|
5544
|
-
} 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
|
+
}
|
|
5545
4967
|
if (textBlockScope) {
|
|
5546
4968
|
let t8;
|
|
5547
|
-
return $[
|
|
4969
|
+
return $[33] !== rendered || $[34] !== textBlockScope ? (t8 = /* @__PURE__ */ jsx(ParentTextBlockContext.Provider, {
|
|
5548
4970
|
value: textBlockScope,
|
|
5549
4971
|
children: rendered
|
|
5550
|
-
}), $[
|
|
4972
|
+
}), $[33] = rendered, $[34] = textBlockScope, $[35] = t8) : t8 = $[35], t8;
|
|
5551
4973
|
}
|
|
5552
4974
|
return rendered;
|
|
5553
4975
|
}
|
|
5554
4976
|
if (isInline(engineStatic.snapshot, props.path)) {
|
|
5555
|
-
if (isInNewPipeline && !inlineObjectConfig) {
|
|
5556
|
-
let rest_0;
|
|
5557
|
-
if ($[39] !== props.attributes) {
|
|
5558
|
-
let { "data-slate-node": _sn_0, "data-slate-void": _sv, ...t8 } = props.attributes;
|
|
5559
|
-
rest_0 = t8, $[39] = props.attributes, $[40] = rest_0;
|
|
5560
|
-
} else rest_0 = $[40];
|
|
5561
|
-
let t8;
|
|
5562
|
-
$[41] !== props.element._key || $[42] !== props.element._type ? (t8 = /* @__PURE__ */ jsxs("span", {
|
|
5563
|
-
contentEditable: !1,
|
|
5564
|
-
children: [
|
|
5565
|
-
"[",
|
|
5566
|
-
props.element._type,
|
|
5567
|
-
": ",
|
|
5568
|
-
props.element._key,
|
|
5569
|
-
"]"
|
|
5570
|
-
]
|
|
5571
|
-
}), $[41] = props.element._key, $[42] = props.element._type, $[43] = t8) : t8 = $[43];
|
|
5572
|
-
let t9;
|
|
5573
|
-
return $[44] !== props.children || $[45] !== rest_0 || $[46] !== t8 ? (t9 = /* @__PURE__ */ jsxs("span", {
|
|
5574
|
-
...rest_0,
|
|
5575
|
-
"data-pt-inline": "object",
|
|
5576
|
-
children: [props.children, t8]
|
|
5577
|
-
}), $[44] = props.children, $[45] = rest_0, $[46] = t8, $[47] = t9) : t9 = $[47], t9;
|
|
5578
|
-
}
|
|
5579
4977
|
let t8;
|
|
5580
|
-
return $[
|
|
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, {
|
|
5581
4979
|
attributes: props.attributes,
|
|
5582
4980
|
element: props.element,
|
|
5583
4981
|
inlineObjectConfig,
|
|
5584
|
-
legacy: props.legacy,
|
|
5585
4982
|
path: props.path,
|
|
5586
4983
|
readOnly: props.readOnly,
|
|
5587
4984
|
schema,
|
|
5588
4985
|
children: props.children
|
|
5589
|
-
}), $[
|
|
5590
|
-
}
|
|
5591
|
-
if (isInNewPipeline && !blockObjectConfig) {
|
|
5592
|
-
let rest_1;
|
|
5593
|
-
if ($[57] !== props.attributes) {
|
|
5594
|
-
let { "data-slate-node": _sn_1, "data-slate-void": _sv_0, ...t8 } = props.attributes;
|
|
5595
|
-
rest_1 = t8, $[57] = props.attributes, $[58] = rest_1;
|
|
5596
|
-
} else rest_1 = $[58];
|
|
5597
|
-
let t8;
|
|
5598
|
-
$[59] !== props.element._key || $[60] !== props.element._type ? (t8 = /* @__PURE__ */ jsxs("div", {
|
|
5599
|
-
contentEditable: !1,
|
|
5600
|
-
children: [
|
|
5601
|
-
"[",
|
|
5602
|
-
props.element._type,
|
|
5603
|
-
": ",
|
|
5604
|
-
props.element._key,
|
|
5605
|
-
"]"
|
|
5606
|
-
]
|
|
5607
|
-
}), $[59] = props.element._key, $[60] = props.element._type, $[61] = t8) : t8 = $[61];
|
|
5608
|
-
let t9;
|
|
5609
|
-
return $[62] !== props.children || $[63] !== rest_1 || $[64] !== t8 ? (t9 = /* @__PURE__ */ jsxs("div", {
|
|
5610
|
-
...rest_1,
|
|
5611
|
-
"data-pt-block": "object",
|
|
5612
|
-
children: [props.children, t8]
|
|
5613
|
-
}), $[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;
|
|
5614
4987
|
}
|
|
5615
4988
|
let t8;
|
|
5616
|
-
return $[
|
|
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, {
|
|
5617
4990
|
attributes: props.attributes,
|
|
5618
|
-
blockObject: props.element,
|
|
5619
4991
|
element: props.element,
|
|
5620
4992
|
blockObjectConfig,
|
|
5621
|
-
legacy: props.legacy,
|
|
5622
4993
|
path: props.path,
|
|
5623
4994
|
readOnly: props.readOnly,
|
|
5624
4995
|
schema,
|
|
5625
4996
|
children: props.children
|
|
5626
|
-
}), $[
|
|
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;
|
|
5627
4998
|
}
|
|
5628
4999
|
/**
|
|
5629
5000
|
* Renders a text block via a registered `defineTextBlock` config whose
|
|
@@ -5685,6 +5056,9 @@ function useSpanConfig(node, _path) {
|
|
|
5685
5056
|
function useDecoratorConfigs() {
|
|
5686
5057
|
return useRegistrationsSelector(_temp$2);
|
|
5687
5058
|
}
|
|
5059
|
+
function _temp$2(engine) {
|
|
5060
|
+
return engine.decorators;
|
|
5061
|
+
}
|
|
5688
5062
|
/**
|
|
5689
5063
|
* Hook: the engine's registered GLOBAL annotation map. Positional
|
|
5690
5064
|
* (in-parent) annotation overrides are a separate layer: the caller
|
|
@@ -5696,9 +5070,6 @@ function useDecoratorConfigs() {
|
|
|
5696
5070
|
* span's marks resolve to a variable number of annotation `markDef`s
|
|
5697
5071
|
* per render.
|
|
5698
5072
|
*/
|
|
5699
|
-
function _temp$2(engine) {
|
|
5700
|
-
return engine.decorators;
|
|
5701
|
-
}
|
|
5702
5073
|
function useAnnotationConfigs() {
|
|
5703
5074
|
return useRegistrationsSelector(_temp2$1);
|
|
5704
5075
|
}
|
|
@@ -5706,167 +5077,86 @@ function _temp2$1(engine) {
|
|
|
5706
5077
|
return engine.annotations;
|
|
5707
5078
|
}
|
|
5708
5079
|
function RenderSpan(props) {
|
|
5709
|
-
let $ = c(
|
|
5710
|
-
$[0]
|
|
5711
|
-
let t1;
|
|
5712
|
-
$[
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
});
|
|
5729
|
-
children = props.children;
|
|
5730
|
-
for (let mark_1 of decorators) {
|
|
5731
|
-
let decoratorSchemaType = subSchema.decorators.find((dec) => dec.name === mark_1);
|
|
5732
|
-
if (!decoratorSchemaType) continue;
|
|
5733
|
-
let globalDecoratorConfig = decoratorConfigs.get(mark_1) ?? decoratorConfigs.get("*"), positionalDecorator = findPositionalDecoratorOverride(parentTextBlock, mark_1), decoratorConfig = positionalDecorator ? positionalDecorator.decorator.render === void 0 ? globalDecoratorConfig : positionalDecorator : globalDecoratorConfig;
|
|
5734
|
-
if (decoratorConfig) {
|
|
5735
|
-
let render = decoratorConfig.decorator.render, renderProps = {
|
|
5736
|
-
children,
|
|
5737
|
-
decorator: mark_1,
|
|
5738
|
-
focused,
|
|
5739
|
-
path: props.path,
|
|
5740
|
-
readOnly: props.readOnly,
|
|
5741
|
-
renderDefault: renderDefaultDecorator,
|
|
5742
|
-
selected
|
|
5743
|
-
};
|
|
5744
|
-
children = render ? render(renderProps) : renderDefaultDecorator(renderProps);
|
|
5745
|
-
continue;
|
|
5746
|
-
}
|
|
5747
|
-
props.renderDecorator && (children = /* @__PURE__ */ jsx(RenderDecorator, {
|
|
5748
|
-
renderDecorator: props.renderDecorator,
|
|
5749
|
-
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,
|
|
5750
5099
|
focused,
|
|
5751
5100
|
path: props.path,
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
}
|
|
5758
|
-
for (let annotationMarkDef of annotationMarkDefs) {
|
|
5759
|
-
let annotationSchemaType = subSchema.annotations.find((t) => t.name === annotationMarkDef._type);
|
|
5760
|
-
if (annotationSchemaType) {
|
|
5761
|
-
let globalAnnotationConfig = annotationConfigs.get(annotationMarkDef._type) ?? annotationConfigs.get("*"), positionalAnnotation = findPositionalAnnotationOverride(parentTextBlock, annotationMarkDef._type), annotationConfig = positionalAnnotation ? positionalAnnotation.annotation.render === void 0 ? globalAnnotationConfig : positionalAnnotation : globalAnnotationConfig;
|
|
5762
|
-
if (annotationConfig) {
|
|
5763
|
-
let render_0 = annotationConfig.annotation.render, renderProps_0 = {
|
|
5764
|
-
children,
|
|
5765
|
-
focused,
|
|
5766
|
-
annotation: annotationMarkDef,
|
|
5767
|
-
path: props.path,
|
|
5768
|
-
readOnly: props.readOnly,
|
|
5769
|
-
renderDefault: renderDefaultAnnotation,
|
|
5770
|
-
selected
|
|
5771
|
-
};
|
|
5772
|
-
children = /* @__PURE__ */ jsx("span", {
|
|
5773
|
-
ref: spanRef,
|
|
5774
|
-
children: render_0 ? render_0(renderProps_0) : renderDefaultAnnotation(renderProps_0)
|
|
5775
|
-
});
|
|
5776
|
-
continue;
|
|
5777
|
-
}
|
|
5778
|
-
children = block && props.renderAnnotation ? /* @__PURE__ */ jsx("span", {
|
|
5779
|
-
ref: spanRef,
|
|
5780
|
-
children: /* @__PURE__ */ jsx(RenderAnnotation, {
|
|
5781
|
-
renderAnnotation: props.renderAnnotation,
|
|
5782
|
-
block,
|
|
5783
|
-
editorElementRef: spanRef,
|
|
5784
|
-
focused,
|
|
5785
|
-
path: props.path,
|
|
5786
|
-
selected,
|
|
5787
|
-
schemaType: annotationSchemaType,
|
|
5788
|
-
value: annotationMarkDef,
|
|
5789
|
-
children
|
|
5790
|
-
})
|
|
5791
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
5792
|
-
ref: spanRef,
|
|
5793
|
-
children
|
|
5794
|
-
});
|
|
5795
|
-
}
|
|
5101
|
+
readOnly: props.readOnly,
|
|
5102
|
+
renderDefault: renderDefaultDecorator,
|
|
5103
|
+
selected
|
|
5104
|
+
};
|
|
5105
|
+
children = render ? render(renderProps) : renderDefaultDecorator(renderProps);
|
|
5796
5106
|
}
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
path: props.path,
|
|
5803
|
-
schemaType,
|
|
5804
|
-
selected,
|
|
5805
|
-
value: child,
|
|
5806
|
-
children
|
|
5807
|
-
})), spanConfig) {
|
|
5808
|
-
let render_1 = spanConfig.span.render, renderProps_1 = {
|
|
5809
|
-
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 = {
|
|
5810
5112
|
children,
|
|
5811
5113
|
focused,
|
|
5812
|
-
|
|
5114
|
+
annotation: annotationMarkDef,
|
|
5813
5115
|
path: props.path,
|
|
5814
5116
|
readOnly: props.readOnly,
|
|
5815
|
-
renderDefault:
|
|
5117
|
+
renderDefault: renderDefaultAnnotation,
|
|
5816
5118
|
selected
|
|
5817
5119
|
};
|
|
5818
|
-
|
|
5819
|
-
|
|
5120
|
+
children = /* @__PURE__ */ jsx("span", {
|
|
5121
|
+
ref: spanRef,
|
|
5122
|
+
children: render_0 ? render_0(renderProps_0) : renderDefaultAnnotation(renderProps_0)
|
|
5123
|
+
});
|
|
5124
|
+
continue;
|
|
5820
5125
|
}
|
|
5126
|
+
children = /* @__PURE__ */ jsx("span", {
|
|
5127
|
+
ref: spanRef,
|
|
5128
|
+
children
|
|
5129
|
+
});
|
|
5821
5130
|
}
|
|
5822
|
-
$[
|
|
5823
|
-
} else children = $[
|
|
5824
|
-
if (
|
|
5825
|
-
|
|
5826
|
-
|
|
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", {
|
|
5827
5152
|
...props.attributes,
|
|
5828
5153
|
ref: spanRef,
|
|
5829
5154
|
children
|
|
5830
|
-
}), $[
|
|
5155
|
+
}), $[27] = children, $[28] = props.attributes, $[29] = t2) : t2 = $[29], t2;
|
|
5831
5156
|
}
|
|
5832
5157
|
function _temp$1(decorator) {
|
|
5833
5158
|
return decorator.name;
|
|
5834
5159
|
}
|
|
5835
|
-
function RenderAnnotation({ renderAnnotation, block, children, editorElementRef, focused, path, schemaType, selected, value }) {
|
|
5836
|
-
return renderAnnotation({
|
|
5837
|
-
block,
|
|
5838
|
-
children,
|
|
5839
|
-
editorElementRef,
|
|
5840
|
-
focused,
|
|
5841
|
-
path,
|
|
5842
|
-
schemaType,
|
|
5843
|
-
selected,
|
|
5844
|
-
value
|
|
5845
|
-
});
|
|
5846
|
-
}
|
|
5847
|
-
function RenderDecorator({ renderDecorator, children, editorElementRef, focused, path, schemaType, selected, value }) {
|
|
5848
|
-
return renderDecorator({
|
|
5849
|
-
children,
|
|
5850
|
-
editorElementRef,
|
|
5851
|
-
focused,
|
|
5852
|
-
path,
|
|
5853
|
-
schemaType,
|
|
5854
|
-
selected,
|
|
5855
|
-
value
|
|
5856
|
-
});
|
|
5857
|
-
}
|
|
5858
|
-
function RenderChild({ renderChild, annotations, children, editorElementRef, focused, path, schemaType, selected, value }) {
|
|
5859
|
-
return renderChild({
|
|
5860
|
-
annotations,
|
|
5861
|
-
children,
|
|
5862
|
-
editorElementRef,
|
|
5863
|
-
focused,
|
|
5864
|
-
path,
|
|
5865
|
-
schemaType,
|
|
5866
|
-
selected,
|
|
5867
|
-
value
|
|
5868
|
-
});
|
|
5869
|
-
}
|
|
5870
5160
|
const PLACEHOLDER_STYLE = {
|
|
5871
5161
|
position: "absolute",
|
|
5872
5162
|
userSelect: "none",
|
|
@@ -5900,29 +5190,12 @@ function RenderLeaf(props) {
|
|
|
5900
5190
|
return renderedSpan;
|
|
5901
5191
|
}
|
|
5902
5192
|
function RenderText(props) {
|
|
5903
|
-
let $ = c(
|
|
5904
|
-
|
|
5905
|
-
let t0 = props.attributes, rest;
|
|
5906
|
-
if ($[0] !== t0) {
|
|
5907
|
-
let { "data-slate-node": _sn, ...t1 } = t0;
|
|
5908
|
-
rest = t1, $[0] = t0, $[1] = rest;
|
|
5909
|
-
} else rest = $[1];
|
|
5910
|
-
let t1;
|
|
5911
|
-
return $[2] !== props.children || $[3] !== rest ? (t1 = /* @__PURE__ */ jsx("span", {
|
|
5912
|
-
...rest,
|
|
5913
|
-
"data-pt-inline": "span",
|
|
5914
|
-
children: props.children
|
|
5915
|
-
}), $[2] = props.children, $[3] = rest, $[4] = t1) : t1 = $[4], t1;
|
|
5916
|
-
}
|
|
5917
|
-
let t0;
|
|
5918
|
-
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", {
|
|
5919
5195
|
...props.attributes,
|
|
5920
|
-
"data-child-key": props.text._key,
|
|
5921
|
-
"data-child-name": props.text._type,
|
|
5922
|
-
"data-child-type": "span",
|
|
5923
5196
|
"data-pt-inline": "span",
|
|
5924
5197
|
children: props.children
|
|
5925
|
-
}), $[
|
|
5198
|
+
}), $[0] = props.attributes, $[1] = props.children, $[2] = t0) : t0 = $[2], t0;
|
|
5926
5199
|
}
|
|
5927
5200
|
/**
|
|
5928
5201
|
* A React context for sharing the editor object.
|
|
@@ -6009,62 +5282,51 @@ function validateSelection(editorEngine, editorElement) {
|
|
|
6009
5282
|
* @group Components
|
|
6010
5283
|
*/
|
|
6011
5284
|
const PortableTextEditable = forwardRef(function PortableTextEditable(props, forwardedRef) {
|
|
6012
|
-
let $ = c(
|
|
6013
|
-
$[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],
|
|
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);
|
|
6014
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;
|
|
6015
|
-
$[
|
|
5288
|
+
$[21] === editorEngine ? t0 = $[22] : (t0 = { input: { editorEngine } }, $[21] = editorEngine, $[22] = t0);
|
|
6016
5289
|
let validateSelectionActor = useActorRef(validateSelectionMachine, t0), t1;
|
|
6017
|
-
$[
|
|
5290
|
+
$[23] === rangeDecorations ? t1 = $[24] : (t1 = rangeDecorations ?? [], $[23] = rangeDecorations, $[24] = t1);
|
|
6018
5291
|
let t2;
|
|
6019
|
-
$[
|
|
5292
|
+
$[25] === editorActor ? t2 = $[26] : (t2 = editorActor.getSnapshot().matches({ setup: "setting up" }), $[25] = editorActor, $[26] = t2);
|
|
6020
5293
|
let t3 = !t2, t4;
|
|
6021
|
-
$[
|
|
5294
|
+
$[27] !== editorEngine || $[28] !== readOnly || $[29] !== schema || $[30] !== t1 || $[31] !== t3 ? (t4 = { input: {
|
|
6022
5295
|
rangeDecorations: t1,
|
|
6023
5296
|
readOnly,
|
|
6024
5297
|
schema,
|
|
6025
5298
|
editorEngine,
|
|
6026
5299
|
skipSetup: t3
|
|
6027
|
-
} }, $[
|
|
5300
|
+
} }, $[27] = editorEngine, $[28] = readOnly, $[29] = schema, $[30] = t1, $[31] = t3, $[32] = t4) : t4 = $[32];
|
|
6028
5301
|
let rangeDecorationsActor = useActorRef(rangeDecorationsMachine, t4), decorate = useSelector(rangeDecorationsActor, _temp2), t5, t6;
|
|
6029
|
-
$[
|
|
5302
|
+
$[33] !== rangeDecorationsActor || $[34] !== readOnly ? (t5 = () => {
|
|
6030
5303
|
rangeDecorationsActor.send({
|
|
6031
5304
|
type: "update read only",
|
|
6032
5305
|
readOnly
|
|
6033
5306
|
});
|
|
6034
|
-
}, t6 = [rangeDecorationsActor, readOnly], $[
|
|
5307
|
+
}, t6 = [rangeDecorationsActor, readOnly], $[33] = rangeDecorationsActor, $[34] = readOnly, $[35] = t5, $[36] = t6) : (t5 = $[35], t6 = $[36]), useEffect(t5, t6);
|
|
6035
5308
|
let t7, t8;
|
|
6036
|
-
$[
|
|
5309
|
+
$[37] !== rangeDecorations || $[38] !== rangeDecorationsActor ? (t7 = () => {
|
|
6037
5310
|
rangeDecorationsActor.send({
|
|
6038
5311
|
type: "range decorations updated",
|
|
6039
5312
|
rangeDecorations: rangeDecorations ?? []
|
|
6040
5313
|
});
|
|
6041
|
-
}, t8 = [rangeDecorationsActor, rangeDecorations], $[
|
|
5314
|
+
}, t8 = [rangeDecorationsActor, rangeDecorations], $[37] = rangeDecorations, $[38] = rangeDecorationsActor, $[39] = t7, $[40] = t8) : (t7 = $[39], t8 = $[40]), useEffect(t7, t8);
|
|
6042
5315
|
let t9;
|
|
6043
|
-
$[
|
|
6044
|
-
renderBlock,
|
|
6045
|
-
renderChild,
|
|
6046
|
-
renderListItem,
|
|
6047
|
-
renderStyle
|
|
6048
|
-
}, $[47] = renderBlock, $[48] = renderChild, $[49] = renderListItem, $[50] = renderStyle, $[51] = t9) : t9 = $[51];
|
|
6049
|
-
let legacy = t9, t10;
|
|
6050
|
-
$[52] !== legacy || $[53] !== readOnly || $[54] !== schema ? (t10 = (eProps) => /* @__PURE__ */ jsx(RenderElement, {
|
|
5316
|
+
$[41] !== readOnly || $[42] !== schema ? (t9 = (eProps) => /* @__PURE__ */ jsx(RenderElement, {
|
|
6051
5317
|
...eProps,
|
|
6052
|
-
legacy,
|
|
6053
5318
|
readOnly,
|
|
6054
5319
|
schema
|
|
6055
|
-
}), $[
|
|
6056
|
-
let renderElement =
|
|
6057
|
-
$[
|
|
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, {
|
|
6058
5323
|
...leafProps,
|
|
6059
5324
|
readOnly,
|
|
6060
|
-
renderAnnotation,
|
|
6061
|
-
renderChild,
|
|
6062
|
-
renderDecorator,
|
|
6063
5325
|
renderPlaceholder,
|
|
6064
5326
|
schema
|
|
6065
|
-
}), $[
|
|
6066
|
-
let renderLeaf =
|
|
6067
|
-
$[
|
|
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 = () => {
|
|
6068
5330
|
if (propsSelection) {
|
|
6069
5331
|
debug.selection.enabled && debug.selection(`Selection from props ${safeStringify(propsSelection)}`);
|
|
6070
5332
|
let resolvedSelection = resolveSelection(editorEngine, propsSelection);
|
|
@@ -6073,9 +5335,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6073
5335
|
selection: resolvedSelection
|
|
6074
5336
|
}), editorEngine.onChange());
|
|
6075
5337
|
}
|
|
6076
|
-
}, $[
|
|
6077
|
-
let restoreSelectionFromProps = t12, t13
|
|
6078
|
-
$[
|
|
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 = () => {
|
|
6079
5341
|
let onReady = editorActor.on("ready", () => {
|
|
6080
5342
|
rangeDecorationsActor.send({ type: "ready" }), restoreSelectionFromProps();
|
|
6081
5343
|
}), onInvalidValue = editorActor.on("invalid value", () => {
|
|
@@ -6086,21 +5348,21 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6086
5348
|
return () => {
|
|
6087
5349
|
onReady.unsubscribe(), onInvalidValue.unsubscribe(), onValueChanged.unsubscribe();
|
|
6088
5350
|
};
|
|
6089
|
-
},
|
|
5351
|
+
}, t13 = [
|
|
6090
5352
|
rangeDecorationsActor,
|
|
6091
5353
|
editorActor,
|
|
6092
5354
|
restoreSelectionFromProps
|
|
6093
|
-
], $[
|
|
6094
|
-
let
|
|
6095
|
-
$[
|
|
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 = () => {
|
|
6096
5358
|
propsSelection && !hasInvalidValue && restoreSelectionFromProps();
|
|
6097
|
-
},
|
|
5359
|
+
}, t15 = [
|
|
6098
5360
|
hasInvalidValue,
|
|
6099
5361
|
propsSelection,
|
|
6100
5362
|
restoreSelectionFromProps
|
|
6101
|
-
], $[
|
|
6102
|
-
let
|
|
6103
|
-
$[
|
|
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) => {
|
|
6104
5366
|
if (DOMEditor.hasSelectableTarget(editorEngine, event.target)) {
|
|
6105
5367
|
if (onCopy) onCopy(event) !== void 0 && event.preventDefault();
|
|
6106
5368
|
else if (event.nativeEvent.clipboardData) {
|
|
@@ -6122,9 +5384,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6122
5384
|
});
|
|
6123
5385
|
}
|
|
6124
5386
|
}
|
|
6125
|
-
}, $[
|
|
6126
|
-
let handleCopy =
|
|
6127
|
-
$[
|
|
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) => {
|
|
6128
5390
|
if (DOMEditor.hasSelectableTarget(editorEngine, event_0.target)) {
|
|
6129
5391
|
if (onCut) onCut(event_0) !== void 0 && event_0.preventDefault();
|
|
6130
5392
|
else if (event_0.nativeEvent.clipboardData) {
|
|
@@ -6146,16 +5408,16 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6146
5408
|
});
|
|
6147
5409
|
}
|
|
6148
5410
|
}
|
|
6149
|
-
}, $[
|
|
6150
|
-
let handleCut =
|
|
6151
|
-
$[
|
|
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) => {
|
|
6152
5414
|
let value = editorEngine.snapshot.context.value, path = editorEngine.snapshot.context.selection?.focus.path || [], onPasteResult = onPaste?.({
|
|
6153
5415
|
event: event_1,
|
|
6154
5416
|
value,
|
|
6155
5417
|
path,
|
|
6156
5418
|
schemaTypes: portableTextEditor.schemaTypes
|
|
6157
5419
|
});
|
|
6158
|
-
if (onPasteResult || !editorEngine.snapshot.context.selection) event_1.preventDefault(),
|
|
5420
|
+
if (onPasteResult || !editorEngine.snapshot.context.selection) event_1.preventDefault(), Promise.resolve(onPasteResult).then((result_1) => {
|
|
6159
5421
|
if (debug.behaviors("Custom paste function from client resolved", result_1), !result_1 || !result_1.insert) {
|
|
6160
5422
|
debug.behaviors("No result from custom paste handler, pasting normally");
|
|
6161
5423
|
let selection_1 = editorEngine.snapshot.context.selection, position_1 = selection_1 ? { selection: selection_1 } : void 0;
|
|
@@ -6191,9 +5453,7 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6191
5453
|
},
|
|
6192
5454
|
editor: editorEngine
|
|
6193
5455
|
}) : console.warn("Your onPaste function returned something unexpected:", result_1);
|
|
6194
|
-
}).catch(_temp5)
|
|
6195
|
-
relay.send({ type: "done loading" });
|
|
6196
|
-
});
|
|
5456
|
+
}).catch(_temp5);
|
|
6197
5457
|
else if (event_1.nativeEvent.clipboardData) {
|
|
6198
5458
|
event_1.preventDefault(), event_1.stopPropagation();
|
|
6199
5459
|
let selection_2 = editorEngine.snapshot.context.selection, position_2 = selection_2 ? { selection: selection_2 } : void 0;
|
|
@@ -6213,16 +5473,16 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6213
5473
|
});
|
|
6214
5474
|
}
|
|
6215
5475
|
debug.behaviors("No result from custom paste handler, pasting normally");
|
|
6216
|
-
}, $[
|
|
6217
|
-
let handlePaste =
|
|
6218
|
-
$[
|
|
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) => {
|
|
6219
5479
|
onFocus && onFocus(event_2), event_2.isDefaultPrevented() || (relay.send({
|
|
6220
5480
|
type: "focused",
|
|
6221
5481
|
event: event_2
|
|
6222
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()));
|
|
6223
|
-
}, $[
|
|
6224
|
-
let handleOnFocus =
|
|
6225
|
-
$[
|
|
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) => {
|
|
6226
5486
|
if (onClick && onClick(event_3), event_3.isDefaultPrevented() || event_3.isPropagationStopped()) return;
|
|
6227
5487
|
let position_3 = getEventPosition({
|
|
6228
5488
|
editorActor,
|
|
@@ -6238,20 +5498,20 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6238
5498
|
editor: editorEngine,
|
|
6239
5499
|
nativeEvent: event_3
|
|
6240
5500
|
});
|
|
6241
|
-
}, $[
|
|
6242
|
-
let handleClick =
|
|
6243
|
-
$[
|
|
5501
|
+
}, $[79] = editorActor, $[80] = editorEngine, $[81] = onClick, $[82] = t20) : t20 = $[82];
|
|
5502
|
+
let handleClick = t20, t21;
|
|
5503
|
+
$[83] !== onBlur || $[84] !== relay ? (t21 = (event_4) => {
|
|
6244
5504
|
onBlur && onBlur(event_4), event_4.isPropagationStopped() || relay.send({
|
|
6245
5505
|
type: "blurred",
|
|
6246
5506
|
event: event_4
|
|
6247
5507
|
});
|
|
6248
|
-
}, $[
|
|
6249
|
-
let handleOnBlur =
|
|
6250
|
-
$[
|
|
5508
|
+
}, $[83] = onBlur, $[84] = relay, $[85] = t21) : t21 = $[85];
|
|
5509
|
+
let handleOnBlur = t21, t22;
|
|
5510
|
+
$[86] === onBeforeInput ? t22 = $[87] : (t22 = (event_5) => {
|
|
6251
5511
|
onBeforeInput && onBeforeInput(event_5);
|
|
6252
|
-
}, $[
|
|
6253
|
-
let handleOnBeforeInput =
|
|
6254
|
-
$[
|
|
5512
|
+
}, $[86] = onBeforeInput, $[87] = t22);
|
|
5513
|
+
let handleOnBeforeInput = t22, t23;
|
|
5514
|
+
$[88] !== editorActor || $[89] !== editorEngine || $[90] !== hotkeys || $[91] !== portableTextEditor || $[92] !== props ? (t23 = (event_6) => {
|
|
6255
5515
|
props.onKeyDown && props.onKeyDown(event_6), event_6.isDefaultPrevented() || performHotkey({
|
|
6256
5516
|
editorActor,
|
|
6257
5517
|
editor: editorEngine,
|
|
@@ -6274,9 +5534,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6274
5534
|
editor: editorEngine,
|
|
6275
5535
|
nativeEvent: event_6
|
|
6276
5536
|
});
|
|
6277
|
-
}, $[
|
|
6278
|
-
let handleKeyDown =
|
|
6279
|
-
$[
|
|
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) => {
|
|
6280
5540
|
props.onKeyUp && props.onKeyUp(event_7), event_7.isDefaultPrevented() || editorActor.send({
|
|
6281
5541
|
type: "behavior event",
|
|
6282
5542
|
behaviorEvent: {
|
|
@@ -6293,24 +5553,24 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6293
5553
|
editor: editorEngine,
|
|
6294
5554
|
nativeEvent: event_7
|
|
6295
5555
|
});
|
|
6296
|
-
}, $[
|
|
6297
|
-
let handleKeyUp =
|
|
5556
|
+
}, $[94] = editorActor, $[95] = editorEngine, $[96] = props, $[97] = t24) : t24 = $[97];
|
|
5557
|
+
let handleKeyUp = t24, t25;
|
|
6298
5558
|
bb0: {
|
|
6299
5559
|
if (scrollSelectionIntoView === void 0) {
|
|
6300
|
-
|
|
5560
|
+
t25 = void 0;
|
|
6301
5561
|
break bb0;
|
|
6302
5562
|
}
|
|
6303
5563
|
if (scrollSelectionIntoView === null) {
|
|
6304
|
-
|
|
5564
|
+
t25 = noop;
|
|
6305
5565
|
break bb0;
|
|
6306
5566
|
}
|
|
6307
|
-
let
|
|
6308
|
-
$[
|
|
5567
|
+
let t26;
|
|
5568
|
+
$[98] !== portableTextEditor || $[99] !== scrollSelectionIntoView ? (t26 = (_editor, domRange) => {
|
|
6309
5569
|
scrollSelectionIntoView(portableTextEditor, domRange);
|
|
6310
|
-
}, $[
|
|
5570
|
+
}, $[98] = portableTextEditor, $[99] = scrollSelectionIntoView, $[100] = t26) : t26 = $[100], t25 = t26;
|
|
6311
5571
|
}
|
|
6312
|
-
let scrollSelectionIntoViewToEngine = t26, t27
|
|
6313
|
-
$[
|
|
5572
|
+
let scrollSelectionIntoViewToEngine = t25, t26, t27;
|
|
5573
|
+
$[101] !== editorActor || $[102] !== editorEngine ? (t26 = () => {
|
|
6314
5574
|
let window = DOMEditor.getWindow(editorEngine), onDragEnd_0 = () => {
|
|
6315
5575
|
editorActor.send({ type: "dragend" });
|
|
6316
5576
|
}, onDrop_0 = () => {
|
|
@@ -6319,9 +5579,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6319
5579
|
return window.document.addEventListener("dragend", onDragEnd_0), window.document.addEventListener("drop", onDrop_0), () => {
|
|
6320
5580
|
window.document.removeEventListener("dragend", onDragEnd_0), window.document.removeEventListener("drop", onDrop_0);
|
|
6321
5581
|
};
|
|
6322
|
-
},
|
|
6323
|
-
let
|
|
6324
|
-
$[
|
|
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) => {
|
|
6325
5585
|
if (readOnly || !DOMEditor.hasTarget(editorEngine, event_8.target) || (onDragStart?.(event_8), event_8.isDefaultPrevented() || event_8.isPropagationStopped())) return;
|
|
6326
5586
|
let position_4 = getEventPosition({
|
|
6327
5587
|
editorActor,
|
|
@@ -6355,9 +5615,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6355
5615
|
},
|
|
6356
5616
|
editor: editorEngine
|
|
6357
5617
|
}), !0;
|
|
6358
|
-
}, $[
|
|
6359
|
-
let handleDragStart =
|
|
6360
|
-
$[
|
|
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) => {
|
|
6361
5621
|
if (onDrag?.(event_9), !(event_9.isDefaultPrevented() || event_9.isPropagationStopped()) && getEventPosition({
|
|
6362
5622
|
editorActor,
|
|
6363
5623
|
editorEngine,
|
|
@@ -6370,9 +5630,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6370
5630
|
},
|
|
6371
5631
|
editor: editorEngine
|
|
6372
5632
|
}), !0;
|
|
6373
|
-
}, $[
|
|
6374
|
-
let handleDrag =
|
|
6375
|
-
$[
|
|
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) => {
|
|
6376
5636
|
if (onDragEnd?.(event_10), !(event_10.isDefaultPrevented() || event_10.isPropagationStopped())) return editorActor.send({
|
|
6377
5637
|
type: "behavior event",
|
|
6378
5638
|
behaviorEvent: {
|
|
@@ -6381,9 +5641,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6381
5641
|
},
|
|
6382
5642
|
editor: editorEngine
|
|
6383
5643
|
}), !0;
|
|
6384
|
-
}, $[
|
|
6385
|
-
let handleDragEnd =
|
|
6386
|
-
$[
|
|
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) => {
|
|
6387
5647
|
if (onDragEnter?.(event_11), event_11.isDefaultPrevented() || event_11.isPropagationStopped()) return;
|
|
6388
5648
|
let position_6 = getEventPosition({
|
|
6389
5649
|
editorActor,
|
|
@@ -6399,9 +5659,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6399
5659
|
},
|
|
6400
5660
|
editor: editorEngine
|
|
6401
5661
|
}), !0;
|
|
6402
|
-
}, $[
|
|
6403
|
-
let handleDragEnter =
|
|
6404
|
-
$[
|
|
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) => {
|
|
6405
5665
|
if (onDragOver?.(event_12), event_12.isDefaultPrevented() || event_12.isPropagationStopped()) return;
|
|
6406
5666
|
let position_7 = getEventPosition({
|
|
6407
5667
|
editorActor,
|
|
@@ -6419,9 +5679,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6419
5679
|
editor: editorEngine,
|
|
6420
5680
|
nativeEvent: event_12
|
|
6421
5681
|
}), !0;
|
|
6422
|
-
}, $[
|
|
6423
|
-
let handleDragOver =
|
|
6424
|
-
$[
|
|
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) => {
|
|
6425
5685
|
if (onDrop?.(event_13), event_13.isDefaultPrevented() || event_13.isPropagationStopped()) return;
|
|
6426
5686
|
let position_8 = getEventPosition({
|
|
6427
5687
|
editorActor,
|
|
@@ -6443,9 +5703,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6443
5703
|
editor: editorEngine,
|
|
6444
5704
|
nativeEvent: event_13
|
|
6445
5705
|
}), !0;
|
|
6446
|
-
}, $[
|
|
6447
|
-
let handleDrop =
|
|
6448
|
-
$[
|
|
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) => {
|
|
6449
5709
|
if (onDragLeave?.(event_14), !(event_14.isDefaultPrevented() || event_14.isPropagationStopped()) && getEventPosition({
|
|
6450
5710
|
editorActor,
|
|
6451
5711
|
editorEngine,
|
|
@@ -6458,9 +5718,9 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6458
5718
|
},
|
|
6459
5719
|
editor: editorEngine
|
|
6460
5720
|
}), !0;
|
|
6461
|
-
}, $[
|
|
6462
|
-
let handleDragLeave =
|
|
6463
|
-
$[
|
|
5721
|
+
}, $[130] = editorActor, $[131] = editorEngine, $[132] = onDragLeave, $[133] = t34) : t34 = $[133];
|
|
5722
|
+
let handleDragLeave = t34, t35;
|
|
5723
|
+
$[134] !== forwardedRef || $[135] !== validateSelectionActor ? (t35 = (editorElement) => {
|
|
6464
5724
|
if (typeof forwardedRef == "function" ? forwardedRef(editorElement) : forwardedRef && (forwardedRef.current = editorElement), editorElement) {
|
|
6465
5725
|
let mutationObserver = new MutationObserver(() => {
|
|
6466
5726
|
validateSelectionActor.send({
|
|
@@ -6478,17 +5738,17 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6478
5738
|
mutationObserver.disconnect();
|
|
6479
5739
|
};
|
|
6480
5740
|
}
|
|
6481
|
-
}, $[
|
|
6482
|
-
let callbackRef =
|
|
5741
|
+
}, $[134] = forwardedRef, $[135] = validateSelectionActor, $[136] = t35) : t35 = $[136];
|
|
5742
|
+
let callbackRef = t35;
|
|
6483
5743
|
if (!portableTextEditor) return null;
|
|
6484
|
-
let
|
|
6485
|
-
return $[
|
|
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, {
|
|
6486
5746
|
...restProps,
|
|
6487
5747
|
ref: callbackRef,
|
|
6488
5748
|
editorActor,
|
|
6489
5749
|
"data-read-only": readOnly,
|
|
6490
5750
|
autoFocus: !1,
|
|
6491
|
-
className: restProps.className
|
|
5751
|
+
className: restProps.className,
|
|
6492
5752
|
decorate,
|
|
6493
5753
|
onBlur: handleOnBlur,
|
|
6494
5754
|
onCopy: handleCopy,
|
|
@@ -6511,7 +5771,7 @@ const PortableTextEditable = forwardRef(function PortableTextEditable(props, for
|
|
|
6511
5771
|
renderLeaf,
|
|
6512
5772
|
renderText,
|
|
6513
5773
|
scrollSelectionIntoView: scrollSelectionIntoViewToEngine
|
|
6514
|
-
}) })
|
|
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;
|
|
6515
5775
|
});
|
|
6516
5776
|
PortableTextEditable.displayName = "ForwardRef(PortableTextEditable)";
|
|
6517
5777
|
function noop() {}
|
|
@@ -6536,11 +5796,8 @@ function _temp5(error) {
|
|
|
6536
5796
|
*/
|
|
6537
5797
|
const Engine = (props) => {
|
|
6538
5798
|
let { editor, children } = props, { selectorContext, onChange: handleSelectorChange } = useSelectorContext(), onContextChange = useCallback(() => {
|
|
6539
|
-
let pending = editor.selectorChannelsPending, registrations = pending.registrations
|
|
6540
|
-
pending.registrations = !1,
|
|
6541
|
-
registrations,
|
|
6542
|
-
listIndex
|
|
6543
|
-
});
|
|
5799
|
+
let pending = editor.selectorChannelsPending, registrations = pending.registrations;
|
|
5800
|
+
pending.registrations = !1, handleSelectorChange({ registrations });
|
|
6544
5801
|
}, [editor, handleSelectorChange]);
|
|
6545
5802
|
return useEffect(() => (editor.onContextChange = onContextChange, () => {
|
|
6546
5803
|
editor.onContextChange = () => {};
|
|
@@ -6707,50 +5964,6 @@ const converterJson = defineConverter({
|
|
|
6707
5964
|
mimeType: "text/html"
|
|
6708
5965
|
};
|
|
6709
5966
|
}
|
|
6710
|
-
}), converterTextMarkdown = defineConverter({
|
|
6711
|
-
mimeType: "text/markdown",
|
|
6712
|
-
serialize: ({ snapshot, event }) => {
|
|
6713
|
-
if (!snapshot.context.selection) return {
|
|
6714
|
-
type: "serialization.failure",
|
|
6715
|
-
mimeType: "text/markdown",
|
|
6716
|
-
reason: "No selection",
|
|
6717
|
-
originEvent: event.originEvent
|
|
6718
|
-
};
|
|
6719
|
-
let blocks = getFragment(snapshot).map((entry) => entry.node);
|
|
6720
|
-
return {
|
|
6721
|
-
type: "serialization.success",
|
|
6722
|
-
data: portableTextToMarkdown(blocks),
|
|
6723
|
-
mimeType: "text/markdown",
|
|
6724
|
-
originEvent: event.originEvent
|
|
6725
|
-
};
|
|
6726
|
-
},
|
|
6727
|
-
deserialize: ({ snapshot, event }) => {
|
|
6728
|
-
let parsedBlocks = markdownToPortableText(event.data, {
|
|
6729
|
-
keyGenerator: snapshot.context.keyGenerator,
|
|
6730
|
-
schema: snapshot.context.schema
|
|
6731
|
-
}).flatMap((block) => {
|
|
6732
|
-
let parsedBlock = parseBlock({
|
|
6733
|
-
keyGenerator: snapshot.context.keyGenerator,
|
|
6734
|
-
block,
|
|
6735
|
-
options: {
|
|
6736
|
-
normalize: !1,
|
|
6737
|
-
removeUnusedMarkDefs: !0,
|
|
6738
|
-
validateFields: !1
|
|
6739
|
-
},
|
|
6740
|
-
schema: snapshot.context.schema
|
|
6741
|
-
});
|
|
6742
|
-
return parsedBlock ? [parsedBlock] : [];
|
|
6743
|
-
});
|
|
6744
|
-
return parsedBlocks.length === 0 ? {
|
|
6745
|
-
type: "deserialization.failure",
|
|
6746
|
-
mimeType: "text/markdown",
|
|
6747
|
-
reason: "No blocks deserialized"
|
|
6748
|
-
} : {
|
|
6749
|
-
type: "deserialization.success",
|
|
6750
|
-
data: parsedBlocks,
|
|
6751
|
-
mimeType: "text/markdown"
|
|
6752
|
-
};
|
|
6753
|
-
}
|
|
6754
5967
|
}), converterTextPlain = defineConverter({
|
|
6755
5968
|
mimeType: "text/plain",
|
|
6756
5969
|
serialize: ({ snapshot, event }) => snapshot.context.selection ? {
|
|
@@ -6807,10 +6020,17 @@ function escapeHtml(str) {
|
|
|
6807
6020
|
const coreConverters = [
|
|
6808
6021
|
converterJson,
|
|
6809
6022
|
converterPortableText,
|
|
6810
|
-
converterTextMarkdown,
|
|
6811
6023
|
converterTextHtml,
|
|
6812
6024
|
converterTextPlain
|
|
6813
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" });
|
|
6814
6034
|
function isListItemActive({ editor, listItem }) {
|
|
6815
6035
|
if (!editor.snapshot.context.selection) return !1;
|
|
6816
6036
|
let [selStart, selEnd] = rangeEdges(editor.snapshot.context.selection, editor.snapshot.context), selectedBlocks = [...getNodes(editor.snapshot, {
|
|
@@ -9075,6 +8295,33 @@ var BlockIndexMap = class extends Map {
|
|
|
9075
8295
|
return key.startsWith("[_key==") ? super.has(key) : super.has(serializePath([{ _key: key }]));
|
|
9076
8296
|
}
|
|
9077
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
|
+
}
|
|
9078
8325
|
function withRemoteChanges(editor, fn) {
|
|
9079
8326
|
let prev = editor.isProcessingRemoteChanges;
|
|
9080
8327
|
editor.isProcessingRemoteChanges = !0, fn(), editor.isProcessingRemoteChanges = prev;
|
|
@@ -10065,10 +9312,7 @@ function transformBlockIndexMap(map, op, beforeValue, afterValue, context) {
|
|
|
10065
9312
|
schema: context.schema,
|
|
10066
9313
|
value: afterValue,
|
|
10067
9314
|
containers: context.containers
|
|
10068
|
-
}, {
|
|
10069
|
-
blockIndexMap: map,
|
|
10070
|
-
listIndexMap: /* @__PURE__ */ new Map()
|
|
10071
|
-
});
|
|
9315
|
+
}, { blockIndexMap: map });
|
|
10072
9316
|
return;
|
|
10073
9317
|
}
|
|
10074
9318
|
let lastSegment = op.path[op.path.length - 1];
|
|
@@ -10392,12 +9636,6 @@ function invalidateVerifiedGroups(groups, operation) {
|
|
|
10392
9636
|
* incrementally per operation so the operation pipeline (which resolves
|
|
10393
9637
|
* keyed paths through it) never observes a stale map.
|
|
10394
9638
|
*
|
|
10395
|
-
* `listIndexMap` is only consumed by the text-block renderer, never by
|
|
10396
|
-
* operations or selectors, so it is invalidated here and rebuilt lazily
|
|
10397
|
-
* on read (`getListIndexMap`) instead of per operation. List-item
|
|
10398
|
-
* numbering depends on block adjacency that any structural op can disturb
|
|
10399
|
-
* non-locally, so any structural op marks it dirty.
|
|
10400
|
-
*
|
|
10401
9639
|
* `verifiedUniqueChildGroups` is invalidated per structural op so per-node
|
|
10402
9640
|
* duplicate-key normalization can skip groups whose membership is unchanged
|
|
10403
9641
|
* (see `invalidateVerifiedGroups`).
|
|
@@ -10410,7 +9648,7 @@ function subscribeUpdateValue(context, editor) {
|
|
|
10410
9648
|
operation.type !== "set.selection" && operation.type !== "insert.text" && operation.type !== "remove.text" && (transformBlockIndexMap(editor.blockIndexMap, operation, event.beforeValue, editor.snapshot.context.value, {
|
|
10411
9649
|
schema: context.schema,
|
|
10412
9650
|
containers: editor.snapshot.context.containers
|
|
10413
|
-
}),
|
|
9651
|
+
}), invalidateVerifiedGroups(editor.verifiedUniqueChildGroups, operation));
|
|
10414
9652
|
});
|
|
10415
9653
|
return () => {
|
|
10416
9654
|
unsubscribeNormalizationLog?.(), unsubscribeIndexMaps();
|
|
@@ -10442,10 +9680,7 @@ function createEditorEngine(config) {
|
|
|
10442
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 = {
|
|
10443
9681
|
undos: [],
|
|
10444
9682
|
redos: []
|
|
10445
|
-
}, editor.
|
|
10446
|
-
registrations: !1,
|
|
10447
|
-
listIndex: !1
|
|
10448
|
-
}, 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;
|
|
10449
9684
|
let editorEngine = plugins(withDOM(editor), { editorActor: config.editorActor });
|
|
10450
9685
|
return subscribeUpdateValue(context, editorEngine), subscribePatchGeneration({
|
|
10451
9686
|
editorActor: config.editorActor,
|
|
@@ -10462,10 +9697,7 @@ function createEditorEngine(config) {
|
|
|
10462
9697
|
schema: context.schema,
|
|
10463
9698
|
value: editorEngine.snapshot.context.value,
|
|
10464
9699
|
containers: editorEngine.snapshot.context.containers
|
|
10465
|
-
}, {
|
|
10466
|
-
blockIndexMap: editorEngine.blockIndexMap,
|
|
10467
|
-
listIndexMap: editorEngine.listIndexMap
|
|
10468
|
-
}), config.subscriptions.push(() => {
|
|
9700
|
+
}, { blockIndexMap: editorEngine.blockIndexMap }), config.subscriptions.push(() => {
|
|
10469
9701
|
let subscription = config.editorActor.subscribe(() => {
|
|
10470
9702
|
editorEngine.snapshot = {
|
|
10471
9703
|
...editorEngine.snapshot,
|
|
@@ -11277,13 +10509,19 @@ const coreDndBehaviors = [
|
|
|
11277
10509
|
...snapshot.context,
|
|
11278
10510
|
selection: dragSelection
|
|
11279
10511
|
}
|
|
11280
|
-
}, draggingEntireBlocks = isSelectingEntireBlocks(dragSnapshot), movedInlineObjectKey = !draggingEntireBlocks && isCollapsedRange(dragSelection) ? getFocusInlineObject(dragSnapshot)?.node._key : void 0, draggedNodes = getFragment(dragSnapshot),
|
|
10512
|
+
}, draggingEntireBlocks = isSelectingEntireBlocks(dragSnapshot), movedInlineObjectKey = !draggingEntireBlocks && isCollapsedRange(dragSelection) ? getFocusInlineObject(dragSnapshot)?.node._key : void 0, draggedNodes = getFragment(dragSnapshot), dropSnapshot = {
|
|
11281
10513
|
...snapshot,
|
|
11282
10514
|
context: {
|
|
11283
10515
|
...snapshot.context,
|
|
11284
10516
|
selection: dropPosition
|
|
11285
10517
|
}
|
|
11286
|
-
}, 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;
|
|
11287
10525
|
return !droppingOnDragOrigin && {
|
|
11288
10526
|
dropPosition,
|
|
11289
10527
|
draggingEntireBlocks,
|
|
@@ -11291,10 +10529,11 @@ const coreDndBehaviors = [
|
|
|
11291
10529
|
dragOrigin,
|
|
11292
10530
|
originEvent: event.originEvent,
|
|
11293
10531
|
fittedBlocks,
|
|
11294
|
-
movedInlineObjectKey
|
|
10532
|
+
movedInlineObjectKey,
|
|
10533
|
+
droppedInsideTextBlock
|
|
11295
10534
|
};
|
|
11296
10535
|
},
|
|
11297
|
-
actions: [(_, { draggingEntireBlocks, draggedNodes, dragOrigin, dropPosition, originEvent, fittedBlocks, movedInlineObjectKey }) => {
|
|
10536
|
+
actions: [(_, { draggingEntireBlocks, draggedNodes, dragOrigin, dropPosition, originEvent, fittedBlocks, movedInlineObjectKey, droppedInsideTextBlock }) => {
|
|
11298
10537
|
if (fittedBlocks.length === 0) return [];
|
|
11299
10538
|
let movedInlineObjectPath = movedInlineObjectKey ? [
|
|
11300
10539
|
...dropPosition.anchor.path.slice(0, -2),
|
|
@@ -11325,7 +10564,7 @@ const coreDndBehaviors = [
|
|
|
11325
10564
|
raise$1({
|
|
11326
10565
|
type: "insert.blocks",
|
|
11327
10566
|
blocks: fittedBlocks,
|
|
11328
|
-
placement: draggingEntireBlocks ?
|
|
10567
|
+
placement: draggingEntireBlocks ? droppedInsideTextBlock ? "auto" : originEvent.position.block === "start" ? "before" : "after" : "auto",
|
|
11329
10568
|
select: movedInlineObjectSelection ? "none" : void 0
|
|
11330
10569
|
}),
|
|
11331
10570
|
...movedInlineObjectSelection ? [raise$1({
|
|
@@ -12369,9 +11608,13 @@ function fieldAcceptsTextBlock(editor, node, _path) {
|
|
|
12369
11608
|
/**
|
|
12370
11609
|
* Indic scripts whose grapheme clusters span multiple code points. Backward
|
|
12371
11610
|
* character delete on these scripts removes one code point at a time instead
|
|
12372
|
-
* of the entire cluster.
|
|
11611
|
+
* of the entire cluster. Besides the script ranges, the class lists the BMP
|
|
11612
|
+
* conjunct linkers (`InCB=Linker`) of scripts the ranges miss, since every
|
|
11613
|
+
* cluster glued by grapheme rule GB9c contains its linker. The
|
|
11614
|
+
* supplementary-plane linkers stay out on purpose: the reinsert below slices
|
|
11615
|
+
* code units and would split a surrogate pair.
|
|
12373
11616
|
*/
|
|
12374
|
-
const COMPOUND_SCRIPT_REGEX = /[\u0980-\u09FF\u0E00-\u0E7F\u1000-\u109F\u0900-\u097F\u1780-\u17FF\u0D00-\u0D7F\u0B00-\u0B7F\u0A00-\u0A7F\u0B80-\u0BFF\u0C00-\u0C7F]+/;
|
|
11617
|
+
const COMPOUND_SCRIPT_REGEX = /[\u0980-\u09FF\u0E00-\u0E7F\u1000-\u109F\u0900-\u097F\u1780-\u17FF\u0D00-\u0D7F\u0B00-\u0B7F\u0A00-\u0A7F\u0B80-\u0BFF\u0C00-\u0C7F\u0ACD\u1A60\u1B44\u1BAB\uA9C0\uAAF6]+/;
|
|
12375
11618
|
/**
|
|
12376
11619
|
* Apply a resolved delete: mutate the tree, update selection, and reinsert
|
|
12377
11620
|
* code points for compound-script backward character delete.
|
|
@@ -14179,6 +13422,16 @@ const abstractDeserializeBehaviors = [
|
|
|
14179
13422
|
originEvent: event.originEvent
|
|
14180
13423
|
})]]
|
|
14181
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
|
+
}),
|
|
14182
13435
|
defineBehavior({
|
|
14183
13436
|
on: "deserialization.success",
|
|
14184
13437
|
actions: [({ snapshot, event }) => [raise$1({
|
|
@@ -17133,11 +16386,9 @@ function createInternalEditor(config) {
|
|
|
17133
16386
|
}, { batch: !0 }) : relay.on(type, (event) => {
|
|
17134
16387
|
switch (event.type) {
|
|
17135
16388
|
case "blurred":
|
|
17136
|
-
case "done loading":
|
|
17137
16389
|
case "editable":
|
|
17138
16390
|
case "focused":
|
|
17139
16391
|
case "invalid value":
|
|
17140
|
-
case "loading":
|
|
17141
16392
|
case "mutation":
|
|
17142
16393
|
case "operation":
|
|
17143
16394
|
case "patch":
|
|
@@ -17274,7 +16525,14 @@ function createActors(config) {
|
|
|
17274
16525
|
*/
|
|
17275
16526
|
var PortableTextEditor = class {
|
|
17276
16527
|
constructor(config) {
|
|
17277
|
-
_defineProperty(
|
|
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) => {
|
|
17278
16536
|
this.editable = {
|
|
17279
16537
|
...this.editable,
|
|
17280
16538
|
...editable
|
|
@@ -17625,6 +16883,6 @@ function defineTextBlock(config) {
|
|
|
17625
16883
|
...config
|
|
17626
16884
|
};
|
|
17627
16885
|
}
|
|
17628
|
-
export { EditorProvider, PortableTextEditable, PortableTextEditor, defineAnnotation, defineBlockObject, defineContainer, defineDecorator, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator,
|
|
16886
|
+
export { EditorProvider, PortableTextEditable, PortableTextEditor, defineAnnotation, defineBlockObject, defineContainer, defineDecorator, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
|
|
17629
16887
|
|
|
17630
16888
|
//# sourceMappingURL=index.js.map
|