markdown-flow-ui 0.3.1 → 0.3.2-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 +13 -0
- package/dist/_virtual/index.es3.js +4 -5
- package/dist/_virtual/index.es3.js.map +1 -1
- package/dist/_virtual/index.es4.js +5 -4
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index4.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 +444 -415
- 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.d.ts +1 -0
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +71 -68
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.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 +16 -14
- 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 +19 -17
- 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 +15 -13
- 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 +21 -19
- 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 +27 -25
- 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 +21 -19
- 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 +19 -17
- 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 +18 -16
- 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 +17 -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 +2 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +25 -23
- 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 +28 -26
- 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 +154 -149
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.d.ts +2 -0
- package/dist/components/MarkdownFlowEditor/utils.es.js +54 -52
- package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
- package/package.json +1 -1
|
@@ -1,309 +1,314 @@
|
|
|
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
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { SelectedOption as
|
|
1
|
+
import { jsx as p, jsxs as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as I, useMemo as T, useState as L, useRef as U, useCallback as s } from "react";
|
|
3
|
+
import Ze from "../../node_modules/@uiw/react-codemirror/esm/index.es.js";
|
|
4
|
+
import { autocompletion as qe } 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 Me } from "../../node_modules/@codemirror/lang-markdown/dist/index.es.js";
|
|
7
|
+
import { syntaxHighlighting as et, defaultHighlightStyle as tt } from "../../node_modules/@codemirror/language/dist/index.es.js";
|
|
8
|
+
import { Tooltip as rt, TooltipTrigger as nt, TooltipContent as ot } from "../ui/tooltip.es.js";
|
|
9
|
+
import at from "./components/CustomDialog.es.js";
|
|
10
|
+
import lt from "./components/CustomPopover.es.js";
|
|
11
|
+
import it from "./components/EditorToolbar.es.js";
|
|
12
|
+
import st from "./components/VariableSearchDropdown.es.js";
|
|
13
|
+
import ct from "./editor-context.es.js";
|
|
14
|
+
import ut from "./components/ImageInject.es.js";
|
|
15
|
+
import mt from "./components/VideoInject.es.js";
|
|
16
|
+
import ft from "./components/VariableSelect.es.js";
|
|
17
|
+
import { SelectedOption as m } from "./types.es.js";
|
|
18
18
|
/* empty css */
|
|
19
|
-
import { getImageContentToInsert as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { mediaPlaceholderLabels as
|
|
23
|
-
import
|
|
24
|
-
import
|
|
19
|
+
import { getImageContentToInsert as ht, getVideoContentToInsert as pt, createSlashCommands as gt, parseContentInfo as dt } from "./utils.es.js";
|
|
20
|
+
import Vt from "./plugins/ImgPlaceholder.es.js";
|
|
21
|
+
import bt from "./plugins/VideoPlaceholder.es.js";
|
|
22
|
+
import { mediaPlaceholderLabels as Ct } from "./plugins/mediaPlaceholderLabels.es.js";
|
|
23
|
+
import St from "./plugins/VariablePlaceholder.es.js";
|
|
24
|
+
import It, { QuestionSyntaxHighlighter as vt } from "./plugins/SyntaxHighlighter.es.js";
|
|
25
25
|
import ne from "../../node_modules/i18next/dist/esm/i18next.es.js";
|
|
26
|
-
import { DEFAULT_EDITOR_LOCALE as
|
|
27
|
-
import { normalizeMarkdownFlowLocale as
|
|
28
|
-
import { useDetachedLanguage as
|
|
29
|
-
import { useResolvedDirection as
|
|
30
|
-
import { initReactI18next as
|
|
31
|
-
import { useTranslation as
|
|
26
|
+
import { DEFAULT_EDITOR_LOCALE as oe, editorLocaleResources as Le, getEditorLocaleMessages as wt } from "./editorI18n.es.js";
|
|
27
|
+
import { normalizeMarkdownFlowLocale as Tt, getMarkdownFlowDirection as Lt, getMarkdownFlowLanguage as kt } from "../../lib/locale.es.js";
|
|
28
|
+
import { useDetachedLanguage as Et } from "../../lib/useDetachedLanguage.es.js";
|
|
29
|
+
import { useResolvedDirection as yt } from "../../lib/useResolvedDirection.es.js";
|
|
30
|
+
import { initReactI18next as Ot } from "../../node_modules/react-i18next/dist/es/initReactI18next.es.js";
|
|
31
|
+
import { useTranslation as Pt } from "../../node_modules/react-i18next/dist/es/useTranslation.es.js";
|
|
32
32
|
import { d as N } from "../../_virtual/index.es.js";
|
|
33
|
-
ne.isInitialized ? Object.entries(
|
|
33
|
+
ne.isInitialized ? Object.entries(Le).forEach(([C, d]) => {
|
|
34
34
|
ne.addResourceBundle(
|
|
35
|
-
|
|
35
|
+
C,
|
|
36
36
|
"translation",
|
|
37
|
-
|
|
37
|
+
d.translation,
|
|
38
38
|
!0,
|
|
39
39
|
!0
|
|
40
40
|
);
|
|
41
|
-
}) : ne.use(
|
|
42
|
-
resources:
|
|
43
|
-
lng:
|
|
44
|
-
fallbackLng:
|
|
41
|
+
}) : ne.use(Ot).init({
|
|
42
|
+
resources: Le,
|
|
43
|
+
lng: oe,
|
|
44
|
+
fallbackLng: oe,
|
|
45
45
|
interpolation: { escapeValue: !1 }
|
|
46
46
|
});
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
47
|
+
const ke = [], Ee = (C, d) => {
|
|
48
|
+
if (!C || d < 0)
|
|
49
49
|
return !1;
|
|
50
|
-
for (const
|
|
51
|
-
if (
|
|
50
|
+
for (const l of N.findDocumentVariableMarkers(C))
|
|
51
|
+
if (l.name !== null && d >= l.start + 2 && d <= l.end - 2)
|
|
52
52
|
return !0;
|
|
53
53
|
return !1;
|
|
54
|
-
},
|
|
55
|
-
content:
|
|
56
|
-
editMode:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
}, xt = (C = "") => C ? N.formatVariableReference(C) : "{{ }}", ur = ({
|
|
55
|
+
content: C = "",
|
|
56
|
+
editMode: d = "codeEdit",
|
|
57
|
+
questionMode: l = !1,
|
|
58
|
+
variables: ae,
|
|
59
|
+
systemVariables: le,
|
|
60
|
+
onChange: D,
|
|
61
|
+
onBlur: ye,
|
|
62
|
+
locale: Y,
|
|
62
63
|
lang: Oe,
|
|
63
|
-
uploadProps:
|
|
64
|
+
uploadProps: Pe,
|
|
64
65
|
disabled: n = !1,
|
|
65
|
-
toolbarActionsRight:
|
|
66
|
+
toolbarActionsRight: J,
|
|
66
67
|
onReady: xe
|
|
67
68
|
}) => {
|
|
68
|
-
const { t:
|
|
69
|
-
|
|
70
|
-
),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
const
|
|
69
|
+
const { t: i, i18n: X } = Pt(), H = Tt(
|
|
70
|
+
Y ?? oe
|
|
71
|
+
), ie = Lt(Y), se = Oe ?? kt(Y);
|
|
72
|
+
I(() => {
|
|
73
|
+
X.language !== H && X.changeLanguage(H);
|
|
74
|
+
}, [X, H]);
|
|
75
|
+
const f = wt(H), S = T(
|
|
75
76
|
() => ({
|
|
76
|
-
image:
|
|
77
|
+
image: i("toolbarInsertImage", {
|
|
77
78
|
defaultValue: "Insert image"
|
|
78
79
|
}),
|
|
79
|
-
video:
|
|
80
|
+
video: i("toolbarInsertVideo", {
|
|
80
81
|
defaultValue: "Insert video"
|
|
81
82
|
}),
|
|
82
|
-
variable:
|
|
83
|
+
variable: i("slashVariable", {
|
|
83
84
|
defaultValue: "Variable"
|
|
84
85
|
}),
|
|
85
|
-
addVariable:
|
|
86
|
+
addVariable: i("toolbarInsertNewVariable", {
|
|
86
87
|
defaultValue: "Insert new variable"
|
|
87
88
|
}),
|
|
88
|
-
search:
|
|
89
|
+
search: i("toolbarInsertExistingVariable", {
|
|
89
90
|
defaultValue: "Insert existing variable"
|
|
90
91
|
}),
|
|
91
|
-
confirmOutput:
|
|
92
|
+
confirmOutput: i("toolbarConfirmOutput", {
|
|
92
93
|
defaultValue: "Confirm output"
|
|
93
94
|
}),
|
|
94
|
-
insertLink:
|
|
95
|
+
insertLink: i("toolbarInsertLink", {
|
|
95
96
|
defaultValue: "Insert link"
|
|
96
97
|
}),
|
|
97
|
-
insertButton:
|
|
98
|
+
insertButton: i("toolbarInsertButton", {
|
|
98
99
|
defaultValue: "Insert button"
|
|
99
100
|
}),
|
|
100
|
-
insertSingleChoice:
|
|
101
|
+
insertSingleChoice: i("toolbarInsertSingleChoice", {
|
|
101
102
|
defaultValue: "Insert single choice"
|
|
102
103
|
}),
|
|
103
|
-
insertMultiChoice:
|
|
104
|
+
insertMultiChoice: i("toolbarInsertMultiChoice", {
|
|
104
105
|
defaultValue: "Insert multi choice"
|
|
105
106
|
}),
|
|
106
|
-
insertInput:
|
|
107
|
+
insertInput: i("toolbarInsertInput", {
|
|
107
108
|
defaultValue: "Insert input"
|
|
108
109
|
}),
|
|
109
|
-
singleChoiceOption1:
|
|
110
|
+
singleChoiceOption1: i("toolbarChoiceOption1", {
|
|
110
111
|
defaultValue: "Option 1"
|
|
111
112
|
}),
|
|
112
|
-
singleChoiceOption2:
|
|
113
|
+
singleChoiceOption2: i("toolbarChoiceOption2", {
|
|
113
114
|
defaultValue: "Option 2"
|
|
114
115
|
}),
|
|
115
|
-
inputPlaceholder:
|
|
116
|
+
inputPlaceholder: i("toolbarInputPlaceholder", {
|
|
116
117
|
defaultValue: "Please enter"
|
|
117
118
|
})
|
|
118
119
|
}),
|
|
119
|
-
[
|
|
120
|
-
),
|
|
120
|
+
[i]
|
|
121
|
+
), Ne = T(
|
|
121
122
|
() => ({
|
|
122
|
-
searchPlaceholder:
|
|
123
|
+
searchPlaceholder: i("variableSearchPlaceholder", {
|
|
123
124
|
defaultValue: "Search variable"
|
|
124
125
|
}),
|
|
125
|
-
systemLabel:
|
|
126
|
-
customLabel:
|
|
127
|
-
emptyLabel:
|
|
126
|
+
systemLabel: i("variableSectionSystem", "System Variables"),
|
|
127
|
+
customLabel: i("variableSectionCustom", "Custom Variables"),
|
|
128
|
+
emptyLabel: i("variableNotFound", "No variables found")
|
|
128
129
|
}),
|
|
129
|
-
[
|
|
130
|
-
),
|
|
131
|
-
defaultValue:
|
|
132
|
-
defaultValue:
|
|
130
|
+
[i]
|
|
131
|
+
), De = d === "quickEdit" ? i("placeholderQuickEdit", {
|
|
132
|
+
defaultValue: i("placeholderCodeEdit", {
|
|
133
|
+
defaultValue: i("placeholder")
|
|
133
134
|
})
|
|
134
|
-
}) :
|
|
135
|
+
}) : i("placeholderCodeEdit", { defaultValue: i("placeholder") }), R = T(() => {
|
|
135
136
|
const e = /* @__PURE__ */ new Set();
|
|
136
|
-
return (
|
|
137
|
-
const
|
|
138
|
-
return
|
|
137
|
+
return (le ?? ke).flatMap((r) => {
|
|
138
|
+
const o = typeof r?.name == "string" ? N.normalizeVariableName(r.name) : null;
|
|
139
|
+
return o === null || e.has(o) ? [] : (e.add(o), [{ ...r, name: o }]);
|
|
139
140
|
});
|
|
140
|
-
}, [
|
|
141
|
+
}, [le]), Z = T(() => {
|
|
141
142
|
const e = new Set(
|
|
142
|
-
|
|
143
|
-
),
|
|
144
|
-
return (
|
|
145
|
-
const t = typeof
|
|
146
|
-
return t === null || e.has(t) ||
|
|
143
|
+
R.map((o) => o.name)
|
|
144
|
+
), r = /* @__PURE__ */ new Set();
|
|
145
|
+
return (ae ?? ke).flatMap((o) => {
|
|
146
|
+
const t = typeof o?.name == "string" ? N.normalizeVariableName(o.name) : null;
|
|
147
|
+
return t === null || e.has(t) || r.has(t) ? [] : (r.add(t), [{ ...o, name: t }]);
|
|
147
148
|
});
|
|
148
|
-
}, [
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
), [
|
|
152
|
-
|
|
153
|
-
), [
|
|
154
|
-
|
|
149
|
+
}, [ae, R]), [q, k] = L(!1), [M, y] = L(!1), j = U(null), A = Et(j, se), { resolvedDirection: z } = yt(
|
|
150
|
+
j,
|
|
151
|
+
ie
|
|
152
|
+
), [Re, B] = L(null), [ce, ee] = L(
|
|
153
|
+
Z
|
|
154
|
+
), [_, Ae] = L(
|
|
155
|
+
R
|
|
155
156
|
);
|
|
156
|
-
|
|
157
|
-
ee(
|
|
158
|
-
}, [
|
|
159
|
-
|
|
160
|
-
}, [
|
|
161
|
-
const [
|
|
162
|
-
|
|
163
|
-
), [
|
|
164
|
-
|
|
165
|
-
}, [])
|
|
157
|
+
I(() => {
|
|
158
|
+
ee(Z);
|
|
159
|
+
}, [Z]), I(() => {
|
|
160
|
+
Ae(R);
|
|
161
|
+
}, [R]);
|
|
162
|
+
const [v, E] = L(
|
|
163
|
+
m.Empty
|
|
164
|
+
), [u, F] = L(), a = U(null), G = U(null), Q = U(null), [te, ue] = L(!1), g = s(() => {
|
|
165
|
+
ue(!1), Q.current = null;
|
|
166
|
+
}, []);
|
|
167
|
+
I(() => {
|
|
168
|
+
l && g();
|
|
169
|
+
}, [g, l]);
|
|
170
|
+
const ze = s(
|
|
166
171
|
(e) => {
|
|
167
172
|
if (!n) {
|
|
168
|
-
if (te &&
|
|
169
|
-
|
|
173
|
+
if (te && Q.current === e) {
|
|
174
|
+
g();
|
|
170
175
|
return;
|
|
171
176
|
}
|
|
172
|
-
|
|
177
|
+
Q.current = e, ue(!0);
|
|
173
178
|
}
|
|
174
179
|
},
|
|
175
|
-
[
|
|
176
|
-
),
|
|
177
|
-
selectedOption:
|
|
178
|
-
setSelectedOption:
|
|
179
|
-
dialogOpen:
|
|
180
|
-
setDialogOpen:
|
|
181
|
-
popoverOpen:
|
|
182
|
-
setPopoverOpen:
|
|
183
|
-
popoverPosition:
|
|
184
|
-
setPopoverPosition:
|
|
180
|
+
[g, n, te]
|
|
181
|
+
), Be = {
|
|
182
|
+
selectedOption: v,
|
|
183
|
+
setSelectedOption: E,
|
|
184
|
+
dialogOpen: q,
|
|
185
|
+
setDialogOpen: k,
|
|
186
|
+
popoverOpen: M,
|
|
187
|
+
setPopoverOpen: y,
|
|
188
|
+
popoverPosition: Re,
|
|
189
|
+
setPopoverPosition: B
|
|
185
190
|
};
|
|
186
|
-
|
|
187
|
-
n && (
|
|
191
|
+
I(() => {
|
|
192
|
+
n && (k(!1), y(!1), E(m.Empty), F(null), B(null), g());
|
|
188
193
|
}, [
|
|
189
|
-
|
|
194
|
+
g,
|
|
190
195
|
n,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
k,
|
|
197
|
+
y,
|
|
198
|
+
B,
|
|
199
|
+
E,
|
|
200
|
+
F
|
|
196
201
|
]);
|
|
197
|
-
const
|
|
202
|
+
const O = s(
|
|
198
203
|
(e) => {
|
|
199
|
-
if (
|
|
204
|
+
if (l || d !== "quickEdit" || !e)
|
|
200
205
|
return;
|
|
201
|
-
const
|
|
202
|
-
if (!
|
|
206
|
+
const r = N.extractVariableNames(e);
|
|
207
|
+
if (!r.length)
|
|
203
208
|
return;
|
|
204
|
-
const
|
|
205
|
-
|
|
209
|
+
const o = new Set(
|
|
210
|
+
_.map((t) => t.name)
|
|
206
211
|
);
|
|
207
212
|
ee((t) => {
|
|
208
|
-
const c = new Set(t.map((
|
|
209
|
-
return
|
|
210
|
-
const
|
|
211
|
-
!
|
|
212
|
-
}),
|
|
213
|
+
const c = new Set(t.map((b) => b.name)), h = /* @__PURE__ */ new Set(), V = [];
|
|
214
|
+
return r.forEach((b) => {
|
|
215
|
+
const w = b;
|
|
216
|
+
!b || o.has(w) || c.has(w) || h.has(w) || (V.push({ name: b }), h.add(w));
|
|
217
|
+
}), V.length ? [...V, ...t] : t;
|
|
213
218
|
});
|
|
214
219
|
},
|
|
215
|
-
[
|
|
220
|
+
[d, l, _]
|
|
216
221
|
);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}, [
|
|
220
|
-
const
|
|
222
|
+
I(() => {
|
|
223
|
+
O(C);
|
|
224
|
+
}, [C, O]);
|
|
225
|
+
const re = s(
|
|
221
226
|
(e) => {
|
|
222
|
-
if (!n)
|
|
223
|
-
if (
|
|
224
|
-
if (
|
|
225
|
-
const { state:
|
|
226
|
-
t &&
|
|
227
|
+
if (!(n || l && e === m.Variable))
|
|
228
|
+
if (g(), E(e), e === m.Variable) {
|
|
229
|
+
if (a.current) {
|
|
230
|
+
const { state: r } = a.current, o = r.selection.main.from, t = a.current.coordsAtPos(o);
|
|
231
|
+
t && B({
|
|
227
232
|
x: t.left,
|
|
228
233
|
y: t.bottom
|
|
229
234
|
});
|
|
230
235
|
}
|
|
231
|
-
|
|
236
|
+
y(!0);
|
|
232
237
|
} else
|
|
233
|
-
|
|
238
|
+
k(!0);
|
|
234
239
|
},
|
|
235
|
-
[
|
|
236
|
-
),
|
|
240
|
+
[g, n, l]
|
|
241
|
+
), P = s(
|
|
237
242
|
(e) => {
|
|
238
|
-
if (n || !
|
|
239
|
-
const { state:
|
|
240
|
-
|
|
243
|
+
if (n || !a.current) return;
|
|
244
|
+
const { state: r, dispatch: o } = a.current, t = r.selection.main.from;
|
|
245
|
+
o({
|
|
241
246
|
changes: { from: t, insert: e },
|
|
242
247
|
selection: { anchor: t + e.length }
|
|
243
248
|
});
|
|
244
249
|
},
|
|
245
|
-
[
|
|
246
|
-
),
|
|
250
|
+
[a, n]
|
|
251
|
+
), me = s(
|
|
247
252
|
(e) => {
|
|
248
|
-
if (n || !
|
|
253
|
+
if (n || !a.current)
|
|
249
254
|
return;
|
|
250
|
-
const { state:
|
|
251
|
-
|
|
255
|
+
const { state: r, dispatch: o } = a.current, t = r.selection.main;
|
|
256
|
+
o({
|
|
252
257
|
changes: { from: t.from, to: t.to, insert: e },
|
|
253
258
|
selection: { anchor: t.from + e.length }
|
|
254
259
|
});
|
|
255
260
|
},
|
|
256
261
|
[n]
|
|
257
|
-
),
|
|
258
|
-
|
|
259
|
-
}, []),
|
|
262
|
+
), fe = s(() => {
|
|
263
|
+
a.current?.focus();
|
|
264
|
+
}, []), he = s(() => a.current?.state.doc.toString() ?? "", []), pe = s(
|
|
260
265
|
(e) => {
|
|
261
266
|
if (n)
|
|
262
267
|
return;
|
|
263
|
-
if (!
|
|
264
|
-
|
|
268
|
+
if (!a.current) {
|
|
269
|
+
D?.(e);
|
|
265
270
|
return;
|
|
266
271
|
}
|
|
267
|
-
const
|
|
272
|
+
const r = a.current, { state: o, dispatch: t } = r;
|
|
268
273
|
t({
|
|
269
|
-
changes: { from: 0, to:
|
|
274
|
+
changes: { from: 0, to: o.doc.length, insert: e },
|
|
270
275
|
selection: { anchor: e.length }
|
|
271
276
|
});
|
|
272
277
|
},
|
|
273
|
-
[n,
|
|
274
|
-
),
|
|
275
|
-
if (n || !
|
|
278
|
+
[n, D]
|
|
279
|
+
), W = s(() => {
|
|
280
|
+
if (n || !u || !a.current || u.from === -1)
|
|
276
281
|
return;
|
|
277
|
-
const { from: e, to:
|
|
278
|
-
|
|
279
|
-
changes: { from: e, to:
|
|
282
|
+
const { from: e, to: r } = u, { dispatch: o } = a.current;
|
|
283
|
+
o({
|
|
284
|
+
changes: { from: e, to: r, insert: "" }
|
|
280
285
|
});
|
|
281
|
-
}, [
|
|
282
|
-
(e,
|
|
283
|
-
if (n || !
|
|
286
|
+
}, [u, a, n]), K = s(
|
|
287
|
+
(e, r, o = !1) => {
|
|
288
|
+
if (n || !a.current)
|
|
284
289
|
return;
|
|
285
|
-
const t =
|
|
286
|
-
if (!
|
|
287
|
-
const
|
|
288
|
-
|
|
290
|
+
const t = a.current, { state: c, dispatch: h } = t, V = r ?? c.selection.main, b = xt(e);
|
|
291
|
+
if (!b) return;
|
|
292
|
+
const w = N.normalizeVariableName(e) ?? "", Xe = o ? b.length : 3 + w.length;
|
|
293
|
+
h({
|
|
289
294
|
changes: {
|
|
290
|
-
from:
|
|
291
|
-
to:
|
|
292
|
-
insert:
|
|
295
|
+
from: V.from,
|
|
296
|
+
to: V.to,
|
|
297
|
+
insert: b
|
|
293
298
|
},
|
|
294
299
|
selection: {
|
|
295
|
-
anchor:
|
|
300
|
+
anchor: V.from + Xe
|
|
296
301
|
}
|
|
297
302
|
}), t.focus();
|
|
298
303
|
},
|
|
299
304
|
[n]
|
|
300
|
-
),
|
|
301
|
-
n || (
|
|
302
|
-
}, [
|
|
303
|
-
if (n || !
|
|
305
|
+
), Fe = s(() => {
|
|
306
|
+
n || (g(), K(""));
|
|
307
|
+
}, [g, n, K]), $e = s(() => {
|
|
308
|
+
if (n || !a.current)
|
|
304
309
|
return;
|
|
305
|
-
const e =
|
|
306
|
-
|
|
310
|
+
const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main;
|
|
311
|
+
o({
|
|
307
312
|
changes: {
|
|
308
313
|
from: t.from,
|
|
309
314
|
to: t.to,
|
|
@@ -313,11 +318,11 @@ const Le = [], ke = (V, h) => {
|
|
|
313
318
|
anchor: t.from + 3
|
|
314
319
|
}
|
|
315
320
|
}), e.focus();
|
|
316
|
-
}, [n]),
|
|
317
|
-
if (n || !
|
|
321
|
+
}, [n]), He = s(() => {
|
|
322
|
+
if (n || !a.current)
|
|
318
323
|
return;
|
|
319
|
-
const e =
|
|
320
|
-
|
|
324
|
+
const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main;
|
|
325
|
+
o({
|
|
321
326
|
changes: {
|
|
322
327
|
from: t.from,
|
|
323
328
|
to: t.to,
|
|
@@ -327,11 +332,11 @@ const Le = [], ke = (V, h) => {
|
|
|
327
332
|
anchor: t.from + 1
|
|
328
333
|
}
|
|
329
334
|
}), e.focus();
|
|
330
|
-
}, [n]), je =
|
|
331
|
-
if (n || !
|
|
335
|
+
}, [n]), je = s(() => {
|
|
336
|
+
if (n || !a.current)
|
|
332
337
|
return;
|
|
333
|
-
const e =
|
|
334
|
-
|
|
338
|
+
const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main;
|
|
339
|
+
o({
|
|
335
340
|
changes: {
|
|
336
341
|
from: t.from,
|
|
337
342
|
to: t.to,
|
|
@@ -341,266 +346,289 @@ const Le = [], ke = (V, h) => {
|
|
|
341
346
|
anchor: t.from + 2
|
|
342
347
|
}
|
|
343
348
|
}), e.focus();
|
|
344
|
-
}, [n]),
|
|
345
|
-
if (n || !
|
|
349
|
+
}, [n]), _e = s(() => {
|
|
350
|
+
if (n || !a.current)
|
|
346
351
|
return;
|
|
347
|
-
const e =
|
|
348
|
-
|
|
352
|
+
const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main, c = S.singleChoiceOption1, h = S.singleChoiceOption2, V = `?[%{{ ${l ? f.questionPlaceholder : ""} }} ${c} | ${h}]`;
|
|
353
|
+
o({
|
|
349
354
|
changes: {
|
|
350
355
|
from: t.from,
|
|
351
356
|
to: t.to,
|
|
352
|
-
insert:
|
|
357
|
+
insert: V
|
|
353
358
|
},
|
|
354
359
|
selection: {
|
|
355
|
-
anchor: t.from + 6
|
|
360
|
+
anchor: t.from + 6,
|
|
361
|
+
head: t.from + 6 + (l ? f.questionPlaceholder.length : 0)
|
|
356
362
|
}
|
|
357
363
|
}), e.focus();
|
|
358
364
|
}, [
|
|
359
365
|
n,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
366
|
+
S.singleChoiceOption1,
|
|
367
|
+
S.singleChoiceOption2,
|
|
368
|
+
l,
|
|
369
|
+
f.questionPlaceholder
|
|
370
|
+
]), Ge = s(() => {
|
|
371
|
+
if (n || !a.current)
|
|
364
372
|
return;
|
|
365
|
-
const e =
|
|
366
|
-
|
|
373
|
+
const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main, c = S.singleChoiceOption1, h = S.singleChoiceOption2, V = `?[%{{ ${l ? f.questionPlaceholder : ""} }} ${c} || ${h}]`;
|
|
374
|
+
o({
|
|
367
375
|
changes: {
|
|
368
376
|
from: t.from,
|
|
369
377
|
to: t.to,
|
|
370
|
-
insert:
|
|
378
|
+
insert: V
|
|
371
379
|
},
|
|
372
380
|
selection: {
|
|
373
|
-
anchor: t.from + 6
|
|
381
|
+
anchor: t.from + 6,
|
|
382
|
+
head: t.from + 6 + (l ? f.questionPlaceholder.length : 0)
|
|
374
383
|
}
|
|
375
384
|
}), e.focus();
|
|
376
385
|
}, [
|
|
377
386
|
n,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
387
|
+
S.singleChoiceOption1,
|
|
388
|
+
S.singleChoiceOption2,
|
|
389
|
+
l,
|
|
390
|
+
f.questionPlaceholder
|
|
391
|
+
]), Qe = s(() => {
|
|
392
|
+
if (n || !a.current)
|
|
382
393
|
return;
|
|
383
|
-
const e =
|
|
384
|
-
|
|
394
|
+
const e = a.current, { state: r, dispatch: o } = e, t = r.selection.main, c = S.inputPlaceholder ?? "请输入", h = `?[%{{ ${l ? f.questionPlaceholder : ""} }}...${c}]`;
|
|
395
|
+
o({
|
|
385
396
|
changes: {
|
|
386
397
|
from: t.from,
|
|
387
398
|
to: t.to,
|
|
388
|
-
insert:
|
|
399
|
+
insert: h
|
|
389
400
|
},
|
|
390
401
|
selection: {
|
|
391
|
-
anchor: t.from + 6
|
|
402
|
+
anchor: t.from + 6,
|
|
403
|
+
head: t.from + 6 + (l ? f.questionPlaceholder.length : 0)
|
|
392
404
|
}
|
|
393
405
|
}), e.focus();
|
|
394
|
-
}, [
|
|
406
|
+
}, [
|
|
407
|
+
n,
|
|
408
|
+
S.inputPlaceholder,
|
|
409
|
+
l,
|
|
410
|
+
f.questionPlaceholder
|
|
411
|
+
]), We = s(
|
|
395
412
|
({
|
|
396
413
|
resourceUrl: e,
|
|
397
|
-
resourceTitle:
|
|
398
|
-
scalePercent:
|
|
414
|
+
resourceTitle: r,
|
|
415
|
+
scalePercent: o
|
|
399
416
|
}) => {
|
|
400
417
|
if (!e || n) return;
|
|
401
|
-
const t =
|
|
418
|
+
const t = ht({
|
|
402
419
|
resourceUrl: e,
|
|
403
|
-
resourceTitle:
|
|
404
|
-
scalePercent:
|
|
420
|
+
resourceTitle: r,
|
|
421
|
+
scalePercent: o
|
|
405
422
|
});
|
|
406
|
-
if (
|
|
407
|
-
if (
|
|
408
|
-
const { dispatch: c } =
|
|
423
|
+
if (u?.type === m.Image) {
|
|
424
|
+
if (W(), !a.current) return;
|
|
425
|
+
const { dispatch: c } = a.current;
|
|
409
426
|
c({
|
|
410
|
-
changes: { from:
|
|
427
|
+
changes: { from: u.from, insert: t }
|
|
411
428
|
});
|
|
412
429
|
} else
|
|
413
|
-
|
|
414
|
-
|
|
430
|
+
P(t);
|
|
431
|
+
k(!1);
|
|
415
432
|
},
|
|
416
|
-
[
|
|
417
|
-
),
|
|
433
|
+
[W, n, P, u]
|
|
434
|
+
), Ke = s(
|
|
418
435
|
({
|
|
419
436
|
resourceUrl: e,
|
|
420
|
-
resourceTitle:
|
|
437
|
+
resourceTitle: r
|
|
421
438
|
}) => {
|
|
422
439
|
if (n)
|
|
423
440
|
return;
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
426
|
-
if (
|
|
427
|
-
const { dispatch: t } =
|
|
441
|
+
const o = pt(e, r);
|
|
442
|
+
if (u?.type === m.Video) {
|
|
443
|
+
if (W(), !a.current) return;
|
|
444
|
+
const { dispatch: t } = a.current;
|
|
428
445
|
t({
|
|
429
|
-
changes: { from:
|
|
446
|
+
changes: { from: u.from, insert: o }
|
|
430
447
|
});
|
|
431
448
|
} else
|
|
432
|
-
|
|
433
|
-
|
|
449
|
+
P(o);
|
|
450
|
+
k(!1);
|
|
434
451
|
},
|
|
435
|
-
[
|
|
436
|
-
),
|
|
452
|
+
[W, n, P, u]
|
|
453
|
+
), ge = s(
|
|
437
454
|
(e) => {
|
|
438
455
|
if (n)
|
|
439
456
|
return;
|
|
440
|
-
const
|
|
441
|
-
|
|
457
|
+
const r = u?.type === m.Variable ? { from: u.from, to: u.to } : void 0;
|
|
458
|
+
K(e.name, r, !0), y(!1), g();
|
|
442
459
|
},
|
|
443
|
-
[n,
|
|
444
|
-
),
|
|
460
|
+
[n, K, u, g]
|
|
461
|
+
), de = s(() => qe({
|
|
445
462
|
override: [
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
463
|
+
gt(
|
|
464
|
+
re,
|
|
465
|
+
{
|
|
466
|
+
// divider: currentStrings.slashDivider,
|
|
467
|
+
// fixedText: currentStrings.slashFixedText,
|
|
468
|
+
image: f.slashImage,
|
|
469
|
+
video: f.slashVideo,
|
|
470
|
+
variable: f.slashVariable
|
|
471
|
+
},
|
|
472
|
+
{ enableVariables: !l }
|
|
473
|
+
)
|
|
453
474
|
]
|
|
454
475
|
}), [
|
|
455
476
|
// currentStrings.slashDivider,
|
|
456
477
|
// currentStrings.slashFixedText,
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
478
|
+
f.slashImage,
|
|
479
|
+
f.slashVideo,
|
|
480
|
+
f.slashVariable,
|
|
481
|
+
re,
|
|
482
|
+
l
|
|
483
|
+
]), Ve = s(
|
|
462
484
|
(e) => {
|
|
463
|
-
if (
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
) || (
|
|
485
|
+
if (a.current = e.view, !l && d === "quickEdit" && G.current && e.selectionSet) {
|
|
486
|
+
const r = e.state.selection.main.head, o = e.state.doc.toString();
|
|
487
|
+
Ee(
|
|
488
|
+
o,
|
|
489
|
+
r
|
|
490
|
+
) || (O(o), G.current = null);
|
|
469
491
|
}
|
|
470
492
|
},
|
|
471
|
-
[
|
|
472
|
-
),
|
|
493
|
+
[O, d, l]
|
|
494
|
+
), be = s(
|
|
473
495
|
(e) => {
|
|
474
496
|
if (e.stopPropagation(), n)
|
|
475
497
|
return;
|
|
476
|
-
const { type:
|
|
477
|
-
if (
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
498
|
+
const { type: r, from: o, to: t, dataset: c, target: h } = e.detail;
|
|
499
|
+
if (l && r === m.Variable) return;
|
|
500
|
+
const V = dt(r, c);
|
|
501
|
+
if (F({
|
|
502
|
+
type: r,
|
|
503
|
+
value: V,
|
|
504
|
+
from: o,
|
|
481
505
|
to: t
|
|
482
|
-
}),
|
|
483
|
-
if (
|
|
484
|
-
const
|
|
485
|
-
|
|
506
|
+
}), E(r), r === m.Variable) {
|
|
507
|
+
if (h) {
|
|
508
|
+
const b = h.getBoundingClientRect(), w = h.ownerDocument.defaultView?.getComputedStyle(
|
|
509
|
+
j.current ?? h
|
|
486
510
|
).direction;
|
|
487
|
-
|
|
488
|
-
x:
|
|
489
|
-
y:
|
|
511
|
+
B({
|
|
512
|
+
x: w === "rtl" ? b.right : b.left,
|
|
513
|
+
y: b.bottom
|
|
490
514
|
});
|
|
491
515
|
}
|
|
492
|
-
|
|
516
|
+
y(!0);
|
|
493
517
|
} else
|
|
494
|
-
|
|
518
|
+
k(!0);
|
|
495
519
|
},
|
|
496
|
-
[n]
|
|
520
|
+
[n, l]
|
|
497
521
|
);
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}, [
|
|
501
|
-
!
|
|
502
|
-
}, [
|
|
503
|
-
const e = (
|
|
504
|
-
|
|
522
|
+
I(() => {
|
|
523
|
+
q || (E(m.Empty), F(null));
|
|
524
|
+
}, [q]), I(() => {
|
|
525
|
+
!M && v === m.Variable && (E(m.Empty), F(null));
|
|
526
|
+
}, [M, v]), I(() => {
|
|
527
|
+
const e = (r) => {
|
|
528
|
+
r.detail.view === a.current && be(r);
|
|
505
529
|
};
|
|
506
530
|
return window.addEventListener("globalTagClick", e), () => {
|
|
507
531
|
window.removeEventListener("globalTagClick", e);
|
|
508
532
|
};
|
|
509
|
-
}, [
|
|
510
|
-
const
|
|
511
|
-
() =>
|
|
512
|
-
image:
|
|
513
|
-
video:
|
|
533
|
+
}, [be]);
|
|
534
|
+
const Ce = i("imageDefaultTitle"), Se = i("videoDefaultTitle"), Ie = T(
|
|
535
|
+
() => Ct.of({
|
|
536
|
+
image: Ce,
|
|
537
|
+
video: Se
|
|
514
538
|
}),
|
|
515
|
-
[
|
|
516
|
-
),
|
|
539
|
+
[Ce, Se]
|
|
540
|
+
), Ue = T(() => {
|
|
517
541
|
const e = [
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
542
|
+
Te.lineWrapping,
|
|
543
|
+
Me(),
|
|
544
|
+
et(tt),
|
|
545
|
+
l ? vt : It
|
|
522
546
|
];
|
|
523
|
-
return n || e.push(
|
|
524
|
-
|
|
525
|
-
dt,
|
|
547
|
+
return n || e.push(de()), d === "quickEdit" && (e.push(
|
|
548
|
+
Ie,
|
|
526
549
|
Vt,
|
|
527
|
-
|
|
550
|
+
bt
|
|
528
551
|
// fixedTextPlaceholderExtension,
|
|
529
552
|
// DividerPlaceholder,
|
|
530
|
-
), e.push(
|
|
531
|
-
|
|
532
|
-
|
|
553
|
+
), l || e.push(St)), e.push(
|
|
554
|
+
Te.updateListener.of((r) => {
|
|
555
|
+
Ve(r);
|
|
533
556
|
})
|
|
534
557
|
), e;
|
|
535
558
|
}, [
|
|
536
559
|
n,
|
|
537
|
-
|
|
538
|
-
ge,
|
|
560
|
+
d,
|
|
539
561
|
de,
|
|
540
|
-
|
|
541
|
-
|
|
562
|
+
Ve,
|
|
563
|
+
Ie,
|
|
564
|
+
l
|
|
565
|
+
]), Ye = s(
|
|
542
566
|
(e) => {
|
|
543
567
|
if (n)
|
|
544
568
|
return;
|
|
545
|
-
|
|
546
|
-
|
|
569
|
+
if (l) {
|
|
570
|
+
D?.(e);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
const r = a.current?.state.selection.main.head ?? -1;
|
|
574
|
+
Ee(
|
|
547
575
|
e,
|
|
548
|
-
|
|
549
|
-
) ?
|
|
576
|
+
r
|
|
577
|
+
) ? G.current = e : (G.current = null, O(e)), D?.(e);
|
|
550
578
|
},
|
|
551
|
-
[
|
|
552
|
-
),
|
|
579
|
+
[O, D, n, l]
|
|
580
|
+
), ve = !l && !n && te, x = T(
|
|
553
581
|
() => ({
|
|
554
|
-
insertTextAtCursor:
|
|
555
|
-
replaceSelection:
|
|
556
|
-
focus:
|
|
557
|
-
getContent:
|
|
558
|
-
setContent:
|
|
582
|
+
insertTextAtCursor: P,
|
|
583
|
+
replaceSelection: me,
|
|
584
|
+
focus: fe,
|
|
585
|
+
getContent: he,
|
|
586
|
+
setContent: pe
|
|
559
587
|
}),
|
|
560
|
-
[
|
|
561
|
-
),
|
|
588
|
+
[fe, he, P, me, pe]
|
|
589
|
+
), we = s(
|
|
562
590
|
(e) => {
|
|
563
|
-
n || "render" in e || e.onClick?.(
|
|
591
|
+
n || "render" in e || e.onClick?.(x);
|
|
564
592
|
},
|
|
565
|
-
[n,
|
|
566
|
-
),
|
|
593
|
+
[n, x]
|
|
594
|
+
), Je = T(() => J?.length ? /* @__PURE__ */ p("div", { className: "markdown-flow-editor-toolbar-right", children: J.map((e) => {
|
|
567
595
|
if ("render" in e)
|
|
568
|
-
return /* @__PURE__ */
|
|
596
|
+
return /* @__PURE__ */ p(
|
|
569
597
|
"div",
|
|
570
598
|
{
|
|
571
599
|
className: "markdown-flow-editor-toolbar-right-item",
|
|
572
|
-
children: e.render(
|
|
600
|
+
children: e.render(x)
|
|
573
601
|
},
|
|
574
602
|
e.key
|
|
575
603
|
);
|
|
576
|
-
const
|
|
604
|
+
const r = e.label || e.tooltip || void 0, o = /* @__PURE__ */ $(
|
|
577
605
|
"button",
|
|
578
606
|
{
|
|
579
607
|
type: "button",
|
|
580
608
|
disabled: n || e.disabled,
|
|
581
|
-
onClick: () =>
|
|
609
|
+
onClick: () => we(e),
|
|
582
610
|
className: "markdown-flow-editor-toolbar-right-button",
|
|
583
|
-
"aria-label":
|
|
611
|
+
"aria-label": r,
|
|
584
612
|
title: e.label || e.tooltip,
|
|
585
613
|
children: [
|
|
586
|
-
e.icon ? /* @__PURE__ */
|
|
587
|
-
e.label ? /* @__PURE__ */
|
|
614
|
+
e.icon ? /* @__PURE__ */ p("span", { className: "toolbar-right-icon", children: e.icon }) : null,
|
|
615
|
+
e.label ? /* @__PURE__ */ p("span", { className: "toolbar-right-label", children: e.label }) : null
|
|
588
616
|
]
|
|
589
617
|
},
|
|
590
618
|
e.key
|
|
591
|
-
), t = e.tooltip ? /* @__PURE__ */
|
|
592
|
-
/* @__PURE__ */
|
|
593
|
-
/* @__PURE__ */
|
|
594
|
-
|
|
619
|
+
), t = e.tooltip ? /* @__PURE__ */ $(rt, { children: [
|
|
620
|
+
/* @__PURE__ */ p(nt, { asChild: !0, children: o }),
|
|
621
|
+
/* @__PURE__ */ p(
|
|
622
|
+
ot,
|
|
595
623
|
{
|
|
596
624
|
side: "top",
|
|
597
|
-
dir:
|
|
598
|
-
lang:
|
|
625
|
+
dir: z,
|
|
626
|
+
lang: A,
|
|
599
627
|
children: e.tooltip
|
|
600
628
|
}
|
|
601
629
|
)
|
|
602
|
-
] }) :
|
|
603
|
-
return /* @__PURE__ */
|
|
630
|
+
] }) : o;
|
|
631
|
+
return /* @__PURE__ */ p(
|
|
604
632
|
"div",
|
|
605
633
|
{
|
|
606
634
|
className: "markdown-flow-editor-toolbar-right-item",
|
|
@@ -610,62 +638,63 @@ const Le = [], ke = (V, h) => {
|
|
|
610
638
|
);
|
|
611
639
|
}) }) : null, [
|
|
612
640
|
n,
|
|
613
|
-
|
|
614
|
-
|
|
641
|
+
x,
|
|
642
|
+
we,
|
|
643
|
+
z,
|
|
615
644
|
A,
|
|
616
|
-
|
|
617
|
-
U
|
|
645
|
+
J
|
|
618
646
|
]);
|
|
619
|
-
return
|
|
620
|
-
xe?.(
|
|
621
|
-
}, [
|
|
647
|
+
return I(() => {
|
|
648
|
+
xe?.(x);
|
|
649
|
+
}, [x]), /* @__PURE__ */ $(
|
|
622
650
|
"div",
|
|
623
651
|
{
|
|
624
652
|
className: "markdown-flow-editor",
|
|
625
|
-
ref:
|
|
626
|
-
dir:
|
|
627
|
-
lang:
|
|
653
|
+
ref: j,
|
|
654
|
+
dir: ie,
|
|
655
|
+
lang: se,
|
|
628
656
|
"data-disabled": n ? "true" : void 0,
|
|
629
657
|
"aria-disabled": n,
|
|
630
658
|
children: [
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
-
|
|
659
|
+
/* @__PURE__ */ p(
|
|
660
|
+
it,
|
|
633
661
|
{
|
|
634
662
|
disabled: n,
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
663
|
+
enableVariables: !l,
|
|
664
|
+
labels: S,
|
|
665
|
+
tooltipDirection: z,
|
|
666
|
+
tooltipLanguage: A,
|
|
667
|
+
onSelect: re,
|
|
668
|
+
onInsertVariablePlaceholder: Fe,
|
|
669
|
+
onVariableSearchToggle: ze,
|
|
670
|
+
onVariableSearchClose: g,
|
|
671
|
+
onInsertConfirmOutput: $e,
|
|
672
|
+
onInsertLink: He,
|
|
644
673
|
onInsertButton: je,
|
|
645
|
-
onInsertSingleChoice:
|
|
646
|
-
onInsertMultiChoice:
|
|
647
|
-
onInsertInputField:
|
|
648
|
-
variableSearchActive:
|
|
649
|
-
rightSlot:
|
|
674
|
+
onInsertSingleChoice: _e,
|
|
675
|
+
onInsertMultiChoice: Ge,
|
|
676
|
+
onInsertInputField: Qe,
|
|
677
|
+
variableSearchActive: ve,
|
|
678
|
+
rightSlot: Je
|
|
650
679
|
}
|
|
651
680
|
),
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
|
|
681
|
+
!l && /* @__PURE__ */ p(
|
|
682
|
+
st,
|
|
654
683
|
{
|
|
655
|
-
open:
|
|
656
|
-
anchorElement:
|
|
657
|
-
onClose:
|
|
658
|
-
onSelect:
|
|
659
|
-
variables:
|
|
660
|
-
systemVariables:
|
|
661
|
-
labels:
|
|
684
|
+
open: ve,
|
|
685
|
+
anchorElement: Q.current,
|
|
686
|
+
onClose: g,
|
|
687
|
+
onSelect: ge,
|
|
688
|
+
variables: ce,
|
|
689
|
+
systemVariables: _,
|
|
690
|
+
labels: Ne
|
|
662
691
|
}
|
|
663
692
|
),
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
|
|
693
|
+
/* @__PURE__ */ p("div", { className: "markdown-flow-editor-body relative overflow-auto", children: /* @__PURE__ */ $(ct.Provider, { value: Be, children: [
|
|
694
|
+
/* @__PURE__ */ p(
|
|
695
|
+
Ze,
|
|
667
696
|
{
|
|
668
|
-
extensions:
|
|
697
|
+
extensions: Ue,
|
|
669
698
|
basicSetup: {
|
|
670
699
|
lineNumbers: !1,
|
|
671
700
|
searchKeymap: !1,
|
|
@@ -675,56 +704,56 @@ const Le = [], ke = (V, h) => {
|
|
|
675
704
|
foldGutter: !1
|
|
676
705
|
},
|
|
677
706
|
className: "rounded-md",
|
|
678
|
-
placeholder:
|
|
679
|
-
value:
|
|
707
|
+
placeholder: De,
|
|
708
|
+
value: C,
|
|
680
709
|
theme: "light",
|
|
681
710
|
minHeight: "2rem",
|
|
682
711
|
editable: !n,
|
|
683
|
-
onChange:
|
|
684
|
-
onBlur:
|
|
712
|
+
onChange: Ye,
|
|
713
|
+
onBlur: ye
|
|
685
714
|
}
|
|
686
715
|
),
|
|
687
|
-
!n && /* @__PURE__ */
|
|
688
|
-
|
|
716
|
+
!n && /* @__PURE__ */ $(
|
|
717
|
+
at,
|
|
689
718
|
{
|
|
690
|
-
dir:
|
|
691
|
-
lang:
|
|
719
|
+
dir: z,
|
|
720
|
+
lang: A,
|
|
692
721
|
labels: {
|
|
693
|
-
closeButtonLabel:
|
|
694
|
-
title:
|
|
722
|
+
closeButtonLabel: i("dialogCloseLabel"),
|
|
723
|
+
title: v === m.Image ? i("dialogTitleImage") : v === m.Video ? i("dialogTitleVideo") : v === m.Variable ? i("dialogTitleVariable") : i("dialogTitle")
|
|
695
724
|
},
|
|
696
725
|
children: [
|
|
697
|
-
|
|
698
|
-
|
|
726
|
+
v === m.Image && /* @__PURE__ */ p(
|
|
727
|
+
ut,
|
|
699
728
|
{
|
|
700
|
-
value:
|
|
701
|
-
onSelect:
|
|
702
|
-
uploadProps:
|
|
729
|
+
value: u?.value,
|
|
730
|
+
onSelect: We,
|
|
731
|
+
uploadProps: Pe
|
|
703
732
|
}
|
|
704
733
|
),
|
|
705
|
-
|
|
706
|
-
|
|
734
|
+
v === m.Video && /* @__PURE__ */ p(
|
|
735
|
+
mt,
|
|
707
736
|
{
|
|
708
|
-
value:
|
|
709
|
-
onSelect:
|
|
737
|
+
value: u?.value,
|
|
738
|
+
onSelect: Ke
|
|
710
739
|
}
|
|
711
740
|
)
|
|
712
741
|
]
|
|
713
742
|
}
|
|
714
743
|
),
|
|
715
|
-
!n && /* @__PURE__ */
|
|
716
|
-
|
|
744
|
+
!n && !l && /* @__PURE__ */ p(lt, { dir: z, lang: A, children: /* @__PURE__ */ p(
|
|
745
|
+
ft,
|
|
717
746
|
{
|
|
718
|
-
variables:
|
|
719
|
-
systemVariables:
|
|
720
|
-
selectedName:
|
|
721
|
-
onSelect:
|
|
747
|
+
variables: ce,
|
|
748
|
+
systemVariables: _,
|
|
749
|
+
selectedName: u?.value?.variableName,
|
|
750
|
+
onSelect: ge,
|
|
722
751
|
onAddVariable: (e) => {
|
|
723
|
-
ee((
|
|
724
|
-
const
|
|
725
|
-
return
|
|
726
|
-
(c) => c.name ===
|
|
727
|
-
) ?
|
|
752
|
+
ee((r) => {
|
|
753
|
+
const o = e.name;
|
|
754
|
+
return r.some(
|
|
755
|
+
(c) => c.name === o
|
|
756
|
+
) ? r : [e, ...r];
|
|
728
757
|
});
|
|
729
758
|
}
|
|
730
759
|
}
|
|
@@ -735,6 +764,6 @@ const Le = [], ke = (V, h) => {
|
|
|
735
764
|
);
|
|
736
765
|
};
|
|
737
766
|
export {
|
|
738
|
-
|
|
767
|
+
ur as default
|
|
739
768
|
};
|
|
740
769
|
//# sourceMappingURL=MarkdownFlowEditor.es.js.map
|