@clevertask/scribe 0.1.8 → 0.1.10
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 +10 -9
- package/dist/{BarMenu-BG_w4DVo.js → BarMenu-5S2vKAtc.js} +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +58 -44
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +1 -0
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +4 -2
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +11 -11
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +4 -4
- package/dist/components/Scribe/index.js +3 -3
- package/dist/dist-DErUltkU.js +3245 -0
- package/dist/{dist-BgEySLwo.js → dist-wYqYXEOz.js} +1 -1
- package/dist/{extension-BVGWENts.js → extension-6I5t1ZxQ.js} +1744 -2294
- package/dist/{extension-link-CMRfHUc5.js → extension-link-DJy7XDoj.js} +62 -62
- package/dist/{menus-D9OsP28c.js → menus-m_EkiaUN.js} +66 -66
- package/dist/{slashCommand-B6Iz1i0d.js → slashCommand-DuSH9sXJ.js} +46 -45
- package/dist/utils/index.js +2 -2
- package/package.json +3 -2
- package/dist/dist-BMKyBtRa.js +0 -7023
- package/dist/dist-FrapLVQu.js +0 -3513
- package/dist/tables-CXpUVKdw.js +0 -1347
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { M as e, N as t, _ as n, f as r, h as i, i as a, j as o, m as s, o as c, r as l, u } from "./dist-DErUltkU.js";
|
|
2
|
+
import { Plugin as d, PluginKey as f } from "@tiptap/pm/state";
|
|
3
3
|
//#region node_modules/.pnpm/linkifyjs@4.3.3/node_modules/linkifyjs/dist/linkify.mjs
|
|
4
4
|
var p = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2", m = "ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2", h = "numeric", g = "ascii", _ = "alpha", v = "asciinumeric", y = "alphanumeric", b = "domain", x = "emoji", ee = "scheme", S = "slashscheme", C = "whitespace";
|
|
5
5
|
function w(e, t) {
|
|
@@ -516,57 +516,57 @@ var bt = "[\0- \xA0 -\u2029 ]", xt = new RegExp(bt), St = RegExp(`$
|
|
|
516
516
|
function wt(e) {
|
|
517
517
|
return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
|
|
518
518
|
}
|
|
519
|
-
function Tt(
|
|
520
|
-
return new
|
|
521
|
-
key: new
|
|
522
|
-
appendTransaction: (
|
|
523
|
-
let s =
|
|
519
|
+
function Tt(e) {
|
|
520
|
+
return new d({
|
|
521
|
+
key: new f("autolink"),
|
|
522
|
+
appendTransaction: (t, a, o) => {
|
|
523
|
+
let s = t.some((e) => e.docChanged) && !a.doc.eq(o.doc), c = t.some((e) => e.getMeta("preventAutolink"));
|
|
524
524
|
if (!s || c) return;
|
|
525
|
-
let { tr: l } =
|
|
526
|
-
if (
|
|
527
|
-
let
|
|
528
|
-
if (
|
|
529
|
-
else if (
|
|
530
|
-
let
|
|
531
|
-
if (!St.test(
|
|
532
|
-
|
|
525
|
+
let { tr: l } = o, d = u(a.doc, [...t]);
|
|
526
|
+
if (i(d).forEach(({ newRange: t }) => {
|
|
527
|
+
let i = r(o.doc, t, (e) => e.isTextblock), a, s;
|
|
528
|
+
if (i.length > 1) a = i[0], s = o.doc.textBetween(a.pos, a.pos + a.node.nodeSize, void 0, " ");
|
|
529
|
+
else if (i.length) {
|
|
530
|
+
let e = o.doc.textBetween(t.from, t.to, " ", " ");
|
|
531
|
+
if (!St.test(e)) return;
|
|
532
|
+
a = i[0], s = o.doc.textBetween(a.pos, t.to, void 0, " ");
|
|
533
533
|
}
|
|
534
|
-
if (
|
|
535
|
-
let
|
|
536
|
-
if (
|
|
537
|
-
let
|
|
538
|
-
if (!
|
|
539
|
-
let c = vt(
|
|
534
|
+
if (a && s) {
|
|
535
|
+
let t = s.split(xt).filter(Boolean);
|
|
536
|
+
if (t.length <= 0) return !1;
|
|
537
|
+
let r = t[t.length - 1], i = a.pos + s.lastIndexOf(r);
|
|
538
|
+
if (!r) return !1;
|
|
539
|
+
let c = vt(r).map((t) => t.toObject(e.defaultProtocol));
|
|
540
540
|
if (!wt(c)) return !1;
|
|
541
541
|
c.filter((e) => e.isLink).map((e) => ({
|
|
542
542
|
...e,
|
|
543
|
-
from:
|
|
544
|
-
to:
|
|
545
|
-
})).filter((e) => !
|
|
546
|
-
|
|
543
|
+
from: i + e.start + 1,
|
|
544
|
+
to: i + e.end + 1
|
|
545
|
+
})).filter((e) => !o.schema.marks.code || !o.doc.rangeHasMark(e.from, e.to, o.schema.marks.code)).filter((t) => e.validate(t.value)).filter((t) => e.shouldAutoLink(t.value)).forEach((t) => {
|
|
546
|
+
n(t.from, t.to, o.doc).some((t) => t.mark.type === e.type) || l.addMark(t.from, t.to, e.type.create({ href: t.href }));
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
}), l.steps.length) return l;
|
|
550
550
|
}
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
|
-
function Et(
|
|
554
|
-
return new
|
|
555
|
-
key: new
|
|
556
|
-
props: { handleClick: (
|
|
557
|
-
if (r.button !== 0 || !
|
|
553
|
+
function Et(e) {
|
|
554
|
+
return new d({
|
|
555
|
+
key: new f("handleClickLink"),
|
|
556
|
+
props: { handleClick: (t, n, r) => {
|
|
557
|
+
if (r.button !== 0 || !t.editable) return !1;
|
|
558
558
|
let i = null;
|
|
559
559
|
if (r.target instanceof HTMLAnchorElement) i = r.target;
|
|
560
560
|
else {
|
|
561
|
-
let
|
|
562
|
-
if (!
|
|
563
|
-
let
|
|
564
|
-
i =
|
|
561
|
+
let t = r.target;
|
|
562
|
+
if (!t) return !1;
|
|
563
|
+
let n = e.editor.view.dom;
|
|
564
|
+
i = t.closest("a"), i && !n.contains(i) && (i = null);
|
|
565
565
|
}
|
|
566
566
|
if (!i) return !1;
|
|
567
567
|
let a = !1;
|
|
568
|
-
if (
|
|
569
|
-
let
|
|
568
|
+
if (e.enableClickSelection && (a = e.editor.commands.extendMarkRange(e.type.name)), e.openOnClick) {
|
|
569
|
+
let n = s(t.state, e.type.name), r = i.href ?? n.href, o = i.target ?? n.target;
|
|
570
570
|
r && (window.open(r, o), a = !0);
|
|
571
571
|
}
|
|
572
572
|
return a;
|
|
@@ -623,7 +623,7 @@ function Pt(e) {
|
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
625
|
function Ft(e) {
|
|
626
|
-
let t =
|
|
626
|
+
let t = o({
|
|
627
627
|
find: (t) => {
|
|
628
628
|
let n = Dt.exec(t);
|
|
629
629
|
return !n || !jt(t, n, e.isAllowedHref) ? null : Mt(n);
|
|
@@ -631,7 +631,7 @@ function Ft(e) {
|
|
|
631
631
|
type: e.type,
|
|
632
632
|
getAttributes: Pt
|
|
633
633
|
});
|
|
634
|
-
return new
|
|
634
|
+
return new l({
|
|
635
635
|
find: t.find,
|
|
636
636
|
handler: (e) => {
|
|
637
637
|
let n = t.handler(e);
|
|
@@ -639,37 +639,37 @@ function Ft(e) {
|
|
|
639
639
|
}
|
|
640
640
|
});
|
|
641
641
|
}
|
|
642
|
-
function It(
|
|
643
|
-
let
|
|
644
|
-
find: (
|
|
642
|
+
function It(t) {
|
|
643
|
+
let n = e({
|
|
644
|
+
find: (e) => {
|
|
645
645
|
let n = [];
|
|
646
|
-
for (let r of
|
|
647
|
-
let r = (
|
|
646
|
+
for (let r of e.matchAll(Ot)) jt(e, r, t.isAllowedHref) && n.push(Mt(r));
|
|
647
|
+
let r = (t.findPlainUrls?.call(t, e) ?? []).filter((e) => !n.some((t) => Nt(t, e)));
|
|
648
648
|
return [...n, ...r];
|
|
649
649
|
},
|
|
650
|
-
type:
|
|
650
|
+
type: t.type,
|
|
651
651
|
getAttributes: Pt
|
|
652
652
|
});
|
|
653
|
-
return new
|
|
654
|
-
find:
|
|
653
|
+
return new c({
|
|
654
|
+
find: n.find,
|
|
655
655
|
handler: (e) => {
|
|
656
|
-
let
|
|
657
|
-
return
|
|
656
|
+
let t = n.handler(e);
|
|
657
|
+
return t !== null && e.state.tr.steps.length && e.match.data?.markdown && e.state.tr.setMeta("preventAutolink", !0), t;
|
|
658
658
|
}
|
|
659
659
|
});
|
|
660
660
|
}
|
|
661
|
-
function Lt(
|
|
662
|
-
return new
|
|
663
|
-
key: new
|
|
664
|
-
props: { handlePaste: (
|
|
665
|
-
let { shouldAutoLink: i } =
|
|
661
|
+
function Lt(e) {
|
|
662
|
+
return new d({
|
|
663
|
+
key: new f("handlePasteLink"),
|
|
664
|
+
props: { handlePaste: (t, n, r) => {
|
|
665
|
+
let { shouldAutoLink: i } = e, { state: a } = t, { selection: o } = a, { empty: s } = o;
|
|
666
666
|
if (s) return !1;
|
|
667
667
|
let c = "";
|
|
668
668
|
r.content.forEach((e) => {
|
|
669
669
|
c += e.textContent;
|
|
670
670
|
});
|
|
671
|
-
let l = yt(c, { defaultProtocol:
|
|
672
|
-
return !c || !l || i !== void 0 && !i(l.value) ? !1 :
|
|
671
|
+
let l = yt(c, { defaultProtocol: e.defaultProtocol }).find((e) => e.isLink && e.value === c);
|
|
672
|
+
return !c || !l || i !== void 0 && !i(l.value) ? !1 : e.editor.commands.setMark(e.type, { href: l.href });
|
|
673
673
|
} }
|
|
674
674
|
});
|
|
675
675
|
}
|
|
@@ -691,7 +691,7 @@ function $(e, t) {
|
|
|
691
691
|
t && n.push(t);
|
|
692
692
|
}), !e || e.replace(Ct, "").match(RegExp(`^(?:(?:${n.map((e) => e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`, "i"));
|
|
693
693
|
}
|
|
694
|
-
var Rt =
|
|
694
|
+
var Rt = a.create({
|
|
695
695
|
name: "link",
|
|
696
696
|
priority: 1e3,
|
|
697
697
|
keepOnSplit: !1,
|
|
@@ -769,11 +769,11 @@ var Rt = s.create({
|
|
|
769
769
|
defaultProtocol: this.options.defaultProtocol
|
|
770
770
|
}) ? [
|
|
771
771
|
"a",
|
|
772
|
-
|
|
772
|
+
t(this.options.HTMLAttributes, e),
|
|
773
773
|
0
|
|
774
774
|
] : [
|
|
775
775
|
"a",
|
|
776
|
-
|
|
776
|
+
t(this.options.HTMLAttributes, {
|
|
777
777
|
...e,
|
|
778
778
|
href: ""
|
|
779
779
|
}),
|
|
@@ -821,7 +821,7 @@ var Rt = s.create({
|
|
|
821
821
|
})] : [];
|
|
822
822
|
},
|
|
823
823
|
addPasteRules() {
|
|
824
|
-
let
|
|
824
|
+
let t = (e) => {
|
|
825
825
|
let t = [];
|
|
826
826
|
if (e) {
|
|
827
827
|
let { protocols: n, defaultProtocol: r } = this.options;
|
|
@@ -846,9 +846,9 @@ var Rt = s.create({
|
|
|
846
846
|
protocols: this.options.protocols,
|
|
847
847
|
defaultProtocol: this.options.defaultProtocol
|
|
848
848
|
}),
|
|
849
|
-
findPlainUrls:
|
|
850
|
-
})] : [
|
|
851
|
-
find:
|
|
849
|
+
findPlainUrls: t
|
|
850
|
+
})] : [e({
|
|
851
|
+
find: t,
|
|
852
852
|
type: this.type,
|
|
853
853
|
getAttributes: (e) => ({ href: e.data?.href })
|
|
854
854
|
})];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { r as e } from "./dist-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
1
|
+
import { r as e } from "./dist-wYqYXEOz.js";
|
|
2
|
+
import { A as t, C as n, I as r, S as i, n as a } from "./dist-DErUltkU.js";
|
|
3
|
+
import { a as o, c as s, i as c, l, n as u, o as d, s as f, t as p, u as m } from "./floating-ui.dom-CmJ6iBdh.js";
|
|
4
|
+
import h, { useEffect as g, useLayoutEffect as _, useRef as v, useState as y } from "react";
|
|
5
|
+
import { createPortal as b } from "react-dom";
|
|
6
|
+
import { NodeSelection as x, Plugin as S, PluginKey as C } from "@tiptap/pm/state";
|
|
7
|
+
import { CellSelection as w } from "@tiptap/pm/tables";
|
|
8
8
|
//#region node_modules/.pnpm/@tiptap+extension-bubble-menu@3.29.2_@tiptap+core@3.29.2_@tiptap+pm@3.29.2__@tiptap+pm@3.29.2/node_modules/@tiptap/extension-bubble-menu/dist/index.js
|
|
9
9
|
function T(e, t) {
|
|
10
10
|
let n = Math.min(e.top, t.top), r = Math.max(e.bottom, t.bottom), i = Math.min(e.left, t.left), a = Math.max(e.right, t.right) - i, o = r - n;
|
|
11
11
|
return new DOMRect(i, n, a, o);
|
|
12
12
|
}
|
|
13
13
|
var E = class {
|
|
14
|
-
constructor({ editor: e, element:
|
|
14
|
+
constructor({ editor: e, element: n, view: r, pluginKey: i = "bubbleMenu", updateDelay: a = 250, resizeDelay: o = 60, shouldShow: s, appendTo: c, getReferencedVirtualElement: l, options: u }) {
|
|
15
15
|
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
|
|
16
16
|
strategy: "absolute",
|
|
17
17
|
placement: "top",
|
|
@@ -27,8 +27,8 @@ var E = class {
|
|
|
27
27
|
onHide: void 0,
|
|
28
28
|
onUpdate: void 0,
|
|
29
29
|
onDestroy: void 0
|
|
30
|
-
}, this.shouldShow = ({ view: e, state:
|
|
31
|
-
let { doc: a, selection: o } =
|
|
30
|
+
}, this.shouldShow = ({ view: e, state: n, from: r, to: i }) => {
|
|
31
|
+
let { doc: a, selection: o } = n, { empty: s } = o, c = !a.textBetween(r, i).length && t(n.selection), l = this.element.contains(document.activeElement);
|
|
32
32
|
return !(!(e.hasFocus() || l) || s || c || !this.editor.isEditable);
|
|
33
33
|
}, this.mousedownHandler = () => {
|
|
34
34
|
this.preventHide = !0;
|
|
@@ -67,31 +67,31 @@ var E = class {
|
|
|
67
67
|
}, this.transactionHandler = ({ transaction: e }) => {
|
|
68
68
|
let t = e.getMeta(this.pluginKey);
|
|
69
69
|
t === "updatePosition" ? this.updatePosition() : t && typeof t == "object" && t.type === "updateOptions" ? this.updateOptions(t.options) : t === "hide" ? this.hide() : t === "show" && (this.updatePosition(), this.show());
|
|
70
|
-
}, this.editor = e, this.element =
|
|
70
|
+
}, this.editor = e, this.element = n, this.view = r, this.pluginKey = i, this.updateDelay = a, this.resizeDelay = o, this.appendTo = c, this.scrollTarget = u?.scrollTarget ?? window, this.getReferencedVirtualElement = l, this.floatingUIOptions = {
|
|
71
71
|
...this.floatingUIOptions,
|
|
72
72
|
...u
|
|
73
|
-
}, this.element.tabIndex = 0, s && (this.shouldShow = s), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(
|
|
73
|
+
}, this.element.tabIndex = 0, s && (this.shouldShow = s), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(r, r.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
74
74
|
}
|
|
75
75
|
get middlewares() {
|
|
76
76
|
let e = [];
|
|
77
|
-
return this.floatingUIOptions.flip && e.push(
|
|
77
|
+
return this.floatingUIOptions.flip && e.push(o(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(l(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(s(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(p(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(m(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(u(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(d(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(f(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
|
|
78
78
|
}
|
|
79
79
|
get virtualElement() {
|
|
80
80
|
let { selection: e } = this.editor.state, t = this.getReferencedVirtualElement?.call(this);
|
|
81
81
|
if (t) return t;
|
|
82
82
|
if (!this.view?.dom?.parentNode) return;
|
|
83
|
-
let n =
|
|
83
|
+
let n = r(this.view, e.from, e.to), i = {
|
|
84
84
|
getBoundingClientRect: () => n,
|
|
85
85
|
getClientRects: () => [n]
|
|
86
86
|
};
|
|
87
|
-
if (e instanceof
|
|
87
|
+
if (e instanceof x) {
|
|
88
88
|
let t = this.view.nodeDOM(e.from), n = t.dataset.nodeViewWrapper ? t : t.querySelector("[data-node-view-wrapper]");
|
|
89
89
|
n && (t = n), t && (i = {
|
|
90
90
|
getBoundingClientRect: () => t.getBoundingClientRect(),
|
|
91
91
|
getClientRects: () => [t.getBoundingClientRect()]
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
if (e instanceof
|
|
94
|
+
if (e instanceof w) {
|
|
95
95
|
let { $anchorCell: t, $headCell: n } = e, r = t ? t.pos : n.pos, a = n ? n.pos : t.pos, o = this.view.nodeDOM(r), s = this.view.nodeDOM(a);
|
|
96
96
|
if (!o || !s) return;
|
|
97
97
|
let c = o === s ? o.getBoundingClientRect() : T(o.getBoundingClientRect(), s.getBoundingClientRect());
|
|
@@ -105,7 +105,7 @@ var E = class {
|
|
|
105
105
|
updatePosition() {
|
|
106
106
|
if (!this.isVisible) return;
|
|
107
107
|
let e = this.virtualElement;
|
|
108
|
-
e &&
|
|
108
|
+
e && c(e, this.element, {
|
|
109
109
|
placement: this.floatingUIOptions.placement,
|
|
110
110
|
strategy: this.floatingUIOptions.strategy,
|
|
111
111
|
middleware: this.middlewares
|
|
@@ -159,14 +159,14 @@ var E = class {
|
|
|
159
159
|
destroy() {
|
|
160
160
|
this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
|
|
161
161
|
}
|
|
162
|
-
}, D = (e) => new
|
|
163
|
-
key: typeof e.pluginKey == "string" ? new
|
|
162
|
+
}, D = (e) => new S({
|
|
163
|
+
key: typeof e.pluginKey == "string" ? new C(e.pluginKey) : e.pluginKey,
|
|
164
164
|
view: (t) => new E({
|
|
165
165
|
view: t,
|
|
166
166
|
...e
|
|
167
167
|
})
|
|
168
168
|
});
|
|
169
|
-
|
|
169
|
+
a.create({
|
|
170
170
|
name: "bubbleMenu",
|
|
171
171
|
addOptions() {
|
|
172
172
|
return {
|
|
@@ -240,11 +240,11 @@ var O = class {
|
|
|
240
240
|
}, this.element.tabIndex = 0, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
241
241
|
}
|
|
242
242
|
getTextContent(e) {
|
|
243
|
-
return
|
|
243
|
+
return i(e, { textSerializers: n(this.editor.schema) });
|
|
244
244
|
}
|
|
245
245
|
get middlewares() {
|
|
246
246
|
let e = [];
|
|
247
|
-
return this.floatingUIOptions.flip && e.push(
|
|
247
|
+
return this.floatingUIOptions.flip && e.push(o(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(l(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(s(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(p(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(m(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(u(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(d(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(f(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
|
|
248
248
|
}
|
|
249
249
|
getShouldShow(e) {
|
|
250
250
|
let { state: t } = this.view, { selection: n } = t, { ranges: r } = n, i = Math.min(...r.map((e) => e.$from.pos)), a = Math.max(...r.map((e) => e.$to.pos));
|
|
@@ -268,8 +268,8 @@ var O = class {
|
|
|
268
268
|
}
|
|
269
269
|
updatePosition() {
|
|
270
270
|
if (!this.view?.dom?.parentNode) return;
|
|
271
|
-
let { selection: e } = this.editor.state, t =
|
|
272
|
-
|
|
271
|
+
let { selection: e } = this.editor.state, t = r(this.view, e.from, e.to);
|
|
272
|
+
c({
|
|
273
273
|
getBoundingClientRect: () => t,
|
|
274
274
|
getClientRects: () => [t]
|
|
275
275
|
}, this.element, {
|
|
@@ -298,14 +298,14 @@ var O = class {
|
|
|
298
298
|
destroy() {
|
|
299
299
|
this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
|
|
300
300
|
}
|
|
301
|
-
}, k = (e) => new
|
|
302
|
-
key: typeof e.pluginKey == "string" ? new
|
|
301
|
+
}, k = (e) => new S({
|
|
302
|
+
key: typeof e.pluginKey == "string" ? new C(e.pluginKey) : e.pluginKey,
|
|
303
303
|
view: (t) => new O({
|
|
304
304
|
view: t,
|
|
305
305
|
...e
|
|
306
306
|
})
|
|
307
307
|
});
|
|
308
|
-
|
|
308
|
+
a.create({
|
|
309
309
|
name: "floatingMenu",
|
|
310
310
|
addOptions() {
|
|
311
311
|
return {
|
|
@@ -336,10 +336,10 @@ c.create({
|
|
|
336
336
|
});
|
|
337
337
|
//#endregion
|
|
338
338
|
//#region node_modules/.pnpm/@tiptap+react@3.29.2_@floating-ui+dom@1.8.0_@tiptap+core@3.29.2_@tiptap+pm@3.29.2__@tip_6ae02cdf395ababc98513a112803373d/node_modules/@tiptap/react/dist/menus/index.js
|
|
339
|
-
function A(e,
|
|
340
|
-
return e ?? new t
|
|
339
|
+
function A(e, t) {
|
|
340
|
+
return e ?? new C(t);
|
|
341
341
|
}
|
|
342
|
-
var j = typeof window < "u" ?
|
|
342
|
+
var j = typeof window < "u" ? _ : g, M = /* @__PURE__ */ new Set([
|
|
343
343
|
"left",
|
|
344
344
|
"opacity",
|
|
345
345
|
"position",
|
|
@@ -507,7 +507,7 @@ function Q(e, t, n) {
|
|
|
507
507
|
}), r;
|
|
508
508
|
}
|
|
509
509
|
function $(e, t) {
|
|
510
|
-
let n =
|
|
510
|
+
let n = v({}), r = v([]);
|
|
511
511
|
j(() => {
|
|
512
512
|
let i = n.current;
|
|
513
513
|
return X(e, i.className, t.className), Z(e, i.style, t.style), Y(e, i, t), r.current = Q(e, r.current, t), n.current = t, () => {
|
|
@@ -517,10 +517,10 @@ function $(e, t) {
|
|
|
517
517
|
};
|
|
518
518
|
}, [e, t]);
|
|
519
519
|
}
|
|
520
|
-
var te =
|
|
521
|
-
let f =
|
|
520
|
+
var te = h.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i, appendTo: a, shouldShow: o = null, getReferencedVirtualElement: s, options: c, children: l, ...u }, d) => {
|
|
521
|
+
let f = v(document.createElement("div")), p = v(A(t, "bubbleMenu")).current;
|
|
522
522
|
$(f.current, u), typeof d == "function" ? d(f.current) : d && (d.current = f.current);
|
|
523
|
-
let { editor: m } = e(), h = n || m,
|
|
523
|
+
let { editor: m } = e(), h = n || m, _ = {
|
|
524
524
|
updateDelay: r,
|
|
525
525
|
resizeDelay: i,
|
|
526
526
|
appendTo: a,
|
|
@@ -528,10 +528,10 @@ var te = y.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i
|
|
|
528
528
|
shouldShow: o,
|
|
529
529
|
getReferencedVirtualElement: s,
|
|
530
530
|
options: c
|
|
531
|
-
},
|
|
532
|
-
|
|
533
|
-
let [
|
|
534
|
-
return
|
|
531
|
+
}, x = v(_);
|
|
532
|
+
x.current = _;
|
|
533
|
+
let [S, C] = y(!1), w = v(!0);
|
|
534
|
+
return g(() => {
|
|
535
535
|
if (h?.isDestroyed) return;
|
|
536
536
|
if (!h) {
|
|
537
537
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
@@ -540,30 +540,30 @@ var te = y.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i
|
|
|
540
540
|
let e = f.current;
|
|
541
541
|
e.style.visibility = "hidden", e.style.position = "absolute";
|
|
542
542
|
let t = D({
|
|
543
|
-
...
|
|
543
|
+
...x.current,
|
|
544
544
|
editor: h,
|
|
545
545
|
element: e
|
|
546
546
|
});
|
|
547
547
|
h.registerPlugin(t);
|
|
548
|
-
let n =
|
|
549
|
-
return
|
|
550
|
-
|
|
548
|
+
let n = x.current.pluginKey;
|
|
549
|
+
return w.current = !0, C(!0), () => {
|
|
550
|
+
C(!1), h.unregisterPlugin(n), window.requestAnimationFrame(() => {
|
|
551
551
|
e.parentNode && e.parentNode.removeChild(e);
|
|
552
552
|
});
|
|
553
553
|
};
|
|
554
|
-
}, [h]),
|
|
555
|
-
if (!(!
|
|
556
|
-
if (
|
|
557
|
-
|
|
554
|
+
}, [h]), g(() => {
|
|
555
|
+
if (!(!S || !h || h.isDestroyed)) {
|
|
556
|
+
if (w.current) {
|
|
557
|
+
w.current = !1;
|
|
558
558
|
return;
|
|
559
559
|
}
|
|
560
560
|
h.view.dispatch(h.state.tr.setMeta(p, {
|
|
561
561
|
type: "updateOptions",
|
|
562
|
-
options:
|
|
562
|
+
options: x.current
|
|
563
563
|
}));
|
|
564
564
|
}
|
|
565
565
|
}, [
|
|
566
|
-
|
|
566
|
+
S,
|
|
567
567
|
h,
|
|
568
568
|
r,
|
|
569
569
|
i,
|
|
@@ -572,10 +572,10 @@ var te = y.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i
|
|
|
572
572
|
a,
|
|
573
573
|
s,
|
|
574
574
|
p
|
|
575
|
-
]),
|
|
575
|
+
]), b(l, f.current);
|
|
576
576
|
});
|
|
577
|
-
|
|
578
|
-
let d =
|
|
577
|
+
h.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i, appendTo: a, shouldShow: o = null, options: s, children: c, ...l }, u) => {
|
|
578
|
+
let d = v(document.createElement("div")), f = v(A(t, "floatingMenu")).current;
|
|
579
579
|
$(d.current, l), typeof u == "function" ? u(d.current) : u && (u.current = d.current);
|
|
580
580
|
let { editor: p } = e(), m = n || p, h = {
|
|
581
581
|
updateDelay: r,
|
|
@@ -584,10 +584,10 @@ y.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i, appendT
|
|
|
584
584
|
pluginKey: f,
|
|
585
585
|
shouldShow: o,
|
|
586
586
|
options: s
|
|
587
|
-
},
|
|
588
|
-
|
|
589
|
-
let [
|
|
590
|
-
return
|
|
587
|
+
}, _ = v(h);
|
|
588
|
+
_.current = h;
|
|
589
|
+
let [x, S] = y(!1), C = v(!0);
|
|
590
|
+
return g(() => {
|
|
591
591
|
if (m?.isDestroyed) return;
|
|
592
592
|
if (!m) {
|
|
593
593
|
console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
@@ -596,30 +596,30 @@ y.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i, appendT
|
|
|
596
596
|
let e = d.current;
|
|
597
597
|
e.style.visibility = "hidden", e.style.position = "absolute";
|
|
598
598
|
let t = k({
|
|
599
|
-
...
|
|
599
|
+
..._.current,
|
|
600
600
|
editor: m,
|
|
601
601
|
element: e
|
|
602
602
|
});
|
|
603
603
|
m.registerPlugin(t);
|
|
604
|
-
let n =
|
|
605
|
-
return
|
|
606
|
-
|
|
604
|
+
let n = _.current.pluginKey;
|
|
605
|
+
return C.current = !0, S(!0), () => {
|
|
606
|
+
S(!1), m.unregisterPlugin(n), window.requestAnimationFrame(() => {
|
|
607
607
|
e.parentNode && e.parentNode.removeChild(e);
|
|
608
608
|
});
|
|
609
609
|
};
|
|
610
|
-
}, [m]),
|
|
611
|
-
if (!(!
|
|
612
|
-
if (
|
|
613
|
-
|
|
610
|
+
}, [m]), g(() => {
|
|
611
|
+
if (!(!x || !m || m.isDestroyed)) {
|
|
612
|
+
if (C.current) {
|
|
613
|
+
C.current = !1;
|
|
614
614
|
return;
|
|
615
615
|
}
|
|
616
616
|
m.view.dispatch(m.state.tr.setMeta(f, {
|
|
617
617
|
type: "updateOptions",
|
|
618
|
-
options:
|
|
618
|
+
options: _.current
|
|
619
619
|
}));
|
|
620
620
|
}
|
|
621
621
|
}, [
|
|
622
|
-
|
|
622
|
+
x,
|
|
623
623
|
m,
|
|
624
624
|
r,
|
|
625
625
|
i,
|
|
@@ -627,7 +627,7 @@ y.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i, appendT
|
|
|
627
627
|
s,
|
|
628
628
|
a,
|
|
629
629
|
f
|
|
630
|
-
]),
|
|
630
|
+
]), b(c, d.current);
|
|
631
631
|
});
|
|
632
632
|
//#endregion
|
|
633
633
|
export { te as t };
|