markdown-flow-ui 0.1.111 → 0.1.112
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/_virtual/index.cjs10.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es10.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +321 -317
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +48 -44
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -0
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js +38 -28
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +28 -26
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.js +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.d.ts +8 -1
- package/dist/components/MarkdownFlowEditor/utils.es.js +59 -39
- package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs.js.map +1 -1
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/useSlide.cjs.js.map +1 -1
- package/dist/components/Slide/useSlide.es.js.map +1 -1
- package/dist/components/Slide/utils/streamingNavigation.cjs.js.map +1 -1
- package/dist/components/Slide/utils/streamingNavigation.es.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
- package/package.json +1 -1
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import
|
|
4
|
-
import { autocompletion as
|
|
5
|
-
import { EditorView as
|
|
6
|
-
import { markdown as
|
|
7
|
-
import { syntaxHighlighting as
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { SelectedOption as
|
|
1
|
+
import { j as l } from "../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import { useEffect as S, useMemo as k, useState as I, useRef as Z, useCallback as a } from "react";
|
|
3
|
+
import $e from "../../markdown-flow-ui/node_modules/.pnpm/@uiw_react-codemirror@4.25.2_@babel_runtime@7.28.4_@codemirror_autocomplete@6.19.1_@cod_3434c6a3f0eb7fac49dbaa3a471d1162/node_modules/@uiw/react-codemirror/esm/index.es.js";
|
|
4
|
+
import { autocompletion as He } from "../../markdown-flow-ui/node_modules/.pnpm/@codemirror_autocomplete@6.19.1/node_modules/@codemirror/autocomplete/dist/index.es.js";
|
|
5
|
+
import { EditorView as pe } from "../../markdown-flow-ui/node_modules/.pnpm/@codemirror_view@6.38.6/node_modules/@codemirror/view/dist/index.es.js";
|
|
6
|
+
import { markdown as Ue } from "../../markdown-flow-ui/node_modules/.pnpm/@codemirror_lang-markdown@6.5.0/node_modules/@codemirror/lang-markdown/dist/index.es.js";
|
|
7
|
+
import { syntaxHighlighting as qe, defaultHighlightStyle as Fe } from "../../markdown-flow-ui/node_modules/.pnpm/@codemirror_language@6.11.3/node_modules/@codemirror/language/dist/index.es.js";
|
|
8
|
+
import { Tooltip as De, TooltipTrigger as Ge, TooltipContent as Me } from "../ui/tooltip.es.js";
|
|
9
|
+
import We from "./components/CustomDialog.es.js";
|
|
10
|
+
import Qe from "./components/CustomPopover.es.js";
|
|
11
|
+
import Ye from "./components/EditorToolbar.es.js";
|
|
12
|
+
import _e from "./components/VariableSearchDropdown.es.js";
|
|
13
|
+
import Je from "./editor-context.es.js";
|
|
14
|
+
import Ke from "./components/ImageInject.es.js";
|
|
15
|
+
import Xe from "./components/VideoInject.es.js";
|
|
16
|
+
import Ze from "./components/VariableSelect.es.js";
|
|
17
|
+
import { SelectedOption as m } from "./types.es.js";
|
|
18
18
|
/* empty css */
|
|
19
|
-
import { extractVariableNames as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
19
|
+
import { extractVariableNames as et, getImageContentToInsert as tt, getVideoContentToInsert as nt, createSlashCommands as ot, parseContentInfo as rt, createVariableExpressionRegexp as st } from "./utils.es.js";
|
|
20
|
+
import it from "./plugins/ImgPlaceholder.es.js";
|
|
21
|
+
import at from "./plugins/VideoPlaceholder.es.js";
|
|
22
|
+
import lt from "./plugins/VariablePlaceholder.es.js";
|
|
23
|
+
import ct from "./plugins/SyntaxHighlighter.es.js";
|
|
24
|
+
import Ce from "./locales/en-US.json.es.js";
|
|
25
|
+
import ut from "./locales/zh-CN.json.es.js";
|
|
26
26
|
import ee from "../../markdown-flow-ui/node_modules/.pnpm/i18next@23.16.8/node_modules/i18next/dist/esm/i18next.es.js";
|
|
27
|
-
import { initReactI18next as
|
|
28
|
-
import { useTranslation as
|
|
27
|
+
import { initReactI18next as mt } from "../../markdown-flow-ui/node_modules/.pnpm/react-i18next@15.7.4_i18next@23.16.8_react-dom@19.0.1_react@19.0.1__react@19.0.1_typescript@5.9.3/node_modules/react-i18next/dist/es/initReactI18next.es.js";
|
|
28
|
+
import { useTranslation as ft } from "../../markdown-flow-ui/node_modules/.pnpm/react-i18next@15.7.4_i18next@23.16.8_react-dom@19.0.1_react@19.0.1__react@19.0.1_typescript@5.9.3/node_modules/react-i18next/dist/es/useTranslation.es.js";
|
|
29
29
|
const te = {
|
|
30
|
-
"en-US": { translation:
|
|
31
|
-
"zh-CN": { translation:
|
|
30
|
+
"en-US": { translation: Ce },
|
|
31
|
+
"zh-CN": { translation: ut }
|
|
32
32
|
};
|
|
33
|
-
ee.isInitialized ? Object.entries(te).forEach(([
|
|
33
|
+
ee.isInitialized ? Object.entries(te).forEach(([V, f]) => {
|
|
34
34
|
ee.addResourceBundle(
|
|
35
|
-
|
|
35
|
+
V,
|
|
36
36
|
"translation",
|
|
37
|
-
|
|
37
|
+
f.translation,
|
|
38
38
|
!0,
|
|
39
39
|
!0
|
|
40
40
|
);
|
|
41
|
-
}) : ee.use(
|
|
41
|
+
}) : ee.use(mt).init({
|
|
42
42
|
resources: te,
|
|
43
43
|
lng: "en-US",
|
|
44
44
|
fallbackLng: "en-US",
|
|
45
45
|
interpolation: { escapeValue: !1 }
|
|
46
46
|
});
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
47
|
+
const ge = [], de = (V, f) => {
|
|
48
|
+
if (!V || f < 0)
|
|
49
49
|
return !1;
|
|
50
|
-
const L =
|
|
51
|
-
let
|
|
52
|
-
for (; (
|
|
53
|
-
const v =
|
|
54
|
-
if (
|
|
50
|
+
const L = st();
|
|
51
|
+
let x;
|
|
52
|
+
for (; (x = L.exec(V)) !== null; ) {
|
|
53
|
+
const v = x.index ?? 0, G = v + x[0].length, w = v + 2, M = G - 2;
|
|
54
|
+
if (f >= w && f <= M)
|
|
55
55
|
return !0;
|
|
56
|
-
L.lastIndex ===
|
|
56
|
+
L.lastIndex === x.index && L.lastIndex++;
|
|
57
57
|
}
|
|
58
58
|
return !1;
|
|
59
|
-
},
|
|
60
|
-
content:
|
|
61
|
-
editMode:
|
|
59
|
+
}, ht = (V = "") => `{{${V}}}`, Ft = ({
|
|
60
|
+
content: V = "",
|
|
61
|
+
editMode: f = "codeEdit",
|
|
62
62
|
variables: L,
|
|
63
|
-
systemVariables:
|
|
63
|
+
systemVariables: x,
|
|
64
64
|
onChange: v,
|
|
65
|
-
onBlur:
|
|
66
|
-
locale:
|
|
67
|
-
uploadProps:
|
|
65
|
+
onBlur: G,
|
|
66
|
+
locale: w = "en-US",
|
|
67
|
+
uploadProps: M,
|
|
68
68
|
disabled: o = !1,
|
|
69
|
-
toolbarActionsRight:
|
|
70
|
-
onReady:
|
|
69
|
+
toolbarActionsRight: W,
|
|
70
|
+
onReady: Ve
|
|
71
71
|
}) => {
|
|
72
|
-
const { t: i, i18n:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}, [
|
|
76
|
-
const
|
|
72
|
+
const { t: i, i18n: $ } = ft();
|
|
73
|
+
S(() => {
|
|
74
|
+
w && $.language !== w && $.changeLanguage(w);
|
|
75
|
+
}, [$, w]);
|
|
76
|
+
const Se = w || $.language, O = te[Se]?.translation ?? Ce, d = k(
|
|
77
77
|
() => ({
|
|
78
78
|
image: i("toolbarInsertImage", {
|
|
79
79
|
defaultValue: "Insert image"
|
|
@@ -116,7 +116,7 @@ const Ve = [], Ce = (C, p) => {
|
|
|
116
116
|
})
|
|
117
117
|
}),
|
|
118
118
|
[i]
|
|
119
|
-
),
|
|
119
|
+
), be = k(
|
|
120
120
|
() => ({
|
|
121
121
|
searchPlaceholder: i("variableSearchPlaceholder", {
|
|
122
122
|
defaultValue: "Search variable"
|
|
@@ -126,107 +126,107 @@ const Ve = [], Ce = (C, p) => {
|
|
|
126
126
|
emptyLabel: i("variableNotFound", "No variables found")
|
|
127
127
|
}),
|
|
128
128
|
[i]
|
|
129
|
-
),
|
|
129
|
+
), Ie = f === "quickEdit" ? i("placeholderQuickEdit", {
|
|
130
130
|
defaultValue: i("placeholderCodeEdit", {
|
|
131
131
|
defaultValue: i("placeholder")
|
|
132
132
|
})
|
|
133
|
-
}) : i("placeholderCodeEdit", { defaultValue: i("placeholder") }),
|
|
133
|
+
}) : i("placeholderCodeEdit", { defaultValue: i("placeholder") }), R = k(() => {
|
|
134
134
|
const e = /* @__PURE__ */ new Set();
|
|
135
|
-
return (
|
|
136
|
-
const r = typeof
|
|
135
|
+
return (x ?? ge).filter((n) => {
|
|
136
|
+
const r = typeof n?.name == "string" ? n.name.toLowerCase() : "";
|
|
137
137
|
return !r || e.has(r) ? !1 : (e.add(r), !0);
|
|
138
138
|
});
|
|
139
|
-
}, [
|
|
139
|
+
}, [x]), Q = k(() => {
|
|
140
140
|
const e = new Set(
|
|
141
|
-
|
|
142
|
-
),
|
|
143
|
-
return (L ??
|
|
144
|
-
const
|
|
145
|
-
return !
|
|
141
|
+
R.map((r) => r.name.toLowerCase())
|
|
142
|
+
), n = /* @__PURE__ */ new Set();
|
|
143
|
+
return (L ?? ge).filter((r) => {
|
|
144
|
+
const t = typeof r?.name == "string" ? r.name.toLowerCase() : "";
|
|
145
|
+
return !t || e.has(t) || n.has(t) ? !1 : (n.add(t), !0);
|
|
146
146
|
});
|
|
147
|
-
}, [L,
|
|
148
|
-
|
|
149
|
-
), [
|
|
150
|
-
|
|
147
|
+
}, [L, R]), [Y, E] = I(!1), [_, y] = I(!1), [xe, z] = I(null), [ne, J] = I(
|
|
148
|
+
Q
|
|
149
|
+
), [H, ve] = I(
|
|
150
|
+
R
|
|
151
151
|
);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}, [
|
|
155
|
-
|
|
156
|
-
}, [
|
|
157
|
-
const [
|
|
158
|
-
|
|
159
|
-
), [
|
|
160
|
-
oe(!1),
|
|
161
|
-
}, []),
|
|
152
|
+
S(() => {
|
|
153
|
+
J(Q);
|
|
154
|
+
}, [Q]), S(() => {
|
|
155
|
+
ve(R);
|
|
156
|
+
}, [R]);
|
|
157
|
+
const [b, T] = I(
|
|
158
|
+
m.Empty
|
|
159
|
+
), [c, B] = I(), s = Z(null), U = Z(null), q = Z(null), [K, oe] = I(!1), g = a(() => {
|
|
160
|
+
oe(!1), q.current = null;
|
|
161
|
+
}, []), we = a(
|
|
162
162
|
(e) => {
|
|
163
163
|
if (!o) {
|
|
164
|
-
if (
|
|
164
|
+
if (K && q.current === e) {
|
|
165
165
|
g();
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
q.current = e, oe(!0);
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
|
-
[g, o,
|
|
172
|
-
),
|
|
173
|
-
selectedOption:
|
|
171
|
+
[g, o, K]
|
|
172
|
+
), Ee = {
|
|
173
|
+
selectedOption: b,
|
|
174
174
|
setSelectedOption: T,
|
|
175
|
-
dialogOpen:
|
|
175
|
+
dialogOpen: Y,
|
|
176
176
|
setDialogOpen: E,
|
|
177
|
-
popoverOpen:
|
|
178
|
-
setPopoverOpen:
|
|
179
|
-
popoverPosition:
|
|
177
|
+
popoverOpen: _,
|
|
178
|
+
setPopoverOpen: y,
|
|
179
|
+
popoverPosition: xe,
|
|
180
180
|
setPopoverPosition: z
|
|
181
181
|
};
|
|
182
|
-
|
|
183
|
-
o && (E(!1),
|
|
182
|
+
S(() => {
|
|
183
|
+
o && (E(!1), y(!1), T(m.Empty), B(null), z(null), g());
|
|
184
184
|
}, [
|
|
185
185
|
g,
|
|
186
186
|
o,
|
|
187
187
|
E,
|
|
188
|
-
|
|
188
|
+
y,
|
|
189
189
|
z,
|
|
190
190
|
T,
|
|
191
|
-
|
|
191
|
+
B
|
|
192
192
|
]);
|
|
193
|
-
const
|
|
193
|
+
const j = a(
|
|
194
194
|
(e) => {
|
|
195
|
-
if (
|
|
195
|
+
if (f !== "quickEdit" || !e)
|
|
196
196
|
return;
|
|
197
|
-
const
|
|
198
|
-
if (!
|
|
197
|
+
const n = et(e);
|
|
198
|
+
if (!n.length)
|
|
199
199
|
return;
|
|
200
200
|
const r = new Set(
|
|
201
|
-
|
|
201
|
+
H.map((t) => t.name.toLowerCase())
|
|
202
202
|
);
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
),
|
|
207
|
-
return
|
|
208
|
-
const
|
|
209
|
-
!
|
|
210
|
-
}),
|
|
203
|
+
J((t) => {
|
|
204
|
+
const u = new Set(
|
|
205
|
+
t.map((C) => C.name.toLowerCase())
|
|
206
|
+
), h = /* @__PURE__ */ new Set(), p = [];
|
|
207
|
+
return n.forEach((C) => {
|
|
208
|
+
const A = C.toLowerCase();
|
|
209
|
+
!C || r.has(A) || u.has(A) || h.has(A) || (p.push({ name: C }), h.add(A));
|
|
210
|
+
}), p.length ? [...p, ...t] : t;
|
|
211
211
|
});
|
|
212
212
|
},
|
|
213
|
-
[
|
|
213
|
+
[f, H]
|
|
214
214
|
);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}, [
|
|
218
|
-
const
|
|
215
|
+
S(() => {
|
|
216
|
+
j(V);
|
|
217
|
+
}, [V, j]);
|
|
218
|
+
const X = a(
|
|
219
219
|
(e) => {
|
|
220
220
|
if (!o)
|
|
221
|
-
if (g(), T(e), e ===
|
|
221
|
+
if (g(), T(e), e === m.Variable) {
|
|
222
222
|
if (s.current) {
|
|
223
|
-
const { state:
|
|
224
|
-
|
|
225
|
-
x:
|
|
226
|
-
y:
|
|
223
|
+
const { state: n } = s.current, r = n.selection.main.from, t = s.current.coordsAtPos(r);
|
|
224
|
+
t && z({
|
|
225
|
+
x: t.left,
|
|
226
|
+
y: t.bottom
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
y(!0);
|
|
230
230
|
} else
|
|
231
231
|
E(!0);
|
|
232
232
|
},
|
|
@@ -234,10 +234,10 @@ const Ve = [], Ce = (C, p) => {
|
|
|
234
234
|
), P = a(
|
|
235
235
|
(e) => {
|
|
236
236
|
if (o || !s.current) return;
|
|
237
|
-
const { state:
|
|
237
|
+
const { state: n, dispatch: r } = s.current, t = n.selection.main.from;
|
|
238
238
|
r({
|
|
239
|
-
changes: { from:
|
|
240
|
-
selection: { anchor:
|
|
239
|
+
changes: { from: t, insert: e },
|
|
240
|
+
selection: { anchor: t + e.length }
|
|
241
241
|
});
|
|
242
242
|
},
|
|
243
243
|
[s, o]
|
|
@@ -245,10 +245,10 @@ const Ve = [], Ce = (C, p) => {
|
|
|
245
245
|
(e) => {
|
|
246
246
|
if (o || !s.current)
|
|
247
247
|
return;
|
|
248
|
-
const { state:
|
|
248
|
+
const { state: n, dispatch: r } = s.current, t = n.selection.main;
|
|
249
249
|
r({
|
|
250
|
-
changes: { from:
|
|
251
|
-
selection: { anchor:
|
|
250
|
+
changes: { from: t.from, to: t.to, insert: e },
|
|
251
|
+
selection: { anchor: t.from + e.length }
|
|
252
252
|
});
|
|
253
253
|
},
|
|
254
254
|
[o]
|
|
@@ -262,180 +262,184 @@ const Ve = [], Ce = (C, p) => {
|
|
|
262
262
|
v?.(e);
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
|
-
const
|
|
266
|
-
|
|
265
|
+
const n = s.current, { state: r, dispatch: t } = n;
|
|
266
|
+
t({
|
|
267
267
|
changes: { from: 0, to: r.doc.length, insert: e },
|
|
268
268
|
selection: { anchor: e.length }
|
|
269
269
|
});
|
|
270
270
|
},
|
|
271
271
|
[o, v]
|
|
272
|
-
),
|
|
273
|
-
if (o || !
|
|
272
|
+
), F = a(() => {
|
|
273
|
+
if (o || !c || !s.current || c.from === -1)
|
|
274
274
|
return;
|
|
275
|
-
const { from: e, to:
|
|
275
|
+
const { from: e, to: n } = c, { dispatch: r } = s.current;
|
|
276
276
|
r({
|
|
277
|
-
changes: { from: e, to:
|
|
277
|
+
changes: { from: e, to: n, insert: "" }
|
|
278
278
|
});
|
|
279
|
-
}, [
|
|
280
|
-
(e,
|
|
279
|
+
}, [c, s, o]), D = a(
|
|
280
|
+
(e, n, r = !1) => {
|
|
281
281
|
if (o || !s.current)
|
|
282
282
|
return;
|
|
283
|
-
const
|
|
284
|
-
|
|
283
|
+
const t = s.current, { state: u, dispatch: h } = t, p = n ?? u.selection.main, C = ht(e), A = r ? C.length : 2 + e.length;
|
|
284
|
+
h({
|
|
285
285
|
changes: {
|
|
286
|
-
from:
|
|
287
|
-
to:
|
|
288
|
-
insert:
|
|
286
|
+
from: p.from,
|
|
287
|
+
to: p.to,
|
|
288
|
+
insert: C
|
|
289
289
|
},
|
|
290
290
|
selection: {
|
|
291
|
-
anchor:
|
|
291
|
+
anchor: p.from + A
|
|
292
292
|
}
|
|
293
|
-
}),
|
|
293
|
+
}), t.focus();
|
|
294
294
|
},
|
|
295
295
|
[o]
|
|
296
|
-
),
|
|
297
|
-
o || (g(),
|
|
298
|
-
}, [g, o,
|
|
296
|
+
), Te = a(() => {
|
|
297
|
+
o || (g(), D(""));
|
|
298
|
+
}, [g, o, D]), ke = a(() => {
|
|
299
299
|
if (o || !s.current)
|
|
300
300
|
return;
|
|
301
|
-
const e = s.current, { state:
|
|
301
|
+
const e = s.current, { state: n, dispatch: r } = e, t = n.selection.main;
|
|
302
302
|
r({
|
|
303
303
|
changes: {
|
|
304
|
-
from:
|
|
305
|
-
to:
|
|
304
|
+
from: t.from,
|
|
305
|
+
to: t.to,
|
|
306
306
|
insert: "======"
|
|
307
307
|
},
|
|
308
308
|
selection: {
|
|
309
|
-
anchor:
|
|
309
|
+
anchor: t.from + 3
|
|
310
310
|
}
|
|
311
311
|
}), e.focus();
|
|
312
|
-
}, [o]),
|
|
312
|
+
}, [o]), Le = a(() => {
|
|
313
313
|
if (o || !s.current)
|
|
314
314
|
return;
|
|
315
|
-
const e = s.current, { state:
|
|
315
|
+
const e = s.current, { state: n, dispatch: r } = e, t = n.selection.main;
|
|
316
316
|
r({
|
|
317
317
|
changes: {
|
|
318
|
-
from:
|
|
319
|
-
to:
|
|
318
|
+
from: t.from,
|
|
319
|
+
to: t.to,
|
|
320
320
|
insert: "[]()"
|
|
321
321
|
},
|
|
322
322
|
selection: {
|
|
323
|
-
anchor:
|
|
323
|
+
anchor: t.from + 1
|
|
324
324
|
}
|
|
325
325
|
}), e.focus();
|
|
326
|
-
}, [o]),
|
|
326
|
+
}, [o]), Oe = a(() => {
|
|
327
327
|
if (o || !s.current)
|
|
328
328
|
return;
|
|
329
|
-
const e = s.current, { state:
|
|
329
|
+
const e = s.current, { state: n, dispatch: r } = e, t = n.selection.main;
|
|
330
330
|
r({
|
|
331
331
|
changes: {
|
|
332
|
-
from:
|
|
333
|
-
to:
|
|
332
|
+
from: t.from,
|
|
333
|
+
to: t.to,
|
|
334
334
|
insert: "?[]"
|
|
335
335
|
},
|
|
336
336
|
selection: {
|
|
337
|
-
anchor:
|
|
337
|
+
anchor: t.from + 2
|
|
338
338
|
}
|
|
339
339
|
}), e.focus();
|
|
340
|
-
}, [o]),
|
|
340
|
+
}, [o]), ye = a(() => {
|
|
341
341
|
if (o || !s.current)
|
|
342
342
|
return;
|
|
343
|
-
const e = s.current, { state:
|
|
343
|
+
const e = s.current, { state: n, dispatch: r } = e, t = n.selection.main, u = d.singleChoiceOption1, h = d.singleChoiceOption2, p = `?[%{{}} ${u} | ${h}]`;
|
|
344
344
|
r({
|
|
345
345
|
changes: {
|
|
346
|
-
from:
|
|
347
|
-
to:
|
|
348
|
-
insert:
|
|
346
|
+
from: t.from,
|
|
347
|
+
to: t.to,
|
|
348
|
+
insert: p
|
|
349
349
|
},
|
|
350
350
|
selection: {
|
|
351
|
-
anchor:
|
|
351
|
+
anchor: t.from + 5
|
|
352
352
|
}
|
|
353
353
|
}), e.focus();
|
|
354
354
|
}, [
|
|
355
355
|
o,
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
]),
|
|
356
|
+
d.singleChoiceOption1,
|
|
357
|
+
d.singleChoiceOption2
|
|
358
|
+
]), je = a(() => {
|
|
359
359
|
if (o || !s.current)
|
|
360
360
|
return;
|
|
361
|
-
const e = s.current, { state:
|
|
361
|
+
const e = s.current, { state: n, dispatch: r } = e, t = n.selection.main, u = d.singleChoiceOption1, h = d.singleChoiceOption2, p = `?[%{{}} ${u} || ${h}]`;
|
|
362
362
|
r({
|
|
363
363
|
changes: {
|
|
364
|
-
from:
|
|
365
|
-
to:
|
|
366
|
-
insert:
|
|
364
|
+
from: t.from,
|
|
365
|
+
to: t.to,
|
|
366
|
+
insert: p
|
|
367
367
|
},
|
|
368
368
|
selection: {
|
|
369
|
-
anchor:
|
|
369
|
+
anchor: t.from + 5
|
|
370
370
|
}
|
|
371
371
|
}), e.focus();
|
|
372
372
|
}, [
|
|
373
373
|
o,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
]),
|
|
374
|
+
d.singleChoiceOption1,
|
|
375
|
+
d.singleChoiceOption2
|
|
376
|
+
]), Pe = a(() => {
|
|
377
377
|
if (o || !s.current)
|
|
378
378
|
return;
|
|
379
|
-
const e = s.current, { state:
|
|
379
|
+
const e = s.current, { state: n, dispatch: r } = e, t = n.selection.main, h = `?[%{{}}...${d.inputPlaceholder ?? "请输入"}]`;
|
|
380
380
|
r({
|
|
381
381
|
changes: {
|
|
382
|
-
from:
|
|
383
|
-
to:
|
|
384
|
-
insert:
|
|
382
|
+
from: t.from,
|
|
383
|
+
to: t.to,
|
|
384
|
+
insert: h
|
|
385
385
|
},
|
|
386
386
|
selection: {
|
|
387
|
-
anchor:
|
|
387
|
+
anchor: t.from + 5
|
|
388
388
|
}
|
|
389
389
|
}), e.focus();
|
|
390
|
-
}, [o,
|
|
390
|
+
}, [o, d.inputPlaceholder]), Ne = a(
|
|
391
391
|
({
|
|
392
392
|
resourceUrl: e,
|
|
393
|
-
resourceTitle:
|
|
393
|
+
resourceTitle: n,
|
|
394
394
|
scalePercent: r
|
|
395
395
|
}) => {
|
|
396
396
|
if (!e || o) return;
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
397
|
+
const t = tt({
|
|
398
|
+
resourceUrl: e,
|
|
399
|
+
resourceTitle: n,
|
|
400
|
+
scalePercent: r
|
|
401
|
+
});
|
|
402
|
+
if (c?.type === m.Image) {
|
|
403
|
+
if (F(), !s.current) return;
|
|
404
|
+
const { dispatch: u } = s.current;
|
|
405
|
+
u({
|
|
406
|
+
changes: { from: c.from, insert: t }
|
|
403
407
|
});
|
|
404
408
|
} else
|
|
405
|
-
P(
|
|
409
|
+
P(t);
|
|
406
410
|
E(!1);
|
|
407
411
|
},
|
|
408
|
-
[
|
|
409
|
-
),
|
|
412
|
+
[F, o, P, c]
|
|
413
|
+
), Ae = a(
|
|
410
414
|
({
|
|
411
415
|
resourceUrl: e,
|
|
412
|
-
resourceTitle:
|
|
416
|
+
resourceTitle: n
|
|
413
417
|
}) => {
|
|
414
418
|
if (o)
|
|
415
419
|
return;
|
|
416
|
-
const r =
|
|
417
|
-
if (
|
|
418
|
-
if (
|
|
419
|
-
const { dispatch:
|
|
420
|
-
|
|
421
|
-
changes: { from:
|
|
420
|
+
const r = nt(e, n);
|
|
421
|
+
if (c?.type === m.Video) {
|
|
422
|
+
if (F(), !s.current) return;
|
|
423
|
+
const { dispatch: t } = s.current;
|
|
424
|
+
t({
|
|
425
|
+
changes: { from: c.from, insert: r }
|
|
422
426
|
});
|
|
423
427
|
} else
|
|
424
428
|
P(r);
|
|
425
429
|
E(!1);
|
|
426
430
|
},
|
|
427
|
-
[
|
|
428
|
-
),
|
|
431
|
+
[F, o, P, c]
|
|
432
|
+
), le = a(
|
|
429
433
|
(e) => {
|
|
430
434
|
if (o)
|
|
431
435
|
return;
|
|
432
|
-
const
|
|
433
|
-
|
|
436
|
+
const n = c?.type === m.Variable ? { from: c.from, to: c.to } : void 0;
|
|
437
|
+
D(e.name, n, !0), y(!1), g();
|
|
434
438
|
},
|
|
435
|
-
[o,
|
|
436
|
-
),
|
|
439
|
+
[o, D, c, g]
|
|
440
|
+
), ce = a(() => He({
|
|
437
441
|
override: [
|
|
438
|
-
|
|
442
|
+
ot(X, {
|
|
439
443
|
// divider: currentStrings.slashDivider,
|
|
440
444
|
// fixedText: currentStrings.slashFixedText,
|
|
441
445
|
image: O.slashImage,
|
|
@@ -449,84 +453,84 @@ const Ve = [], Ce = (C, p) => {
|
|
|
449
453
|
O.slashImage,
|
|
450
454
|
O.slashVideo,
|
|
451
455
|
O.slashVariable,
|
|
452
|
-
|
|
453
|
-
]),
|
|
456
|
+
X
|
|
457
|
+
]), ue = a(
|
|
454
458
|
(e) => {
|
|
455
|
-
if (s.current = e.view,
|
|
456
|
-
const
|
|
457
|
-
|
|
459
|
+
if (s.current = e.view, f === "quickEdit" && U.current && e.selectionSet) {
|
|
460
|
+
const n = e.state.selection.main.head, r = e.state.doc.toString();
|
|
461
|
+
de(
|
|
458
462
|
r,
|
|
459
|
-
|
|
460
|
-
) || (
|
|
463
|
+
n
|
|
464
|
+
) || (j(r), U.current = null);
|
|
461
465
|
}
|
|
462
466
|
},
|
|
463
|
-
[
|
|
464
|
-
),
|
|
467
|
+
[j, f]
|
|
468
|
+
), me = a(
|
|
465
469
|
(e) => {
|
|
466
470
|
if (e.stopPropagation(), o)
|
|
467
471
|
return;
|
|
468
|
-
const { type:
|
|
469
|
-
if (
|
|
470
|
-
type:
|
|
471
|
-
value:
|
|
472
|
+
const { type: n, from: r, to: t, dataset: u, target: h } = e.detail, p = rt(n, u);
|
|
473
|
+
if (B({
|
|
474
|
+
type: n,
|
|
475
|
+
value: p,
|
|
472
476
|
from: r,
|
|
473
|
-
to:
|
|
474
|
-
}), T(
|
|
475
|
-
if (
|
|
476
|
-
const
|
|
477
|
+
to: t
|
|
478
|
+
}), T(n), n === m.Variable) {
|
|
479
|
+
if (h) {
|
|
480
|
+
const C = h.getBoundingClientRect();
|
|
477
481
|
z({
|
|
478
|
-
x:
|
|
479
|
-
y:
|
|
482
|
+
x: C.left,
|
|
483
|
+
y: C.bottom
|
|
480
484
|
});
|
|
481
485
|
}
|
|
482
|
-
|
|
486
|
+
y(!0);
|
|
483
487
|
} else
|
|
484
488
|
E(!0);
|
|
485
489
|
},
|
|
486
490
|
[o]
|
|
487
491
|
);
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
}, [
|
|
491
|
-
!
|
|
492
|
-
}, [
|
|
493
|
-
const e = (
|
|
494
|
-
|
|
492
|
+
S(() => {
|
|
493
|
+
Y || (T(m.Empty), B(null));
|
|
494
|
+
}, [Y]), S(() => {
|
|
495
|
+
!_ && b === m.Variable && (T(m.Empty), B(null));
|
|
496
|
+
}, [_, b]), S(() => {
|
|
497
|
+
const e = (n) => {
|
|
498
|
+
n.detail.view === s.current && me(n);
|
|
495
499
|
};
|
|
496
500
|
return window.addEventListener("globalTagClick", e), () => {
|
|
497
501
|
window.removeEventListener("globalTagClick", e);
|
|
498
502
|
};
|
|
499
|
-
}, [
|
|
500
|
-
const Re =
|
|
503
|
+
}, [me]);
|
|
504
|
+
const Re = k(() => {
|
|
501
505
|
const e = [
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
+
pe.lineWrapping,
|
|
507
|
+
Ue(),
|
|
508
|
+
qe(Fe),
|
|
509
|
+
ct
|
|
506
510
|
];
|
|
507
|
-
return o || e.push(
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
+
return o || e.push(ce()), f === "quickEdit" && e.push(
|
|
512
|
+
it,
|
|
513
|
+
at,
|
|
514
|
+
lt
|
|
511
515
|
// fixedTextPlaceholderExtension,
|
|
512
516
|
// DividerPlaceholder,
|
|
513
517
|
), e.push(
|
|
514
|
-
|
|
515
|
-
|
|
518
|
+
pe.updateListener.of((n) => {
|
|
519
|
+
ue(n);
|
|
516
520
|
})
|
|
517
521
|
), e;
|
|
518
|
-
}, [o,
|
|
522
|
+
}, [o, f, ce, ue]), ze = a(
|
|
519
523
|
(e) => {
|
|
520
524
|
if (o)
|
|
521
525
|
return;
|
|
522
|
-
const
|
|
523
|
-
|
|
526
|
+
const n = s.current?.state.selection.main.head ?? -1;
|
|
527
|
+
de(
|
|
524
528
|
e,
|
|
525
|
-
|
|
526
|
-
) ?
|
|
529
|
+
n
|
|
530
|
+
) ? U.current = e : (U.current = null, j(e)), v?.(e);
|
|
527
531
|
},
|
|
528
|
-
[
|
|
529
|
-
),
|
|
532
|
+
[j, v, o]
|
|
533
|
+
), fe = !o && K, N = k(
|
|
530
534
|
() => ({
|
|
531
535
|
insertTextAtCursor: P,
|
|
532
536
|
replaceSelection: re,
|
|
@@ -535,92 +539,92 @@ const Ve = [], Ce = (C, p) => {
|
|
|
535
539
|
setContent: ae
|
|
536
540
|
}),
|
|
537
541
|
[se, ie, P, re, ae]
|
|
538
|
-
),
|
|
542
|
+
), he = a(
|
|
539
543
|
(e) => {
|
|
540
|
-
o || "render" in e || e.onClick?.(
|
|
544
|
+
o || "render" in e || e.onClick?.(N);
|
|
541
545
|
},
|
|
542
|
-
[o,
|
|
543
|
-
),
|
|
546
|
+
[o, N]
|
|
547
|
+
), Be = k(() => W?.length ? /* @__PURE__ */ l.jsx("div", { className: "markdown-flow-editor-toolbar-right", children: W.map((e) => {
|
|
544
548
|
if ("render" in e)
|
|
545
|
-
return /* @__PURE__ */
|
|
549
|
+
return /* @__PURE__ */ l.jsx(
|
|
546
550
|
"div",
|
|
547
551
|
{
|
|
548
552
|
className: "markdown-flow-editor-toolbar-right-item",
|
|
549
|
-
children: e.render(
|
|
553
|
+
children: e.render(N)
|
|
550
554
|
},
|
|
551
555
|
e.key
|
|
552
556
|
);
|
|
553
|
-
const
|
|
557
|
+
const n = e.label || e.tooltip || void 0, r = /* @__PURE__ */ l.jsxs(
|
|
554
558
|
"button",
|
|
555
559
|
{
|
|
556
560
|
type: "button",
|
|
557
561
|
disabled: o || e.disabled,
|
|
558
|
-
onClick: () =>
|
|
562
|
+
onClick: () => he(e),
|
|
559
563
|
className: "markdown-flow-editor-toolbar-right-button",
|
|
560
|
-
"aria-label":
|
|
564
|
+
"aria-label": n,
|
|
561
565
|
title: e.label || e.tooltip,
|
|
562
566
|
children: [
|
|
563
|
-
e.icon ? /* @__PURE__ */
|
|
564
|
-
e.label ? /* @__PURE__ */
|
|
567
|
+
e.icon ? /* @__PURE__ */ l.jsx("span", { className: "toolbar-right-icon", children: e.icon }) : null,
|
|
568
|
+
e.label ? /* @__PURE__ */ l.jsx("span", { className: "toolbar-right-label", children: e.label }) : null
|
|
565
569
|
]
|
|
566
570
|
},
|
|
567
571
|
e.key
|
|
568
|
-
),
|
|
569
|
-
/* @__PURE__ */
|
|
570
|
-
/* @__PURE__ */
|
|
572
|
+
), t = e.tooltip ? /* @__PURE__ */ l.jsxs(De, { children: [
|
|
573
|
+
/* @__PURE__ */ l.jsx(Ge, { asChild: !0, children: r }),
|
|
574
|
+
/* @__PURE__ */ l.jsx(Me, { side: "top", children: e.tooltip })
|
|
571
575
|
] }) : r;
|
|
572
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ l.jsx(
|
|
573
577
|
"div",
|
|
574
578
|
{
|
|
575
579
|
className: "markdown-flow-editor-toolbar-right-item",
|
|
576
|
-
children:
|
|
580
|
+
children: t
|
|
577
581
|
},
|
|
578
582
|
e.key
|
|
579
583
|
);
|
|
580
|
-
}) }) : null, [o,
|
|
581
|
-
return
|
|
582
|
-
|
|
583
|
-
}, [
|
|
584
|
+
}) }) : null, [o, N, he, W]);
|
|
585
|
+
return S(() => {
|
|
586
|
+
Ve?.(N);
|
|
587
|
+
}, [N]), /* @__PURE__ */ l.jsxs(
|
|
584
588
|
"div",
|
|
585
589
|
{
|
|
586
590
|
className: "markdown-flow-editor",
|
|
587
591
|
"data-disabled": o ? "true" : void 0,
|
|
588
592
|
"aria-disabled": o,
|
|
589
593
|
children: [
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
-
|
|
594
|
+
/* @__PURE__ */ l.jsx(
|
|
595
|
+
Ye,
|
|
592
596
|
{
|
|
593
597
|
disabled: o,
|
|
594
|
-
labels:
|
|
595
|
-
onSelect:
|
|
596
|
-
onInsertVariablePlaceholder:
|
|
597
|
-
onVariableSearchToggle:
|
|
598
|
+
labels: d,
|
|
599
|
+
onSelect: X,
|
|
600
|
+
onInsertVariablePlaceholder: Te,
|
|
601
|
+
onVariableSearchToggle: we,
|
|
598
602
|
onVariableSearchClose: g,
|
|
599
|
-
onInsertConfirmOutput:
|
|
600
|
-
onInsertLink:
|
|
601
|
-
onInsertButton:
|
|
602
|
-
onInsertSingleChoice:
|
|
603
|
-
onInsertMultiChoice:
|
|
604
|
-
onInsertInputField:
|
|
605
|
-
variableSearchActive:
|
|
606
|
-
rightSlot:
|
|
603
|
+
onInsertConfirmOutput: ke,
|
|
604
|
+
onInsertLink: Le,
|
|
605
|
+
onInsertButton: Oe,
|
|
606
|
+
onInsertSingleChoice: ye,
|
|
607
|
+
onInsertMultiChoice: je,
|
|
608
|
+
onInsertInputField: Pe,
|
|
609
|
+
variableSearchActive: fe,
|
|
610
|
+
rightSlot: Be
|
|
607
611
|
}
|
|
608
612
|
),
|
|
609
|
-
/* @__PURE__ */
|
|
610
|
-
|
|
613
|
+
/* @__PURE__ */ l.jsx(
|
|
614
|
+
_e,
|
|
611
615
|
{
|
|
612
|
-
open:
|
|
613
|
-
anchorElement:
|
|
616
|
+
open: fe,
|
|
617
|
+
anchorElement: q.current,
|
|
614
618
|
onClose: g,
|
|
615
|
-
onSelect:
|
|
619
|
+
onSelect: le,
|
|
616
620
|
variables: ne,
|
|
617
|
-
systemVariables:
|
|
618
|
-
labels:
|
|
621
|
+
systemVariables: H,
|
|
622
|
+
labels: be
|
|
619
623
|
}
|
|
620
624
|
),
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
|
|
625
|
+
/* @__PURE__ */ l.jsx("div", { className: "markdown-flow-editor-body relative overflow-auto", children: /* @__PURE__ */ l.jsxs(Je.Provider, { value: Ee, children: [
|
|
626
|
+
/* @__PURE__ */ l.jsx(
|
|
627
|
+
$e,
|
|
624
628
|
{
|
|
625
629
|
extensions: Re,
|
|
626
630
|
basicSetup: {
|
|
@@ -631,53 +635,53 @@ const Ve = [], Ce = (C, p) => {
|
|
|
631
635
|
foldGutter: !1
|
|
632
636
|
},
|
|
633
637
|
className: "rounded-md",
|
|
634
|
-
placeholder:
|
|
635
|
-
value:
|
|
638
|
+
placeholder: Ie,
|
|
639
|
+
value: V,
|
|
636
640
|
theme: "light",
|
|
637
641
|
minHeight: "2rem",
|
|
638
642
|
editable: !o,
|
|
639
|
-
onChange:
|
|
640
|
-
onBlur:
|
|
643
|
+
onChange: ze,
|
|
644
|
+
onBlur: G
|
|
641
645
|
}
|
|
642
646
|
),
|
|
643
|
-
!o && /* @__PURE__ */
|
|
644
|
-
|
|
647
|
+
!o && /* @__PURE__ */ l.jsxs(
|
|
648
|
+
We,
|
|
645
649
|
{
|
|
646
650
|
labels: {
|
|
647
|
-
title:
|
|
651
|
+
title: b === m.Image ? i("dialogTitleImage") : b === m.Video ? i("dialogTitleVideo") : b === m.Variable ? i("dialogTitleVariable") : i("dialogTitle")
|
|
648
652
|
},
|
|
649
653
|
children: [
|
|
650
|
-
|
|
651
|
-
|
|
654
|
+
b === m.Image && /* @__PURE__ */ l.jsx(
|
|
655
|
+
Ke,
|
|
652
656
|
{
|
|
653
|
-
value:
|
|
654
|
-
onSelect:
|
|
655
|
-
uploadProps:
|
|
657
|
+
value: c?.value,
|
|
658
|
+
onSelect: Ne,
|
|
659
|
+
uploadProps: M
|
|
656
660
|
}
|
|
657
661
|
),
|
|
658
|
-
|
|
659
|
-
|
|
662
|
+
b === m.Video && /* @__PURE__ */ l.jsx(
|
|
663
|
+
Xe,
|
|
660
664
|
{
|
|
661
|
-
value:
|
|
662
|
-
onSelect:
|
|
665
|
+
value: c?.value,
|
|
666
|
+
onSelect: Ae
|
|
663
667
|
}
|
|
664
668
|
)
|
|
665
669
|
]
|
|
666
670
|
}
|
|
667
671
|
),
|
|
668
|
-
!o && /* @__PURE__ */
|
|
669
|
-
|
|
672
|
+
!o && /* @__PURE__ */ l.jsx(Qe, { children: /* @__PURE__ */ l.jsx(
|
|
673
|
+
Ze,
|
|
670
674
|
{
|
|
671
675
|
variables: ne,
|
|
672
|
-
systemVariables:
|
|
673
|
-
selectedName:
|
|
674
|
-
onSelect:
|
|
676
|
+
systemVariables: H,
|
|
677
|
+
selectedName: c?.value?.variableName,
|
|
678
|
+
onSelect: le,
|
|
675
679
|
onAddVariable: (e) => {
|
|
676
|
-
|
|
680
|
+
J((n) => {
|
|
677
681
|
const r = e.name.toLowerCase();
|
|
678
|
-
return
|
|
679
|
-
(
|
|
680
|
-
) ?
|
|
682
|
+
return n.some(
|
|
683
|
+
(u) => u.name.toLowerCase() === r
|
|
684
|
+
) ? n : [e, ...n];
|
|
681
685
|
});
|
|
682
686
|
}
|
|
683
687
|
}
|
|
@@ -688,6 +692,6 @@ const Ve = [], Ce = (C, p) => {
|
|
|
688
692
|
);
|
|
689
693
|
};
|
|
690
694
|
export {
|
|
691
|
-
|
|
695
|
+
Ft as default
|
|
692
696
|
};
|
|
693
697
|
//# sourceMappingURL=MarkdownFlowEditor.es.js.map
|