@portabletext/editor 7.11.0 → 7.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -67
- package/lib/{behavior.types.action-DXkAaEGS.d.ts → behavior.types.action-DH6ujvaH.d.ts} +244 -16
- package/lib/behavior.types.action-DH6ujvaH.d.ts.map +1 -0
- package/lib/behaviors/index.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +297 -97
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +3 -3
- package/lib/plugins/index.js +2 -2
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.ts +1 -1
- package/lib/traversal/index.d.ts +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/lib/behavior.types.action-DXkAaEGS.d.ts.map +0 -1
package/lib/index.js
CHANGED
|
@@ -530,12 +530,12 @@ function end(editor, at) {
|
|
|
530
530
|
* Get the distance to the end of the first character in a string of text.
|
|
531
531
|
*/
|
|
532
532
|
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;
|
|
533
|
+
let isLTR = !isRTL, codepoints = isRTL ? codepointsIteratorRTL(str) : str, left = CodepointType.None, right = CodepointType.None, distance = 0, gb11 = null, gb12Or13 = null, gb9c = null;
|
|
534
534
|
for (let char of codepoints) {
|
|
535
535
|
let code = char.codePointAt(0);
|
|
536
536
|
if (!code) break;
|
|
537
537
|
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;
|
|
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) || 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
539
|
distance += char.length;
|
|
540
540
|
}
|
|
541
541
|
return distance || 1;
|
|
@@ -588,10 +588,13 @@ const getCharacterDistance = (str, isRTL = !1) => {
|
|
|
588
588
|
LV: 256,
|
|
589
589
|
LVT: 512,
|
|
590
590
|
ExtPict: 1024,
|
|
591
|
-
Any: 2048
|
|
592
|
-
|
|
591
|
+
Any: 2048,
|
|
592
|
+
InCBConsonant: 4096,
|
|
593
|
+
InCBExtend: 8192,
|
|
594
|
+
InCBLinker: 16384
|
|
595
|
+
}, 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
596
|
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;
|
|
597
|
+
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
598
|
};
|
|
596
599
|
function intersects(x, y) {
|
|
597
600
|
return (x & y) !== 0;
|
|
@@ -603,13 +606,14 @@ const NonBoundaryPairs = [
|
|
|
603
606
|
[CodepointType.Any, CodepointType.Extend | CodepointType.ZWJ],
|
|
604
607
|
[CodepointType.Any, CodepointType.SpacingMark],
|
|
605
608
|
[CodepointType.Prepend, CodepointType.Any],
|
|
609
|
+
[CodepointType.InCBLinker | CodepointType.InCBExtend, CodepointType.InCBConsonant],
|
|
606
610
|
[CodepointType.ZWJ, CodepointType.ExtPict],
|
|
607
611
|
[CodepointType.RI, CodepointType.RI]
|
|
608
612
|
];
|
|
609
613
|
function isBoundaryPair(left, right) {
|
|
610
614
|
return NonBoundaryPairs.findIndex((r) => intersects(left, r[0]) && intersects(right, r[1])) === -1;
|
|
611
615
|
}
|
|
612
|
-
const endingEmojiZWJ = /\p{ExtPict}[\p{Gr_Ext}\p{EMod}]*\u200D$/u, endsWithEmojiZWJ = (str) => str.search(endingEmojiZWJ) !== -1, endingRIs = /\p{RI}+$/gu, endsWithOddNumberOfRIs = (str) => {
|
|
616
|
+
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
617
|
let match = str.match(endingRIs);
|
|
614
618
|
return match !== null && match[0].length / 2 % 2 == 1;
|
|
615
619
|
};
|
|
@@ -1993,7 +1997,7 @@ const DecorateContext = createContext({}), useDecorations = (node, path, parentD
|
|
|
1993
1997
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ new Set(), $[0] = t0) : t0 = $[0];
|
|
1994
1998
|
let eventListeners = useRef(t0), latestDecorate = useRef(decorateProp), t1, t2;
|
|
1995
1999
|
$[1] === decorateProp ? (t1 = $[2], t2 = $[3]) : (t1 = () => {
|
|
1996
|
-
latestDecorate.current = decorateProp, eventListeners.current.forEach(_temp$
|
|
2000
|
+
latestDecorate.current = decorateProp, eventListeners.current.forEach(_temp$5);
|
|
1997
2001
|
}, t2 = [decorateProp], $[1] = decorateProp, $[2] = t1, $[3] = t2), useIsomorphicLayoutEffect(t1, t2);
|
|
1998
2002
|
let t3;
|
|
1999
2003
|
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = (entry) => latestDecorate.current(entry), $[4] = t3) : t3 = $[4];
|
|
@@ -2007,7 +2011,7 @@ const DecorateContext = createContext({}), useDecorations = (node, path, parentD
|
|
|
2007
2011
|
addEventListener
|
|
2008
2012
|
}, $[6] = t5) : t5 = $[6], t5;
|
|
2009
2013
|
};
|
|
2010
|
-
function _temp$
|
|
2014
|
+
function _temp$5(listener) {
|
|
2011
2015
|
listener();
|
|
2012
2016
|
}
|
|
2013
2017
|
const rtlRange = "֑-߿יִ-﷽ﹰ-ﻼ", ltrRange = "A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--", rtl = RegExp(`^[^${ltrRange}]*[${rtlRange}]`), ltr = RegExp(`^[^${rtlRange}]*[${ltrRange}]`);
|
|
@@ -2554,7 +2558,7 @@ const useChildren = (props) => {
|
|
|
2554
2558
|
* selector re-runs on its component's renders and when a renderer
|
|
2555
2559
|
* registration map is swapped, not on document or selection changes.
|
|
2556
2560
|
* Only for selectors that read the registration maps
|
|
2557
|
-
* (`engine.containers/spans/textBlocks/blockObjects/inlineObjects`)
|
|
2561
|
+
* (`engine.containers/spans/textBlocks/blockObjects/inlineObjects/decorators/annotations`)
|
|
2558
2562
|
* exclusively; those maps are mutated only in
|
|
2559
2563
|
* `register-node-on-engine.ts`, which arms this channel.
|
|
2560
2564
|
*/
|
|
@@ -4057,7 +4061,7 @@ const DropPositionStoreContext = createContext({
|
|
|
4057
4061
|
* gaining or losing the indicator. Mirrors `SelectionStateProvider`.
|
|
4058
4062
|
*/
|
|
4059
4063
|
function DropPositionStateProvider(t0) {
|
|
4060
|
-
let $ = c(6), { children } = t0, editorActor = useContext(EditorActorContext), [initialSubscribers] = useState(_temp$
|
|
4064
|
+
let $ = c(6), { children } = t0, editorActor = useContext(EditorActorContext), [initialSubscribers] = useState(_temp$4), subscribersRef = useRef(initialSubscribers), stateRef = useRef(void 0), t1, t2;
|
|
4061
4065
|
$[0] === editorActor ? (t1 = $[1], t2 = $[2]) : (t1 = () => {
|
|
4062
4066
|
let behaviorConfigs = createDropPositionBehaviorsConfig({ setDropPosition: (next) => {
|
|
4063
4067
|
let prev = stateRef.current;
|
|
@@ -4095,7 +4099,7 @@ function DropPositionStateProvider(t0) {
|
|
|
4095
4099
|
* when no drag is hovering this block. Re-renders only when this block's slice
|
|
4096
4100
|
* flips, not when the position moves between other blocks.
|
|
4097
4101
|
*/
|
|
4098
|
-
function _temp$
|
|
4102
|
+
function _temp$4() {
|
|
4099
4103
|
return /* @__PURE__ */ new Set();
|
|
4100
4104
|
}
|
|
4101
4105
|
function useElementDropPosition(path) {
|
|
@@ -4526,14 +4530,40 @@ function findBlockPositionalOverride(parentConfig, type) {
|
|
|
4526
4530
|
* for a matching `_type`.
|
|
4527
4531
|
*/
|
|
4528
4532
|
function findInlinePositionalOverride(parentTextBlock, type) {
|
|
4529
|
-
return parentTextBlock?.of ? parentTextBlock.of.find((entry) =>
|
|
4533
|
+
return parentTextBlock?.of ? parentTextBlock.of.find((entry) => isMatchingSpanOrInlineObject(entry, type)) || parentTextBlock.of.find((entry) => isMatchingSpanOrInlineObject(entry, "*")) : void 0;
|
|
4534
|
+
}
|
|
4535
|
+
function isMatchingSpanOrInlineObject(entry, type) {
|
|
4536
|
+
return "span" in entry ? entry.span.type === type : "inlineObject" in entry && entry.inlineObject.type === type;
|
|
4537
|
+
}
|
|
4538
|
+
/**
|
|
4539
|
+
* Decorator positional override lookup. Walks the immediate parent
|
|
4540
|
+
* text block's `of` array (decorator kind) for a matching decorator
|
|
4541
|
+
* name: exact first, then a `'*'` entry.
|
|
4542
|
+
*/
|
|
4543
|
+
function findPositionalDecoratorOverride(parentTextBlock, decorator) {
|
|
4544
|
+
return parentTextBlock?.of ? parentTextBlock.of.find((entry) => isMatchingDecorator(entry, decorator)) || parentTextBlock.of.find((entry) => isMatchingDecorator(entry, "*")) : void 0;
|
|
4545
|
+
}
|
|
4546
|
+
function isMatchingDecorator(entry, decorator) {
|
|
4547
|
+
return "decorator" in entry && entry.decorator.type === decorator;
|
|
4548
|
+
}
|
|
4549
|
+
/**
|
|
4550
|
+
* Annotation positional override lookup. Walks the immediate parent
|
|
4551
|
+
* text block's `of` array (annotation kind) for a matching annotation
|
|
4552
|
+
* `_type`: exact first, then a `'*'` entry.
|
|
4553
|
+
*/
|
|
4554
|
+
function findPositionalAnnotationOverride(parentTextBlock, type) {
|
|
4555
|
+
return parentTextBlock?.of ? parentTextBlock.of.find((entry) => isMatchingAnnotation(entry, type)) || parentTextBlock.of.find((entry) => isMatchingAnnotation(entry, "*")) : void 0;
|
|
4556
|
+
}
|
|
4557
|
+
function isMatchingAnnotation(entry, type) {
|
|
4558
|
+
return "annotation" in entry && entry.annotation.type === type;
|
|
4530
4559
|
}
|
|
4531
4560
|
/**
|
|
4532
4561
|
* The active text block's resolved config at this render position.
|
|
4533
4562
|
* Provided by the text-block render branch in `render.element.tsx`;
|
|
4534
4563
|
* consumed by inline-level dispatch (`useSpanConfig` + the
|
|
4535
|
-
* inline-object branch of `render.element.tsx`) for positional
|
|
4536
|
-
* override lookup
|
|
4564
|
+
* inline-object branch of `render.element.tsx`) for positional span/
|
|
4565
|
+
* inline-object override lookup, and directly by `RenderSpan` for
|
|
4566
|
+
* positional decorator/annotation override lookup.
|
|
4537
4567
|
*
|
|
4538
4568
|
* Separate from `ParentContainerContext` so inline subscribers only
|
|
4539
4569
|
* re-render on text-block `of` changes, and block subscribers only
|
|
@@ -4574,6 +4604,24 @@ function renderDefaultSpan(props) {
|
|
|
4574
4604
|
});
|
|
4575
4605
|
}
|
|
4576
4606
|
/**
|
|
4607
|
+
* Engine-default wrapper for Decorator marks: identity. The engine
|
|
4608
|
+
* applies no decorator markup of its own; a decorator's whole visual
|
|
4609
|
+
* effect comes from its `render`.
|
|
4610
|
+
*/
|
|
4611
|
+
function renderDefaultDecorator(props) {
|
|
4612
|
+
return props.children;
|
|
4613
|
+
}
|
|
4614
|
+
/**
|
|
4615
|
+
* Engine-default wrapper for Annotation marks: identity. The engine
|
|
4616
|
+
* always anchors the annotated text in a `<span ref>` outside this
|
|
4617
|
+
* render, kept for structural parity with the legacy `renderAnnotation`
|
|
4618
|
+
* path (which hands that anchor to consumers as `editorElementRef`);
|
|
4619
|
+
* the render itself owns no markup by default.
|
|
4620
|
+
*/
|
|
4621
|
+
function renderDefaultAnnotation(props) {
|
|
4622
|
+
return props.children;
|
|
4623
|
+
}
|
|
4624
|
+
/**
|
|
4577
4625
|
* Engine-default wrapper for void block objects. Renders the zero-width
|
|
4578
4626
|
* editor children plus a non-editable `[_type: _key]` placeholder so the
|
|
4579
4627
|
* object is visible before a consumer provides a custom `render`.
|
|
@@ -4816,7 +4864,7 @@ function SelectionStateProvider(t0) {
|
|
|
4816
4864
|
blockIndexMap: editorEngine.blockIndexMap
|
|
4817
4865
|
}, selection);
|
|
4818
4866
|
}, $[0] = editorEngine.blockIndexMap, $[1] = editorEngine.snapshot, $[2] = t1) : t1 = $[2];
|
|
4819
|
-
let computeCurrent = t1, [seed] = useState(computeCurrent), stateRef = useRef(seed), [initialSubscribers] = useState(_temp$
|
|
4867
|
+
let computeCurrent = t1, [seed] = useState(computeCurrent), stateRef = useRef(seed), [initialSubscribers] = useState(_temp$3), subscribersRef = useRef(initialSubscribers), t2, t3;
|
|
4820
4868
|
$[3] !== computeCurrent || $[4] !== editorActor ? (t2 = () => {
|
|
4821
4869
|
let next = computeCurrent();
|
|
4822
4870
|
if (!selectionStatesEqual(stateRef.current, next)) {
|
|
@@ -4850,7 +4898,7 @@ function SelectionStateProvider(t0) {
|
|
|
4850
4898
|
* focused. Re-renders only when this boolean flips - not when other
|
|
4851
4899
|
* containers' focused state changes.
|
|
4852
4900
|
*/
|
|
4853
|
-
function _temp$
|
|
4901
|
+
function _temp$3() {
|
|
4854
4902
|
return /* @__PURE__ */ new Set();
|
|
4855
4903
|
}
|
|
4856
4904
|
function useIsFocusedContainer(serializedPath) {
|
|
@@ -5626,8 +5674,43 @@ function useSpanConfig(node, _path) {
|
|
|
5626
5674
|
let [globalSpan, globalSpanCatchAll] = useRegistrationsSelector(t1, tupleRefEqual);
|
|
5627
5675
|
return positional && "span" in positional ? positional.span.render === void 0 ? globalSpan ?? globalSpanCatchAll : positional : globalSpan ?? globalSpanCatchAll;
|
|
5628
5676
|
}
|
|
5677
|
+
/**
|
|
5678
|
+
* Hook: the engine's registered GLOBAL decorator map. Positional
|
|
5679
|
+
* (in-parent) decorator overrides are a separate layer: the caller
|
|
5680
|
+
* resolves them from `ParentTextBlockContext` via
|
|
5681
|
+
* `findPositionalDecoratorOverride` and combines that result with
|
|
5682
|
+
* this map's.
|
|
5683
|
+
*
|
|
5684
|
+
* The per-mark exact-then-`'*'` lookup against this map happens as a
|
|
5685
|
+
* plain `Map` read rather than as one hook call per mark: a span
|
|
5686
|
+
* carries a variable number of decorator marks, and hooks cannot be
|
|
5687
|
+
* called a variable number of times.
|
|
5688
|
+
*/
|
|
5689
|
+
function useDecoratorConfigs() {
|
|
5690
|
+
return useRegistrationsSelector(_temp$2);
|
|
5691
|
+
}
|
|
5692
|
+
/**
|
|
5693
|
+
* Hook: the engine's registered GLOBAL annotation map. Positional
|
|
5694
|
+
* (in-parent) annotation overrides are a separate layer: the caller
|
|
5695
|
+
* resolves them from `ParentTextBlockContext` via
|
|
5696
|
+
* `findPositionalAnnotationOverride` and combines that result with
|
|
5697
|
+
* this map's.
|
|
5698
|
+
*
|
|
5699
|
+
* Same plain-`Map`-read reasoning as {@link useDecoratorConfigs}: a
|
|
5700
|
+
* span's marks resolve to a variable number of annotation `markDef`s
|
|
5701
|
+
* per render.
|
|
5702
|
+
*/
|
|
5703
|
+
function _temp$2(engine) {
|
|
5704
|
+
return engine.decorators;
|
|
5705
|
+
}
|
|
5706
|
+
function useAnnotationConfigs() {
|
|
5707
|
+
return useRegistrationsSelector(_temp2$1);
|
|
5708
|
+
}
|
|
5709
|
+
function _temp2$1(engine) {
|
|
5710
|
+
return engine.annotations;
|
|
5711
|
+
}
|
|
5629
5712
|
function RenderSpan(props) {
|
|
5630
|
-
let $ = c(
|
|
5713
|
+
let $ = c(33), schema = props.schema, spanRef = useRef(null), t0;
|
|
5631
5714
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
|
|
5632
5715
|
let t1;
|
|
5633
5716
|
$[1] === schema.span.name ? t1 = $[2] : (t1 = {
|
|
@@ -5636,88 +5719,119 @@ function RenderSpan(props) {
|
|
|
5636
5719
|
}, $[1] = schema.span.name, $[2] = t1);
|
|
5637
5720
|
let schemaType = t1, parent = props.children.props.parent, block = parent && isTextBlock({ schema }, parent) ? parent : void 0, t2;
|
|
5638
5721
|
$[3] !== block?.children || $[4] !== props.leaf._key ? (t2 = block?.children.find((_child) => _child._key === props.leaf._key), $[3] = block?.children, $[4] = props.leaf._key, $[5] = t2) : t2 = $[5];
|
|
5639
|
-
let child = t2, subSchema = useBlockSubSchema(props.path), spanConfig = useSpanConfig(child ?? props.leaf, props.path), isInNewPipeline = useContext(NewPipelineContext), t3;
|
|
5722
|
+
let child = t2, subSchema = useBlockSubSchema(props.path), spanConfig = useSpanConfig(child ?? props.leaf, props.path), decoratorConfigs = useDecoratorConfigs(), annotationConfigs = useAnnotationConfigs(), parentTextBlock = useContext(ParentTextBlockContext), isInNewPipeline = useContext(NewPipelineContext), t3;
|
|
5640
5723
|
$[6] === props.path ? t3 = $[7] : (t3 = serializePath(props.path), $[6] = props.path, $[7] = t3);
|
|
5641
|
-
let serializedPath = t3, focused = useIsFocusedLeaf(serializedPath), selected = useIsSelectedLeaf(serializedPath),
|
|
5642
|
-
if ($[8] !==
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5724
|
+
let serializedPath = t3, focused = useIsFocusedLeaf(serializedPath), selected = useIsSelectedLeaf(serializedPath), t4 = subSchema.decorators, children, t5;
|
|
5725
|
+
if ($[8] !== annotationConfigs || $[9] !== block || $[10] !== child || $[11] !== decoratorConfigs || $[12] !== focused || $[13] !== isInNewPipeline || $[14] !== parentTextBlock || $[15] !== props.attributes || $[16] !== props.children || $[17] !== props.leaf || $[18] !== props.path || $[19] !== props.readOnly || $[20] !== props.renderAnnotation || $[21] !== props.renderChild || $[22] !== props.renderDecorator || $[23] !== schemaType || $[24] !== selected || $[25] !== spanConfig || $[26] !== subSchema.annotations || $[27] !== subSchema.decorators) {
|
|
5726
|
+
t5 = Symbol.for("react.early_return_sentinel");
|
|
5727
|
+
bb0: {
|
|
5728
|
+
let decoratorSchemaTypes = t4.map(_temp$1), decorators = [...new Set((props.leaf.marks ?? []).filter((mark) => decoratorSchemaTypes.includes(mark)))], annotationMarkDefs = (props.leaf.marks ?? []).flatMap((mark_0) => {
|
|
5729
|
+
if (decoratorSchemaTypes.includes(mark_0)) return [];
|
|
5730
|
+
let markDef_0 = block?.markDefs?.find((markDef) => markDef._key === mark_0);
|
|
5731
|
+
return markDef_0 ? [markDef_0] : [];
|
|
5732
|
+
});
|
|
5733
|
+
children = props.children;
|
|
5734
|
+
for (let mark_1 of decorators) {
|
|
5735
|
+
let decoratorSchemaType = subSchema.decorators.find((dec) => dec.name === mark_1);
|
|
5736
|
+
if (!decoratorSchemaType) continue;
|
|
5737
|
+
let globalDecoratorConfig = decoratorConfigs.get(mark_1) ?? decoratorConfigs.get("*"), positionalDecorator = findPositionalDecoratorOverride(parentTextBlock, mark_1), decoratorConfig = positionalDecorator ? positionalDecorator.decorator.render === void 0 ? globalDecoratorConfig : positionalDecorator : globalDecoratorConfig;
|
|
5738
|
+
if (decoratorConfig) {
|
|
5739
|
+
let render = decoratorConfig.decorator.render, renderProps = {
|
|
5740
|
+
children,
|
|
5741
|
+
decorator: mark_1,
|
|
5742
|
+
focused,
|
|
5743
|
+
path: props.path,
|
|
5744
|
+
readOnly: props.readOnly,
|
|
5745
|
+
renderDefault: renderDefaultDecorator,
|
|
5746
|
+
selected
|
|
5747
|
+
};
|
|
5748
|
+
children = render ? render(renderProps) : renderDefaultDecorator(renderProps);
|
|
5749
|
+
continue;
|
|
5750
|
+
}
|
|
5751
|
+
props.renderDecorator && (children = /* @__PURE__ */ jsx(RenderDecorator, {
|
|
5752
|
+
renderDecorator: props.renderDecorator,
|
|
5753
|
+
editorElementRef: spanRef,
|
|
5754
|
+
focused,
|
|
5755
|
+
path: props.path,
|
|
5756
|
+
selected,
|
|
5757
|
+
schemaType: decoratorSchemaType,
|
|
5758
|
+
value: mark_1,
|
|
5759
|
+
children
|
|
5760
|
+
}));
|
|
5761
|
+
}
|
|
5762
|
+
for (let annotationMarkDef of annotationMarkDefs) {
|
|
5763
|
+
let annotationSchemaType = subSchema.annotations.find((t) => t.name === annotationMarkDef._type);
|
|
5764
|
+
if (annotationSchemaType) {
|
|
5765
|
+
let globalAnnotationConfig = annotationConfigs.get(annotationMarkDef._type) ?? annotationConfigs.get("*"), positionalAnnotation = findPositionalAnnotationOverride(parentTextBlock, annotationMarkDef._type), annotationConfig = positionalAnnotation ? positionalAnnotation.annotation.render === void 0 ? globalAnnotationConfig : positionalAnnotation : globalAnnotationConfig;
|
|
5766
|
+
if (annotationConfig) {
|
|
5767
|
+
let render_0 = annotationConfig.annotation.render, renderProps_0 = {
|
|
5768
|
+
children,
|
|
5769
|
+
focused,
|
|
5770
|
+
annotation: annotationMarkDef,
|
|
5771
|
+
path: props.path,
|
|
5772
|
+
readOnly: props.readOnly,
|
|
5773
|
+
renderDefault: renderDefaultAnnotation,
|
|
5774
|
+
selected
|
|
5775
|
+
};
|
|
5776
|
+
children = /* @__PURE__ */ jsx("span", {
|
|
5777
|
+
ref: spanRef,
|
|
5778
|
+
children: render_0 ? render_0(renderProps_0) : renderDefaultAnnotation(renderProps_0)
|
|
5779
|
+
});
|
|
5780
|
+
continue;
|
|
5781
|
+
}
|
|
5782
|
+
children = block && props.renderAnnotation ? /* @__PURE__ */ jsx("span", {
|
|
5783
|
+
ref: spanRef,
|
|
5784
|
+
children: /* @__PURE__ */ jsx(RenderAnnotation, {
|
|
5785
|
+
renderAnnotation: props.renderAnnotation,
|
|
5786
|
+
block,
|
|
5787
|
+
editorElementRef: spanRef,
|
|
5788
|
+
focused,
|
|
5789
|
+
path: props.path,
|
|
5790
|
+
selected,
|
|
5791
|
+
schemaType: annotationSchemaType,
|
|
5792
|
+
value: annotationMarkDef,
|
|
5793
|
+
children
|
|
5794
|
+
})
|
|
5795
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
5796
|
+
ref: spanRef,
|
|
5797
|
+
children
|
|
5798
|
+
});
|
|
5799
|
+
}
|
|
5800
|
+
}
|
|
5801
|
+
if (block && props.renderChild && child && !spanConfig && !isInNewPipeline && (children = /* @__PURE__ */ jsx(RenderChild, {
|
|
5802
|
+
renderChild: props.renderChild,
|
|
5803
|
+
annotations: annotationMarkDefs,
|
|
5653
5804
|
editorElementRef: spanRef,
|
|
5654
5805
|
focused,
|
|
5655
5806
|
path: props.path,
|
|
5807
|
+
schemaType,
|
|
5656
5808
|
selected,
|
|
5657
|
-
|
|
5658
|
-
value: mark_1,
|
|
5809
|
+
value: child,
|
|
5659
5810
|
children
|
|
5660
|
-
}))
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
annotationSchemaType && (children = block && props.renderAnnotation ? /* @__PURE__ */ jsx("span", {
|
|
5665
|
-
ref: spanRef,
|
|
5666
|
-
children: /* @__PURE__ */ jsx(RenderAnnotation, {
|
|
5667
|
-
renderAnnotation: props.renderAnnotation,
|
|
5668
|
-
block,
|
|
5669
|
-
editorElementRef: spanRef,
|
|
5811
|
+
})), spanConfig) {
|
|
5812
|
+
let render_1 = spanConfig.span.render, renderProps_1 = {
|
|
5813
|
+
attributes: props.attributes,
|
|
5814
|
+
children,
|
|
5670
5815
|
focused,
|
|
5816
|
+
node: child ?? props.leaf,
|
|
5671
5817
|
path: props.path,
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
children
|
|
5680
|
-
}));
|
|
5818
|
+
readOnly: props.readOnly,
|
|
5819
|
+
renderDefault: renderDefaultSpan,
|
|
5820
|
+
selected
|
|
5821
|
+
};
|
|
5822
|
+
t5 = render_1 ? render_1(renderProps_1) : renderDefaultSpan(renderProps_1);
|
|
5823
|
+
break bb0;
|
|
5824
|
+
}
|
|
5681
5825
|
}
|
|
5682
|
-
$[8] =
|
|
5683
|
-
} else
|
|
5684
|
-
if (
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
renderChild: props.renderChild,
|
|
5688
|
-
annotations: annotationMarkDefs,
|
|
5689
|
-
editorElementRef: spanRef,
|
|
5690
|
-
focused,
|
|
5691
|
-
path: props.path,
|
|
5692
|
-
schemaType,
|
|
5693
|
-
selected,
|
|
5694
|
-
value: child,
|
|
5695
|
-
children
|
|
5696
|
-
}), $[20] = annotationMarkDefs, $[21] = child, $[22] = children, $[23] = focused, $[24] = props.path, $[25] = props.renderChild, $[26] = schemaType, $[27] = selected, $[28] = t4) : t4 = $[28], children = t4;
|
|
5697
|
-
}
|
|
5698
|
-
if (spanConfig) {
|
|
5699
|
-
let render = spanConfig.span.render, t4 = child ?? props.leaf, t5;
|
|
5700
|
-
if ($[29] !== children || $[30] !== focused || $[31] !== props.attributes || $[32] !== props.path || $[33] !== props.readOnly || $[34] !== render || $[35] !== selected || $[36] !== t4) {
|
|
5701
|
-
let renderProps = {
|
|
5702
|
-
attributes: props.attributes,
|
|
5703
|
-
children,
|
|
5704
|
-
focused,
|
|
5705
|
-
node: t4,
|
|
5706
|
-
path: props.path,
|
|
5707
|
-
readOnly: props.readOnly,
|
|
5708
|
-
renderDefault: renderDefaultSpan,
|
|
5709
|
-
selected
|
|
5710
|
-
};
|
|
5711
|
-
t5 = render ? render(renderProps) : renderDefaultSpan(renderProps), $[29] = children, $[30] = focused, $[31] = props.attributes, $[32] = props.path, $[33] = props.readOnly, $[34] = render, $[35] = selected, $[36] = t4, $[37] = t5;
|
|
5712
|
-
} else t5 = $[37];
|
|
5713
|
-
return t5;
|
|
5714
|
-
}
|
|
5715
|
-
let t4;
|
|
5716
|
-
return $[38] !== children || $[39] !== props.attributes ? (t4 = /* @__PURE__ */ jsx("span", {
|
|
5826
|
+
$[8] = annotationConfigs, $[9] = block, $[10] = child, $[11] = decoratorConfigs, $[12] = focused, $[13] = isInNewPipeline, $[14] = parentTextBlock, $[15] = props.attributes, $[16] = props.children, $[17] = props.leaf, $[18] = props.path, $[19] = props.readOnly, $[20] = props.renderAnnotation, $[21] = props.renderChild, $[22] = props.renderDecorator, $[23] = schemaType, $[24] = selected, $[25] = spanConfig, $[26] = subSchema.annotations, $[27] = subSchema.decorators, $[28] = children, $[29] = t5;
|
|
5827
|
+
} else children = $[28], t5 = $[29];
|
|
5828
|
+
if (t5 !== Symbol.for("react.early_return_sentinel")) return t5;
|
|
5829
|
+
let t6;
|
|
5830
|
+
return $[30] !== children || $[31] !== props.attributes ? (t6 = /* @__PURE__ */ jsx("span", {
|
|
5717
5831
|
...props.attributes,
|
|
5718
5832
|
ref: spanRef,
|
|
5719
5833
|
children
|
|
5720
|
-
}), $[
|
|
5834
|
+
}), $[30] = children, $[31] = props.attributes, $[32] = t6) : t6 = $[32], t6;
|
|
5721
5835
|
}
|
|
5722
5836
|
function _temp$1(decorator) {
|
|
5723
5837
|
return decorator.name;
|
|
@@ -10329,7 +10443,7 @@ function createEditorEngine(config) {
|
|
|
10329
10443
|
value: [placeholderBlock]
|
|
10330
10444
|
},
|
|
10331
10445
|
decoratorState: {}
|
|
10332
|
-
}, editor.containers = /* @__PURE__ */ new Map(), editor.blockObjects = /* @__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 = {
|
|
10446
|
+
}, 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 = {
|
|
10333
10447
|
undos: [],
|
|
10334
10448
|
redos: []
|
|
10335
10449
|
}, editor.listIndexMap = /* @__PURE__ */ new Map(), editor.listIndexMapDirty = !1, editor.selectorChannelsPending = {
|
|
@@ -12259,9 +12373,13 @@ function fieldAcceptsTextBlock(editor, node, _path) {
|
|
|
12259
12373
|
/**
|
|
12260
12374
|
* Indic scripts whose grapheme clusters span multiple code points. Backward
|
|
12261
12375
|
* character delete on these scripts removes one code point at a time instead
|
|
12262
|
-
* of the entire cluster.
|
|
12376
|
+
* of the entire cluster. Besides the script ranges, the class lists the BMP
|
|
12377
|
+
* conjunct linkers (`InCB=Linker`) of scripts the ranges miss, since every
|
|
12378
|
+
* cluster glued by grapheme rule GB9c contains its linker. The
|
|
12379
|
+
* supplementary-plane linkers stay out on purpose: the reinsert below slices
|
|
12380
|
+
* code units and would split a surrogate pair.
|
|
12263
12381
|
*/
|
|
12264
|
-
const COMPOUND_SCRIPT_REGEX = /[\u0980-\u09FF\u0E00-\u0E7F\u1000-\u109F\u0900-\u097F\u1780-\u17FF\u0D00-\u0D7F\u0B00-\u0B7F\u0A00-\u0A7F\u0B80-\u0BFF\u0C00-\u0C7F]+/;
|
|
12382
|
+
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]+/;
|
|
12265
12383
|
/**
|
|
12266
12384
|
* Apply a resolved delete: mutate the tree, update selection, and reinsert
|
|
12267
12385
|
* code points for compound-script backward character delete.
|
|
@@ -15415,7 +15533,7 @@ function describeContainerFailure(failure, container) {
|
|
|
15415
15533
|
* (if present) for inline-content positional overrides.
|
|
15416
15534
|
*/
|
|
15417
15535
|
function resolveTextBlockConfig(textBlock) {
|
|
15418
|
-
let resolvedOf = textBlock.of ? textBlock.of.flatMap((entry) => entry.kind === "span" ? [{ span: entry }] : [{ inlineObject: entry }]) : void 0;
|
|
15536
|
+
let resolvedOf = textBlock.of ? textBlock.of.flatMap((entry) => entry.kind === "span" ? [{ span: entry }] : entry.kind === "inlineObject" ? [{ inlineObject: entry }] : entry.kind === "decorator" ? [{ decorator: entry }] : [{ annotation: entry }]) : void 0;
|
|
15419
15537
|
return {
|
|
15420
15538
|
textBlock,
|
|
15421
15539
|
...resolvedOf ? { of: resolvedOf } : {}
|
|
@@ -15507,9 +15625,27 @@ function registerNodeOnEngine(engine, node) {
|
|
|
15507
15625
|
blockObjects.set(node.type, { blockObject: node }), engine.blockObjects = blockObjects, notifyRegistrationsChanged(engine);
|
|
15508
15626
|
return;
|
|
15509
15627
|
}
|
|
15510
|
-
if (
|
|
15511
|
-
|
|
15512
|
-
|
|
15628
|
+
if (node.kind === "inlineObject") {
|
|
15629
|
+
if (isTypeAlreadyRegistered(engine, "inlineObject", node.type)) return;
|
|
15630
|
+
let inlineObjects = new Map(engine.inlineObjects);
|
|
15631
|
+
inlineObjects.set(node.type, { inlineObject: node }), engine.inlineObjects = inlineObjects, notifyRegistrationsChanged(engine);
|
|
15632
|
+
return;
|
|
15633
|
+
}
|
|
15634
|
+
if (node.kind === "decorator") {
|
|
15635
|
+
if (engine.decorators.has(node.type)) {
|
|
15636
|
+
console.warn(`registerNode: type "${node.type}" is already registered as a decorator. Registration skipped.`);
|
|
15637
|
+
return;
|
|
15638
|
+
}
|
|
15639
|
+
let decorators = new Map(engine.decorators);
|
|
15640
|
+
decorators.set(node.type, { decorator: node }), engine.decorators = decorators, notifyRegistrationsChanged(engine);
|
|
15641
|
+
return;
|
|
15642
|
+
}
|
|
15643
|
+
if (engine.annotations.has(node.type)) {
|
|
15644
|
+
console.warn(`registerNode: type "${node.type}" is already registered as an annotation. Registration skipped.`);
|
|
15645
|
+
return;
|
|
15646
|
+
}
|
|
15647
|
+
let annotations = new Map(engine.annotations);
|
|
15648
|
+
annotations.set(node.type, { annotation: node }), engine.annotations = annotations, notifyRegistrationsChanged(engine);
|
|
15513
15649
|
}
|
|
15514
15650
|
/**
|
|
15515
15651
|
* Mutate the engine's registration maps to remove a registered node.
|
|
@@ -15537,8 +15673,18 @@ function unregisterNodeOnEngine(engine, node) {
|
|
|
15537
15673
|
blockObjects.delete(node.type), engine.blockObjects = blockObjects, notifyRegistrationsChanged(engine);
|
|
15538
15674
|
return;
|
|
15539
15675
|
}
|
|
15540
|
-
|
|
15541
|
-
|
|
15676
|
+
if (node.kind === "inlineObject") {
|
|
15677
|
+
let inlineObjects = new Map(engine.inlineObjects);
|
|
15678
|
+
inlineObjects.delete(node.type), engine.inlineObjects = inlineObjects, notifyRegistrationsChanged(engine);
|
|
15679
|
+
return;
|
|
15680
|
+
}
|
|
15681
|
+
if (node.kind === "decorator") {
|
|
15682
|
+
let decorators = new Map(engine.decorators);
|
|
15683
|
+
decorators.delete(node.type), engine.decorators = decorators, notifyRegistrationsChanged(engine);
|
|
15684
|
+
return;
|
|
15685
|
+
}
|
|
15686
|
+
let annotations = new Map(engine.annotations);
|
|
15687
|
+
annotations.delete(node.type), engine.annotations = annotations, notifyRegistrationsChanged(engine);
|
|
15542
15688
|
}
|
|
15543
15689
|
/**
|
|
15544
15690
|
* The registration maps are mutated only in this module, so the React
|
|
@@ -17348,6 +17494,60 @@ function defineSpan(config) {
|
|
|
17348
17494
|
/**
|
|
17349
17495
|
* @public
|
|
17350
17496
|
*
|
|
17497
|
+
* Define a decorator renderer for a decorator name declared in the
|
|
17498
|
+
* schema's `decorators` array, or `'*'` to match every decorator.
|
|
17499
|
+
* The returned registration is mounted via the `<NodePlugin>`
|
|
17500
|
+
* component.
|
|
17501
|
+
*
|
|
17502
|
+
* Decorator names live in a different namespace than node
|
|
17503
|
+
* `_type`s, so `type` has no forbidden values here (unlike
|
|
17504
|
+
* `defineSpan`/`defineTextBlock`).
|
|
17505
|
+
*
|
|
17506
|
+
* @example
|
|
17507
|
+
* ```ts
|
|
17508
|
+
* defineDecorator({
|
|
17509
|
+
* type: 'strong',
|
|
17510
|
+
* render: ({children}) => <strong>{children}</strong>,
|
|
17511
|
+
* })
|
|
17512
|
+
* ```
|
|
17513
|
+
*/
|
|
17514
|
+
function defineDecorator(config) {
|
|
17515
|
+
return {
|
|
17516
|
+
kind: "decorator",
|
|
17517
|
+
...config
|
|
17518
|
+
};
|
|
17519
|
+
}
|
|
17520
|
+
/**
|
|
17521
|
+
* @public
|
|
17522
|
+
*
|
|
17523
|
+
* Define an annotation renderer for a `_type` declared in the
|
|
17524
|
+
* schema's `annotations` array, or `'*'` to match every annotation
|
|
17525
|
+
* type. The returned registration is mounted via the `<NodePlugin>`
|
|
17526
|
+
* component.
|
|
17527
|
+
*
|
|
17528
|
+
* Annotation `_type`s live in a different namespace than node
|
|
17529
|
+
* `_type`s, so `type` has no forbidden values here (unlike
|
|
17530
|
+
* `defineInlineObject`/`defineBlockObject`).
|
|
17531
|
+
*
|
|
17532
|
+
* @example
|
|
17533
|
+
* ```ts
|
|
17534
|
+
* defineAnnotation({
|
|
17535
|
+
* type: 'link',
|
|
17536
|
+
* render: ({annotation, children}) => (
|
|
17537
|
+
* <a href={(annotation as {href?: string}).href}>{children}</a>
|
|
17538
|
+
* ),
|
|
17539
|
+
* })
|
|
17540
|
+
* ```
|
|
17541
|
+
*/
|
|
17542
|
+
function defineAnnotation(config) {
|
|
17543
|
+
return {
|
|
17544
|
+
kind: "annotation",
|
|
17545
|
+
...config
|
|
17546
|
+
};
|
|
17547
|
+
}
|
|
17548
|
+
/**
|
|
17549
|
+
* @public
|
|
17550
|
+
*
|
|
17351
17551
|
* Define a non-editable block-level object renderer for a `_type`
|
|
17352
17552
|
* declared in the schema's `blockObjects` array.
|
|
17353
17553
|
*
|
|
@@ -17433,6 +17633,6 @@ function defineTextBlock(config) {
|
|
|
17433
17633
|
...config
|
|
17434
17634
|
};
|
|
17435
17635
|
}
|
|
17436
|
-
export { EditorProvider, PortableTextEditable, PortableTextEditor, defineBlockObject, defineContainer, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator, resolveContainerAt, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
|
|
17636
|
+
export { EditorProvider, PortableTextEditable, PortableTextEditor, defineAnnotation, defineBlockObject, defineContainer, defineDecorator, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator, resolveContainerAt, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
|
|
17437
17637
|
|
|
17438
17638
|
//# sourceMappingURL=index.js.map
|