markdown-flow-ui 0.3.4-dev.1 → 0.3.4

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.
Files changed (123) hide show
  1. package/README.md +8 -17
  2. package/dist/_virtual/index.es3.js +5 -4
  3. package/dist/_virtual/index.es3.js.map +1 -1
  4. package/dist/_virtual/index.es4.js +4 -5
  5. package/dist/_virtual/index.es4.js.map +1 -1
  6. package/dist/_virtual/index.es6.js +5 -3
  7. package/dist/_virtual/index.es6.js.map +1 -1
  8. package/dist/_virtual/index.es7.js +3 -5
  9. package/dist/_virtual/index.es7.js.map +1 -1
  10. package/dist/_virtual/index3.cjs +1 -1
  11. package/dist/_virtual/index4.cjs +1 -1
  12. package/dist/_virtual/index6.cjs +1 -1
  13. package/dist/_virtual/index7.cjs +1 -1
  14. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  15. package/dist/components/ContentRender/ContentRender.es.js +0 -1
  16. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  17. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  18. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  19. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +0 -2
  20. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +260 -284
  21. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  22. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
  23. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
  24. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +40 -48
  25. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
  26. package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -22
  27. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
  28. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +5 -6
  29. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +16 -18
  30. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
  31. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
  32. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +5 -6
  33. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +49 -51
  34. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
  35. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  36. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +5 -6
  37. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +41 -43
  38. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
  39. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
  40. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +5 -6
  41. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +49 -51
  42. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
  43. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
  44. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +5 -6
  45. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +47 -49
  46. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js.map +1 -1
  47. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  48. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +5 -6
  49. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +45 -47
  50. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
  51. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
  52. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +5 -6
  53. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +19 -21
  54. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
  55. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
  56. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +5 -6
  57. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +18 -20
  58. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
  59. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
  60. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +5 -6
  61. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +13 -15
  62. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
  63. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
  64. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +5 -6
  65. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +41 -43
  66. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
  67. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  68. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +5 -6
  69. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +23 -25
  70. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
  71. package/dist/components/MarkdownFlowEditor/plugins/FixedTextPlaceholder.test.d.ts +1 -0
  72. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.map +1 -1
  73. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
  74. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  75. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  76. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +2 -6
  77. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +152 -157
  78. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  79. package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
  80. package/dist/components/MarkdownFlowEditor/utils.es.js +0 -12
  81. package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
  82. package/dist/components/ui/inputGroup/textarea.cjs +1 -1
  83. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  84. package/dist/markdown-flow-ui-lib.css +1 -1
  85. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
  86. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  87. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.cjs +1 -1
  88. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.es.js +1 -1
  89. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.cjs +1 -1
  90. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.es.js +1 -1
  91. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.cjs +1 -1
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.es.js +1 -1
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.cjs +1 -1
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.es.js +1 -1
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.cjs +1 -1
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.es.js +1 -1
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.cjs +1 -1
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.es.js +1 -1
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.cjs +1 -1
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.es.js +1 -1
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.cjs +1 -1
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.es.js +1 -1
  103. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.cjs +1 -1
  104. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.es.js +1 -1
  105. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.cjs +1 -1
  106. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.es.js +1 -1
  107. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.cjs +1 -1
  108. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.es.js +1 -1
  109. package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
  110. package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
  111. package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
  112. package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  113. package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
  114. package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  115. package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
  116. package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
  117. package/dist/node_modules/remark-flow/dist/interaction-parser.cjs +1 -1
  118. package/dist/node_modules/remark-flow/dist/interaction-parser.cjs.map +1 -1
  119. package/dist/node_modules/remark-flow/dist/interaction-parser.es.js +70 -67
  120. package/dist/node_modules/remark-flow/dist/interaction-parser.es.js.map +1 -1
  121. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
  122. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
  123. package/package.json +2 -3
@@ -1,64 +1,63 @@
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";
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 De from "./components/ImageInject.es.js";
13
- import Ne from "./components/VideoInject.es.js";
14
- import { SelectedOption as p } from "./types.es.js";
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 Re, getVideoContentToInsert as $e, createSlashCommands as Be, parseContentInfo as Fe } from "./utils.es.js";
17
- import He from "./plugins/ImgPlaceholder.es.js";
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 ze, { QuestionSyntaxHighlighter as Ge } from "./plugins/SyntaxHighlighter.es.js";
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 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]) => {
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
- w.translation,
32
+ I.translation,
33
33
  !0,
34
34
  !0
35
35
  );
36
- }) : A.use(Je).init({
37
- resources: ne,
38
- lng: z,
39
- fallbackLng: z,
36
+ }) : A.use(Ke).init({
37
+ resources: oe,
38
+ lng: H,
39
+ fallbackLng: H,
40
40
  interpolation: { escapeValue: !1 }
41
41
  });
42
- const Vt = ({
42
+ const Tt = ({
43
43
  content: b = "",
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
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: 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(
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: "Confirm output"
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 = w === "quickEdit" ? l("placeholderQuickEdit", {
97
+ ), se = I === "quickEdit" ? l("placeholderQuickEdit", {
99
98
  defaultValue: l("placeholderCodeEdit", {
100
99
  defaultValue: l("placeholder")
101
100
  })
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
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
- k(() => {
114
- o && (g(!1), C(p.Empty), y(null));
115
- }, [o, g, C, y]);
116
- const F = c(
112
+ L(() => {
113
+ t && (p(!1), g(f.Empty), y(null));
114
+ }, [t, p, g, y]);
115
+ const B = s(
117
116
  (e) => {
118
- o || (C(e), g(!0));
117
+ t || (g(e), p(!0));
119
118
  },
120
- [o]
121
- ), I = c(
119
+ [t]
120
+ ), d = s(
122
121
  (e) => {
123
- if (o || !r.current) return;
124
- const { state: n, dispatch: i } = r.current, t = n.selection.main.from;
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: t, insert: e },
127
- selection: { anchor: t + e.length }
125
+ changes: { from: o, insert: e },
126
+ selection: { anchor: o + e.length }
128
127
  });
129
128
  },
130
- [r, o]
131
- ), W = c(
129
+ [r, t]
130
+ ), z = s(
132
131
  (e) => {
133
- if (o || !r.current)
132
+ if (t || !r.current)
134
133
  return;
135
- const { state: n, dispatch: i } = r.current, t = n.selection.main;
134
+ const { state: n, dispatch: i } = r.current, o = n.selection.main;
136
135
  i({
137
- changes: { from: t.from, to: t.to, insert: e },
138
- selection: { anchor: t.from + e.length }
136
+ changes: { from: o.from, to: o.to, insert: e },
137
+ selection: { anchor: o.from + e.length }
139
138
  });
140
139
  },
141
- [o]
142
- ), _ = c(() => {
140
+ [t]
141
+ ), G = s(() => {
143
142
  r.current?.focus();
144
- }, []), q = c(() => r.current?.state.doc.toString() ?? "", []), K = c(
143
+ }, []), W = s(() => r.current?.state.doc.toString() ?? "", []), _ = s(
145
144
  (e) => {
146
- if (o)
145
+ if (t)
147
146
  return;
148
147
  if (!r.current) {
149
- O?.(e);
148
+ k?.(e);
150
149
  return;
151
150
  }
152
- const n = r.current, { state: i, dispatch: t } = n;
153
- t({
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
- [o, O]
159
- ), x = c(() => {
160
- if (o || !a || !r.current || a.from === -1)
157
+ [t, k]
158
+ ), x = s(() => {
159
+ if (t || !c || !r.current || c.from === -1)
161
160
  return;
162
- const { from: e, to: n } = a, { dispatch: i } = r.current;
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
- }, [a, r, o]), ue = c(() => {
167
- if (o || !r.current)
165
+ }, [c, r, t]), ae = s(() => {
166
+ if (t || !r.current)
168
167
  return;
169
- const e = r.current, { state: n, dispatch: i } = e, t = n.selection.main;
168
+ const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main;
170
169
  i({
171
170
  changes: {
172
- from: t.from,
173
- to: t.to,
171
+ from: o.from,
172
+ to: o.to,
174
173
  insert: "======"
175
174
  },
176
175
  selection: {
177
- anchor: t.from + 3
176
+ anchor: o.from + 3
178
177
  }
179
178
  }), e.focus();
180
- }, [o]), me = c(() => {
181
- if (o || !r.current)
179
+ }, [t]), ue = s(() => {
180
+ if (t || !r.current)
182
181
  return;
183
- const e = r.current, { state: n, dispatch: i } = e, t = n.selection.main;
182
+ const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main;
184
183
  i({
185
184
  changes: {
186
- from: t.from,
187
- to: t.to,
185
+ from: o.from,
186
+ to: o.to,
188
187
  insert: "[]()"
189
188
  },
190
189
  selection: {
191
- anchor: t.from + 1
190
+ anchor: o.from + 1
192
191
  }
193
192
  }), e.focus();
194
- }, [o]), fe = c(() => {
195
- if (o || !r.current)
193
+ }, [t]), me = s(() => {
194
+ if (t || !r.current)
196
195
  return;
197
- const e = r.current, { state: n, dispatch: i } = e, t = n.selection.main;
196
+ const e = r.current, { state: n, dispatch: i } = e, o = n.selection.main;
198
197
  i({
199
198
  changes: {
200
- from: t.from,
201
- to: t.to,
199
+ from: o.from,
200
+ to: o.to,
202
201
  insert: "?[]"
203
202
  },
204
203
  selection: {
205
- anchor: t.from + 2
204
+ anchor: o.from + 2
206
205
  }
207
206
  }), e.focus();
208
- }, [o]), he = c(() => {
209
- if (o || !r.current)
207
+ }, [t]), fe = s(() => {
208
+ if (t || !r.current)
210
209
  return;
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}]`;
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: t.from,
215
- to: t.to,
216
- insert: H
213
+ from: o.from,
214
+ to: o.to,
215
+ insert: F
217
216
  },
218
217
  selection: {
219
- anchor: t.from + 6,
220
- head: t.from + 6 + (f ? s.questionPlaceholder.length : 0)
218
+ anchor: o.from + 5
221
219
  }
222
220
  }), e.focus();
223
221
  }, [
224
- o,
225
- h.singleChoiceOption1,
226
- h.singleChoiceOption2,
227
- f,
228
- s.questionPlaceholder
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, t = n.selection.main, u = h.singleChoiceOption1, d = h.singleChoiceOption2, H = `?[%{{ ${f ? s.questionPlaceholder : ""} }} ${u} || ${d}]`;
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: t.from,
236
- to: t.to,
237
- insert: H
231
+ from: o.from,
232
+ to: o.to,
233
+ insert: F
238
234
  },
239
235
  selection: {
240
- anchor: t.from + 6,
241
- head: t.from + 6 + (f ? s.questionPlaceholder.length : 0)
236
+ anchor: o.from + 5
242
237
  }
243
238
  }), e.focus();
244
239
  }, [
245
- o,
246
- h.singleChoiceOption1,
247
- h.singleChoiceOption2,
248
- f,
249
- s.questionPlaceholder
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, t = n.selection.main, u = h.inputPlaceholder ?? "请输入", d = `?[%{{ ${f ? s.questionPlaceholder : ""} }}...${u}]`;
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: t.from,
257
- to: t.to,
258
- insert: d
249
+ from: o.from,
250
+ to: o.to,
251
+ insert: h
259
252
  },
260
253
  selection: {
261
- anchor: t.from + 6,
262
- head: t.from + 6 + (f ? s.questionPlaceholder.length : 0)
254
+ anchor: o.from + 5
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 || o) return;
277
- const t = Re({
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 (a?.type === p.Image) {
269
+ if (c?.type === f.Image) {
283
270
  if (x(), !r.current) return;
284
- const { dispatch: u } = r.current;
285
- u({
286
- changes: { from: a.from, insert: t }
271
+ const { dispatch: m } = r.current;
272
+ m({
273
+ changes: { from: c.from, insert: o }
287
274
  });
288
275
  } else
289
- I(t);
290
- g(!1);
276
+ d(o);
277
+ p(!1);
291
278
  },
292
- [x, o, I, a]
293
- ), Ce = c(
279
+ [x, t, d, c]
280
+ ), de = s(
294
281
  ({
295
282
  resourceUrl: e,
296
283
  resourceTitle: n
297
284
  }) => {
298
- if (o)
285
+ if (t)
299
286
  return;
300
- const i = $e(e, n);
301
- if (a?.type === p.Video) {
287
+ const i = Me(e, n);
288
+ if (c?.type === f.Video) {
302
289
  if (x(), !r.current) return;
303
- const { dispatch: t } = r.current;
304
- t({
305
- changes: { from: a.from, insert: i }
290
+ const { dispatch: o } = r.current;
291
+ o({
292
+ changes: { from: c.from, insert: i }
306
293
  });
307
294
  } else
308
- I(i);
309
- g(!1);
295
+ d(i);
296
+ p(!1);
310
297
  },
311
- [x, o, I, a]
312
- ), U = c(() => Te({
298
+ [x, t, d, c]
299
+ ), K = s(() => Le({
313
300
  override: [
314
- Be(F, {
315
- // divider: currentStrings.slashDivider,
316
- // fixedText: currentStrings.slashFixedText,
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
- }, []), X = c(
308
+ }, []), U = s(
330
309
  (e) => {
331
- if (e.stopPropagation(), o)
310
+ if (e.stopPropagation(), t)
332
311
  return;
333
- const { type: n, from: i, to: t, dataset: u } = e.detail, d = Fe(n, u);
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: d,
315
+ value: h,
337
316
  from: i,
338
- to: t
339
- }), C(n), g(!0);
317
+ to: o
318
+ }), g(n), p(!0);
340
319
  },
341
- [o]
320
+ [t]
342
321
  );
343
- k(() => {
344
- $ || (C(p.Empty), y(null));
345
- }, [$]), k(() => {
322
+ L(() => {
323
+ M || (g(f.Empty), y(null));
324
+ }, [M]), L(() => {
346
325
  const e = (n) => {
347
- n.detail.view === r.current && X(n);
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
- }, [X]);
353
- const Y = l("imageDefaultTitle"), Z = l("videoDefaultTitle"), M = V(
331
+ }, [U]);
332
+ const J = l("imageDefaultTitle"), X = l("videoDefaultTitle"), Y = T(
354
333
  () => Ae.of({
355
- image: Y,
356
- video: Z
334
+ image: J,
335
+ video: X
357
336
  }),
358
- [Y, Z]
359
- ), Ie = V(() => {
337
+ [J, X]
338
+ ), Ce = T(() => {
360
339
  const e = [
361
- oe.lineWrapping,
362
- ke(),
363
- Ve(Oe),
364
- f ? Ge : ze
340
+ te.lineWrapping,
341
+ Te(),
342
+ ke(Ve),
343
+ He
365
344
  ];
366
- return o || e.push(U()), w === "quickEdit" && e.push(
367
- M,
368
- He,
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
- oe.updateListener.of((n) => {
374
- J(n);
350
+ te.updateListener.of((n) => {
351
+ Q(n);
375
352
  })
376
353
  ), e;
377
354
  }, [
378
- o,
379
- w,
380
- U,
381
- J,
382
- M,
383
- f
384
- ]), ve = c(
355
+ t,
356
+ I,
357
+ K,
358
+ Q,
359
+ Y
360
+ ]), Ie = s(
385
361
  (e) => {
386
- o || O?.(e);
362
+ t || k?.(e);
387
363
  },
388
- [O, o]
389
- ), v = V(
364
+ [k, t]
365
+ ), C = T(
390
366
  () => ({
391
- insertTextAtCursor: I,
392
- replaceSelection: W,
393
- focus: _,
394
- getContent: q,
395
- setContent: K
367
+ insertTextAtCursor: d,
368
+ replaceSelection: z,
369
+ focus: G,
370
+ getContent: W,
371
+ setContent: _
396
372
  }),
397
- [_, q, I, W, K]
398
- ), ee = c(
373
+ [G, W, d, z, _]
374
+ ), Z = s(
399
375
  (e) => {
400
- o || "render" in e || e.onClick?.(v);
376
+ t || "render" in e || e.onClick?.(C);
401
377
  },
402
- [o, v]
403
- ), we = V(() => N?.length ? /* @__PURE__ */ m("div", { className: "markdown-flow-editor-toolbar-right", children: N.map((e) => {
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__ */ m(
381
+ return /* @__PURE__ */ a(
406
382
  "div",
407
383
  {
408
384
  className: "markdown-flow-editor-toolbar-right-item",
409
- children: e.render(v)
385
+ children: e.render(C)
410
386
  },
411
387
  e.key
412
388
  );
413
- const n = e.label || e.tooltip || void 0, i = /* @__PURE__ */ T(
389
+ const n = e.label || e.tooltip || void 0, i = /* @__PURE__ */ w(
414
390
  "button",
415
391
  {
416
392
  type: "button",
417
- disabled: o || e.disabled,
418
- onClick: () => ee(e),
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.label || e.tooltip,
397
+ title: e.tooltip ? void 0 : e.label,
422
398
  children: [
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
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
- ), t = e.tooltip ? /* @__PURE__ */ T(Ee, { children: [
429
- /* @__PURE__ */ m(Se, { asChild: !0, children: i }),
430
- /* @__PURE__ */ m(
431
- Pe,
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: P,
435
- lang: S,
410
+ dir: S,
411
+ lang: E,
436
412
  children: e.tooltip
437
413
  }
438
414
  )
439
415
  ] }) : i;
440
- return /* @__PURE__ */ m(
416
+ return /* @__PURE__ */ a(
441
417
  "div",
442
418
  {
443
419
  className: "markdown-flow-editor-toolbar-right-item",
444
- children: t
420
+ children: o
445
421
  },
446
422
  e.key
447
423
  );
448
424
  }) }) : null, [
449
- o,
450
- v,
451
- ee,
452
- P,
425
+ t,
426
+ C,
427
+ Z,
453
428
  S,
454
- N
429
+ E,
430
+ D
455
431
  ]);
456
- return k(() => {
457
- ce?.(v);
458
- }, [v]), /* @__PURE__ */ T(
432
+ return L(() => {
433
+ le?.(C);
434
+ }, [C]), /* @__PURE__ */ w(
459
435
  "div",
460
436
  {
461
437
  className: "markdown-flow-editor",
462
- ref: B,
463
- dir: G,
464
- lang: Q,
465
- "data-disabled": o ? "true" : void 0,
466
- "aria-disabled": o,
438
+ ref: R,
439
+ dir: $,
440
+ lang: q,
441
+ "data-disabled": t ? "true" : void 0,
442
+ "aria-disabled": t,
467
443
  children: [
468
- /* @__PURE__ */ m(
444
+ /* @__PURE__ */ a(
469
445
  xe,
470
446
  {
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,
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: ge,
482
- rightSlot: we
457
+ onInsertInputField: he,
458
+ rightSlot: ve
483
459
  }
484
460
  ),
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,
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: Ie,
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: !o,
504
- onChange: ve,
505
- onBlur: re
479
+ editable: !t,
480
+ onChange: Ie,
481
+ onBlur: ne
506
482
  }
507
483
  ),
508
- !o && /* @__PURE__ */ T(
484
+ !t && /* @__PURE__ */ w(
509
485
  ye,
510
486
  {
511
- dir: P,
512
- lang: S,
487
+ dir: S,
488
+ lang: E,
513
489
  labels: {
514
490
  closeButtonLabel: l("dialogCloseLabel"),
515
- title: L === p.Image ? l("dialogTitleImage") : L === p.Video ? l("dialogTitleVideo") : l("dialogTitle")
491
+ title: v === f.Image ? l("dialogTitleImage") : v === f.Video ? l("dialogTitleVideo") : l("dialogTitle")
516
492
  },
517
493
  children: [
518
- L === p.Image && /* @__PURE__ */ m(
519
- De,
494
+ v === f.Image && /* @__PURE__ */ a(
495
+ Pe,
520
496
  {
521
- value: a?.value,
522
- onSelect: de,
523
- uploadProps: le
497
+ value: c?.value,
498
+ onSelect: ge,
499
+ uploadProps: ie
524
500
  }
525
501
  ),
526
- L === p.Video && /* @__PURE__ */ m(
527
- Ne,
502
+ v === f.Video && /* @__PURE__ */ a(
503
+ De,
528
504
  {
529
- value: a?.value,
530
- onSelect: Ce
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
- Vt as default
518
+ Tt as default
543
519
  };
544
520
  //# sourceMappingURL=MarkdownFlowEditor.es.js.map