@cyberyozh/text-editor 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor.css +1 -0
- package/dist/editor.css.map +1 -1
- package/dist/editor.js +122 -101
- package/dist/editor.js.map +1 -1
- package/dist/editor.mjs +126 -105
- package/dist/editor.mjs.map +1 -1
- package/dist/render.js +52 -43
- package/dist/render.js.map +1 -1
- package/dist/render.mjs +58 -49
- package/dist/render.mjs.map +1 -1
- package/dist/styles/index.css +1 -0
- package/package.json +42 -39
- package/src/editor/controls/bubble-menu-content.tsx +12 -3
- package/src/editor/controls/character-count.tsx +7 -4
- package/src/editor/dialogs/image-dialog/image-dialog.css +1 -0
- package/src/editor/dialogs/image-dialog/image-dialog.tsx +0 -1
- package/src/editor/editor.tsx +8 -3
- package/src/editor/handlers/dialog-handlers.ts +17 -31
- package/src/editor/handlers/insertion-handlers.ts +4 -25
- package/src/editor/handlers/markup-insertion.test.ts +132 -0
- package/src/editor/handlers/markup-insertion.ts +41 -0
- package/src/extensions/base/link.ts +22 -1
- package/src/utils/image-src-resolver.test.ts +54 -0
package/dist/render.js
CHANGED
|
@@ -459,9 +459,10 @@ var BaseCustomQuoteSign = import_core3.Node.create({
|
|
|
459
459
|
// src/extensions/base/link.ts
|
|
460
460
|
var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
461
461
|
var import_core4 = require("@tiptap/core");
|
|
462
|
+
var import_state3 = require("@tiptap/pm/state");
|
|
462
463
|
|
|
463
464
|
// node_modules/linkifyjs/dist/linkify.mjs
|
|
464
|
-
var encodedTlds = "
|
|
465
|
+
var encodedTlds = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
|
|
465
466
|
var encodedUtlds = "\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2";
|
|
466
467
|
var numeric = "numeric";
|
|
467
468
|
var ascii = "ascii";
|
|
@@ -1392,8 +1393,6 @@ function init$1({
|
|
|
1392
1393
|
ta(Email$1, groups.domain, EmailDomain);
|
|
1393
1394
|
tt(Email$1, DOT, EmailDomainDot);
|
|
1394
1395
|
tt(Email$1, HYPHEN, EmailDomainHyphen);
|
|
1395
|
-
const EmailColon = tt(Email$1, COLON);
|
|
1396
|
-
ta(EmailColon, groups.numeric, Email);
|
|
1397
1396
|
const DomainHyphen = tt(Domain, HYPHEN);
|
|
1398
1397
|
const DomainDot = tt(Domain, DOT);
|
|
1399
1398
|
tt(DomainHyphen, HYPHEN, DomainHyphen);
|
|
@@ -1457,11 +1456,11 @@ function init$1({
|
|
|
1457
1456
|
const [OPEN, CLOSE] = bracketPairs[i];
|
|
1458
1457
|
const UrlOpen = tt(Url$1, OPEN);
|
|
1459
1458
|
tt(UrlNonaccept, OPEN, UrlOpen);
|
|
1460
|
-
tt(UrlOpen, CLOSE, Url$1);
|
|
1461
1459
|
const UrlOpenQ = makeState(Url);
|
|
1462
1460
|
ta(UrlOpen, qsAccepting, UrlOpenQ);
|
|
1463
1461
|
const UrlOpenSyms = makeState();
|
|
1464
|
-
ta(UrlOpen, qsNonAccepting);
|
|
1462
|
+
ta(UrlOpen, qsNonAccepting, UrlOpenSyms);
|
|
1463
|
+
tt(UrlOpen, CLOSE, Url$1);
|
|
1465
1464
|
ta(UrlOpenQ, qsAccepting, UrlOpenQ);
|
|
1466
1465
|
ta(UrlOpenQ, qsNonAccepting, UrlOpenSyms);
|
|
1467
1466
|
ta(UrlOpenSyms, qsAccepting, UrlOpenQ);
|
|
@@ -1639,6 +1638,23 @@ var LinkExtension = import_extension_link.default.extend({
|
|
|
1639
1638
|
}
|
|
1640
1639
|
})
|
|
1641
1640
|
];
|
|
1641
|
+
},
|
|
1642
|
+
addProseMirrorPlugins() {
|
|
1643
|
+
return [
|
|
1644
|
+
...this.parent?.() ?? [],
|
|
1645
|
+
new import_state3.Plugin({
|
|
1646
|
+
props: {
|
|
1647
|
+
handleClick: (view, pos) => {
|
|
1648
|
+
if (!view.editable) return false;
|
|
1649
|
+
const range = (0, import_core4.getMarkRange)(view.state.doc.resolve(pos), this.type);
|
|
1650
|
+
if (!range) return false;
|
|
1651
|
+
const selection = import_state3.TextSelection.create(view.state.doc, range.from, range.to);
|
|
1652
|
+
view.dispatch(view.state.tr.setSelection(selection));
|
|
1653
|
+
return true;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
})
|
|
1657
|
+
];
|
|
1642
1658
|
}
|
|
1643
1659
|
}).configure({
|
|
1644
1660
|
openOnClick: false,
|
|
@@ -1685,7 +1701,7 @@ var BaseMythReality = import_core5.Node.create({
|
|
|
1685
1701
|
|
|
1686
1702
|
// src/extensions/base/prompt.ts
|
|
1687
1703
|
var import_core6 = require("@tiptap/core");
|
|
1688
|
-
var
|
|
1704
|
+
var import_state4 = require("@tiptap/pm/state");
|
|
1689
1705
|
var BasePrompt = import_core6.Node.create({
|
|
1690
1706
|
name: "prompt",
|
|
1691
1707
|
group: "block",
|
|
@@ -1717,7 +1733,7 @@ var BasePrompt = import_core6.Node.create({
|
|
|
1717
1733
|
const paragraphNode = schema.nodes.paragraph.createAndFill();
|
|
1718
1734
|
if (!paragraphNode) return false;
|
|
1719
1735
|
tr2.insert(posAfter, paragraphNode);
|
|
1720
|
-
tr2.setSelection(
|
|
1736
|
+
tr2.setSelection(import_state4.TextSelection.create(tr2.doc, posAfter + 1));
|
|
1721
1737
|
view.dispatch(tr2);
|
|
1722
1738
|
return true;
|
|
1723
1739
|
}
|
|
@@ -2093,21 +2109,8 @@ var BackgroundColor = import_core10.Extension.create({
|
|
|
2093
2109
|
default: null,
|
|
2094
2110
|
parseHTML: (element) => {
|
|
2095
2111
|
var _a;
|
|
2096
|
-
const
|
|
2097
|
-
|
|
2098
|
-
const decls = styleAttr.split(";").map((s) => s.trim()).filter(Boolean);
|
|
2099
|
-
for (let i = decls.length - 1; i >= 0; i -= 1) {
|
|
2100
|
-
const parts = decls[i].split(":");
|
|
2101
|
-
if (parts.length >= 2) {
|
|
2102
|
-
const prop = parts[0].trim().toLowerCase();
|
|
2103
|
-
const val = parts.slice(1).join(":").trim();
|
|
2104
|
-
if (prop === "background-color") {
|
|
2105
|
-
return val.replace(/['"]+/g, "");
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
return (_a = element.style.backgroundColor) == null ? void 0 : _a.replace(/['"]+/g, "");
|
|
2112
|
+
const value = (_a = (0, import_core10.getStyleProperty)(element, "background-color")) != null ? _a : element.style.backgroundColor;
|
|
2113
|
+
return value == null ? void 0 : value.replace(/['"]+/g, "");
|
|
2111
2114
|
},
|
|
2112
2115
|
renderHTML: (attributes) => {
|
|
2113
2116
|
if (!attributes.backgroundColor) {
|
|
@@ -2149,21 +2152,8 @@ var Color = import_core11.Extension.create({
|
|
|
2149
2152
|
default: null,
|
|
2150
2153
|
parseHTML: (element) => {
|
|
2151
2154
|
var _a;
|
|
2152
|
-
const
|
|
2153
|
-
|
|
2154
|
-
const decls = styleAttr.split(";").map((s) => s.trim()).filter(Boolean);
|
|
2155
|
-
for (let i = decls.length - 1; i >= 0; i -= 1) {
|
|
2156
|
-
const parts = decls[i].split(":");
|
|
2157
|
-
if (parts.length >= 2) {
|
|
2158
|
-
const prop = parts[0].trim().toLowerCase();
|
|
2159
|
-
const val = parts.slice(1).join(":").trim();
|
|
2160
|
-
if (prop === "color") {
|
|
2161
|
-
return val.replace(/['"]+/g, "");
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
}
|
|
2166
|
-
return (_a = element.style.color) == null ? void 0 : _a.replace(/['"]+/g, "");
|
|
2155
|
+
const value = (_a = (0, import_core11.getStyleProperty)(element, "color")) != null ? _a : element.style.color;
|
|
2156
|
+
return value == null ? void 0 : value.replace(/['"]+/g, "");
|
|
2167
2157
|
},
|
|
2168
2158
|
renderHTML: (attributes) => {
|
|
2169
2159
|
if (!attributes.color) {
|
|
@@ -2203,7 +2193,14 @@ var FontFamily = import_core12.Extension.create({
|
|
|
2203
2193
|
attributes: {
|
|
2204
2194
|
fontFamily: {
|
|
2205
2195
|
default: null,
|
|
2206
|
-
|
|
2196
|
+
// Prefer the raw inline `style` attribute so unquoted or
|
|
2197
|
+
// single-quoted multi-word names are preserved instead of being
|
|
2198
|
+
// canonicalized by `element.style.fontFamily`, which forces double
|
|
2199
|
+
// quotes that then get HTML-encoded to `"` on serialization.
|
|
2200
|
+
parseHTML: (element) => {
|
|
2201
|
+
var _a;
|
|
2202
|
+
return (_a = (0, import_core12.getStyleProperty)(element, "font-family")) != null ? _a : element.style.fontFamily;
|
|
2203
|
+
},
|
|
2207
2204
|
renderHTML: (attributes) => {
|
|
2208
2205
|
if (!attributes.fontFamily) {
|
|
2209
2206
|
return {};
|
|
@@ -2242,7 +2239,13 @@ var FontSize = import_core13.Extension.create({
|
|
|
2242
2239
|
attributes: {
|
|
2243
2240
|
fontSize: {
|
|
2244
2241
|
default: null,
|
|
2245
|
-
|
|
2242
|
+
// Prefer the raw inline `style` attribute so the original format
|
|
2243
|
+
// is preserved instead of the canonicalized value returned by
|
|
2244
|
+
// `element.style.fontSize`.
|
|
2245
|
+
parseHTML: (element) => {
|
|
2246
|
+
var _a;
|
|
2247
|
+
return (_a = (0, import_core13.getStyleProperty)(element, "font-size")) != null ? _a : element.style.fontSize;
|
|
2248
|
+
},
|
|
2246
2249
|
renderHTML: (attributes) => {
|
|
2247
2250
|
if (!attributes.fontSize) {
|
|
2248
2251
|
return {};
|
|
@@ -2281,7 +2284,13 @@ var LineHeight = import_core14.Extension.create({
|
|
|
2281
2284
|
attributes: {
|
|
2282
2285
|
lineHeight: {
|
|
2283
2286
|
default: null,
|
|
2284
|
-
|
|
2287
|
+
// Prefer the raw inline `style` attribute so the original format
|
|
2288
|
+
// is preserved instead of the canonicalized value returned by
|
|
2289
|
+
// `element.style.lineHeight`.
|
|
2290
|
+
parseHTML: (element) => {
|
|
2291
|
+
var _a;
|
|
2292
|
+
return (_a = (0, import_core14.getStyleProperty)(element, "line-height")) != null ? _a : element.style.lineHeight;
|
|
2293
|
+
},
|
|
2285
2294
|
renderHTML: (attributes) => {
|
|
2286
2295
|
if (!attributes.lineHeight) {
|
|
2287
2296
|
return {};
|
|
@@ -2334,7 +2343,7 @@ var TextStyleKit = import_core15.Extension.create({
|
|
|
2334
2343
|
|
|
2335
2344
|
// src/extensions/base/compatibility.ts
|
|
2336
2345
|
var import_core16 = require("@tiptap/core");
|
|
2337
|
-
var
|
|
2346
|
+
var import_state5 = require("@tiptap/pm/state");
|
|
2338
2347
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
|
|
2339
2348
|
var BaseLegacyBookAlert = import_core16.Node.create({
|
|
2340
2349
|
name: "calloutAlert",
|
|
@@ -2478,7 +2487,7 @@ var BaseLegacySEQuote = import_core16.Node.create({
|
|
|
2478
2487
|
const paragraphNode = schema.nodes.paragraph.createAndFill();
|
|
2479
2488
|
if (!paragraphNode) return false;
|
|
2480
2489
|
tr2.insert(posAfter, paragraphNode);
|
|
2481
|
-
tr2.setSelection(
|
|
2490
|
+
tr2.setSelection(import_state5.TextSelection.create(tr2.doc, posAfter + 1));
|
|
2482
2491
|
view.dispatch(tr2);
|
|
2483
2492
|
return true;
|
|
2484
2493
|
}
|
|
@@ -2526,7 +2535,7 @@ var BaseLegacyPromptSE = import_core16.Node.create({
|
|
|
2526
2535
|
const paragraphNode = schema.nodes.paragraph.createAndFill();
|
|
2527
2536
|
if (!paragraphNode) return false;
|
|
2528
2537
|
tr2.insert(posAfter, paragraphNode);
|
|
2529
|
-
tr2.setSelection(
|
|
2538
|
+
tr2.setSelection(import_state5.TextSelection.create(tr2.doc, posAfter + 1));
|
|
2530
2539
|
view.dispatch(tr2);
|
|
2531
2540
|
return true;
|
|
2532
2541
|
}
|