@fileverse-dev/ddoc 2.1.1-patch-6 → 2.1.1-patch-7
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/index.es.js +281 -263
- package/dist/package/{components → extensions/slash-command}/slash-comand.d.ts +1 -1
- package/dist/package/extensions/slash-command/slash-command-utils.d.ts +15 -0
- package/dist/package/extensions/slash-command/types.d.ts +13 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -79628,117 +79628,135 @@ const m5 = [
|
|
79628
79628
|
const r = n.contentDocument || ((o = n.contentWindow) == null ? void 0 : o.document);
|
79629
79629
|
if (!r) return;
|
79630
79630
|
const i = `
|
79631
|
-
|
79632
|
-
|
79633
|
-
|
79634
|
-
|
79635
|
-
|
79636
|
-
|
79637
|
-
|
79638
|
-
}
|
79639
|
-
|
79640
|
-
|
79641
|
-
|
79642
|
-
|
79643
|
-
|
79644
|
-
|
79645
|
-
|
79646
|
-
|
79647
|
-
}
|
79648
|
-
|
79649
|
-
body {
|
79650
|
-
-webkit-print-color-adjust: exact;
|
79651
|
-
print-color-adjust: exact;
|
79652
|
-
}
|
79653
|
-
body:before, body:after,
|
79654
|
-
head:before, head:after,
|
79655
|
-
div:before, div:after {
|
79656
|
-
content: none !important;
|
79657
|
-
display: none !important;
|
79658
|
-
}
|
79659
|
-
html:before, html:after,
|
79660
|
-
}
|
79661
|
-
body {
|
79662
|
-
font-family: Arial, sans-serif;
|
79663
|
-
line-height: 1.6;
|
79664
|
-
margin: 0;
|
79665
|
-
}
|
79666
|
-
img {
|
79667
|
-
max-width: 100%;
|
79668
|
-
height: auto;
|
79669
|
-
}
|
79670
|
-
h3 {
|
79671
|
-
font-weight: 600;
|
79672
|
-
color: #0D0D0D;
|
79673
|
-
font-size: 20px;
|
79674
|
-
line-height: 1.2;
|
79675
|
-
}
|
79676
|
-
p {
|
79677
|
-
line-height: 1.5;
|
79678
|
-
color: #0D0D0D;
|
79679
|
-
font-size: 16px;
|
79680
|
-
}
|
79681
|
-
|
79682
|
-
/* Lists */
|
79683
|
-
ul, ol {
|
79684
|
-
font-size: 16px;
|
79685
|
-
line-height: 1.5;
|
79686
|
-
margin: 0 0 16px 0;
|
79687
|
-
padding-left: 24px;
|
79688
|
-
}
|
79689
|
-
li {
|
79690
|
-
margin-bottom: 8px;
|
79691
|
-
}
|
79692
|
-
/* Tables */
|
79693
|
-
table {
|
79694
|
-
width: 100%;
|
79695
|
-
border-collapse: collapse;
|
79696
|
-
margin: 16px 0;
|
79697
|
-
font-size: 16px;
|
79698
|
-
}
|
79699
|
-
th {
|
79700
|
-
background: #F8F9FA;
|
79701
|
-
font-weight: 600;
|
79702
|
-
text-align: left;
|
79703
|
-
}
|
79704
|
-
td, th {
|
79705
|
-
border: 1px solid #E8EBEC;
|
79706
|
-
padding: 12px;
|
79707
|
-
}
|
79708
|
-
/* Code blocks */
|
79709
|
-
pre {
|
79710
|
-
background: #F8F9FA;
|
79711
|
-
padding: 16px;
|
79712
|
-
border-radius: 4px;
|
79713
|
-
font-family: monospace;
|
79714
|
-
font-size: 16px;
|
79715
|
-
margin: 16px 0;
|
79631
|
+
<!DOCTYPE html>
|
79632
|
+
<html>
|
79633
|
+
<head>
|
79634
|
+
<title>Print Preview</title>
|
79635
|
+
<style>
|
79636
|
+
@page {
|
79637
|
+
margin: 0.3in 0.5in 0.3in 0.5in !important;
|
79638
|
+
}
|
79639
|
+
@page :first {
|
79640
|
+
margin: -0.25in 0.5in 0.3in 0.5in !important;
|
79641
|
+
}
|
79642
|
+
@media print {
|
79643
|
+
@page { margin: 0; }
|
79644
|
+
html {
|
79645
|
+
-webkit-print-color-adjust: exact;
|
79646
|
+
print-color-adjust: exact;
|
79716
79647
|
}
|
79717
|
-
|
79718
|
-
|
79719
|
-
|
79720
|
-
margin: 16px 0;
|
79721
|
-
padding-left: 16px;
|
79722
|
-
font-style: italic;
|
79723
|
-
}
|
79724
|
-
body {
|
79725
|
-
padding: 10mm;
|
79648
|
+
body {
|
79649
|
+
-webkit-print-color-adjust: exact;
|
79650
|
+
print-color-adjust: exact;
|
79726
79651
|
}
|
79727
|
-
|
79728
|
-
|
79729
|
-
|
79730
|
-
|
79731
|
-
|
79732
|
-
window.onload = () => {
|
79733
|
-
window.print();
|
79734
|
-
window.onafterprint = () => {
|
79735
|
-
window.close();
|
79736
|
-
};
|
79652
|
+
body:before, body:after,
|
79653
|
+
head:before, head:after,
|
79654
|
+
div:before, div:after {
|
79655
|
+
content: none !important;
|
79656
|
+
display: none !important;
|
79737
79657
|
}
|
79738
|
-
|
79739
|
-
|
79740
|
-
|
79741
|
-
|
79658
|
+
html:before, html:after,
|
79659
|
+
}
|
79660
|
+
body {
|
79661
|
+
font-family: Arial, sans-serif;
|
79662
|
+
line-height: 1.6;
|
79663
|
+
margin: 0;
|
79664
|
+
}
|
79665
|
+
img {
|
79666
|
+
max-width: 100%;
|
79667
|
+
height: auto;
|
79668
|
+
}
|
79669
|
+
h3 {
|
79670
|
+
font-weight: 600;
|
79671
|
+
color: #0D0D0D;
|
79672
|
+
font-size: 20px;
|
79673
|
+
line-height: 1.2;
|
79674
|
+
}
|
79675
|
+
p {
|
79676
|
+
line-height: 1.5;
|
79677
|
+
color: #0D0D0D;
|
79678
|
+
font-size: 16px;
|
79679
|
+
}
|
79680
|
+
/* Lists */
|
79681
|
+
ul, ol {
|
79682
|
+
font-size: 16px;
|
79683
|
+
line-height: 1.5;
|
79684
|
+
margin: 0 0 16px 0;
|
79685
|
+
padding-left: 24px;
|
79686
|
+
}
|
79687
|
+
li {
|
79688
|
+
margin-bottom: 8px;
|
79689
|
+
}
|
79690
|
+
ol {
|
79691
|
+
list-style-type: decimal;
|
79692
|
+
}
|
79693
|
+
ol ol {
|
79694
|
+
list-style-type: lower-latin;
|
79695
|
+
}
|
79696
|
+
ol ol ol {
|
79697
|
+
list-style-type: lower-roman;
|
79698
|
+
}
|
79699
|
+
li:has(input[type="checkbox"]) {
|
79700
|
+
list-style-type: none;
|
79701
|
+
display: flex;
|
79702
|
+
align-items: center;
|
79703
|
+
}
|
79704
|
+
li > input[type="checkbox"]::marker {
|
79705
|
+
content: '';
|
79706
|
+
}
|
79707
|
+
input[type="checkbox"] {
|
79708
|
+
margin-right: 10px;
|
79709
|
+
}
|
79710
|
+
/* Tables */
|
79711
|
+
table {
|
79712
|
+
width: 100%;
|
79713
|
+
border-collapse: collapse;
|
79714
|
+
margin: 16px 0;
|
79715
|
+
font-size: 16px;
|
79716
|
+
}
|
79717
|
+
th {
|
79718
|
+
background: #F8F9FA;
|
79719
|
+
font-weight: 600;
|
79720
|
+
text-align: left;
|
79721
|
+
}
|
79722
|
+
td, th {
|
79723
|
+
border: 1px solid #E8EBEC;
|
79724
|
+
padding: 12px;
|
79725
|
+
}
|
79726
|
+
/* Code blocks */
|
79727
|
+
pre {
|
79728
|
+
background: #F8F9FA;
|
79729
|
+
padding: 16px;
|
79730
|
+
border-radius: 4px;
|
79731
|
+
font-family: monospace;
|
79732
|
+
font-size: 16px;
|
79733
|
+
margin: 16px 0;
|
79734
|
+
}
|
79735
|
+
/* Blockquotes */
|
79736
|
+
blockquote {
|
79737
|
+
border-left: 4px solid #E8EBEC;
|
79738
|
+
margin: 16px 0;
|
79739
|
+
padding-left: 16px;
|
79740
|
+
font-style: italic;
|
79741
|
+
}
|
79742
|
+
body {
|
79743
|
+
padding: 10mm;
|
79744
|
+
}
|
79745
|
+
</style>
|
79746
|
+
</head>
|
79747
|
+
<body>
|
79748
|
+
${t}
|
79749
|
+
<script>
|
79750
|
+
window.onload = () => {
|
79751
|
+
window.print();
|
79752
|
+
window.onafterprint = () => {
|
79753
|
+
window.close();
|
79754
|
+
};
|
79755
|
+
}
|
79756
|
+
<\/script>
|
79757
|
+
</body>
|
79758
|
+
</html>
|
79759
|
+
`;
|
79742
79760
|
r.open(), r.write(i), r.close();
|
79743
79761
|
const s = n.contentWindow;
|
79744
79762
|
s && (s.onafterprint = () => {
|
@@ -136852,156 +136870,7 @@ const qmt = async (t, e) => {
|
|
136852
136870
|
return `${r}...${i}`;
|
136853
136871
|
}
|
136854
136872
|
return t;
|
136855
|
-
}
|
136856
|
-
function Zmt(t) {
|
136857
|
-
var e;
|
136858
|
-
const { char: n, allowSpaces: r, allowedPrefixes: i, startOfLine: s, $position: o } = t, a = y0e(n), l = new RegExp(`\\s${a}$`), c = s ? "^" : "", u = r ? new RegExp(`${c}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`, "gm"), f = ((e = o.nodeBefore) === null || e === void 0 ? void 0 : e.isText) && o.nodeBefore.text;
|
136859
|
-
if (!f)
|
136860
|
-
return null;
|
136861
|
-
const d = o.pos - f.length, h = Array.from(f.matchAll(u)).pop();
|
136862
|
-
if (!h || h.input === void 0 || h.index === void 0)
|
136863
|
-
return null;
|
136864
|
-
const p = h.input.slice(Math.max(0, h.index - 1), h.index), m = new RegExp(`^[${i == null ? void 0 : i.join("")}\0]?$`).test(p);
|
136865
|
-
if (i !== null && !m)
|
136866
|
-
return null;
|
136867
|
-
const g = d + h.index;
|
136868
|
-
let v = g + h[0].length;
|
136869
|
-
return r && l.test(f.slice(v - 1, v + 1)) && (h[0] += " ", v += 1), g < o.pos && v >= o.pos ? {
|
136870
|
-
range: {
|
136871
|
-
from: g,
|
136872
|
-
to: v
|
136873
|
-
},
|
136874
|
-
query: h[0].slice(n.length),
|
136875
|
-
text: h[0]
|
136876
|
-
} : null;
|
136877
|
-
}
|
136878
|
-
const Ymt = new Sn("suggestion");
|
136879
|
-
function Kmt({ pluginKey: t = Ymt, editor: e, char: n = "@", allowSpaces: r = !1, allowedPrefixes: i = [" "], startOfLine: s = !1, decorationTag: o = "span", decorationClass: a = "suggestion", command: l = () => null, items: c = () => [], render: u = () => ({}), allow: f = () => !0, findSuggestionMatch: d = Zmt }) {
|
136880
|
-
let h;
|
136881
|
-
const p = u == null ? void 0 : u(), m = new pn({
|
136882
|
-
key: t,
|
136883
|
-
view() {
|
136884
|
-
return {
|
136885
|
-
update: async (g, v) => {
|
136886
|
-
var k, b, w, x, A, E, L;
|
136887
|
-
const N = (k = this.key) === null || k === void 0 ? void 0 : k.getState(v), I = (b = this.key) === null || b === void 0 ? void 0 : b.getState(g.state), O = N.active && I.active && N.range.from !== I.range.from, _ = !N.active && I.active, W = N.active && !I.active, B = !_ && !W && N.query !== I.query, q = _ || O && B, Z = B || O, Q = W || O && B;
|
136888
|
-
if (!q && !Z && !Q)
|
136889
|
-
return;
|
136890
|
-
const ie = Q && !q ? N : I, re = g.dom.querySelector(`[data-decoration-id="${ie.decorationId}"]`);
|
136891
|
-
h = {
|
136892
|
-
editor: e,
|
136893
|
-
range: ie.range,
|
136894
|
-
query: ie.query,
|
136895
|
-
text: ie.text,
|
136896
|
-
items: [],
|
136897
|
-
command: ($) => l({
|
136898
|
-
editor: e,
|
136899
|
-
range: ie.range,
|
136900
|
-
props: $
|
136901
|
-
}),
|
136902
|
-
decorationNode: re,
|
136903
|
-
// virtual node for popper.js or tippy.js
|
136904
|
-
// this can be used for building popups without a DOM node
|
136905
|
-
clientRect: re ? () => {
|
136906
|
-
var $;
|
136907
|
-
const { decorationId: he } = ($ = this.key) === null || $ === void 0 ? void 0 : $.getState(e.state), te = g.dom.querySelector(`[data-decoration-id="${he}"]`);
|
136908
|
-
return (te == null ? void 0 : te.getBoundingClientRect()) || null;
|
136909
|
-
} : null
|
136910
|
-
}, q && ((w = p == null ? void 0 : p.onBeforeStart) === null || w === void 0 || w.call(p, h)), Z && ((x = p == null ? void 0 : p.onBeforeUpdate) === null || x === void 0 || x.call(p, h)), (Z || q) && (h.items = await c({
|
136911
|
-
editor: e,
|
136912
|
-
query: ie.query
|
136913
|
-
})), Q && ((A = p == null ? void 0 : p.onExit) === null || A === void 0 || A.call(p, h)), Z && ((E = p == null ? void 0 : p.onUpdate) === null || E === void 0 || E.call(p, h)), q && ((L = p == null ? void 0 : p.onStart) === null || L === void 0 || L.call(p, h));
|
136914
|
-
},
|
136915
|
-
destroy: () => {
|
136916
|
-
var g;
|
136917
|
-
h && ((g = p == null ? void 0 : p.onExit) === null || g === void 0 || g.call(p, h));
|
136918
|
-
}
|
136919
|
-
};
|
136920
|
-
},
|
136921
|
-
state: {
|
136922
|
-
// Initialize the plugin's internal state.
|
136923
|
-
init() {
|
136924
|
-
return {
|
136925
|
-
active: !1,
|
136926
|
-
range: {
|
136927
|
-
from: 0,
|
136928
|
-
to: 0
|
136929
|
-
},
|
136930
|
-
query: null,
|
136931
|
-
text: null,
|
136932
|
-
composing: !1
|
136933
|
-
};
|
136934
|
-
},
|
136935
|
-
// Apply changes to the plugin state from a view transaction.
|
136936
|
-
apply(g, v, k, b) {
|
136937
|
-
const { isEditable: w } = e, { composing: x } = e.view, { selection: A } = g, { empty: E, from: L } = A, N = { ...v };
|
136938
|
-
if (N.composing = x, w && (E || e.view.composing)) {
|
136939
|
-
(L < v.range.from || L > v.range.to) && !x && !v.composing && (N.active = !1);
|
136940
|
-
const I = d({
|
136941
|
-
char: n,
|
136942
|
-
allowSpaces: r,
|
136943
|
-
allowedPrefixes: i,
|
136944
|
-
startOfLine: s,
|
136945
|
-
$position: A.$from
|
136946
|
-
}), O = `id_${Math.floor(Math.random() * 4294967295)}`;
|
136947
|
-
I && f({
|
136948
|
-
editor: e,
|
136949
|
-
state: b,
|
136950
|
-
range: I.range,
|
136951
|
-
isActive: v.active
|
136952
|
-
}) ? (N.active = !0, N.decorationId = v.decorationId ? v.decorationId : O, N.range = I.range, N.query = I.query, N.text = I.text) : N.active = !1;
|
136953
|
-
} else
|
136954
|
-
N.active = !1;
|
136955
|
-
return N.active || (N.decorationId = null, N.range = { from: 0, to: 0 }, N.query = null, N.text = null), N;
|
136956
|
-
}
|
136957
|
-
},
|
136958
|
-
props: {
|
136959
|
-
// Call the keydown hook if suggestion is active.
|
136960
|
-
handleKeyDown(g, v) {
|
136961
|
-
var k;
|
136962
|
-
const { active: b, range: w } = m.getState(g.state);
|
136963
|
-
return b && ((k = p == null ? void 0 : p.onKeyDown) === null || k === void 0 ? void 0 : k.call(p, { view: g, event: v, range: w })) || !1;
|
136964
|
-
},
|
136965
|
-
// Setup decorator on the currently active suggestion.
|
136966
|
-
decorations(g) {
|
136967
|
-
const { active: v, range: k, decorationId: b } = m.getState(g);
|
136968
|
-
return v ? En.create(g.doc, [
|
136969
|
-
Lr.inline(k.from, k.to, {
|
136970
|
-
nodeName: o,
|
136971
|
-
class: a,
|
136972
|
-
"data-decoration-id": b
|
136973
|
-
})
|
136974
|
-
]) : null;
|
136975
|
-
}
|
136976
|
-
}
|
136977
|
-
});
|
136978
|
-
return m;
|
136979
|
-
}
|
136980
|
-
const Jmt = cn.create({
|
136981
|
-
name: "slash-command",
|
136982
|
-
addOptions() {
|
136983
|
-
return {
|
136984
|
-
suggestion: {
|
136985
|
-
char: "/",
|
136986
|
-
command: ({
|
136987
|
-
editor: t,
|
136988
|
-
range: e,
|
136989
|
-
props: n
|
136990
|
-
}) => {
|
136991
|
-
n.command({ editor: t, range: e });
|
136992
|
-
}
|
136993
|
-
}
|
136994
|
-
};
|
136995
|
-
},
|
136996
|
-
addProseMirrorPlugins() {
|
136997
|
-
return [
|
136998
|
-
Kmt({
|
136999
|
-
editor: this.editor,
|
137000
|
-
...this.options.suggestion
|
137001
|
-
})
|
137002
|
-
];
|
137003
|
-
}
|
137004
|
-
}), Qmt = ({
|
136873
|
+
}, Zmt = ({
|
137005
136874
|
query: t,
|
137006
136875
|
onError: e,
|
137007
136876
|
secureImageUploadUrl: n
|
@@ -137192,10 +137061,159 @@ const Jmt = cn.create({
|
|
137192
137061
|
return r.title.toLowerCase().includes(i) || r.description.toLowerCase().includes(i) || r.searchTerms && r.searchTerms.some((s) => s.includes(i));
|
137193
137062
|
}
|
137194
137063
|
return !0;
|
137195
|
-
}),
|
137064
|
+
}), Ymt = (t, e) => {
|
137196
137065
|
const n = t.offsetHeight, r = e ? e.offsetHeight : 0, i = e.offsetTop, s = i + r;
|
137197
137066
|
i < t.scrollTop ? t.scrollTop -= t.scrollTop - i + 5 : s > n + t.scrollTop && (t.scrollTop += s - n - t.scrollTop + 5);
|
137198
|
-
}
|
137067
|
+
};
|
137068
|
+
function Kmt(t) {
|
137069
|
+
var e;
|
137070
|
+
const { char: n, allowSpaces: r, allowedPrefixes: i, startOfLine: s, $position: o } = t, a = y0e(n), l = new RegExp(`\\s${a}$`), c = s ? "^" : "", u = r ? new RegExp(`${c}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`, "gm"), f = ((e = o.nodeBefore) === null || e === void 0 ? void 0 : e.isText) && o.nodeBefore.text;
|
137071
|
+
if (!f)
|
137072
|
+
return null;
|
137073
|
+
const d = o.pos - f.length, h = Array.from(f.matchAll(u)).pop();
|
137074
|
+
if (!h || h.input === void 0 || h.index === void 0)
|
137075
|
+
return null;
|
137076
|
+
const p = h.input.slice(Math.max(0, h.index - 1), h.index), m = new RegExp(`^[${i == null ? void 0 : i.join("")}\0]?$`).test(p);
|
137077
|
+
if (i !== null && !m)
|
137078
|
+
return null;
|
137079
|
+
const g = d + h.index;
|
137080
|
+
let v = g + h[0].length;
|
137081
|
+
return r && l.test(f.slice(v - 1, v + 1)) && (h[0] += " ", v += 1), g < o.pos && v >= o.pos ? {
|
137082
|
+
range: {
|
137083
|
+
from: g,
|
137084
|
+
to: v
|
137085
|
+
},
|
137086
|
+
query: h[0].slice(n.length),
|
137087
|
+
text: h[0]
|
137088
|
+
} : null;
|
137089
|
+
}
|
137090
|
+
const Jmt = new Sn("suggestion");
|
137091
|
+
function Qmt({ pluginKey: t = Jmt, editor: e, char: n = "@", allowSpaces: r = !1, allowedPrefixes: i = [" "], startOfLine: s = !1, decorationTag: o = "span", decorationClass: a = "suggestion", command: l = () => null, items: c = () => [], render: u = () => ({}), allow: f = () => !0, findSuggestionMatch: d = Kmt }) {
|
137092
|
+
let h;
|
137093
|
+
const p = u == null ? void 0 : u(), m = new pn({
|
137094
|
+
key: t,
|
137095
|
+
view() {
|
137096
|
+
return {
|
137097
|
+
update: async (g, v) => {
|
137098
|
+
var k, b, w, x, A, E, L;
|
137099
|
+
const N = (k = this.key) === null || k === void 0 ? void 0 : k.getState(v), I = (b = this.key) === null || b === void 0 ? void 0 : b.getState(g.state), O = N.active && I.active && N.range.from !== I.range.from, _ = !N.active && I.active, W = N.active && !I.active, B = !_ && !W && N.query !== I.query, q = _ || O && B, Z = B || O, Q = W || O && B;
|
137100
|
+
if (!q && !Z && !Q)
|
137101
|
+
return;
|
137102
|
+
const ie = Q && !q ? N : I, re = g.dom.querySelector(`[data-decoration-id="${ie.decorationId}"]`);
|
137103
|
+
h = {
|
137104
|
+
editor: e,
|
137105
|
+
range: ie.range,
|
137106
|
+
query: ie.query,
|
137107
|
+
text: ie.text,
|
137108
|
+
items: [],
|
137109
|
+
command: ($) => l({
|
137110
|
+
editor: e,
|
137111
|
+
range: ie.range,
|
137112
|
+
props: $
|
137113
|
+
}),
|
137114
|
+
decorationNode: re,
|
137115
|
+
// virtual node for popper.js or tippy.js
|
137116
|
+
// this can be used for building popups without a DOM node
|
137117
|
+
clientRect: re ? () => {
|
137118
|
+
var $;
|
137119
|
+
const { decorationId: he } = ($ = this.key) === null || $ === void 0 ? void 0 : $.getState(e.state), te = g.dom.querySelector(`[data-decoration-id="${he}"]`);
|
137120
|
+
return (te == null ? void 0 : te.getBoundingClientRect()) || null;
|
137121
|
+
} : null
|
137122
|
+
}, q && ((w = p == null ? void 0 : p.onBeforeStart) === null || w === void 0 || w.call(p, h)), Z && ((x = p == null ? void 0 : p.onBeforeUpdate) === null || x === void 0 || x.call(p, h)), (Z || q) && (h.items = await c({
|
137123
|
+
editor: e,
|
137124
|
+
query: ie.query
|
137125
|
+
})), Q && ((A = p == null ? void 0 : p.onExit) === null || A === void 0 || A.call(p, h)), Z && ((E = p == null ? void 0 : p.onUpdate) === null || E === void 0 || E.call(p, h)), q && ((L = p == null ? void 0 : p.onStart) === null || L === void 0 || L.call(p, h));
|
137126
|
+
},
|
137127
|
+
destroy: () => {
|
137128
|
+
var g;
|
137129
|
+
h && ((g = p == null ? void 0 : p.onExit) === null || g === void 0 || g.call(p, h));
|
137130
|
+
}
|
137131
|
+
};
|
137132
|
+
},
|
137133
|
+
state: {
|
137134
|
+
// Initialize the plugin's internal state.
|
137135
|
+
init() {
|
137136
|
+
return {
|
137137
|
+
active: !1,
|
137138
|
+
range: {
|
137139
|
+
from: 0,
|
137140
|
+
to: 0
|
137141
|
+
},
|
137142
|
+
query: null,
|
137143
|
+
text: null,
|
137144
|
+
composing: !1
|
137145
|
+
};
|
137146
|
+
},
|
137147
|
+
// Apply changes to the plugin state from a view transaction.
|
137148
|
+
apply(g, v, k, b) {
|
137149
|
+
const { isEditable: w } = e, { composing: x } = e.view, { selection: A } = g, { empty: E, from: L } = A, N = { ...v };
|
137150
|
+
if (N.composing = x, w && (E || e.view.composing)) {
|
137151
|
+
(L < v.range.from || L > v.range.to) && !x && !v.composing && (N.active = !1);
|
137152
|
+
const I = d({
|
137153
|
+
char: n,
|
137154
|
+
allowSpaces: r,
|
137155
|
+
allowedPrefixes: i,
|
137156
|
+
startOfLine: s,
|
137157
|
+
$position: A.$from
|
137158
|
+
}), O = `id_${Math.floor(Math.random() * 4294967295)}`;
|
137159
|
+
I && f({
|
137160
|
+
editor: e,
|
137161
|
+
state: b,
|
137162
|
+
range: I.range,
|
137163
|
+
isActive: v.active
|
137164
|
+
}) ? (N.active = !0, N.decorationId = v.decorationId ? v.decorationId : O, N.range = I.range, N.query = I.query, N.text = I.text) : N.active = !1;
|
137165
|
+
} else
|
137166
|
+
N.active = !1;
|
137167
|
+
return N.active || (N.decorationId = null, N.range = { from: 0, to: 0 }, N.query = null, N.text = null), N;
|
137168
|
+
}
|
137169
|
+
},
|
137170
|
+
props: {
|
137171
|
+
// Call the keydown hook if suggestion is active.
|
137172
|
+
handleKeyDown(g, v) {
|
137173
|
+
var k;
|
137174
|
+
const { active: b, range: w } = m.getState(g.state);
|
137175
|
+
return b && ((k = p == null ? void 0 : p.onKeyDown) === null || k === void 0 ? void 0 : k.call(p, { view: g, event: v, range: w })) || !1;
|
137176
|
+
},
|
137177
|
+
// Setup decorator on the currently active suggestion.
|
137178
|
+
decorations(g) {
|
137179
|
+
const { active: v, range: k, decorationId: b } = m.getState(g);
|
137180
|
+
return v ? En.create(g.doc, [
|
137181
|
+
Lr.inline(k.from, k.to, {
|
137182
|
+
nodeName: o,
|
137183
|
+
class: a,
|
137184
|
+
"data-decoration-id": b
|
137185
|
+
})
|
137186
|
+
]) : null;
|
137187
|
+
}
|
137188
|
+
}
|
137189
|
+
});
|
137190
|
+
return m;
|
137191
|
+
}
|
137192
|
+
const Xmt = cn.create({
|
137193
|
+
name: "slash-command",
|
137194
|
+
addOptions() {
|
137195
|
+
return {
|
137196
|
+
suggestion: {
|
137197
|
+
char: "/",
|
137198
|
+
command: ({
|
137199
|
+
editor: t,
|
137200
|
+
range: e,
|
137201
|
+
props: n
|
137202
|
+
}) => {
|
137203
|
+
n.command({ editor: t, range: e });
|
137204
|
+
}
|
137205
|
+
}
|
137206
|
+
};
|
137207
|
+
},
|
137208
|
+
addProseMirrorPlugins() {
|
137209
|
+
return [
|
137210
|
+
Qmt({
|
137211
|
+
editor: this.editor,
|
137212
|
+
...this.options.suggestion
|
137213
|
+
})
|
137214
|
+
];
|
137215
|
+
}
|
137216
|
+
}), $mt = ({
|
137199
137217
|
items: t,
|
137200
137218
|
command: e,
|
137201
137219
|
editor: n
|
@@ -137231,7 +137249,7 @@ const Jmt = cn.create({
|
|
137231
137249
|
const c = tt(null);
|
137232
137250
|
return $a(() => {
|
137233
137251
|
const u = c == null ? void 0 : c.current, f = u == null ? void 0 : u.children[r];
|
137234
|
-
f && u &&
|
137252
|
+
f && u && Ymt(u, f);
|
137235
137253
|
}, [r]), s.length > 0 ? /* @__PURE__ */ P.jsx(
|
137236
137254
|
"div",
|
137237
137255
|
{
|
@@ -137286,8 +137304,8 @@ const Jmt = cn.create({
|
|
137286
137304
|
}
|
137287
137305
|
};
|
137288
137306
|
}, t4t = (t, e) => {
|
137289
|
-
const n = ({ query: r }) =>
|
137290
|
-
return
|
137307
|
+
const n = ({ query: r }) => Zmt({ query: r, onError: t, secureImageUploadUrl: e });
|
137308
|
+
return Xmt.configure({
|
137291
137309
|
suggestion: {
|
137292
137310
|
items: n,
|
137293
137311
|
render: e4t
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Extension } from '@tiptap/core';
|
2
2
|
|
3
|
-
export declare const
|
3
|
+
export declare const Command: Extension<any, any>;
|
4
4
|
declare const SlashCommand: (onError?: (errorString: string) => void, secureImageUploadUrl?: string) => Extension<any, any>;
|
5
5
|
export default SlashCommand;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { CommandProps } from './types';
|
2
|
+
|
3
|
+
export declare const getSuggestionItems: ({ query, onError, secureImageUploadUrl, }: {
|
4
|
+
query: string;
|
5
|
+
onError?: (errorString: string) => void;
|
6
|
+
secureImageUploadUrl?: string;
|
7
|
+
}) => {
|
8
|
+
title: string;
|
9
|
+
description: string;
|
10
|
+
searchTerms: string[];
|
11
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
12
|
+
image: string;
|
13
|
+
command: ({ editor, range }: CommandProps) => void;
|
14
|
+
}[];
|
15
|
+
export declare const updateScrollView: (container: HTMLElement, item: HTMLElement) => void;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { Editor, Range } from '@tiptap/core';
|
3
|
+
|
4
|
+
export interface CommandItemProps {
|
5
|
+
title: string;
|
6
|
+
description: string;
|
7
|
+
icon: ReactNode;
|
8
|
+
image?: string;
|
9
|
+
}
|
10
|
+
export interface CommandProps {
|
11
|
+
editor: Editor;
|
12
|
+
range: Range;
|
13
|
+
}
|