markdown-flow-ui 0.3.4-dev.1 → 0.3.4-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -13
- package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
- package/dist/components/ContentRender/ContentRender.es.js +0 -1
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +0 -2
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +260 -284
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +40 -48
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -22
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +16 -18
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +49 -51
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +41 -43
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +49 -51
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +47 -49
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +45 -47
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +19 -21
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +18 -20
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +13 -15
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +41 -43
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +5 -6
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +23 -25
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/FixedTextPlaceholder.test.d.ts +1 -0
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +2 -6
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +152 -157
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.es.js +0 -12
- package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.es.js +70 -67
- package/dist/node_modules/remark-flow/dist/interaction-parser.es.js.map +1 -1
- package/package.json +2 -3
|
@@ -1,64 +1,63 @@
|
|
|
1
|
-
import { jsx 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
|
|
1
|
+
import { jsx as a, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as L, useMemo as T, useState as j, useRef as ee, useCallback as s } from "react";
|
|
3
|
+
import we from "../../node_modules/@uiw/react-codemirror/esm/index.es.js";
|
|
4
|
+
import { autocompletion as Le } from "../../node_modules/@codemirror/autocomplete/dist/index.es.js";
|
|
5
|
+
import { EditorView as te } from "../../node_modules/@codemirror/view/dist/index.es.js";
|
|
6
|
+
import { markdown as Te } from "../../node_modules/@codemirror/lang-markdown/dist/index.es.js";
|
|
7
|
+
import { syntaxHighlighting as ke, defaultHighlightStyle as Ve } from "../../node_modules/@codemirror/language/dist/index.es.js";
|
|
8
|
+
import { Tooltip as Oe, TooltipTrigger as Ee, TooltipContent as Se } from "../ui/tooltip.es.js";
|
|
9
9
|
import ye from "./components/CustomDialog.es.js";
|
|
10
10
|
import xe from "./components/EditorToolbar.es.js";
|
|
11
11
|
import be from "./editor-context.es.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { SelectedOption as
|
|
12
|
+
import Pe from "./components/ImageInject.es.js";
|
|
13
|
+
import De from "./components/VideoInject.es.js";
|
|
14
|
+
import { SelectedOption as f } from "./types.es.js";
|
|
15
15
|
/* empty css */
|
|
16
|
-
import { getImageContentToInsert as
|
|
17
|
-
import
|
|
16
|
+
import { getImageContentToInsert as Ne, getVideoContentToInsert as Me, createSlashCommands as Re, parseContentInfo as Be } from "./utils.es.js";
|
|
17
|
+
import Fe from "./plugins/ImgPlaceholder.es.js";
|
|
18
18
|
import je from "./plugins/VideoPlaceholder.es.js";
|
|
19
19
|
import { mediaPlaceholderLabels as Ae } from "./plugins/mediaPlaceholderLabels.es.js";
|
|
20
|
-
import
|
|
20
|
+
import He from "./plugins/SyntaxHighlighter.es.js";
|
|
21
21
|
import A from "../../node_modules/i18next/dist/esm/i18next.es.js";
|
|
22
|
-
import { DEFAULT_EDITOR_LOCALE as
|
|
23
|
-
import { normalizeMarkdownFlowLocale as
|
|
24
|
-
import { useDetachedLanguage as
|
|
25
|
-
import { useResolvedDirection as
|
|
26
|
-
import { initReactI18next as
|
|
27
|
-
import { useTranslation as
|
|
28
|
-
A.isInitialized ? Object.entries(
|
|
22
|
+
import { DEFAULT_EDITOR_LOCALE as H, editorLocaleResources as oe, getEditorLocaleMessages as $e } from "./editorI18n.es.js";
|
|
23
|
+
import { normalizeMarkdownFlowLocale as qe, getMarkdownFlowDirection as ze, getMarkdownFlowLanguage as Ge } from "../../lib/locale.es.js";
|
|
24
|
+
import { useDetachedLanguage as We } from "../../lib/useDetachedLanguage.es.js";
|
|
25
|
+
import { useResolvedDirection as _e } from "../../lib/useResolvedDirection.es.js";
|
|
26
|
+
import { initReactI18next as Ke } from "../../node_modules/react-i18next/dist/es/initReactI18next.es.js";
|
|
27
|
+
import { useTranslation as Qe } from "../../node_modules/react-i18next/dist/es/useTranslation.es.js";
|
|
28
|
+
A.isInitialized ? Object.entries(oe).forEach(([b, I]) => {
|
|
29
29
|
A.addResourceBundle(
|
|
30
30
|
b,
|
|
31
31
|
"translation",
|
|
32
|
-
|
|
32
|
+
I.translation,
|
|
33
33
|
!0,
|
|
34
34
|
!0
|
|
35
35
|
);
|
|
36
|
-
}) : A.use(
|
|
37
|
-
resources:
|
|
38
|
-
lng:
|
|
39
|
-
fallbackLng:
|
|
36
|
+
}) : A.use(Ke).init({
|
|
37
|
+
resources: oe,
|
|
38
|
+
lng: H,
|
|
39
|
+
fallbackLng: H,
|
|
40
40
|
interpolation: { escapeValue: !1 }
|
|
41
41
|
});
|
|
42
|
-
const
|
|
42
|
+
const Tt = ({
|
|
43
43
|
content: b = "",
|
|
44
|
-
editMode:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
onReady: ce
|
|
44
|
+
editMode: I = "codeEdit",
|
|
45
|
+
onChange: k,
|
|
46
|
+
onBlur: ne,
|
|
47
|
+
locale: P,
|
|
48
|
+
lang: re,
|
|
49
|
+
uploadProps: ie,
|
|
50
|
+
disabled: t = !1,
|
|
51
|
+
toolbarActionsRight: D,
|
|
52
|
+
onReady: le
|
|
54
53
|
}) => {
|
|
55
|
-
const { t: l, i18n:
|
|
56
|
-
|
|
57
|
-
),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, [
|
|
61
|
-
const
|
|
54
|
+
const { t: l, i18n: N } = Qe(), V = qe(
|
|
55
|
+
P ?? H
|
|
56
|
+
), $ = ze(P), q = re ?? Ge(P);
|
|
57
|
+
L(() => {
|
|
58
|
+
N.language !== V && N.changeLanguage(V);
|
|
59
|
+
}, [N, V]);
|
|
60
|
+
const O = $e(V), u = T(
|
|
62
61
|
() => ({
|
|
63
62
|
image: l("toolbarInsertImage", {
|
|
64
63
|
defaultValue: "Insert image"
|
|
@@ -67,7 +66,7 @@ const Vt = ({
|
|
|
67
66
|
defaultValue: "Insert video"
|
|
68
67
|
}),
|
|
69
68
|
confirmOutput: l("toolbarConfirmOutput", {
|
|
70
|
-
defaultValue: "
|
|
69
|
+
defaultValue: "Insert preserved output"
|
|
71
70
|
}),
|
|
72
71
|
insertLink: l("toolbarInsertLink", {
|
|
73
72
|
defaultValue: "Insert link"
|
|
@@ -95,398 +94,375 @@ const Vt = ({
|
|
|
95
94
|
})
|
|
96
95
|
}),
|
|
97
96
|
[l]
|
|
98
|
-
), se =
|
|
97
|
+
), se = I === "quickEdit" ? l("placeholderQuickEdit", {
|
|
99
98
|
defaultValue: l("placeholderCodeEdit", {
|
|
100
99
|
defaultValue: l("placeholder")
|
|
101
100
|
})
|
|
102
|
-
}) : l("placeholderCodeEdit", { defaultValue: l("placeholder") }), [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
), [
|
|
106
|
-
|
|
107
|
-
), [
|
|
108
|
-
selectedOption:
|
|
109
|
-
setSelectedOption:
|
|
110
|
-
dialogOpen:
|
|
111
|
-
setDialogOpen:
|
|
101
|
+
}) : l("placeholderCodeEdit", { defaultValue: l("placeholder") }), [M, p] = j(!1), R = ee(null), E = We(R, q), { resolvedDirection: S } = _e(
|
|
102
|
+
R,
|
|
103
|
+
$
|
|
104
|
+
), [v, g] = j(
|
|
105
|
+
f.Empty
|
|
106
|
+
), [c, y] = j(), r = ee(null), ce = {
|
|
107
|
+
selectedOption: v,
|
|
108
|
+
setSelectedOption: g,
|
|
109
|
+
dialogOpen: M,
|
|
110
|
+
setDialogOpen: p
|
|
112
111
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}, [
|
|
116
|
-
const
|
|
112
|
+
L(() => {
|
|
113
|
+
t && (p(!1), g(f.Empty), y(null));
|
|
114
|
+
}, [t, p, g, y]);
|
|
115
|
+
const B = s(
|
|
117
116
|
(e) => {
|
|
118
|
-
|
|
117
|
+
t || (g(e), p(!0));
|
|
119
118
|
},
|
|
120
|
-
[
|
|
121
|
-
),
|
|
119
|
+
[t]
|
|
120
|
+
), d = s(
|
|
122
121
|
(e) => {
|
|
123
|
-
if (
|
|
124
|
-
const { state: n, dispatch: i } = r.current,
|
|
122
|
+
if (t || !r.current) return;
|
|
123
|
+
const { state: n, dispatch: i } = r.current, o = n.selection.main.from;
|
|
125
124
|
i({
|
|
126
|
-
changes: { from:
|
|
127
|
-
selection: { anchor:
|
|
125
|
+
changes: { from: o, insert: e },
|
|
126
|
+
selection: { anchor: o + e.length }
|
|
128
127
|
});
|
|
129
128
|
},
|
|
130
|
-
[r,
|
|
131
|
-
),
|
|
129
|
+
[r, t]
|
|
130
|
+
), z = s(
|
|
132
131
|
(e) => {
|
|
133
|
-
if (
|
|
132
|
+
if (t || !r.current)
|
|
134
133
|
return;
|
|
135
|
-
const { state: n, dispatch: i } = r.current,
|
|
134
|
+
const { state: n, dispatch: i } = r.current, o = n.selection.main;
|
|
136
135
|
i({
|
|
137
|
-
changes: { from:
|
|
138
|
-
selection: { anchor:
|
|
136
|
+
changes: { from: o.from, to: o.to, insert: e },
|
|
137
|
+
selection: { anchor: o.from + e.length }
|
|
139
138
|
});
|
|
140
139
|
},
|
|
141
|
-
[
|
|
142
|
-
),
|
|
140
|
+
[t]
|
|
141
|
+
), G = s(() => {
|
|
143
142
|
r.current?.focus();
|
|
144
|
-
}, []),
|
|
143
|
+
}, []), W = s(() => r.current?.state.doc.toString() ?? "", []), _ = s(
|
|
145
144
|
(e) => {
|
|
146
|
-
if (
|
|
145
|
+
if (t)
|
|
147
146
|
return;
|
|
148
147
|
if (!r.current) {
|
|
149
|
-
|
|
148
|
+
k?.(e);
|
|
150
149
|
return;
|
|
151
150
|
}
|
|
152
|
-
const n = r.current, { state: i, dispatch:
|
|
153
|
-
|
|
151
|
+
const n = r.current, { state: i, dispatch: o } = n;
|
|
152
|
+
o({
|
|
154
153
|
changes: { from: 0, to: i.doc.length, insert: e },
|
|
155
154
|
selection: { anchor: e.length }
|
|
156
155
|
});
|
|
157
156
|
},
|
|
158
|
-
[
|
|
159
|
-
), x =
|
|
160
|
-
if (
|
|
157
|
+
[t, k]
|
|
158
|
+
), x = s(() => {
|
|
159
|
+
if (t || !c || !r.current || c.from === -1)
|
|
161
160
|
return;
|
|
162
|
-
const { from: e, to: n } =
|
|
161
|
+
const { from: e, to: n } = c, { dispatch: i } = r.current;
|
|
163
162
|
i({
|
|
164
163
|
changes: { from: e, to: n, insert: "" }
|
|
165
164
|
});
|
|
166
|
-
}, [
|
|
167
|
-
if (
|
|
165
|
+
}, [c, r, t]), ae = s(() => {
|
|
166
|
+
if (t || !r.current)
|
|
168
167
|
return;
|
|
169
|
-
const e = r.current, { state: n, dispatch: i } = e,
|
|
168
|
+
const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main;
|
|
170
169
|
i({
|
|
171
170
|
changes: {
|
|
172
|
-
from:
|
|
173
|
-
to:
|
|
171
|
+
from: o.from,
|
|
172
|
+
to: o.to,
|
|
174
173
|
insert: "======"
|
|
175
174
|
},
|
|
176
175
|
selection: {
|
|
177
|
-
anchor:
|
|
176
|
+
anchor: o.from + 3
|
|
178
177
|
}
|
|
179
178
|
}), e.focus();
|
|
180
|
-
}, [
|
|
181
|
-
if (
|
|
179
|
+
}, [t]), ue = s(() => {
|
|
180
|
+
if (t || !r.current)
|
|
182
181
|
return;
|
|
183
|
-
const e = r.current, { state: n, dispatch: i } = e,
|
|
182
|
+
const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main;
|
|
184
183
|
i({
|
|
185
184
|
changes: {
|
|
186
|
-
from:
|
|
187
|
-
to:
|
|
185
|
+
from: o.from,
|
|
186
|
+
to: o.to,
|
|
188
187
|
insert: "[]()"
|
|
189
188
|
},
|
|
190
189
|
selection: {
|
|
191
|
-
anchor:
|
|
190
|
+
anchor: o.from + 1
|
|
192
191
|
}
|
|
193
192
|
}), e.focus();
|
|
194
|
-
}, [
|
|
195
|
-
if (
|
|
193
|
+
}, [t]), me = s(() => {
|
|
194
|
+
if (t || !r.current)
|
|
196
195
|
return;
|
|
197
|
-
const e = r.current, { state: n, dispatch: i } = e,
|
|
196
|
+
const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main;
|
|
198
197
|
i({
|
|
199
198
|
changes: {
|
|
200
|
-
from:
|
|
201
|
-
to:
|
|
199
|
+
from: o.from,
|
|
200
|
+
to: o.to,
|
|
202
201
|
insert: "?[]"
|
|
203
202
|
},
|
|
204
203
|
selection: {
|
|
205
|
-
anchor:
|
|
204
|
+
anchor: o.from + 2
|
|
206
205
|
}
|
|
207
206
|
}), e.focus();
|
|
208
|
-
}, [
|
|
209
|
-
if (
|
|
207
|
+
}, [t]), fe = s(() => {
|
|
208
|
+
if (t || !r.current)
|
|
210
209
|
return;
|
|
211
|
-
const e = r.current, { state: n, dispatch: i } = e,
|
|
210
|
+
const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main, m = u.singleChoiceOption1, h = u.singleChoiceOption2, F = `?[%{{ }} ${m} | ${h}]`;
|
|
212
211
|
i({
|
|
213
212
|
changes: {
|
|
214
|
-
from:
|
|
215
|
-
to:
|
|
216
|
-
insert:
|
|
213
|
+
from: o.from,
|
|
214
|
+
to: o.to,
|
|
215
|
+
insert: F
|
|
217
216
|
},
|
|
218
217
|
selection: {
|
|
219
|
-
anchor:
|
|
220
|
-
head: t.from + 6 + (f ? s.questionPlaceholder.length : 0)
|
|
218
|
+
anchor: o.from + 6
|
|
221
219
|
}
|
|
222
220
|
}), e.focus();
|
|
223
221
|
}, [
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
]), pe = c(() => {
|
|
230
|
-
if (o || !r.current)
|
|
222
|
+
t,
|
|
223
|
+
u.singleChoiceOption1,
|
|
224
|
+
u.singleChoiceOption2
|
|
225
|
+
]), pe = s(() => {
|
|
226
|
+
if (t || !r.current)
|
|
231
227
|
return;
|
|
232
|
-
const e = r.current, { state: n, dispatch: i } = e,
|
|
228
|
+
const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main, m = u.singleChoiceOption1, h = u.singleChoiceOption2, F = `?[%{{ }} ${m} || ${h}]`;
|
|
233
229
|
i({
|
|
234
230
|
changes: {
|
|
235
|
-
from:
|
|
236
|
-
to:
|
|
237
|
-
insert:
|
|
231
|
+
from: o.from,
|
|
232
|
+
to: o.to,
|
|
233
|
+
insert: F
|
|
238
234
|
},
|
|
239
235
|
selection: {
|
|
240
|
-
anchor:
|
|
241
|
-
head: t.from + 6 + (f ? s.questionPlaceholder.length : 0)
|
|
236
|
+
anchor: o.from + 6
|
|
242
237
|
}
|
|
243
238
|
}), e.focus();
|
|
244
239
|
}, [
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
]), ge = c(() => {
|
|
251
|
-
if (o || !r.current)
|
|
240
|
+
t,
|
|
241
|
+
u.singleChoiceOption1,
|
|
242
|
+
u.singleChoiceOption2
|
|
243
|
+
]), he = s(() => {
|
|
244
|
+
if (t || !r.current)
|
|
252
245
|
return;
|
|
253
|
-
const e = r.current, { state: n, dispatch: i } = e,
|
|
246
|
+
const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main, h = `?[%{{ }}...${u.inputPlaceholder ?? "请输入"}]`;
|
|
254
247
|
i({
|
|
255
248
|
changes: {
|
|
256
|
-
from:
|
|
257
|
-
to:
|
|
258
|
-
insert:
|
|
249
|
+
from: o.from,
|
|
250
|
+
to: o.to,
|
|
251
|
+
insert: h
|
|
259
252
|
},
|
|
260
253
|
selection: {
|
|
261
|
-
anchor:
|
|
262
|
-
head: t.from + 6 + (f ? s.questionPlaceholder.length : 0)
|
|
254
|
+
anchor: o.from + 6
|
|
263
255
|
}
|
|
264
256
|
}), e.focus();
|
|
265
|
-
}, [
|
|
266
|
-
o,
|
|
267
|
-
h.inputPlaceholder,
|
|
268
|
-
f,
|
|
269
|
-
s.questionPlaceholder
|
|
270
|
-
]), de = c(
|
|
257
|
+
}, [t, u.inputPlaceholder]), ge = s(
|
|
271
258
|
({
|
|
272
259
|
resourceUrl: e,
|
|
273
260
|
resourceTitle: n,
|
|
274
261
|
scalePercent: i
|
|
275
262
|
}) => {
|
|
276
|
-
if (!e ||
|
|
277
|
-
const
|
|
263
|
+
if (!e || t) return;
|
|
264
|
+
const o = Ne({
|
|
278
265
|
resourceUrl: e,
|
|
279
266
|
resourceTitle: n,
|
|
280
267
|
scalePercent: i
|
|
281
268
|
});
|
|
282
|
-
if (
|
|
269
|
+
if (c?.type === f.Image) {
|
|
283
270
|
if (x(), !r.current) return;
|
|
284
|
-
const { dispatch:
|
|
285
|
-
|
|
286
|
-
changes: { from:
|
|
271
|
+
const { dispatch: m } = r.current;
|
|
272
|
+
m({
|
|
273
|
+
changes: { from: c.from, insert: o }
|
|
287
274
|
});
|
|
288
275
|
} else
|
|
289
|
-
|
|
290
|
-
|
|
276
|
+
d(o);
|
|
277
|
+
p(!1);
|
|
291
278
|
},
|
|
292
|
-
[x,
|
|
293
|
-
),
|
|
279
|
+
[x, t, d, c]
|
|
280
|
+
), de = s(
|
|
294
281
|
({
|
|
295
282
|
resourceUrl: e,
|
|
296
283
|
resourceTitle: n
|
|
297
284
|
}) => {
|
|
298
|
-
if (
|
|
285
|
+
if (t)
|
|
299
286
|
return;
|
|
300
|
-
const i =
|
|
301
|
-
if (
|
|
287
|
+
const i = Me(e, n);
|
|
288
|
+
if (c?.type === f.Video) {
|
|
302
289
|
if (x(), !r.current) return;
|
|
303
|
-
const { dispatch:
|
|
304
|
-
|
|
305
|
-
changes: { from:
|
|
290
|
+
const { dispatch: o } = r.current;
|
|
291
|
+
o({
|
|
292
|
+
changes: { from: c.from, insert: i }
|
|
306
293
|
});
|
|
307
294
|
} else
|
|
308
|
-
|
|
309
|
-
|
|
295
|
+
d(i);
|
|
296
|
+
p(!1);
|
|
310
297
|
},
|
|
311
|
-
[x,
|
|
312
|
-
),
|
|
298
|
+
[x, t, d, c]
|
|
299
|
+
), K = s(() => Le({
|
|
313
300
|
override: [
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
image: s.slashImage,
|
|
318
|
-
video: s.slashVideo
|
|
301
|
+
Re(B, {
|
|
302
|
+
image: O.slashImage,
|
|
303
|
+
video: O.slashVideo
|
|
319
304
|
})
|
|
320
305
|
]
|
|
321
|
-
}), [
|
|
322
|
-
// currentStrings.slashDivider,
|
|
323
|
-
// currentStrings.slashFixedText,
|
|
324
|
-
s.slashImage,
|
|
325
|
-
s.slashVideo,
|
|
326
|
-
F
|
|
327
|
-
]), J = c((e) => {
|
|
306
|
+
}), [O.slashImage, O.slashVideo, B]), Q = s((e) => {
|
|
328
307
|
r.current = e.view;
|
|
329
|
-
}, []),
|
|
308
|
+
}, []), U = s(
|
|
330
309
|
(e) => {
|
|
331
|
-
if (e.stopPropagation(),
|
|
310
|
+
if (e.stopPropagation(), t)
|
|
332
311
|
return;
|
|
333
|
-
const { type: n, from: i, to:
|
|
312
|
+
const { type: n, from: i, to: o, dataset: m } = e.detail, h = Be(n, m);
|
|
334
313
|
y({
|
|
335
314
|
type: n,
|
|
336
|
-
value:
|
|
315
|
+
value: h,
|
|
337
316
|
from: i,
|
|
338
|
-
to:
|
|
339
|
-
}),
|
|
317
|
+
to: o
|
|
318
|
+
}), g(n), p(!0);
|
|
340
319
|
},
|
|
341
|
-
[
|
|
320
|
+
[t]
|
|
342
321
|
);
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}, [
|
|
322
|
+
L(() => {
|
|
323
|
+
M || (g(f.Empty), y(null));
|
|
324
|
+
}, [M]), L(() => {
|
|
346
325
|
const e = (n) => {
|
|
347
|
-
n.detail.view === r.current &&
|
|
326
|
+
n.detail.view === r.current && U(n);
|
|
348
327
|
};
|
|
349
328
|
return window.addEventListener("globalTagClick", e), () => {
|
|
350
329
|
window.removeEventListener("globalTagClick", e);
|
|
351
330
|
};
|
|
352
|
-
}, [
|
|
353
|
-
const
|
|
331
|
+
}, [U]);
|
|
332
|
+
const J = l("imageDefaultTitle"), X = l("videoDefaultTitle"), Y = T(
|
|
354
333
|
() => Ae.of({
|
|
355
|
-
image:
|
|
356
|
-
video:
|
|
334
|
+
image: J,
|
|
335
|
+
video: X
|
|
357
336
|
}),
|
|
358
|
-
[
|
|
359
|
-
),
|
|
337
|
+
[J, X]
|
|
338
|
+
), Ce = T(() => {
|
|
360
339
|
const e = [
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
Ve
|
|
364
|
-
|
|
340
|
+
te.lineWrapping,
|
|
341
|
+
Te(),
|
|
342
|
+
ke(Ve),
|
|
343
|
+
He
|
|
365
344
|
];
|
|
366
|
-
return
|
|
367
|
-
|
|
368
|
-
|
|
345
|
+
return t || e.push(K()), I === "quickEdit" && e.push(
|
|
346
|
+
Y,
|
|
347
|
+
Fe,
|
|
369
348
|
je
|
|
370
|
-
// fixedTextPlaceholderExtension,
|
|
371
|
-
// DividerPlaceholder,
|
|
372
349
|
), e.push(
|
|
373
|
-
|
|
374
|
-
|
|
350
|
+
te.updateListener.of((n) => {
|
|
351
|
+
Q(n);
|
|
375
352
|
})
|
|
376
353
|
), e;
|
|
377
354
|
}, [
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
]), ve = c(
|
|
355
|
+
t,
|
|
356
|
+
I,
|
|
357
|
+
K,
|
|
358
|
+
Q,
|
|
359
|
+
Y
|
|
360
|
+
]), Ie = s(
|
|
385
361
|
(e) => {
|
|
386
|
-
|
|
362
|
+
t || k?.(e);
|
|
387
363
|
},
|
|
388
|
-
[
|
|
389
|
-
),
|
|
364
|
+
[k, t]
|
|
365
|
+
), C = T(
|
|
390
366
|
() => ({
|
|
391
|
-
insertTextAtCursor:
|
|
392
|
-
replaceSelection:
|
|
393
|
-
focus:
|
|
394
|
-
getContent:
|
|
395
|
-
setContent:
|
|
367
|
+
insertTextAtCursor: d,
|
|
368
|
+
replaceSelection: z,
|
|
369
|
+
focus: G,
|
|
370
|
+
getContent: W,
|
|
371
|
+
setContent: _
|
|
396
372
|
}),
|
|
397
|
-
[
|
|
398
|
-
),
|
|
373
|
+
[G, W, d, z, _]
|
|
374
|
+
), Z = s(
|
|
399
375
|
(e) => {
|
|
400
|
-
|
|
376
|
+
t || "render" in e || e.onClick?.(C);
|
|
401
377
|
},
|
|
402
|
-
[
|
|
403
|
-
),
|
|
378
|
+
[t, C]
|
|
379
|
+
), ve = T(() => D?.length ? /* @__PURE__ */ a("div", { className: "markdown-flow-editor-toolbar-right", children: D.map((e) => {
|
|
404
380
|
if ("render" in e)
|
|
405
|
-
return /* @__PURE__ */
|
|
381
|
+
return /* @__PURE__ */ a(
|
|
406
382
|
"div",
|
|
407
383
|
{
|
|
408
384
|
className: "markdown-flow-editor-toolbar-right-item",
|
|
409
|
-
children: e.render(
|
|
385
|
+
children: e.render(C)
|
|
410
386
|
},
|
|
411
387
|
e.key
|
|
412
388
|
);
|
|
413
|
-
const n = e.label || e.tooltip || void 0, i = /* @__PURE__ */
|
|
389
|
+
const n = e.label || e.tooltip || void 0, i = /* @__PURE__ */ w(
|
|
414
390
|
"button",
|
|
415
391
|
{
|
|
416
392
|
type: "button",
|
|
417
|
-
disabled:
|
|
418
|
-
onClick: () =>
|
|
393
|
+
disabled: t || e.disabled,
|
|
394
|
+
onClick: () => Z(e),
|
|
419
395
|
className: "markdown-flow-editor-toolbar-right-button",
|
|
420
396
|
"aria-label": n,
|
|
421
|
-
title: e.
|
|
397
|
+
title: e.tooltip ? void 0 : e.label,
|
|
422
398
|
children: [
|
|
423
|
-
e.icon ? /* @__PURE__ */
|
|
424
|
-
e.label ? /* @__PURE__ */
|
|
399
|
+
e.icon ? /* @__PURE__ */ a("span", { className: "toolbar-right-icon", children: e.icon }) : null,
|
|
400
|
+
e.label ? /* @__PURE__ */ a("span", { className: "toolbar-right-label", children: e.label }) : null
|
|
425
401
|
]
|
|
426
402
|
},
|
|
427
403
|
e.key
|
|
428
|
-
),
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
|
|
404
|
+
), o = e.tooltip ? /* @__PURE__ */ w(Oe, { children: [
|
|
405
|
+
/* @__PURE__ */ a(Ee, { asChild: !0, children: i }),
|
|
406
|
+
/* @__PURE__ */ a(
|
|
407
|
+
Se,
|
|
432
408
|
{
|
|
433
409
|
side: "top",
|
|
434
|
-
dir:
|
|
435
|
-
lang:
|
|
410
|
+
dir: S,
|
|
411
|
+
lang: E,
|
|
436
412
|
children: e.tooltip
|
|
437
413
|
}
|
|
438
414
|
)
|
|
439
415
|
] }) : i;
|
|
440
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ a(
|
|
441
417
|
"div",
|
|
442
418
|
{
|
|
443
419
|
className: "markdown-flow-editor-toolbar-right-item",
|
|
444
|
-
children:
|
|
420
|
+
children: o
|
|
445
421
|
},
|
|
446
422
|
e.key
|
|
447
423
|
);
|
|
448
424
|
}) }) : null, [
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
P,
|
|
425
|
+
t,
|
|
426
|
+
C,
|
|
427
|
+
Z,
|
|
453
428
|
S,
|
|
454
|
-
|
|
429
|
+
E,
|
|
430
|
+
D
|
|
455
431
|
]);
|
|
456
|
-
return
|
|
457
|
-
|
|
458
|
-
}, [
|
|
432
|
+
return L(() => {
|
|
433
|
+
le?.(C);
|
|
434
|
+
}, [C]), /* @__PURE__ */ w(
|
|
459
435
|
"div",
|
|
460
436
|
{
|
|
461
437
|
className: "markdown-flow-editor",
|
|
462
|
-
ref:
|
|
463
|
-
dir:
|
|
464
|
-
lang:
|
|
465
|
-
"data-disabled":
|
|
466
|
-
"aria-disabled":
|
|
438
|
+
ref: R,
|
|
439
|
+
dir: $,
|
|
440
|
+
lang: q,
|
|
441
|
+
"data-disabled": t ? "true" : void 0,
|
|
442
|
+
"aria-disabled": t,
|
|
467
443
|
children: [
|
|
468
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ a(
|
|
469
445
|
xe,
|
|
470
446
|
{
|
|
471
|
-
disabled:
|
|
472
|
-
labels:
|
|
473
|
-
tooltipDirection:
|
|
474
|
-
tooltipLanguage:
|
|
475
|
-
onSelect:
|
|
476
|
-
onInsertConfirmOutput:
|
|
477
|
-
onInsertLink:
|
|
478
|
-
onInsertButton:
|
|
479
|
-
onInsertSingleChoice:
|
|
447
|
+
disabled: t,
|
|
448
|
+
labels: u,
|
|
449
|
+
tooltipDirection: S,
|
|
450
|
+
tooltipLanguage: E,
|
|
451
|
+
onSelect: B,
|
|
452
|
+
onInsertConfirmOutput: ae,
|
|
453
|
+
onInsertLink: ue,
|
|
454
|
+
onInsertButton: me,
|
|
455
|
+
onInsertSingleChoice: fe,
|
|
480
456
|
onInsertMultiChoice: pe,
|
|
481
|
-
onInsertInputField:
|
|
482
|
-
rightSlot:
|
|
457
|
+
onInsertInputField: he,
|
|
458
|
+
rightSlot: ve
|
|
483
459
|
}
|
|
484
460
|
),
|
|
485
|
-
/* @__PURE__ */
|
|
486
|
-
/* @__PURE__ */
|
|
487
|
-
|
|
461
|
+
/* @__PURE__ */ a("div", { className: "markdown-flow-editor-body relative overflow-auto", children: /* @__PURE__ */ w(be.Provider, { value: ce, children: [
|
|
462
|
+
/* @__PURE__ */ a(
|
|
463
|
+
we,
|
|
488
464
|
{
|
|
489
|
-
extensions:
|
|
465
|
+
extensions: Ce,
|
|
490
466
|
basicSetup: {
|
|
491
467
|
lineNumbers: !1,
|
|
492
468
|
searchKeymap: !1,
|
|
@@ -500,34 +476,34 @@ const Vt = ({
|
|
|
500
476
|
value: b,
|
|
501
477
|
theme: "light",
|
|
502
478
|
minHeight: "2rem",
|
|
503
|
-
editable: !
|
|
504
|
-
onChange:
|
|
505
|
-
onBlur:
|
|
479
|
+
editable: !t,
|
|
480
|
+
onChange: Ie,
|
|
481
|
+
onBlur: ne
|
|
506
482
|
}
|
|
507
483
|
),
|
|
508
|
-
!
|
|
484
|
+
!t && /* @__PURE__ */ w(
|
|
509
485
|
ye,
|
|
510
486
|
{
|
|
511
|
-
dir:
|
|
512
|
-
lang:
|
|
487
|
+
dir: S,
|
|
488
|
+
lang: E,
|
|
513
489
|
labels: {
|
|
514
490
|
closeButtonLabel: l("dialogCloseLabel"),
|
|
515
|
-
title:
|
|
491
|
+
title: v === f.Image ? l("dialogTitleImage") : v === f.Video ? l("dialogTitleVideo") : l("dialogTitle")
|
|
516
492
|
},
|
|
517
493
|
children: [
|
|
518
|
-
|
|
519
|
-
|
|
494
|
+
v === f.Image && /* @__PURE__ */ a(
|
|
495
|
+
Pe,
|
|
520
496
|
{
|
|
521
|
-
value:
|
|
522
|
-
onSelect:
|
|
523
|
-
uploadProps:
|
|
497
|
+
value: c?.value,
|
|
498
|
+
onSelect: ge,
|
|
499
|
+
uploadProps: ie
|
|
524
500
|
}
|
|
525
501
|
),
|
|
526
|
-
|
|
527
|
-
|
|
502
|
+
v === f.Video && /* @__PURE__ */ a(
|
|
503
|
+
De,
|
|
528
504
|
{
|
|
529
|
-
value:
|
|
530
|
-
onSelect:
|
|
505
|
+
value: c?.value,
|
|
506
|
+
onSelect: de
|
|
531
507
|
}
|
|
532
508
|
)
|
|
533
509
|
]
|
|
@@ -539,6 +515,6 @@ const Vt = ({
|
|
|
539
515
|
);
|
|
540
516
|
};
|
|
541
517
|
export {
|
|
542
|
-
|
|
518
|
+
Tt as default
|
|
543
519
|
};
|
|
544
520
|
//# sourceMappingURL=MarkdownFlowEditor.es.js.map
|