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