dishui 0.0.72 → 0.0.74

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 (100) hide show
  1. package/dist/components/Button/index.d.ts +4 -4
  2. package/dist/components/Button/index.js +18 -17
  3. package/dist/components/Button/index.js.map +1 -1
  4. package/dist/components/Card/Metric.d.ts +17 -0
  5. package/dist/components/Card/Metric2.js +50 -0
  6. package/dist/components/Card/Metric2.js.map +1 -0
  7. package/dist/components/Card/index.d.ts +3 -0
  8. package/dist/components/Card/index.js +118 -117
  9. package/dist/components/Card/index.js.map +1 -1
  10. package/dist/components/Group/index.d.ts +2 -0
  11. package/dist/components/GroupButton/index.d.ts +16 -0
  12. package/dist/components/GroupButton/index.js +41 -0
  13. package/dist/components/GroupButton/index.js.map +1 -0
  14. package/dist/components/GroupedTable/index.d.ts +38 -0
  15. package/dist/components/GroupedTable/index.js +92 -0
  16. package/dist/components/GroupedTable/index.js.map +1 -0
  17. package/dist/components/Layout/index.d.ts +4 -2
  18. package/dist/components/Layout/index.js +1 -1
  19. package/dist/components/Layout/index.js.map +1 -1
  20. package/dist/components/NavigationList/index.d.ts +17 -0
  21. package/dist/components/NavigationList/index.js +48 -0
  22. package/dist/components/NavigationList/index.js.map +1 -0
  23. package/dist/components/Section/index.d.ts +28 -0
  24. package/dist/components/Section/index.js +58 -0
  25. package/dist/components/Section/index.js.map +1 -0
  26. package/dist/components/Select/index.d.ts +2 -0
  27. package/dist/components/Select/index.js +83 -82
  28. package/dist/components/Select/index.js.map +1 -1
  29. package/dist/components/SidebarToggleButton/index.d.ts +16 -1
  30. package/dist/components/SidebarToggleButton/index.js +90 -30
  31. package/dist/components/SidebarToggleButton/index.js.map +1 -1
  32. package/dist/components/Skeleton/index.d.ts +7 -0
  33. package/dist/components/Skeleton/index.js +21 -0
  34. package/dist/components/Skeleton/index.js.map +1 -0
  35. package/dist/components/Tree/Tree.js +5 -2
  36. package/dist/components/Tree/Tree.js.map +1 -1
  37. package/dist/components/pro/RichTextEditor/AIRewrite.js +114 -72
  38. package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
  39. package/dist/components/pro/RichTextEditor/BlockHandle.js +315 -196
  40. package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
  41. package/dist/components/pro/RichTextEditor/BubbleToolbar.d.ts +1 -1
  42. package/dist/components/pro/RichTextEditor/BubbleToolbar.js +156 -39
  43. package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
  44. package/dist/components/pro/RichTextEditor/CommentPanel.d.ts +2 -1
  45. package/dist/components/pro/RichTextEditor/CommentPanel.js +100 -81
  46. package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
  47. package/dist/components/pro/RichTextEditor/CommentPopover.d.ts +2 -1
  48. package/dist/components/pro/RichTextEditor/CommentPopover.js +92 -68
  49. package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
  50. package/dist/components/pro/RichTextEditor/RichTextEditor.js +24 -22
  51. package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
  52. package/dist/components/pro/RichTextEditor/SearchReplace.d.ts +7 -0
  53. package/dist/components/pro/RichTextEditor/SlashMenu.js +132 -73
  54. package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
  55. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.d.ts +2 -0
  56. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +9 -9
  57. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
  58. package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js +8 -13
  59. package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
  60. package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js +22 -3
  61. package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
  62. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.d.ts +1 -1
  63. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +346 -313
  64. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
  65. package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js +120 -146
  66. package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
  67. package/dist/components/pro/RichTextEditor/extensions/CommentMark.js +2 -2
  68. package/dist/components/pro/RichTextEditor/extensions/CommentMark.js.map +1 -1
  69. package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js +178 -163
  70. package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
  71. package/dist/components/pro/RichTextEditor/extensions/FontSize.js +8 -5
  72. package/dist/components/pro/RichTextEditor/extensions/FontSize.js.map +1 -1
  73. package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.d.ts +6 -0
  74. package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js +85 -74
  75. package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
  76. package/dist/components/pro/RichTextEditor/searchUtils.d.ts +23 -0
  77. package/dist/contexts/AppContext.js +47 -45
  78. package/dist/contexts/AppContext.js.map +1 -1
  79. package/dist/dishui.css +1 -1
  80. package/dist/index-nostyled.d.ts +11 -1
  81. package/dist/index.d.ts +11 -1
  82. package/dist/index.js +119 -114
  83. package/dist/layouts/MainLayout.js +9 -10
  84. package/dist/layouts/MainLayout.js.map +1 -1
  85. package/dist/layouts/Sidebar.d.ts +9 -0
  86. package/dist/layouts/Sidebar.js +99 -80
  87. package/dist/layouts/Sidebar.js.map +1 -1
  88. package/dist/layouts/headbar/Headbar.d.ts +1 -1
  89. package/dist/layouts/headbar/Headbar.js +2 -2
  90. package/dist/layouts/headbar/Headbar.js.map +1 -1
  91. package/dist/lite.d.ts +19 -1
  92. package/dist/lite.js +17 -8
  93. package/dist/styles/themeStyles.js +6 -6
  94. package/dist/styles/themeStyles.js.map +1 -1
  95. package/dist/utils/i18n.d.ts +3 -0
  96. package/dist/utils/i18n.js +78 -0
  97. package/dist/utils/i18n.js.map +1 -1
  98. package/dist/utils/menu.js +23 -6
  99. package/dist/utils/menu.js.map +1 -1
  100. package/package.json +8 -2
@@ -1,9 +1,10 @@
1
1
  import { cn as e } from "../../../../utils/cn.js";
2
- import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
3
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
- import { Node as s, NodeViewContent as c, NodeViewWrapper as l, ReactNodeViewRenderer as u, mergeAttributes as d } from "@tiptap/react";
2
+ import { useNodeEditable as t } from "./MarkdownBlock.js";
3
+ import { useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
4
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
+ import { Node as c, NodeViewContent as l, NodeViewWrapper as u, ReactNodeViewRenderer as d, mergeAttributes as f } from "@tiptap/react";
5
6
  //#region src/components/pro/RichTextEditor/extensions/FloatingDialog.tsx
6
- var f = [
7
+ var p = [
7
8
  {
8
9
  label: "Blue",
9
10
  border: "#3b82f6",
@@ -34,11 +35,11 @@ var f = [
34
35
  border: "#6b7280",
35
36
  bg: "#f9fafb"
36
37
  }
37
- ], p = [
38
+ ], m = [
38
39
  {
39
40
  key: "block",
40
41
  label: "Block",
41
- icon: /* @__PURE__ */ o("svg", {
42
+ icon: /* @__PURE__ */ s("svg", {
42
43
  width: "14",
43
44
  height: "14",
44
45
  viewBox: "0 0 24 24",
@@ -46,20 +47,20 @@ var f = [
46
47
  stroke: "currentColor",
47
48
  strokeWidth: "2",
48
49
  children: [
49
- /* @__PURE__ */ a("rect", {
50
+ /* @__PURE__ */ o("rect", {
50
51
  x: "3",
51
52
  y: "5",
52
53
  width: "18",
53
54
  height: "14",
54
55
  rx: "2"
55
56
  }),
56
- /* @__PURE__ */ a("line", {
57
+ /* @__PURE__ */ o("line", {
57
58
  x1: "3",
58
59
  y1: "3",
59
60
  x2: "21",
60
61
  y2: "3"
61
62
  }),
62
- /* @__PURE__ */ a("line", {
63
+ /* @__PURE__ */ o("line", {
63
64
  x1: "3",
64
65
  y1: "21",
65
66
  x2: "21",
@@ -71,7 +72,7 @@ var f = [
71
72
  {
72
73
  key: "wrap-left",
73
74
  label: "Wrap Left",
74
- icon: /* @__PURE__ */ o("svg", {
75
+ icon: /* @__PURE__ */ s("svg", {
75
76
  width: "14",
76
77
  height: "14",
77
78
  viewBox: "0 0 24 24",
@@ -79,38 +80,38 @@ var f = [
79
80
  stroke: "currentColor",
80
81
  strokeWidth: "2",
81
82
  children: [
82
- /* @__PURE__ */ a("rect", {
83
+ /* @__PURE__ */ o("rect", {
83
84
  x: "2",
84
85
  y: "4",
85
86
  width: "10",
86
87
  height: "8",
87
88
  rx: "1"
88
89
  }),
89
- /* @__PURE__ */ a("line", {
90
+ /* @__PURE__ */ o("line", {
90
91
  x1: "15",
91
92
  y1: "5",
92
93
  x2: "22",
93
94
  y2: "5"
94
95
  }),
95
- /* @__PURE__ */ a("line", {
96
+ /* @__PURE__ */ o("line", {
96
97
  x1: "15",
97
98
  y1: "8",
98
99
  x2: "22",
99
100
  y2: "8"
100
101
  }),
101
- /* @__PURE__ */ a("line", {
102
+ /* @__PURE__ */ o("line", {
102
103
  x1: "15",
103
104
  y1: "11",
104
105
  x2: "22",
105
106
  y2: "11"
106
107
  }),
107
- /* @__PURE__ */ a("line", {
108
+ /* @__PURE__ */ o("line", {
108
109
  x1: "2",
109
110
  y1: "15",
110
111
  x2: "22",
111
112
  y2: "15"
112
113
  }),
113
- /* @__PURE__ */ a("line", {
114
+ /* @__PURE__ */ o("line", {
114
115
  x1: "2",
115
116
  y1: "18",
116
117
  x2: "22",
@@ -122,7 +123,7 @@ var f = [
122
123
  {
123
124
  key: "wrap-right",
124
125
  label: "Wrap Right",
125
- icon: /* @__PURE__ */ o("svg", {
126
+ icon: /* @__PURE__ */ s("svg", {
126
127
  width: "14",
127
128
  height: "14",
128
129
  viewBox: "0 0 24 24",
@@ -130,38 +131,38 @@ var f = [
130
131
  stroke: "currentColor",
131
132
  strokeWidth: "2",
132
133
  children: [
133
- /* @__PURE__ */ a("rect", {
134
+ /* @__PURE__ */ o("rect", {
134
135
  x: "12",
135
136
  y: "4",
136
137
  width: "10",
137
138
  height: "8",
138
139
  rx: "1"
139
140
  }),
140
- /* @__PURE__ */ a("line", {
141
+ /* @__PURE__ */ o("line", {
141
142
  x1: "2",
142
143
  y1: "5",
143
144
  x2: "9",
144
145
  y2: "5"
145
146
  }),
146
- /* @__PURE__ */ a("line", {
147
+ /* @__PURE__ */ o("line", {
147
148
  x1: "2",
148
149
  y1: "8",
149
150
  x2: "9",
150
151
  y2: "8"
151
152
  }),
152
- /* @__PURE__ */ a("line", {
153
+ /* @__PURE__ */ o("line", {
153
154
  x1: "2",
154
155
  y1: "11",
155
156
  x2: "9",
156
157
  y2: "11"
157
158
  }),
158
- /* @__PURE__ */ a("line", {
159
+ /* @__PURE__ */ o("line", {
159
160
  x1: "2",
160
161
  y1: "15",
161
162
  x2: "22",
162
163
  y2: "15"
163
164
  }),
164
- /* @__PURE__ */ a("line", {
165
+ /* @__PURE__ */ o("line", {
165
166
  x1: "2",
166
167
  y1: "18",
167
168
  x2: "22",
@@ -173,7 +174,7 @@ var f = [
173
174
  {
174
175
  key: "float",
175
176
  label: "Float",
176
- icon: /* @__PURE__ */ o("svg", {
177
+ icon: /* @__PURE__ */ s("svg", {
177
178
  width: "14",
178
179
  height: "14",
179
180
  viewBox: "0 0 24 24",
@@ -181,25 +182,25 @@ var f = [
181
182
  stroke: "currentColor",
182
183
  strokeWidth: "2",
183
184
  children: [
184
- /* @__PURE__ */ a("rect", {
185
+ /* @__PURE__ */ o("rect", {
185
186
  x: "6",
186
187
  y: "6",
187
188
  width: "12",
188
189
  height: "12",
189
190
  rx: "2"
190
191
  }),
191
- /* @__PURE__ */ a("path", {
192
+ /* @__PURE__ */ o("path", {
192
193
  d: "M2 2h4M18 2h4M2 22h4M18 22h4",
193
194
  strokeDasharray: "2 2"
194
195
  }),
195
- /* @__PURE__ */ a("line", {
196
+ /* @__PURE__ */ o("line", {
196
197
  x1: "2",
197
198
  y1: "12",
198
199
  x2: "6",
199
200
  y2: "12",
200
201
  strokeDasharray: "2 2"
201
202
  }),
202
- /* @__PURE__ */ a("line", {
203
+ /* @__PURE__ */ o("line", {
203
204
  x1: "18",
204
205
  y1: "12",
205
206
  x2: "22",
@@ -210,119 +211,131 @@ var f = [
210
211
  })
211
212
  }
212
213
  ];
213
- function m(e) {
214
+ function h(e) {
214
215
  let t = [];
215
216
  return e.state.doc.descendants((e) => {
216
217
  e.type.name === "floatingDialog" && e.attrs.layout === "float" && t.push(e.attrs.zIndex ?? 10);
217
218
  }), t;
218
219
  }
219
- var h = ({ node: s, editor: u, updateAttributes: d, deleteNode: h, selected: g }) => {
220
- let _ = s.attrs, v = _.layout || "block", y = v === "float", b = _.zIndex ?? 10, [x, S] = i(!1), [C, w] = i(_.title), [T, E] = i(!1), [D, O] = i(!1), k = r({
220
+ var g = ({ node: c, editor: d, updateAttributes: f, deleteNode: g, selected: _ }) => {
221
+ let v = t(d), y = n((e) => {
222
+ !d.isDestroyed && d.isEditable && f(e);
223
+ }, [d, f]), b = i(null), x = c.attrs, S = x.layout || "block", C = S === "float", w = x.zIndex ?? 10, [T, E] = a(!1), [D, O] = a(x.title), [k, A] = a(!1), [j, M] = a(!1), N = i({
221
224
  mx: 0,
222
225
  my: 0,
223
226
  x: 0,
224
227
  y: 0
225
- }), A = r({
228
+ }), P = i({
226
229
  mx: 0,
227
230
  my: 0,
228
231
  w: 0,
229
232
  h: 0
230
- }), j = r(null), M = r(null);
231
- n(() => {
232
- w(_.title);
233
- }, [_.title]), n(() => {
233
+ }), F = i(null), I = i(null);
234
+ r(() => {
235
+ O(x.title);
236
+ }, [x.title]), r(() => {
237
+ v || (b.current?.(), E(!1), O(x.title), A(!1), M(!1));
238
+ }, [v, x.title]), r(() => {
239
+ let e = () => b.current?.();
240
+ return d.on("destroy", e), window.addEventListener("blur", e), () => {
241
+ e(), d.off("destroy", e), window.removeEventListener("blur", e);
242
+ };
243
+ }, [d]), r(() => {
234
244
  let e = (e) => {
235
- j.current && !j.current.contains(e.target) && E(!1), M.current && !M.current.contains(e.target) && O(!1);
245
+ F.current && !F.current.contains(e.target) && A(!1), I.current && !I.current.contains(e.target) && M(!1);
236
246
  };
237
247
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
238
248
  }, []);
239
- let N = t((e) => {
240
- if (!y) return;
241
- e.preventDefault(), e.stopPropagation(), k.current = {
249
+ let L = n((e) => {
250
+ if (!C || d.isDestroyed || !d.isEditable || e.button !== 0) return;
251
+ b.current?.(), e.preventDefault(), e.stopPropagation(), N.current = {
242
252
  mx: e.clientX,
243
253
  my: e.clientY,
244
- x: _.x,
245
- y: _.y
254
+ x: x.x,
255
+ y: x.y
246
256
  };
247
257
  let t = (e) => {
248
- let t = e.clientX - k.current.mx, n = e.clientY - k.current.my;
249
- d({
250
- x: k.current.x + t,
251
- y: k.current.y + n
258
+ let t = e.clientX - N.current.mx, n = e.clientY - N.current.my;
259
+ y({
260
+ x: N.current.x + t,
261
+ y: N.current.y + n
252
262
  });
253
263
  }, n = () => {
254
264
  document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
255
265
  };
256
- document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
266
+ document.addEventListener("mousemove", t), document.addEventListener("mouseup", n), b.current = n;
257
267
  }, [
258
- y,
259
- _.x,
260
- _.y,
261
- d
262
- ]), P = t((e) => {
263
- e.preventDefault(), e.stopPropagation(), A.current = {
268
+ d,
269
+ C,
270
+ x.x,
271
+ x.y,
272
+ y
273
+ ]), R = n((e) => {
274
+ if (d.isDestroyed || !d.isEditable || e.button !== 0) return;
275
+ b.current?.(), e.preventDefault(), e.stopPropagation(), P.current = {
264
276
  mx: e.clientX,
265
277
  my: e.clientY,
266
- w: _.width,
267
- h: _.height
278
+ w: x.width,
279
+ h: x.height
268
280
  };
269
281
  let t = (e) => {
270
- let t = e.clientX - A.current.mx, n = e.clientY - A.current.my;
271
- d({
272
- width: Math.max(160, A.current.w + t),
273
- height: Math.max(80, A.current.h + n)
282
+ let t = e.clientX - P.current.mx, n = e.clientY - P.current.my;
283
+ y({
284
+ width: Math.max(160, P.current.w + t),
285
+ height: Math.max(80, P.current.h + n)
274
286
  });
275
287
  }, n = () => {
276
288
  document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
277
289
  };
278
- document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
290
+ document.addEventListener("mousemove", t), document.addEventListener("mouseup", n), b.current = n;
279
291
  }, [
280
- _.width,
281
- _.height,
282
- d
283
- ]), F = t(() => {
284
- d({ title: C }), S(!1);
285
- }, [C, d]), I = t(() => {
286
- let e = m(u), t = Math.max(...e);
287
- b < t && d({ zIndex: t + 1 });
292
+ d,
293
+ x.width,
294
+ x.height,
295
+ y
296
+ ]), z = n(() => {
297
+ y({ title: D }), E(!1);
298
+ }, [D, y]), B = n(() => {
299
+ let e = h(d), t = Math.max(...e);
300
+ w < t && y({ zIndex: t + 1 });
288
301
  }, [
289
- u,
290
- b,
291
- d
292
- ]), L = t(() => {
293
- let e = m(u), t = Math.min(...e);
294
- b > t ? d({ zIndex: t - 1 }) : b > 1 && d({ zIndex: b - 1 });
302
+ d,
303
+ w,
304
+ y
305
+ ]), V = n(() => {
306
+ let e = h(d), t = Math.min(...e);
307
+ w > t ? y({ zIndex: t - 1 }) : w > 1 && y({ zIndex: w - 1 });
295
308
  }, [
296
- u,
297
- b,
298
- d
299
- ]), R = e("rte-float-dialog", `rte-float-dialog--${v}`, g && "rte-float-dialog--selected"), z = y ? {
309
+ d,
310
+ w,
311
+ y
312
+ ]), H = e("rte-float-dialog", `rte-float-dialog--${S}`, _ && "rte-float-dialog--selected"), U = C ? {
300
313
  position: "absolute",
301
- left: _.x,
302
- top: _.y,
303
- zIndex: b
304
- } : {}, B = {
305
- width: v === "block" ? "100%" : _.width,
306
- minHeight: _.height,
307
- borderColor: _.borderColor,
308
- backgroundColor: _.bgColor
309
- }, V = p.find((e) => e.key === v)?.icon;
310
- return /* @__PURE__ */ a(l, {
311
- className: R,
312
- style: z,
313
- children: /* @__PURE__ */ o("div", {
314
+ left: x.x,
315
+ top: x.y,
316
+ zIndex: w
317
+ } : {}, W = {
318
+ width: S === "block" ? "100%" : x.width,
319
+ minHeight: x.height,
320
+ borderColor: x.borderColor,
321
+ backgroundColor: x.bgColor
322
+ }, G = m.find((e) => e.key === S)?.icon;
323
+ return /* @__PURE__ */ o(u, {
324
+ className: H,
325
+ style: U,
326
+ children: /* @__PURE__ */ s("div", {
314
327
  className: "rte-float-dialog__box",
315
- style: B,
328
+ style: W,
316
329
  children: [
317
- /* @__PURE__ */ o("div", {
330
+ /* @__PURE__ */ s("div", {
318
331
  className: "rte-float-dialog__titlebar",
319
- style: { borderBottomColor: _.borderColor },
320
- onMouseDown: N,
332
+ style: { borderBottomColor: x.borderColor },
333
+ onMouseDown: L,
321
334
  contentEditable: !1,
322
335
  children: [
323
- y && /* @__PURE__ */ a("span", {
336
+ C && /* @__PURE__ */ o("span", {
324
337
  className: "rte-float-dialog__drag-icon",
325
- children: /* @__PURE__ */ o("svg", {
338
+ children: /* @__PURE__ */ s("svg", {
326
339
  width: "12",
327
340
  height: "12",
328
341
  viewBox: "0 0 24 24",
@@ -330,32 +343,32 @@ var h = ({ node: s, editor: u, updateAttributes: d, deleteNode: h, selected: g }
330
343
  stroke: "currentColor",
331
344
  strokeWidth: "2",
332
345
  children: [
333
- /* @__PURE__ */ a("circle", {
346
+ /* @__PURE__ */ o("circle", {
334
347
  cx: "9",
335
348
  cy: "5",
336
349
  r: "1.5"
337
350
  }),
338
- /* @__PURE__ */ a("circle", {
351
+ /* @__PURE__ */ o("circle", {
339
352
  cx: "15",
340
353
  cy: "5",
341
354
  r: "1.5"
342
355
  }),
343
- /* @__PURE__ */ a("circle", {
356
+ /* @__PURE__ */ o("circle", {
344
357
  cx: "9",
345
358
  cy: "12",
346
359
  r: "1.5"
347
360
  }),
348
- /* @__PURE__ */ a("circle", {
361
+ /* @__PURE__ */ o("circle", {
349
362
  cx: "15",
350
363
  cy: "12",
351
364
  r: "1.5"
352
365
  }),
353
- /* @__PURE__ */ a("circle", {
366
+ /* @__PURE__ */ o("circle", {
354
367
  cx: "9",
355
368
  cy: "19",
356
369
  r: "1.5"
357
370
  }),
358
- /* @__PURE__ */ a("circle", {
371
+ /* @__PURE__ */ o("circle", {
359
372
  cx: "15",
360
373
  cy: "19",
361
374
  r: "1.5"
@@ -363,49 +376,51 @@ var h = ({ node: s, editor: u, updateAttributes: d, deleteNode: h, selected: g }
363
376
  ]
364
377
  })
365
378
  }),
366
- x ? /* @__PURE__ */ a("input", {
379
+ T && v ? /* @__PURE__ */ o("input", {
367
380
  className: "rte-float-dialog__title-input",
368
- value: C,
369
- onChange: (e) => w(e.target.value),
381
+ value: D,
382
+ onChange: (e) => O(e.target.value),
370
383
  placeholder: "Title...",
371
384
  onMouseDown: (e) => e.stopPropagation(),
372
- onBlur: F,
385
+ onBlur: z,
373
386
  onKeyDown: (e) => {
374
- (e.key === "Enter" || e.key === "Escape") && F();
387
+ (e.key === "Enter" || e.key === "Escape") && z();
375
388
  },
376
389
  autoFocus: !0
377
- }) : /* @__PURE__ */ a("span", {
390
+ }) : /* @__PURE__ */ o("span", {
378
391
  className: "rte-float-dialog__title",
379
- onDoubleClick: () => S(!0),
380
- children: _.title || "Dialog"
392
+ onDoubleClick: () => {
393
+ !d.isDestroyed && d.isEditable && E(!0);
394
+ },
395
+ children: x.title || "Dialog"
381
396
  }),
382
- /* @__PURE__ */ o("div", {
397
+ v && /* @__PURE__ */ s("div", {
383
398
  className: "rte-float-dialog__actions",
384
399
  children: [
385
- y && /* @__PURE__ */ o("div", {
400
+ C && /* @__PURE__ */ s("div", {
386
401
  className: "rte-float-dialog__zorder",
387
- children: [/* @__PURE__ */ a("button", {
402
+ children: [/* @__PURE__ */ o("button", {
388
403
  type: "button",
389
404
  className: "rte-float-dialog__action-btn",
390
405
  onClick: (e) => {
391
- e.stopPropagation(), I();
406
+ e.stopPropagation(), B();
392
407
  },
393
408
  title: "Bring to Front",
394
409
  onMouseDown: (e) => e.stopPropagation(),
395
- children: /* @__PURE__ */ o("svg", {
410
+ children: /* @__PURE__ */ s("svg", {
396
411
  width: "12",
397
412
  height: "12",
398
413
  viewBox: "0 0 24 24",
399
414
  fill: "none",
400
415
  stroke: "currentColor",
401
416
  strokeWidth: "2",
402
- children: [/* @__PURE__ */ a("rect", {
417
+ children: [/* @__PURE__ */ o("rect", {
403
418
  x: "8",
404
419
  y: "2",
405
420
  width: "13",
406
421
  height: "13",
407
422
  rx: "2"
408
- }), /* @__PURE__ */ a("rect", {
423
+ }), /* @__PURE__ */ o("rect", {
409
424
  x: "3",
410
425
  y: "9",
411
426
  width: "13",
@@ -414,28 +429,28 @@ var h = ({ node: s, editor: u, updateAttributes: d, deleteNode: h, selected: g }
414
429
  opacity: "0.4"
415
430
  })]
416
431
  })
417
- }), /* @__PURE__ */ a("button", {
432
+ }), /* @__PURE__ */ o("button", {
418
433
  type: "button",
419
434
  className: "rte-float-dialog__action-btn",
420
435
  onClick: (e) => {
421
- e.stopPropagation(), L();
436
+ e.stopPropagation(), V();
422
437
  },
423
438
  title: "Send to Back",
424
439
  onMouseDown: (e) => e.stopPropagation(),
425
- children: /* @__PURE__ */ o("svg", {
440
+ children: /* @__PURE__ */ s("svg", {
426
441
  width: "12",
427
442
  height: "12",
428
443
  viewBox: "0 0 24 24",
429
444
  fill: "none",
430
445
  stroke: "currentColor",
431
446
  strokeWidth: "2",
432
- children: [/* @__PURE__ */ a("rect", {
447
+ children: [/* @__PURE__ */ o("rect", {
433
448
  x: "3",
434
449
  y: "9",
435
450
  width: "13",
436
451
  height: "13",
437
452
  rx: "2"
438
- }), /* @__PURE__ */ a("rect", {
453
+ }), /* @__PURE__ */ o("rect", {
439
454
  x: "8",
440
455
  y: "2",
441
456
  width: "13",
@@ -446,94 +461,94 @@ var h = ({ node: s, editor: u, updateAttributes: d, deleteNode: h, selected: g }
446
461
  })
447
462
  })]
448
463
  }),
449
- /* @__PURE__ */ o("div", {
450
- ref: M,
464
+ /* @__PURE__ */ s("div", {
465
+ ref: I,
451
466
  style: { position: "relative" },
452
- children: [/* @__PURE__ */ a("button", {
467
+ children: [/* @__PURE__ */ o("button", {
453
468
  type: "button",
454
469
  className: "rte-float-dialog__action-btn",
455
470
  onClick: (e) => {
456
- e.stopPropagation(), O(!D);
471
+ e.stopPropagation(), M(!j);
457
472
  },
458
- title: `Layout: ${v}`,
473
+ title: `Layout: ${S}`,
459
474
  onMouseDown: (e) => e.stopPropagation(),
460
- children: V
461
- }), D && /* @__PURE__ */ a("div", {
475
+ children: G
476
+ }), j && /* @__PURE__ */ o("div", {
462
477
  className: "rte-float-dialog__layout-dropdown",
463
478
  onMouseDown: (e) => e.stopPropagation(),
464
- children: p.map((e) => /* @__PURE__ */ o("button", {
479
+ children: m.map((e) => /* @__PURE__ */ s("button", {
465
480
  type: "button",
466
- className: `rte-float-dialog__layout-option ${v === e.key ? "rte-float-dialog__layout-option--active" : ""}`,
481
+ className: `rte-float-dialog__layout-option ${S === e.key ? "rte-float-dialog__layout-option--active" : ""}`,
467
482
  onClick: () => {
468
- d({ layout: e.key }), O(!1);
483
+ y({ layout: e.key }), M(!1);
469
484
  },
470
485
  title: e.label,
471
- children: [e.icon, /* @__PURE__ */ a("span", { children: e.label })]
486
+ children: [e.icon, /* @__PURE__ */ o("span", { children: e.label })]
472
487
  }, e.key))
473
488
  })]
474
489
  }),
475
- /* @__PURE__ */ o("div", {
476
- ref: j,
490
+ /* @__PURE__ */ s("div", {
491
+ ref: F,
477
492
  style: { position: "relative" },
478
- children: [/* @__PURE__ */ a("button", {
493
+ children: [/* @__PURE__ */ o("button", {
479
494
  type: "button",
480
495
  className: "rte-float-dialog__action-btn",
481
496
  onClick: (e) => {
482
- e.stopPropagation(), E(!T);
497
+ e.stopPropagation(), A(!k);
483
498
  },
484
499
  title: "Color",
485
500
  onMouseDown: (e) => e.stopPropagation(),
486
- children: /* @__PURE__ */ a("svg", {
501
+ children: /* @__PURE__ */ o("svg", {
487
502
  width: "12",
488
503
  height: "12",
489
504
  viewBox: "0 0 24 24",
490
- fill: _.borderColor,
491
- stroke: _.borderColor,
505
+ fill: x.borderColor,
506
+ stroke: x.borderColor,
492
507
  strokeWidth: "2",
493
- children: /* @__PURE__ */ a("circle", {
508
+ children: /* @__PURE__ */ o("circle", {
494
509
  cx: "12",
495
510
  cy: "12",
496
511
  r: "8"
497
512
  })
498
513
  })
499
- }), T && /* @__PURE__ */ a("div", {
514
+ }), k && /* @__PURE__ */ o("div", {
500
515
  className: "rte-float-dialog__color-dropdown",
501
516
  onMouseDown: (e) => e.stopPropagation(),
502
- children: f.map((e) => /* @__PURE__ */ a("button", {
517
+ children: p.map((e) => /* @__PURE__ */ o("button", {
503
518
  type: "button",
504
519
  className: "rte-float-dialog__color-swatch",
505
520
  style: { backgroundColor: e.border },
506
521
  onClick: () => {
507
- d({
522
+ y({
508
523
  borderColor: e.border,
509
524
  bgColor: e.bg
510
- }), E(!1);
525
+ }), A(!1);
511
526
  },
512
527
  title: e.label
513
528
  }, e.label))
514
529
  })]
515
530
  }),
516
- /* @__PURE__ */ a("button", {
531
+ /* @__PURE__ */ o("button", {
517
532
  type: "button",
518
533
  className: "rte-float-dialog__action-btn rte-float-dialog__action-btn--danger",
519
534
  onClick: (e) => {
520
- e.stopPropagation(), h();
535
+ e.stopPropagation(), !d.isDestroyed && d.isEditable && g();
521
536
  },
522
537
  title: "Delete",
523
538
  onMouseDown: (e) => e.stopPropagation(),
524
- children: /* @__PURE__ */ o("svg", {
539
+ children: /* @__PURE__ */ s("svg", {
525
540
  width: "12",
526
541
  height: "12",
527
542
  viewBox: "0 0 24 24",
528
543
  fill: "none",
529
544
  stroke: "currentColor",
530
545
  strokeWidth: "2",
531
- children: [/* @__PURE__ */ a("line", {
546
+ children: [/* @__PURE__ */ o("line", {
532
547
  x1: "18",
533
548
  y1: "6",
534
549
  x2: "6",
535
550
  y2: "18"
536
- }), /* @__PURE__ */ a("line", {
551
+ }), /* @__PURE__ */ o("line", {
537
552
  x1: "6",
538
553
  y1: "6",
539
554
  x2: "18",
@@ -545,28 +560,28 @@ var h = ({ node: s, editor: u, updateAttributes: d, deleteNode: h, selected: g }
545
560
  })
546
561
  ]
547
562
  }),
548
- /* @__PURE__ */ a(c, { className: "rte-float-dialog__body" }),
549
- /* @__PURE__ */ a("div", {
563
+ /* @__PURE__ */ o(l, { className: "rte-float-dialog__body" }),
564
+ v && /* @__PURE__ */ o("div", {
550
565
  className: "rte-float-dialog__resize-handle",
551
- onMouseDown: P,
566
+ onMouseDown: R,
552
567
  contentEditable: !1,
553
- children: /* @__PURE__ */ o("svg", {
568
+ children: /* @__PURE__ */ s("svg", {
554
569
  width: "10",
555
570
  height: "10",
556
571
  viewBox: "0 0 10 10",
557
572
  fill: "currentColor",
558
573
  children: [
559
- /* @__PURE__ */ a("circle", {
574
+ /* @__PURE__ */ o("circle", {
560
575
  cx: "8",
561
576
  cy: "8",
562
577
  r: "1.2"
563
578
  }),
564
- /* @__PURE__ */ a("circle", {
579
+ /* @__PURE__ */ o("circle", {
565
580
  cx: "4",
566
581
  cy: "8",
567
582
  r: "1.2"
568
583
  }),
569
- /* @__PURE__ */ a("circle", {
584
+ /* @__PURE__ */ o("circle", {
570
585
  cx: "8",
571
586
  cy: "4",
572
587
  r: "1.2"
@@ -578,7 +593,7 @@ var h = ({ node: s, editor: u, updateAttributes: d, deleteNode: h, selected: g }
578
593
  })
579
594
  });
580
595
  };
581
- function g(e) {
596
+ function _(e) {
582
597
  let t = 9;
583
598
  return e.state.doc.descendants((e) => {
584
599
  if (e.type.name === "floatingDialog" && e.attrs.layout === "float") {
@@ -587,7 +602,7 @@ function g(e) {
587
602
  }
588
603
  }), t + 1;
589
604
  }
590
- var _ = s.create({
605
+ var v = c.create({
591
606
  name: "floatingDialog",
592
607
  group: "block",
593
608
  content: "block+",
@@ -613,15 +628,15 @@ var _ = s.create({
613
628
  renderHTML({ HTMLAttributes: e }) {
614
629
  return [
615
630
  "div",
616
- d(e, { "data-type": "floating-dialog" }),
631
+ f(e, { "data-type": "floating-dialog" }),
617
632
  0
618
633
  ];
619
634
  },
620
635
  addNodeView() {
621
- return u(h);
636
+ return d(g);
622
637
  }
623
638
  });
624
639
  //#endregion
625
- export { _ as FloatingDialogExtension, _ as default, g as getNextFloatZIndex };
640
+ export { v as FloatingDialogExtension, v as default, _ as getNextFloatZIndex };
626
641
 
627
642
  //# sourceMappingURL=FloatingDialog.js.map