@clevertask/scribe 0.1.3 → 0.1.5
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 +3 -0
- package/dist/BarMenu-V1uRL3bt.js +272 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +2 -10
- package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/BubbleMenu.js +165 -2090
- package/dist/components/Menu/LinkBubbleMenu.d.ts +8 -0
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -0
- package/dist/components/Menu/LinkBubbleMenu.js +78 -0
- package/dist/components/Menu/LinkEditor.d.ts +14 -0
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -0
- package/dist/components/Menu/LinkEditor.js +140 -0
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.js +38 -44
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +5 -0
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -0
- package/dist/components/Menu/linkBubbleMenuPlugin.js +7 -0
- package/dist/components/Menu/linkUrl.d.ts +2 -0
- package/dist/components/Menu/linkUrl.d.ts.map +1 -0
- package/dist/components/Menu/linkUrl.js +21 -0
- package/dist/components/Scribe/extension/emoji/EmojiList.js +58 -45
- package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -2
- package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +39 -43
- package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-link.js +2 -4
- package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +50 -45
- package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-selectedText.js +10 -12
- package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -1
- package/dist/components/Scribe/extension/getPopupMountTarget.js +12 -15
- package/dist/components/Scribe/extension/index.d.ts +4 -4
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +2 -37169
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3369 -3731
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -6
- package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.js +177 -176
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +35 -41
- package/dist/components/Scribe/extension/tableOfContents.js +153 -180
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +113 -153
- package/dist/dist-BQjH-i-q.js +7016 -0
- package/dist/dist-CnXCIcnl.js +3506 -0
- package/dist/dist-RuuEA1GJ.js +686 -0
- package/dist/extension-CZOsheCI.js +56236 -0
- package/dist/extension-link-DZID_SYl.js +908 -0
- package/dist/floating-ui.dom-rih69525.js +928 -0
- package/dist/html-to-markdown-CrNOkSye.js +497 -0
- package/dist/icons/ToolbarIcons.d.ts.map +1 -1
- package/dist/icons/ToolbarIcons.js +76 -135
- package/dist/main.css +10 -0
- package/dist/main.js +7 -15
- package/dist/markdown-to-html-DEczPfuq.js +1458 -0
- package/dist/menus-CzX7kyXn.js +633 -0
- package/dist/purify.es-DF9CW1cl.js +767 -0
- package/dist/rolldown-runtime-B8UxIWdF.js +7 -0
- package/dist/slashCommand-B7CRIaKG.js +429 -0
- package/dist/tables-CjOC70rm.js +1345 -0
- package/dist/tippy.esm-D9LL2xiE.js +1713 -0
- package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
- package/dist/utils/convert-legacy-math-delimiters.js +7 -13
- package/dist/utils/create-scribe-editor.js +2 -31
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +2 -600
- package/dist/utils/index.js +24 -12
- package/dist/utils/is-in-viewport.d.ts.map +1 -1
- package/dist/utils/is-in-viewport.js +6 -6
- package/dist/utils/markdown-to-html.d.ts.map +1 -1
- package/dist/utils/markdown-to-html.js +2 -5
- package/dist/vite-env.d.js +0 -1
- package/package.json +40 -38
- package/dist/BarMenu-DaKIz3zZ.js +0 -327
- package/dist/extension-link-Ch_T7WWG.js +0 -1030
- package/dist/index-BiBV5TQx.js +0 -13513
- package/dist/index-CqzMmrnw.js +0 -1410
- package/dist/index-DxF-1P4n.js +0 -834
- package/dist/index-V-gN11Y9.js +0 -249
- package/dist/markdown-to-html-pL7ckd-m.js +0 -1135
- package/dist/purify.es-exIQuqhb.js +0 -595
- package/dist/tippy.esm-DLHdsnfG.js +0 -1711
|
@@ -1,181 +1,154 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return;
|
|
153
|
-
this.storage.updateScrollParent();
|
|
154
|
-
const t = x(
|
|
155
|
-
this.editor,
|
|
156
|
-
this.options.anchorTypes,
|
|
157
|
-
this.storage.scrollParent
|
|
158
|
-
), n = this.editor.view.dom.isConnected && g(t, this.storage.scrollParent);
|
|
159
|
-
n && (this.storage.layoutRefreshRetries = 0), P(this.storage, this.options, t), !n && this.storage.layoutRefreshRetries < T && (this.storage.layoutRefreshRetries += 1, this.storage.scheduleRefresh());
|
|
160
|
-
}, this.storage.scheduleRefresh = () => {
|
|
161
|
-
this.storage.rafId !== null && window.cancelAnimationFrame(this.storage.rafId), this.storage.rafId = window.requestAnimationFrame(() => {
|
|
162
|
-
this.storage.rafId = null, this.storage.refresh();
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
const e = d(
|
|
166
|
-
this.editor.state,
|
|
167
|
-
this.options.anchorTypes
|
|
168
|
-
);
|
|
169
|
-
e && this.editor.view.dispatch(e), this.storage.scheduleRefresh();
|
|
170
|
-
},
|
|
171
|
-
onTransaction({ transaction: e }) {
|
|
172
|
-
e.docChanged && this.storage.scheduleRefresh();
|
|
173
|
-
},
|
|
174
|
-
onDestroy() {
|
|
175
|
-
typeof window < "u" && this.storage.rafId !== null && window.cancelAnimationFrame(this.storage.rafId), this.storage.scrollParent?.removeEventListener("scroll", this.storage.scrollHandler);
|
|
176
|
-
}
|
|
1
|
+
import { a as e, i as t } from "../../../dist-CnXCIcnl.js";
|
|
2
|
+
import { n } from "../../../dist-BQjH-i-q.js";
|
|
3
|
+
//#region lib/components/Scribe/extension/tableOfContents.ts
|
|
4
|
+
var r = "scribeTableOfContents", i = new e("scribeTableOfContents"), a = 10, o = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "heading", s = (e, t) => {
|
|
5
|
+
let n = t[t.length - 1], r = [...t].reverse().find((t) => t.originalLevel <= e.node.attrs.level)?.level || 1;
|
|
6
|
+
return e.node.attrs.level > (n?.originalLevel || 1) ? (n?.level || 1) + 1 : e.node.attrs.level < (n?.originalLevel || 1) ? r : n?.level || 1;
|
|
7
|
+
}, c = (e) => (e[e.length - 1]?.itemIndex || 0) + 1, l = (e, t, n) => {
|
|
8
|
+
if (e.textContent.length === 0) return null;
|
|
9
|
+
let r = o(e.textContent), i = (t.get(r) || 0) + 1, a = i === 1 ? r : `${r}-${i}`;
|
|
10
|
+
return t.set(r, i), n === a ? n : a;
|
|
11
|
+
}, u = (e, t) => {
|
|
12
|
+
let n = e.tr, i = /* @__PURE__ */ new Map(), a = !1;
|
|
13
|
+
return e.doc.descendants((e, r) => {
|
|
14
|
+
if (!t.includes(e.type.name)) return;
|
|
15
|
+
let o = e.attrs["data-toc-id"], s = l(e, i, o);
|
|
16
|
+
o !== s && (n.setNodeMarkup(r, void 0, {
|
|
17
|
+
...e.attrs,
|
|
18
|
+
"data-toc-id": s
|
|
19
|
+
}), a = !0);
|
|
20
|
+
}), a ? n.setMeta(r, !0).setMeta("addToHistory", !1) : null;
|
|
21
|
+
}, d = (e) => {
|
|
22
|
+
let { overflowY: t } = window.getComputedStyle(e);
|
|
23
|
+
return /(auto|scroll|overlay)/.test(t) && e.scrollHeight > e.clientHeight;
|
|
24
|
+
}, f = (e) => {
|
|
25
|
+
let t = e.parentElement;
|
|
26
|
+
for (; t;) {
|
|
27
|
+
if (d(t)) return t;
|
|
28
|
+
t = t.parentElement;
|
|
29
|
+
}
|
|
30
|
+
return window;
|
|
31
|
+
}, p = (e) => typeof Window < "u" && e instanceof Window, m = (e) => p(e) ? 32 : e.getBoundingClientRect().top + 32, h = (e) => e.isConnected && e.getClientRects().length > 0, g = (e, t) => {
|
|
32
|
+
let n = e.view.nodeDOM(t);
|
|
33
|
+
return n instanceof HTMLElement ? n : null;
|
|
34
|
+
}, _ = (e, t) => {
|
|
35
|
+
let n = [];
|
|
36
|
+
return e.state.doc.descendants((e, r) => {
|
|
37
|
+
!t.includes(e.type.name) || e.textContent.length === 0 || n.push({
|
|
38
|
+
node: e,
|
|
39
|
+
pos: r
|
|
40
|
+
});
|
|
41
|
+
}), n;
|
|
42
|
+
}, v = (e, t) => e.length === 0 ? !0 : !t || !e.every((e) => h(e.dom)) ? !1 : p(t) || h(t), y = (e, t) => {
|
|
43
|
+
if (!v(e, t)) return e;
|
|
44
|
+
let n = m(t), r = /* @__PURE__ */ new Set(), i = null;
|
|
45
|
+
return e.forEach((e) => {
|
|
46
|
+
e.dom.getBoundingClientRect().top <= n && (i = e.id, r.add(e.id));
|
|
47
|
+
}), e.map((e) => ({
|
|
48
|
+
...e,
|
|
49
|
+
isActive: e.id === i,
|
|
50
|
+
isScrolledOver: r.has(e.id)
|
|
51
|
+
}));
|
|
52
|
+
}, b = (e, t, n) => {
|
|
53
|
+
let r = _(e, t), i = [];
|
|
54
|
+
return r.forEach((t) => {
|
|
55
|
+
let n = t.node.attrs["data-toc-id"], r = g(e, t.pos);
|
|
56
|
+
if (!n || !r) return;
|
|
57
|
+
let a = Number(t.node.attrs.level) || 1, o = s(t, i), l = c(i);
|
|
58
|
+
i.push({
|
|
59
|
+
dom: r,
|
|
60
|
+
editor: e,
|
|
61
|
+
id: n,
|
|
62
|
+
isActive: !1,
|
|
63
|
+
isScrolledOver: !1,
|
|
64
|
+
itemIndex: l,
|
|
65
|
+
level: o,
|
|
66
|
+
node: t.node,
|
|
67
|
+
originalLevel: a,
|
|
68
|
+
pos: t.pos,
|
|
69
|
+
textContent: t.node.textContent
|
|
70
|
+
});
|
|
71
|
+
}), y(i, n);
|
|
72
|
+
}, x = (e) => JSON.stringify(e.map((e) => ({
|
|
73
|
+
id: e.id,
|
|
74
|
+
isActive: e.isActive,
|
|
75
|
+
isScrolledOver: e.isScrolledOver,
|
|
76
|
+
itemIndex: e.itemIndex,
|
|
77
|
+
level: e.level,
|
|
78
|
+
originalLevel: e.originalLevel,
|
|
79
|
+
pos: e.pos,
|
|
80
|
+
textContent: e.textContent
|
|
81
|
+
}))), S = (e, t, n) => {
|
|
82
|
+
let r = x(n), i = !e.hasCreated;
|
|
83
|
+
e.anchors = n.map((e) => e.dom), e.content = n, !(!i && r === e.lastSignature) && (e.hasCreated = !0, e.lastSignature = r, t.onUpdate?.(n, i));
|
|
84
|
+
}, C = n.create({
|
|
85
|
+
name: "scribeTableOfContents",
|
|
86
|
+
addOptions() {
|
|
87
|
+
return { anchorTypes: ["heading"] };
|
|
88
|
+
},
|
|
89
|
+
addStorage() {
|
|
90
|
+
return {
|
|
91
|
+
anchors: [],
|
|
92
|
+
content: [],
|
|
93
|
+
hasCreated: !1,
|
|
94
|
+
lastSignature: "",
|
|
95
|
+
layoutRefreshRetries: 0,
|
|
96
|
+
rafId: null,
|
|
97
|
+
refresh: () => null,
|
|
98
|
+
scheduleRefresh: () => null,
|
|
99
|
+
scrollHandler: () => null,
|
|
100
|
+
scrollParent: null,
|
|
101
|
+
updateScrollParent: () => null
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
addGlobalAttributes() {
|
|
105
|
+
return [{
|
|
106
|
+
types: this.options.anchorTypes,
|
|
107
|
+
attributes: { "data-toc-id": {
|
|
108
|
+
default: null,
|
|
109
|
+
renderHTML: (e) => {
|
|
110
|
+
let t = e["data-toc-id"];
|
|
111
|
+
return t ? { "data-toc-id": t } : {};
|
|
112
|
+
},
|
|
113
|
+
parseHTML: (e) => e.getAttribute("data-toc-id")
|
|
114
|
+
} }
|
|
115
|
+
}];
|
|
116
|
+
},
|
|
117
|
+
addCommands() {
|
|
118
|
+
return { updateScribeTableOfContents: () => ({ dispatch: e }) => (e && this.storage.refresh(), !0) };
|
|
119
|
+
},
|
|
120
|
+
addProseMirrorPlugins() {
|
|
121
|
+
return [new t({
|
|
122
|
+
key: i,
|
|
123
|
+
appendTransaction: (e, t, n) => typeof window > "u" || e.some((e) => e.getMeta("scribeTableOfContents") || e.getMeta("composition")) || !e.some((e) => e.docChanged) ? null : u(n, this.options.anchorTypes)
|
|
124
|
+
})];
|
|
125
|
+
},
|
|
126
|
+
onCreate() {
|
|
127
|
+
if (typeof window > "u" || !this.editor.view) return;
|
|
128
|
+
this.storage.scrollHandler = () => {
|
|
129
|
+
this.storage.refresh();
|
|
130
|
+
}, this.storage.updateScrollParent = () => {
|
|
131
|
+
let e = f(this.editor.view.dom);
|
|
132
|
+
this.storage.scrollParent !== e && (this.storage.scrollParent?.removeEventListener("scroll", this.storage.scrollHandler), this.storage.scrollParent = e, this.storage.scrollParent.addEventListener("scroll", this.storage.scrollHandler));
|
|
133
|
+
}, this.storage.refresh = () => {
|
|
134
|
+
if (this.editor.isDestroyed) return;
|
|
135
|
+
this.storage.updateScrollParent();
|
|
136
|
+
let e = b(this.editor, this.options.anchorTypes, this.storage.scrollParent), t = this.editor.view.dom.isConnected && v(e, this.storage.scrollParent);
|
|
137
|
+
t && (this.storage.layoutRefreshRetries = 0), S(this.storage, this.options, e), !t && this.storage.layoutRefreshRetries < a && (this.storage.layoutRefreshRetries += 1, this.storage.scheduleRefresh());
|
|
138
|
+
}, this.storage.scheduleRefresh = () => {
|
|
139
|
+
this.storage.rafId !== null && window.cancelAnimationFrame(this.storage.rafId), this.storage.rafId = window.requestAnimationFrame(() => {
|
|
140
|
+
this.storage.rafId = null, this.storage.refresh();
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
let e = u(this.editor.state, this.options.anchorTypes);
|
|
144
|
+
e && this.editor.view.dispatch(e), this.storage.scheduleRefresh();
|
|
145
|
+
},
|
|
146
|
+
onTransaction({ transaction: e }) {
|
|
147
|
+
e.docChanged && this.storage.scheduleRefresh();
|
|
148
|
+
},
|
|
149
|
+
onDestroy() {
|
|
150
|
+
typeof window < "u" && this.storage.rafId !== null && window.cancelAnimationFrame(this.storage.rafId), this.storage.scrollParent?.removeEventListener("scroll", this.storage.scrollHandler);
|
|
151
|
+
}
|
|
177
152
|
});
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
F as ScribeTableOfContents
|
|
181
|
-
};
|
|
153
|
+
//#endregion
|
|
154
|
+
export { r as SCRIBE_TABLE_OF_CONTENTS_META, C as ScribeTableOfContents };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Scribe/index.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Scribe/index.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAC;AAGxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,KAAK,EACV,kCAAkC,EAElC,iCAAiC,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,OAAO,EACP,MAAM,EAGN,SAAS,EACT,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,oBAAoB,EAMrB,MAAM,OAAO,CAAC;AAGf,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,YAAY,EACV,kCAAkC,EAClC,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,6BAA6B,CAAC;AAErC,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,KAAK,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IAC5F,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,2FAA2F;IAC3F,2BAA2B,EAAE,CAAC,MAAM,EAAE,iCAAiC,KAAK,IAAI,CAAC;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC5D;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACzC,sBAAsB,CAAC,EAAE,UAAU,CAAC;IACpC,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACzC,sBAAsB,CAAC,EAAE,UAAU,CAAC;IACpC,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,sEAAsE;IACtE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mFAAmF;IACnF,uBAAuB,CAAC,EAAE,kCAAkC,CAAC;CAC9D;AAED,eAAO,MAAM,MAAM,mGA0MjB,CAAC"}
|
|
@@ -1,154 +1,114 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "
|
|
5
|
-
import "../../
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import '../../assets/index.css'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
y.current = !1;
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
t.commands.setContent(i, { emitUpdate: !1 });
|
|
116
|
-
}
|
|
117
|
-
}, [i, t]), c(() => {
|
|
118
|
-
t.setEditable(!!o);
|
|
119
|
-
}, [o, t]), c(() => (t.off("update"), t.on("update", p), () => {
|
|
120
|
-
t.off("update", p);
|
|
121
|
-
}), [t, p]), c(() => {
|
|
122
|
-
g && t.commands.focus("end");
|
|
123
|
-
}, [g, t]), /* @__PURE__ */ I(
|
|
124
|
-
"div",
|
|
125
|
-
{
|
|
126
|
-
className: b("scribe-wrapper", "scribe-root", k),
|
|
127
|
-
"data-scribe-root": !0,
|
|
128
|
-
style: P,
|
|
129
|
-
children: [
|
|
130
|
-
/* @__PURE__ */ I("div", { className: b("scribe-frame", o && "scribe-frame--editable"), children: [
|
|
131
|
-
t && R ? /* @__PURE__ */ a(A, { editor: t }) : null,
|
|
132
|
-
/* @__PURE__ */ a(
|
|
133
|
-
"div",
|
|
134
|
-
{
|
|
135
|
-
className: b(
|
|
136
|
-
"scribe-content",
|
|
137
|
-
o && "scribe-content--editable",
|
|
138
|
-
H
|
|
139
|
-
),
|
|
140
|
-
style: j,
|
|
141
|
-
children: /* @__PURE__ */ a(V, { editor: t, onKeyDown: _ })
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
D ? /* @__PURE__ */ a(Q, { editor: t }) : null
|
|
145
|
-
] }),
|
|
146
|
-
/* @__PURE__ */ a("div", { className: "scribe-popup-root", "data-scribe-popup-root": !0 })
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
);
|
|
1
|
+
import { n as e, t } from "../../BarMenu-V1uRL3bt.js";
|
|
2
|
+
import { t as n } from "../../dist-RuuEA1GJ.js";
|
|
3
|
+
import { t as r } from "../../dist-BQjH-i-q.js";
|
|
4
|
+
import i from "../Menu/LinkBubbleMenu.js";
|
|
5
|
+
import { t as a } from "../../html-to-markdown-CrNOkSye.js";
|
|
6
|
+
import { t as o } from "../../extension-CZOsheCI.js";
|
|
7
|
+
import { SuggestionItemType as s } from "./extension/slashCommand/items.js";
|
|
8
|
+
import "./extension/tableOfContents.js";
|
|
9
|
+
import "../../utils/index.js";
|
|
10
|
+
import { ListOptionBar as c } from "../Menu/Mobile/ListOptionBar.js";
|
|
11
|
+
import { forwardRef as l, useCallback as u, useEffect as d, useImperativeHandle as f, useRef as p, useState as m } from "react";
|
|
12
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
13
|
+
import '../../assets/index.css';//#region lib/components/Scribe/index.tsx
|
|
14
|
+
var _ = l((s, l) => {
|
|
15
|
+
let { autoFocus: _ = !1, content: v, editable: y = !0, editorProps: b, extensions: x, onContentChange: S, showBarMenu: C = !0, editorContentStyle: w, editorContentClassName: T, mainContainerStyle: E, mainContainerClassName: D, onKeyDown: O, externalEditor: k, mobile: A, onTableOfContentsChange: j } = s, M = p(!k && v !== void 0), N = p([]), P = p(j);
|
|
16
|
+
d(() => {
|
|
17
|
+
P.current = j;
|
|
18
|
+
}, [j]);
|
|
19
|
+
let F = u((e, t) => {
|
|
20
|
+
N.current = e, P.current?.(e, t);
|
|
21
|
+
}, []), I = u(({ editor: e, transaction: t }) => {
|
|
22
|
+
if (t.getMeta("scribeTableOfContents")) return;
|
|
23
|
+
let n = e.getHTML(), r = e.getJSON(), i = !y;
|
|
24
|
+
S && S({
|
|
25
|
+
jsonContent: e.isEmpty ? "" : r,
|
|
26
|
+
htmlContent: e.isEmpty ? "" : n,
|
|
27
|
+
markdownContent: e.isEmpty ? "" : a(n),
|
|
28
|
+
source: i ? "programmatic" : "user"
|
|
29
|
+
});
|
|
30
|
+
}, [y, S]), [L] = m(() => k ?? new r({
|
|
31
|
+
...b,
|
|
32
|
+
content: v ?? b?.content,
|
|
33
|
+
editable: y,
|
|
34
|
+
extensions: [...o({
|
|
35
|
+
...s,
|
|
36
|
+
onTableOfContentsChange: F
|
|
37
|
+
}), ...x ?? []],
|
|
38
|
+
editorProps: {
|
|
39
|
+
attributes: { class: "scribe" },
|
|
40
|
+
...b?.editorProps
|
|
41
|
+
}
|
|
42
|
+
})), R = u(() => {
|
|
43
|
+
L.commands.setContent("");
|
|
44
|
+
}, [L]), z = u((e) => L.isEmpty ? "" : {
|
|
45
|
+
html: () => L.getHTML(),
|
|
46
|
+
json: () => L.getJSON(),
|
|
47
|
+
markdown: () => a(L.getHTML())
|
|
48
|
+
}[e]?.(), [L]), B = u((e) => {
|
|
49
|
+
L.commands.setContent(e);
|
|
50
|
+
}, [L]), V = u((e) => {
|
|
51
|
+
let t = typeof e == "string" ? e : e.id, n = N.current.find((e) => e.id === t) ?? (typeof e == "string" ? void 0 : e);
|
|
52
|
+
if (!n || L.isDestroyed) return;
|
|
53
|
+
let r = L.view.nodeDOM(n.pos), i = r instanceof HTMLElement ? r : n.dom;
|
|
54
|
+
if (L.isEditable) {
|
|
55
|
+
let e = Math.max(0, Math.min(n.pos + n.node.nodeSize - 1, L.state.doc.content.size));
|
|
56
|
+
L.commands.focus(e, { scrollIntoView: !1 });
|
|
57
|
+
}
|
|
58
|
+
i.scrollIntoView({
|
|
59
|
+
behavior: "smooth",
|
|
60
|
+
block: "start"
|
|
61
|
+
});
|
|
62
|
+
}, [L]);
|
|
63
|
+
return f(l, () => ({
|
|
64
|
+
resetContent: R,
|
|
65
|
+
setContent: B,
|
|
66
|
+
getContent: z,
|
|
67
|
+
scrollToTableOfContentsItem: V,
|
|
68
|
+
editor: L
|
|
69
|
+
}), [
|
|
70
|
+
L,
|
|
71
|
+
z,
|
|
72
|
+
R,
|
|
73
|
+
V,
|
|
74
|
+
B
|
|
75
|
+
]), d(() => {
|
|
76
|
+
if (v !== void 0) {
|
|
77
|
+
if (M.current) {
|
|
78
|
+
M.current = !1;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
L.commands.setContent(v, { emitUpdate: !1 });
|
|
82
|
+
}
|
|
83
|
+
}, [v, L]), d(() => {
|
|
84
|
+
L.setEditable(!!y);
|
|
85
|
+
}, [y, L]), d(() => (L.off("update"), L.on("update", I), () => {
|
|
86
|
+
L.off("update", I);
|
|
87
|
+
}), [L, I]), d(() => {
|
|
88
|
+
_ && L.commands.focus("end");
|
|
89
|
+
}, [_, L]), /* @__PURE__ */ g("div", {
|
|
90
|
+
className: e("scribe-wrapper", "scribe-root", D),
|
|
91
|
+
"data-scribe-root": !0,
|
|
92
|
+
style: E,
|
|
93
|
+
children: [/* @__PURE__ */ g("div", {
|
|
94
|
+
className: e("scribe-frame", y && "scribe-frame--editable"),
|
|
95
|
+
children: [
|
|
96
|
+
L && C ? /* @__PURE__ */ h(t, { editor: L }) : null,
|
|
97
|
+
/* @__PURE__ */ g("div", {
|
|
98
|
+
className: e("scribe-content", y && "scribe-content--editable", T),
|
|
99
|
+
style: w,
|
|
100
|
+
children: [/* @__PURE__ */ h(n, {
|
|
101
|
+
editor: L,
|
|
102
|
+
onKeyDown: O
|
|
103
|
+
}), y ? /* @__PURE__ */ h(i, { editor: L }) : null]
|
|
104
|
+
}),
|
|
105
|
+
A ? /* @__PURE__ */ h(c, { editor: L }) : null
|
|
106
|
+
]
|
|
107
|
+
}), /* @__PURE__ */ h("div", {
|
|
108
|
+
className: "scribe-popup-root",
|
|
109
|
+
"data-scribe-popup-root": !0
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
150
112
|
});
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
mt as SuggestionItemType
|
|
154
|
-
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { _ as Scribe, s as SuggestionItemType };
|