@npm-questionpro/wick-ui-editor 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # @npm-questionpro/wick-ui-editor
2
2
 
3
- A rich text editor component built with React and TipTap. Part of the Wick UI design system.
3
+ A rich text editor component built with React and TipTap. Part of the Wick UI
4
+ design system.
4
5
 
5
6
  [![npm version](https://img.shields.io/npm/v/@npm-questionpro/wick-ui-editor.svg)](https://www.npmjs.com/package/@npm-questionpro/wick-ui-editor)
6
7
  [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
@@ -37,22 +38,23 @@ function App() {
37
38
 
38
39
  ## Props
39
40
 
40
- | Prop | Type | Default | Description |
41
- | ---- | ---- | ------- | ----------- |
42
- | `defaultValue` | `string` | `undefined` | Initial HTML content (auto-sanitized) |
43
- | `onUpdate` | `(html: string) => void` | `undefined` | Fires when content changes |
44
- | `readonly` | `boolean` | `false` | Disable editing |
45
- | `renderHtml` | `boolean` | `false` | Render raw HTML in read-only mode |
46
- | `toolbarPosition` | `'top' \| 'bottom'` | `'top'` | Toolbar placement |
47
- | `toolbarItems` | `IToolbarExtensionKey[]` | all | Toolbar buttons to show |
48
- | `hideToolbar` | `boolean` | `false` | Hide the toolbar |
49
- | `customFonts` | `string[]` | `undefined` | Extra font families in font picker |
50
- | `customToolbarChildren` | `ReactNode` | `undefined` | Custom elements appended to toolbar |
51
- | `className` | `string` | `undefined` | Class on the root container |
41
+ | Prop | Type | Default | Description |
42
+ | ----------------------- | ------------------------ | ----------- | ------------------------------------- |
43
+ | `defaultValue` | `string` | `undefined` | Initial HTML content (auto-sanitized) |
44
+ | `onUpdate` | `(html: string) => void` | `undefined` | Fires when content changes |
45
+ | `readonly` | `boolean` | `false` | Disable editing |
46
+ | `renderHtml` | `boolean` | `false` | Render raw HTML in read-only mode |
47
+ | `toolbarPosition` | `'top' \| 'bottom'` | `'top'` | Toolbar placement |
48
+ | `toolbarItems` | `IToolbarExtensionKey[]` | all | Toolbar buttons to show |
49
+ | `hideToolbar` | `boolean` | `false` | Hide the toolbar |
50
+ | `customFonts` | `string[]` | `undefined` | Extra font families in font picker |
51
+ | `customToolbarChildren` | `ReactNode` | `undefined` | Custom elements appended to toolbar |
52
+ | `className` | `string` | `undefined` | Class on the root container |
52
53
 
53
54
  ## Documentation
54
55
 
55
- Full documentation and interactive examples: [wick-ui-lib.pages.dev](https://wick-ui-lib.pages.dev)
56
+ Full documentation and interactive examples:
57
+ [wick-ui-lib.pages.dev](https://wick-ui-lib.pages.dev)
56
58
 
57
59
  ## License
58
60
 
package/dist/index.d.ts CHANGED
@@ -7,12 +7,12 @@ export declare interface IWuContentEditorProps extends default_2.HTMLAttributes<
7
7
  defaultValue?: string;
8
8
  onUpdate?: (content: string) => void;
9
9
  customFonts?: string[];
10
- readonly?: boolean;
11
10
  toolbarPosition?: 'top' | 'bottom';
12
11
  customToolbarChildren?: default_2.ReactNode;
13
12
  toolbarItems?: IToolbarExtensionKey[];
14
13
  hideToolbar?: boolean;
15
- renderHtml?: boolean;
14
+ readonly?: boolean;
15
+ renderDefaultOnly?: boolean;
16
16
  }
17
17
 
18
18
  declare const TOOLBAR_EXTENSIONS: {
@@ -38,6 +38,6 @@ declare const TOOLBAR_EXTENSIONS: {
38
38
  '|': JSX.Element;
39
39
  };
40
40
 
41
- export declare function WuContentEditor({ defaultValue, onUpdate, className, readonly, toolbarPosition, customToolbarChildren, toolbarItems, hideToolbar, renderHtml, customFonts, ...props }: IWuContentEditorProps): default_2.JSX.Element;
41
+ export declare function WuContentEditor({ defaultValue, onUpdate, className, toolbarPosition, customToolbarChildren, toolbarItems, hideToolbar, readonly, customFonts, renderDefaultOnly, ...props }: IWuContentEditorProps): default_2.JSX.Element;
42
42
 
43
43
  export { }
@@ -1,30 +1,30 @@
1
- import { jsx as o, jsxs as p, Fragment as _ } from "react/jsx-runtime";
2
- import { useEditorState as g, useEditor as U, EditorContent as q } from "@tiptap/react";
3
- import F from "clsx";
4
- import C, { useState as E, useRef as $, useCallback as N } from "react";
5
- import j from "@tiptap/extension-image";
6
- import { TaskList as K, TaskItem as J } from "@tiptap/extension-list";
1
+ import { jsx as o, jsxs as g, Fragment as R } from "react/jsx-runtime";
2
+ import { useEditorState as f, useEditor as q, EditorContent as $ } from "@tiptap/react";
3
+ import D from "clsx";
4
+ import C, { useState as E, useRef as j, useCallback as _ } from "react";
5
+ import K from "@tiptap/extension-image";
6
+ import { TaskList as J, TaskItem as V } from "@tiptap/extension-list";
7
7
  import G from "@tiptap/extension-subscript";
8
- import V from "@tiptap/extension-superscript";
9
- import { TableKit as X } from "@tiptap/extension-table";
10
- import Y from "@tiptap/extension-text-align";
11
- import { TextStyle as Z, Color as Q, BackgroundColor as tt, LineHeight as et, FontSize as ot, FontFamily as nt } from "@tiptap/extension-text-style";
12
- import it from "@tiptap/starter-kit";
13
- import { WuIcon as h, WuModal as y, WuModalHeader as T, WuModalContent as S, WuInput as k, WuModalFooter as x, WuModalClose as A, WuToggle as rt, WuButton as st } from "@npm-questionpro/wick-ui-lib";
14
- import { DropdownMenu as R, DropdownMenuTrigger as M, DropdownMenuContent as z, DropdownMenuItem as H } from "@radix-ui/react-dropdown-menu";
15
- import ct from "dompurify";
16
- const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt = "_wuContentEditorContainer_399u0_8", ut = "_wuContentEditorToolbar_399u0_80", mt = "_wuContentEditorAction_399u0_106", ht = "_wuContentEditorDropdown_399u0_132", gt = "_wuContentEditorDropdownItem_399u0_145", pt = "_wuContentEditorFontSize_399u0_156", ft = "_wuContentEditorModal_399u0_170", d = {
17
- wuContentEditor: lt,
18
- wuContentEditorTable: at,
19
- wuContentEditorContainer: dt,
20
- wuContentEditorToolbar: ut,
21
- wuContentEditorAction: mt,
22
- wuContentEditorDropdown: ht,
8
+ import X from "@tiptap/extension-superscript";
9
+ import { TableKit as Y } from "@tiptap/extension-table";
10
+ import Z from "@tiptap/extension-text-align";
11
+ import { TextStyle as Q, Color as tt, BackgroundColor as et, LineHeight as ot, FontSize as nt, FontFamily as it } from "@tiptap/extension-text-style";
12
+ import rt from "@tiptap/starter-kit";
13
+ import { WuIcon as h, WuModal as y, WuModalHeader as T, WuModalContent as S, WuInput as k, WuModalFooter as x, WuModalClose as b, WuToggle as st, WuButton as ct } from "@npm-questionpro/wick-ui-lib";
14
+ import { DropdownMenu as M, DropdownMenuTrigger as H, DropdownMenuContent as z, DropdownMenuItem as B } from "@radix-ui/react-dropdown-menu";
15
+ import lt from "dompurify";
16
+ const at = "_wuContentEditor_399u0_8", dt = "_wuContentEditorTable_399u0_1", ut = "_wuContentEditorContainer_399u0_8", mt = "_wuContentEditorToolbar_399u0_80", ht = "_wuContentEditorAction_399u0_106", ft = "_wuContentEditorDropdown_399u0_132", gt = "_wuContentEditorDropdownItem_399u0_145", pt = "_wuContentEditorFontSize_399u0_156", wt = "_wuContentEditorModal_399u0_170", d = {
17
+ wuContentEditor: at,
18
+ wuContentEditorTable: dt,
19
+ wuContentEditorContainer: ut,
20
+ wuContentEditorToolbar: mt,
21
+ wuContentEditorAction: ht,
22
+ wuContentEditorDropdown: ft,
23
23
  wuContentEditorDropdownItem: gt,
24
24
  wuContentEditorFontSize: pt,
25
- wuContentEditorModal: ft
26
- }, wt = [
27
- it.configure({
25
+ wuContentEditorModal: wt
26
+ }, Ct = [
27
+ rt.configure({
28
28
  link: {
29
29
  openOnClick: !1,
30
30
  autolink: !0,
@@ -35,16 +35,16 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
35
35
  const e = t.includes(":") ? new URL(t) : new URL(`${n.defaultProtocol}://${t}`);
36
36
  if (!n.defaultValidate(e.href))
37
37
  return !1;
38
- const i = ["ftp", "file", "mailto"], s = e.protocol.replace(":", "");
39
- if (i.includes(s) || !n.protocols.map(
38
+ const i = ["ftp", "file", "mailto"], l = e.protocol.replace(":", "");
39
+ if (i.includes(l) || !n.protocols.map(
40
40
  (r) => typeof r == "string" ? r : r.scheme
41
- ).includes(s))
41
+ ).includes(l))
42
42
  return !1;
43
43
  const a = [
44
44
  "example-phishing.com",
45
45
  "malicious-site.net"
46
- ], c = e.hostname;
47
- return !a.includes(c);
46
+ ], s = e.hostname;
47
+ return !a.includes(s);
48
48
  } catch {
49
49
  return !1;
50
50
  }
@@ -62,52 +62,52 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
62
62
  }
63
63
  }
64
64
  }),
65
- Y.configure({
65
+ Z.configure({
66
66
  types: ["heading", "paragraph"]
67
67
  }),
68
- V,
68
+ X,
69
69
  G,
70
- Z,
71
70
  Q,
72
71
  tt,
73
- K,
74
- J,
75
72
  et,
73
+ J,
74
+ V,
76
75
  ot,
77
76
  nt,
78
- j.configure({
77
+ it,
78
+ K.configure({
79
79
  resize: {
80
80
  enabled: !0,
81
81
  alwaysPreserveAspectRatio: !0
82
82
  },
83
83
  inline: !0
84
84
  }),
85
- X.configure({
85
+ Y.configure({
86
86
  table: { resizable: !0 }
87
87
  })
88
- ], B = C.createContext(
88
+ ], O = C.createContext(
89
89
  null
90
- ), Ct = ({
90
+ ), vt = ({
91
91
  editor: t,
92
92
  children: n,
93
93
  customFonts: e
94
- }) => /* @__PURE__ */ o(B.Provider, { value: { editor: t, customFonts: e }, children: n }), m = () => {
95
- const t = C.useContext(B);
94
+ }) => /* @__PURE__ */ o(O.Provider, { value: { editor: t, customFonts: e }, children: n }), m = () => {
95
+ const t = C.useContext(O);
96
96
  if (!t)
97
97
  throw new Error("useToolbar must be used within a ToolbarProvider");
98
98
  return t;
99
99
  }, L = ({ action: t, defaultValue: n }) => {
100
- var s;
100
+ var l;
101
101
  const [e, i] = C.useState(
102
- n || t.items.find((l) => l.active) || t.items[0]
102
+ n || t.items.find((c) => c.active) || t.items[0]
103
103
  );
104
104
  return C.useEffect(() => {
105
105
  i(
106
- n || t.items.find((l) => l.active) || t.items[0]
106
+ n || t.items.find((c) => c.active) || t.items[0]
107
107
  );
108
- }, [t, n]), /* @__PURE__ */ p(R, { children: [
108
+ }, [t, n]), /* @__PURE__ */ g(M, { children: [
109
109
  /* @__PURE__ */ o(
110
- M,
110
+ H,
111
111
  {
112
112
  className: d.wuContentEditorAction,
113
113
  "data-active": t.active,
@@ -118,41 +118,41 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
118
118
  z,
119
119
  {
120
120
  align: "start",
121
- onCloseAutoFocus: (l) => l.preventDefault(),
121
+ onCloseAutoFocus: (c) => c.preventDefault(),
122
122
  className: d.wuContentEditorDropdown,
123
123
  "data-inline": !0,
124
- children: (s = t.items) == null ? void 0 : s.map((l) => /* @__PURE__ */ o(
125
- H,
124
+ children: (l = t.items) == null ? void 0 : l.map((c) => /* @__PURE__ */ o(
125
+ B,
126
126
  {
127
127
  onClick: () => {
128
- l.event(), i(l);
128
+ c.event(), i(c);
129
129
  },
130
- title: l.tooltip,
130
+ title: c.tooltip,
131
131
  children: /* @__PURE__ */ o(
132
132
  "button",
133
133
  {
134
134
  className: d.wuContentEditorAction,
135
- "data-active": l.active,
136
- children: /* @__PURE__ */ o(h, { icon: l.icon })
135
+ "data-active": c.active,
136
+ children: /* @__PURE__ */ o(h, { icon: c.icon })
137
137
  }
138
138
  )
139
139
  },
140
- l.id
140
+ c.id
141
141
  ))
142
142
  }
143
143
  )
144
144
  ] });
145
- }, vt = () => {
146
- const { editor: t } = m(), n = g({
145
+ }, bt = () => {
146
+ const { editor: t } = m(), n = f({
147
147
  editor: t,
148
148
  selector: (i) => {
149
- var s, l, a, c, r, u, w;
149
+ var l, c, a, s, r, u, p;
150
150
  return {
151
- isLeft: (s = i.editor) == null ? void 0 : s.isActive({ textAlign: "left" }),
152
- isCenter: (l = i.editor) == null ? void 0 : l.isActive({ textAlign: "center" }),
151
+ isLeft: (l = i.editor) == null ? void 0 : l.isActive({ textAlign: "left" }),
152
+ isCenter: (c = i.editor) == null ? void 0 : c.isActive({ textAlign: "center" }),
153
153
  isRight: (a = i.editor) == null ? void 0 : a.isActive({ textAlign: "right" }),
154
- isJustify: (c = i.editor) == null ? void 0 : c.isActive({ textAlign: "justify" }),
155
- isAligned: ((r = i.editor) == null ? void 0 : r.isActive({ textAlign: "center" })) || ((u = i.editor) == null ? void 0 : u.isActive({ textAlign: "right" })) || ((w = i.editor) == null ? void 0 : w.isActive({ textAlign: "justify" }))
154
+ isJustify: (s = i.editor) == null ? void 0 : s.isActive({ textAlign: "justify" }),
155
+ isAligned: ((r = i.editor) == null ? void 0 : r.isActive({ textAlign: "center" })) || ((u = i.editor) == null ? void 0 : u.isActive({ textAlign: "right" })) || ((p = i.editor) == null ? void 0 : p.isActive({ textAlign: "justify" }))
156
156
  };
157
157
  }
158
158
  }), e = [
@@ -196,14 +196,14 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
196
196
  }
197
197
  }
198
198
  );
199
- }, bt = () => {
200
- const { editor: t } = m(), n = g({
199
+ }, At = () => {
200
+ const { editor: t } = m(), n = f({
201
201
  editor: t,
202
202
  selector: ({ editor: e }) => ({
203
203
  bgColor: e.getAttributes("textStyle").backgroundColor
204
204
  })
205
205
  });
206
- return /* @__PURE__ */ p(
206
+ return /* @__PURE__ */ g(
207
207
  "label",
208
208
  {
209
209
  className: d.wuContentEditorAction,
@@ -224,16 +224,16 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
224
224
  ]
225
225
  }
226
226
  );
227
- }, At = () => {
228
- const { editor: t } = m(), n = g({
227
+ }, kt = () => {
228
+ const { editor: t } = m(), n = f({
229
229
  editor: t,
230
230
  selector: (i) => {
231
- var s, l, a, c, r, u;
231
+ var l, c, a, s, r, u;
232
232
  return {
233
- isParagraph: (s = i.editor) == null ? void 0 : s.isActive("paragraph"),
234
- isH1: (l = i.editor) == null ? void 0 : l.isActive("heading", { level: 1 }),
233
+ isParagraph: (l = i.editor) == null ? void 0 : l.isActive("paragraph"),
234
+ isH1: (c = i.editor) == null ? void 0 : c.isActive("heading", { level: 1 }),
235
235
  isH2: (a = i.editor) == null ? void 0 : a.isActive("heading", { level: 2 }),
236
- isH3: (c = i.editor) == null ? void 0 : c.isActive("heading", { level: 3 }),
236
+ isH3: (s = i.editor) == null ? void 0 : s.isActive("heading", { level: 3 }),
237
237
  isH4: (r = i.editor) == null ? void 0 : r.isActive("heading", { level: 4 }),
238
238
  isStyle: (u = i.editor) == null ? void 0 : u.isActive("heading")
239
239
  };
@@ -282,8 +282,8 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
282
282
  defaultValue: e.find((i) => i.active)
283
283
  }
284
284
  );
285
- }, kt = () => {
286
- const { editor: t } = m(), n = g({
285
+ }, Et = () => {
286
+ const { editor: t } = m(), n = f({
287
287
  editor: t,
288
288
  selector: (e) => {
289
289
  var i;
@@ -304,8 +304,8 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
304
304
  children: /* @__PURE__ */ o(h, { icon: "wm-format-quote" })
305
305
  }
306
306
  );
307
- }, Et = () => {
308
- const { editor: t } = m(), n = g({
307
+ }, yt = () => {
308
+ const { editor: t } = m(), n = f({
309
309
  editor: t,
310
310
  selector: (e) => {
311
311
  var i;
@@ -326,9 +326,9 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
326
326
  children: /* @__PURE__ */ o(h, { icon: "wm-format-bold" })
327
327
  }
328
328
  );
329
- }, yt = () => {
329
+ }, Tt = () => {
330
330
  const { editor: t } = m();
331
- return /* @__PURE__ */ o(_, { children: [
331
+ return /* @__PURE__ */ o(R, { children: [
332
332
  {
333
333
  id: "clear",
334
334
  icon: "wm-format-clear",
@@ -347,8 +347,8 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
347
347
  },
348
348
  e.id
349
349
  )) });
350
- }, Tt = () => {
351
- const { editor: t } = m(), n = g({
350
+ }, St = () => {
351
+ const { editor: t } = m(), n = f({
352
352
  editor: t,
353
353
  selector: (e) => ({
354
354
  code: e.editor.isActive("code")
@@ -366,20 +366,20 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
366
366
  children: /* @__PURE__ */ o(h, { icon: "wm-code" })
367
367
  }
368
368
  );
369
- }, St = () => {
370
- const { editor: t } = m(), n = g({
369
+ }, xt = () => {
370
+ const { editor: t } = m(), n = f({
371
371
  editor: t,
372
- selector: (c) => {
372
+ selector: (s) => {
373
373
  var r, u;
374
374
  return {
375
- isImage: (r = c.editor) == null ? void 0 : r.isActive("image"),
376
- imageAttrs: (u = c.editor) == null ? void 0 : u.getAttributes("image")
375
+ isImage: (r = s.editor) == null ? void 0 : r.isActive("image"),
376
+ imageAttrs: (u = s.editor) == null ? void 0 : u.getAttributes("image")
377
377
  };
378
378
  }
379
- }), [e, i] = C.useState(n.imageAttrs.src || ""), [s, l] = C.useState(n.imageAttrs.alt || ""), a = () => {
380
- t.chain().focus().setImage({ src: e, alt: s }).run();
379
+ }), [e, i] = C.useState(n.imageAttrs.src || ""), [l, c] = C.useState(n.imageAttrs.alt || ""), a = () => {
380
+ t.chain().focus().setImage({ src: e, alt: l }).run();
381
381
  };
382
- return /* @__PURE__ */ p(
382
+ return /* @__PURE__ */ g(
383
383
  y,
384
384
  {
385
385
  Trigger: /* @__PURE__ */ o(
@@ -393,14 +393,14 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
393
393
  maxWidth: "400px",
394
394
  children: [
395
395
  /* @__PURE__ */ o(T, { style: { display: "none" } }),
396
- /* @__PURE__ */ p(S, { className: d.wuContentEditorModal, children: [
396
+ /* @__PURE__ */ g(S, { className: d.wuContentEditorModal, children: [
397
397
  /* @__PURE__ */ o(
398
398
  k,
399
399
  {
400
400
  Label: "Image URL",
401
401
  type: "url",
402
402
  value: e,
403
- onChange: (c) => i(c.target.value),
403
+ onChange: (s) => i(s.target.value),
404
404
  required: !0
405
405
  }
406
406
  ),
@@ -409,45 +409,45 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
409
409
  {
410
410
  Label: "Alt Text",
411
411
  type: "text",
412
- value: s,
413
- onChange: (c) => l(c.target.value)
412
+ value: l,
413
+ onChange: (s) => c(s.target.value)
414
414
  }
415
415
  )
416
416
  ] }),
417
- /* @__PURE__ */ p(x, { children: [
418
- /* @__PURE__ */ o(A, { variant: "secondary", children: "Cancel" }),
419
- /* @__PURE__ */ o(A, { onClick: a, disabled: !e, children: "Save" })
417
+ /* @__PURE__ */ g(x, { children: [
418
+ /* @__PURE__ */ o(b, { variant: "secondary", children: "Cancel" }),
419
+ /* @__PURE__ */ o(b, { onClick: a, disabled: !e, children: "Save" })
420
420
  ] })
421
421
  ]
422
422
  }
423
423
  );
424
- }, xt = () => {
425
- const { editor: t } = m(), n = g({
424
+ }, Lt = () => {
425
+ const { editor: t } = m(), n = f({
426
426
  editor: t,
427
427
  selector: (r) => {
428
- var u, w;
428
+ var u, p;
429
429
  return {
430
430
  isLink: (u = r.editor) == null ? void 0 : u.isActive("link"),
431
- linkAttrs: (w = r.editor) == null ? void 0 : w.getAttributes("link")
431
+ linkAttrs: (p = r.editor) == null ? void 0 : p.getAttributes("link")
432
432
  };
433
433
  }
434
- }), [e, i] = C.useState(n.linkAttrs.href || ""), [s, l] = C.useState(n.linkAttrs.alt || ""), a = () => {
434
+ }), [e, i] = C.useState(n.linkAttrs.href || ""), [l, c] = C.useState(n.linkAttrs.alt || ""), a = () => {
435
435
  t.chain().focus().insertContent({
436
436
  type: "text",
437
- text: s || e,
437
+ text: l || e,
438
438
  marks: [{ type: "link", attrs: { href: e } }]
439
439
  }).run();
440
- }, c = () => {
441
- const { $from: r } = t.state.selection, u = r.parent.textContent, w = r.parentOffset;
442
- let v = w, f = w;
443
- for (; v > 0 && !/\s/.test(u[v - 1]); )
444
- v--;
445
- for (; f < u.length && !/\s/.test(u[f]); )
446
- f++;
447
- const b = r.start(), O = b + v, P = b + f, W = u.slice(v, f);
448
- t.commands.setTextSelection({ from: O, to: P }), i(n.linkAttrs.href || ""), l(W || n.linkAttrs.alt || "");
440
+ }, s = () => {
441
+ const { $from: r } = t.state.selection, u = r.parent.textContent, p = r.parentOffset;
442
+ let w = p, v = p;
443
+ for (; w > 0 && !/\s/.test(u[w - 1]); )
444
+ w--;
445
+ for (; v < u.length && !/\s/.test(u[v]); )
446
+ v++;
447
+ const N = r.start(), P = N + w, W = N + v, U = u.slice(w, v);
448
+ t.commands.setTextSelection({ from: P, to: W }), i(n.linkAttrs.href || ""), c(U || n.linkAttrs.alt || "");
449
449
  };
450
- return /* @__PURE__ */ p(
450
+ return /* @__PURE__ */ g(
451
451
  y,
452
452
  {
453
453
  Trigger: /* @__PURE__ */ o(
@@ -459,10 +459,10 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
459
459
  }
460
460
  ),
461
461
  maxWidth: "400px",
462
- onOpenChange: (r) => r && c(),
462
+ onOpenChange: (r) => r && s(),
463
463
  children: [
464
464
  /* @__PURE__ */ o(T, { style: { display: "none" } }),
465
- /* @__PURE__ */ p(S, { className: d.wuContentEditorModal, children: [
465
+ /* @__PURE__ */ g(S, { className: d.wuContentEditorModal, children: [
466
466
  /* @__PURE__ */ o(
467
467
  k,
468
468
  {
@@ -478,14 +478,14 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
478
478
  {
479
479
  Label: "Text to display",
480
480
  type: "text",
481
- value: s,
482
- onChange: (r) => l(r.target.value)
481
+ value: l,
482
+ onChange: (r) => c(r.target.value)
483
483
  }
484
484
  )
485
485
  ] }),
486
- /* @__PURE__ */ p(x, { children: [
486
+ /* @__PURE__ */ g(x, { children: [
487
487
  n.isLink && /* @__PURE__ */ o(
488
- A,
488
+ b,
489
489
  {
490
490
  color: "error",
491
491
  onClick: () => t.chain().focus().unsetLink().run(),
@@ -493,27 +493,27 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
493
493
  children: "Remove"
494
494
  }
495
495
  ),
496
- /* @__PURE__ */ o(A, { onClick: a, disabled: !e, children: "Save" })
496
+ /* @__PURE__ */ o(b, { onClick: a, disabled: !e, children: "Save" })
497
497
  ] })
498
498
  ]
499
499
  }
500
500
  );
501
- }, Lt = () => {
502
- const { editor: t } = m(), n = g({
501
+ }, Ft = () => {
502
+ const { editor: t } = m(), n = f({
503
503
  editor: t,
504
504
  selector: (r) => ({
505
505
  isTable: r.editor.isActive("table"),
506
506
  tableAttrs: r.editor.getAttributes("table")
507
507
  })
508
- }), [e, i] = E(!1), s = $(null), l = N(() => {
509
- s.current = setTimeout(() => {
508
+ }), [e, i] = E(!1), l = j(null), c = _(() => {
509
+ l.current = setTimeout(() => {
510
510
  t.chain().focus().insertTable({ rows: 2, cols: 4, withHeaderRow: e }).run();
511
511
  }, 100);
512
- }, [t, e]), a = N(() => {
513
- i((r) => !r), s.current = setTimeout(() => {
512
+ }, [t, e]), a = _(() => {
513
+ i((r) => !r), l.current = setTimeout(() => {
514
514
  t.chain().focus().toggleHeaderRow().run();
515
515
  }, 100);
516
- }, [t]), c = [
516
+ }, [t]), s = [
517
517
  {
518
518
  text: "Column left",
519
519
  icon: "wm-add",
@@ -545,7 +545,7 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
545
545
  event: () => t.chain().focus().deleteRow().run()
546
546
  }
547
547
  ];
548
- return n.isTable ? /* @__PURE__ */ p(
548
+ return n.isTable ? /* @__PURE__ */ g(
549
549
  y,
550
550
  {
551
551
  Trigger: /* @__PURE__ */ o(
@@ -559,9 +559,9 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
559
559
  maxWidth: "320px",
560
560
  children: [
561
561
  /* @__PURE__ */ o(T, { style: { display: "none" } }),
562
- /* @__PURE__ */ p(S, { className: d.wuContentEditorModal, children: [
562
+ /* @__PURE__ */ g(S, { className: d.wuContentEditorModal, children: [
563
563
  /* @__PURE__ */ o(
564
- rt,
564
+ st,
565
565
  {
566
566
  checked: e,
567
567
  onClick: a,
@@ -569,10 +569,10 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
569
569
  labelPosition: "left"
570
570
  }
571
571
  ),
572
- /* @__PURE__ */ o("div", { className: d.wuContentEditorTable, children: c.map(({ text: r, icon: u, event: w }) => /* @__PURE__ */ o(
573
- st,
572
+ /* @__PURE__ */ o("div", { className: d.wuContentEditorTable, children: s.map(({ text: r, icon: u, event: p }) => /* @__PURE__ */ o(
573
+ ct,
574
574
  {
575
- onClick: w,
575
+ onClick: p,
576
576
  variant: "secondary",
577
577
  Icon: /* @__PURE__ */ o(h, { icon: u }),
578
578
  children: r
@@ -581,7 +581,7 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
581
581
  )) })
582
582
  ] }),
583
583
  /* @__PURE__ */ o(x, { children: /* @__PURE__ */ o(
584
- A,
584
+ b,
585
585
  {
586
586
  onClick: () => t.chain().focus().deleteTable().run(),
587
587
  variant: "outline",
@@ -596,13 +596,13 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
596
596
  ) : /* @__PURE__ */ o(
597
597
  "button",
598
598
  {
599
- onClick: l,
599
+ onClick: c,
600
600
  className: d.wuContentEditorAction,
601
601
  children: /* @__PURE__ */ o(h, { icon: "wm-table" })
602
602
  }
603
603
  );
604
- }, Ft = () => {
605
- const { editor: t, customFonts: n } = m(), e = g({
604
+ }, Nt = () => {
605
+ const { editor: t, customFonts: n } = m(), e = f({
606
606
  editor: t,
607
607
  selector: (a) => ({
608
608
  currentFontFamily: a.editor.getAttributes("textStyle").fontFamily || ""
@@ -614,23 +614,23 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
614
614
  "JetBrains Mono",
615
615
  "Montserrat",
616
616
  ...n || []
617
- ], [s, l] = E(
617
+ ], [l, c] = E(
618
618
  e.currentFontFamily || i[0]
619
619
  );
620
620
  return C.useEffect(() => {
621
621
  var a;
622
- l(
622
+ c(
623
623
  ((a = e.currentFontFamily) == null ? void 0 : a.replace(/"/g, "")) || i[0]
624
624
  );
625
- }, [e.currentFontFamily]), /* @__PURE__ */ p(R, { children: [
625
+ }, [e.currentFontFamily]), /* @__PURE__ */ g(M, { children: [
626
626
  /* @__PURE__ */ o(
627
- M,
627
+ H,
628
628
  {
629
629
  className: d.wuContentEditorAction,
630
- "data-active": s !== "Fira Sans",
631
- style: { fontFamily: s },
632
- title: s || "Font Family",
633
- children: s == null ? void 0 : s[0]
630
+ "data-active": l !== "Fira Sans",
631
+ style: { fontFamily: l },
632
+ title: l || "Font Family",
633
+ children: l == null ? void 0 : l[0]
634
634
  }
635
635
  ),
636
636
  /* @__PURE__ */ o(
@@ -641,12 +641,12 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
641
641
  "data-block": !0,
642
642
  onCloseAutoFocus: (a) => a.preventDefault(),
643
643
  children: i.map((a) => /* @__PURE__ */ o(
644
- H,
644
+ B,
645
645
  {
646
646
  title: a,
647
647
  className: d.wuContentEditorDropdownItem,
648
648
  onSelect: () => {
649
- t.chain().focus().setFontFamily(a).run(), l(a);
649
+ t.chain().focus().setFontFamily(a).run(), c(a);
650
650
  },
651
651
  children: a
652
652
  },
@@ -655,8 +655,8 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
655
655
  }
656
656
  )
657
657
  ] });
658
- }, Nt = () => {
659
- const { editor: t } = m(), n = g({
658
+ }, Dt = () => {
659
+ const { editor: t } = m(), n = f({
660
660
  editor: t,
661
661
  selector: (e) => {
662
662
  var i;
@@ -677,16 +677,16 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
677
677
  children: /* @__PURE__ */ o(h, { icon: "wm-format-italic" })
678
678
  }
679
679
  );
680
- }, Dt = () => {
681
- const { editor: t } = m(), n = g({
680
+ }, _t = () => {
681
+ const { editor: t } = m(), n = f({
682
682
  editor: t,
683
683
  selector: (i) => {
684
- var s, l, a, c, r, u;
684
+ var l, c, a, s, r, u;
685
685
  return {
686
- isUl: (s = i.editor) == null ? void 0 : s.isActive("bulletList"),
687
- isOl: (l = i.editor) == null ? void 0 : l.isActive("orderedList"),
686
+ isUl: (l = i.editor) == null ? void 0 : l.isActive("bulletList"),
687
+ isOl: (c = i.editor) == null ? void 0 : c.isActive("orderedList"),
688
688
  isTodo: (a = i.editor) == null ? void 0 : a.isActive("taskList"),
689
- isList: ((c = i.editor) == null ? void 0 : c.isActive("bulletList")) || ((r = i.editor) == null ? void 0 : r.isActive("orderedList")) || ((u = i.editor) == null ? void 0 : u.isActive("taskList"))
689
+ isList: ((s = i.editor) == null ? void 0 : s.isActive("bulletList")) || ((r = i.editor) == null ? void 0 : r.isActive("orderedList")) || ((u = i.editor) == null ? void 0 : u.isActive("taskList"))
690
690
  };
691
691
  }
692
692
  }), e = [
@@ -723,30 +723,30 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
723
723
  }
724
724
  }
725
725
  );
726
- }, It = ["e", "E", "+", "-"], D = 1, _t = () => {
727
- const { editor: t } = m(), [n, e] = E(16), i = g({
726
+ }, It = ["e", "E", "+", "-"], I = 1, Rt = () => {
727
+ const { editor: t } = m(), [n, e] = E(16), i = f({
728
728
  editor: t,
729
- selector: (c) => ({
730
- fontSize: c.editor.getAttributes("textStyle").fontSize
729
+ selector: (s) => ({
730
+ fontSize: s.editor.getAttributes("textStyle").fontSize
731
731
  })
732
- }), s = (c) => {
733
- t.chain().focus().setFontSize(c + "px").run();
734
- }, l = (c) => {
735
- const r = Math.max(D, c);
736
- e(r), s(r);
737
- }, a = (c) => {
738
- It.includes(c.key) ? c.preventDefault() : c.key === "Enter" && s(n);
732
+ }), l = (s) => {
733
+ t.chain().focus().setFontSize(s + "px").run();
734
+ }, c = (s) => {
735
+ const r = Math.max(I, s);
736
+ e(r), l(r);
737
+ }, a = (s) => {
738
+ It.includes(s.key) ? s.preventDefault() : s.key === "Enter" && l(n);
739
739
  };
740
740
  return C.useEffect(() => {
741
- var c;
742
- e(Number((c = i.fontSize) == null ? void 0 : c.replace("px", "")) || 16);
743
- }, [i.fontSize]), /* @__PURE__ */ p("div", { className: d.wuContentEditorFontSize, children: [
741
+ var s;
742
+ e(Number((s = i.fontSize) == null ? void 0 : s.replace("px", "")) || 16);
743
+ }, [i.fontSize]), /* @__PURE__ */ g("div", { className: d.wuContentEditorFontSize, children: [
744
744
  /* @__PURE__ */ o(
745
745
  "button",
746
746
  {
747
747
  className: d.wuContentEditorAction,
748
- onClick: () => l(n - 1),
749
- disabled: n <= D,
748
+ onClick: () => c(n - 1),
749
+ disabled: n <= I,
750
750
  children: "−"
751
751
  }
752
752
  ),
@@ -758,22 +758,22 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
758
758
  pattern: "[0-9]*",
759
759
  value: n,
760
760
  onKeyDown: a,
761
- onChange: (c) => e(c.target.valueAsNumber),
762
- onBlur: () => s(n)
761
+ onChange: (s) => e(s.target.valueAsNumber),
762
+ onBlur: () => l(n)
763
763
  }
764
764
  ),
765
765
  /* @__PURE__ */ o(
766
766
  "button",
767
767
  {
768
768
  className: d.wuContentEditorAction,
769
- onClick: () => l(n + 1),
769
+ onClick: () => c(n + 1),
770
770
  disabled: n >= 128,
771
771
  children: "+"
772
772
  }
773
773
  )
774
774
  ] });
775
- }, Rt = () => {
776
- const { editor: t } = m(), n = g({
775
+ }, Mt = () => {
776
+ const { editor: t } = m(), n = f({
777
777
  editor: t,
778
778
  selector: (e) => {
779
779
  var i;
@@ -794,8 +794,8 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
794
794
  children: /* @__PURE__ */ o(h, { icon: "wm-format-strikethrough" })
795
795
  }
796
796
  );
797
- }, Mt = () => {
798
- const { editor: t } = m(), n = g({
797
+ }, Ht = () => {
798
+ const { editor: t } = m(), n = f({
799
799
  editor: t,
800
800
  selector: (e) => {
801
801
  var i;
@@ -817,7 +817,7 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
817
817
  }
818
818
  );
819
819
  }, zt = () => {
820
- const { editor: t } = m(), n = g({
820
+ const { editor: t } = m(), n = f({
821
821
  editor: t,
822
822
  selector: (e) => {
823
823
  var i;
@@ -838,14 +838,14 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
838
838
  children: /* @__PURE__ */ o(h, { icon: "wm-superscript" })
839
839
  }
840
840
  );
841
- }, Ht = () => {
842
- const { editor: t } = m(), n = g({
841
+ }, Bt = () => {
842
+ const { editor: t } = m(), n = f({
843
843
  editor: t,
844
844
  selector: ({ editor: e }) => ({
845
845
  textColor: e.getAttributes("textStyle").color
846
846
  })
847
847
  });
848
- return /* @__PURE__ */ p(
848
+ return /* @__PURE__ */ g(
849
849
  "label",
850
850
  {
851
851
  className: d.wuContentEditorAction,
@@ -873,8 +873,8 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
873
873
  ]
874
874
  }
875
875
  );
876
- }, Bt = () => {
877
- const { editor: t } = m(), n = g({
876
+ }, Ot = () => {
877
+ const { editor: t } = m(), n = f({
878
878
  editor: t,
879
879
  selector: (e) => {
880
880
  var i;
@@ -895,26 +895,26 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
895
895
  children: /* @__PURE__ */ o(h, { icon: "wm-format-underlined" })
896
896
  }
897
897
  );
898
- }, Ot = {
899
- block: /* @__PURE__ */ o(At, {}),
900
- fontFamily: /* @__PURE__ */ o(Ft, {}),
901
- fontSize: /* @__PURE__ */ o(_t, {}),
902
- bold: /* @__PURE__ */ o(Et, {}),
903
- italic: /* @__PURE__ */ o(Nt, {}),
904
- underline: /* @__PURE__ */ o(Bt, {}),
905
- strike: /* @__PURE__ */ o(Rt, {}),
906
- color: /* @__PURE__ */ o(Ht, {}),
907
- bgColor: /* @__PURE__ */ o(bt, {}),
908
- list: /* @__PURE__ */ o(Dt, {}),
909
- alignment: /* @__PURE__ */ o(vt, {}),
910
- image: /* @__PURE__ */ o(St, {}),
911
- link: /* @__PURE__ */ o(xt, {}),
912
- table: /* @__PURE__ */ o(Lt, {}),
913
- blockquote: /* @__PURE__ */ o(kt, {}),
898
+ }, Pt = {
899
+ block: /* @__PURE__ */ o(kt, {}),
900
+ fontFamily: /* @__PURE__ */ o(Nt, {}),
901
+ fontSize: /* @__PURE__ */ o(Rt, {}),
902
+ bold: /* @__PURE__ */ o(yt, {}),
903
+ italic: /* @__PURE__ */ o(Dt, {}),
904
+ underline: /* @__PURE__ */ o(Ot, {}),
905
+ strike: /* @__PURE__ */ o(Mt, {}),
906
+ color: /* @__PURE__ */ o(Bt, {}),
907
+ bgColor: /* @__PURE__ */ o(At, {}),
908
+ list: /* @__PURE__ */ o(_t, {}),
909
+ alignment: /* @__PURE__ */ o(bt, {}),
910
+ image: /* @__PURE__ */ o(xt, {}),
911
+ link: /* @__PURE__ */ o(Lt, {}),
912
+ table: /* @__PURE__ */ o(Ft, {}),
913
+ blockquote: /* @__PURE__ */ o(Et, {}),
914
914
  superscript: /* @__PURE__ */ o(zt, {}),
915
- subscript: /* @__PURE__ */ o(Mt, {}),
916
- codeline: /* @__PURE__ */ o(Tt, {}),
917
- clear: /* @__PURE__ */ o(yt, {}),
915
+ subscript: /* @__PURE__ */ o(Ht, {}),
916
+ codeline: /* @__PURE__ */ o(St, {}),
917
+ clear: /* @__PURE__ */ o(Tt, {}),
918
918
  // eslint-disable-next-line @typescript-eslint/naming-convention
919
919
  "|": /* @__PURE__ */ o(
920
920
  "div",
@@ -926,7 +926,7 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
926
926
  }
927
927
  }
928
928
  )
929
- }, Pt = [
929
+ }, Wt = [
930
930
  "block",
931
931
  "fontFamily",
932
932
  "|",
@@ -953,22 +953,28 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
953
953
  "codeline",
954
954
  "|",
955
955
  "clear"
956
- ], Wt = (t) => {
957
- const { editor: n, customFonts: e, children: i, items: s = Pt, ...l } = t;
958
- return /* @__PURE__ */ o("div", { ...l, children: /* @__PURE__ */ p(Ct, { editor: n, customFonts: e, children: [
959
- s.map((a, c) => /* @__PURE__ */ o(_, { children: Ot[a] }, a + c)),
956
+ ], Ut = (t) => {
957
+ const { editor: n, customFonts: e, children: i, items: l = Wt, ...c } = t;
958
+ return /* @__PURE__ */ o("div", { ...c, children: /* @__PURE__ */ g(vt, { editor: n, customFonts: e, children: [
959
+ l.map((a, s) => /* @__PURE__ */ o(R, { children: Pt[a] }, a + s)),
960
960
  i
961
961
  ] }) });
962
- }, Ut = {
963
- allowedTags: [
962
+ }, F = lt();
963
+ F.setConfig({
964
+ USE_PROFILES: { html: !0 },
965
+ ALLOWED_TAGS: [
966
+ "div",
964
967
  "p",
965
968
  "br",
966
969
  "strong",
970
+ "b",
967
971
  "em",
972
+ "i",
968
973
  "u",
969
974
  "s",
970
975
  "code",
971
976
  "pre",
977
+ "blockquote",
972
978
  "h1",
973
979
  "h2",
974
980
  "h3",
@@ -978,7 +984,6 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
978
984
  "ul",
979
985
  "ol",
980
986
  "li",
981
- "blockquote",
982
987
  "a",
983
988
  "img",
984
989
  "table",
@@ -988,97 +993,90 @@ const lt = "_wuContentEditor_399u0_8", at = "_wuContentEditorTable_399u0_1", dt
988
993
  "th",
989
994
  "td",
990
995
  "sup",
991
- "sub",
992
- "span",
993
- "div"
996
+ "sub"
994
997
  ],
995
- allowedAttributes: {
996
- a: ["href", "title", "target"],
997
- img: ["src", "alt", "title", "width", "height"],
998
- span: ["style"],
999
- td: ["colspan", "rowspan"],
1000
- th: ["colspan", "rowspan"]
1001
- },
1002
- allowedSchemes: ["http", "https", "mailto"]
1003
- }, I = (t, n) => {
1004
- var s;
1005
- if (!t) return "";
1006
- const e = { ...Ut, ...n }, i = Object.keys(e.allowedAttributes || {}).reduce(
1007
- (l, a) => {
1008
- var r;
1009
- const c = ((r = e.allowedAttributes) == null ? void 0 : r[a]) || [];
1010
- return [...l, ...c];
1011
- },
1012
- []
1013
- );
1014
- return ct.sanitize(t, {
1015
- ALLOWED_TAGS: e.allowedTags,
1016
- ALLOWED_ATTR: [...new Set(i)],
1017
- ALLOWED_URI_REGEXP: new RegExp(
1018
- `^(${(s = e.allowedSchemes) == null ? void 0 : s.join("|")}):`,
1019
- "i"
1020
- )
1021
- });
1022
- };
998
+ ALLOWED_ATTR: [
999
+ "href",
1000
+ "target",
1001
+ "rel",
1002
+ "src",
1003
+ "alt",
1004
+ "title",
1005
+ "width",
1006
+ "height",
1007
+ "colspan",
1008
+ "rowspan",
1009
+ "data-*",
1010
+ "style",
1011
+ "class"
1012
+ ],
1013
+ ALLOW_DATA_ATTR: !0
1014
+ });
1015
+ F.addHook("uponSanitizeAttribute", (t, n) => {
1016
+ if (n.attrName === "style") {
1017
+ const e = n.attrValue.toLowerCase();
1018
+ (e.includes("expression") || e.includes("javascript:") || e.includes("url(")) && (n.keepAttr = !1);
1019
+ }
1020
+ });
1021
+ function A(t) {
1022
+ return t ? F.sanitize(t) : "";
1023
+ }
1023
1024
  function ie({
1024
1025
  defaultValue: t,
1025
1026
  onUpdate: n,
1026
1027
  className: e,
1027
- readonly: i,
1028
- toolbarPosition: s = "top",
1028
+ toolbarPosition: i = "top",
1029
1029
  customToolbarChildren: l,
1030
- toolbarItems: a,
1031
- hideToolbar: c,
1032
- renderHtml: r,
1033
- customFonts: u,
1034
- ...w
1030
+ toolbarItems: c,
1031
+ hideToolbar: a,
1032
+ readonly: s,
1033
+ customFonts: r,
1034
+ renderDefaultOnly: u,
1035
+ ...p
1035
1036
  }) {
1036
- const v = C.useMemo(() => t ? I(t) : "", [t]), f = U({
1037
- editable: !i,
1038
- extensions: wt,
1039
- content: v,
1040
- onUpdate: ({ editor: b }) => {
1041
- n && n(b.getHTML());
1037
+ const w = q({
1038
+ extensions: Ct,
1039
+ content: A(t || ""),
1040
+ onUpdate: ({ editor: v }) => {
1041
+ n && n(A(v.getHTML()));
1042
1042
  }
1043
1043
  });
1044
- if (i && r) {
1045
- const b = f ? I(f.getHTML()) : v;
1046
- return /* @__PURE__ */ o(
1047
- "div",
1048
- {
1049
- "data-slot": "wu-content-editor-render-html",
1050
- className: F(d.wuContentEditorContainer, e),
1051
- dangerouslySetInnerHTML: { __html: b }
1052
- }
1053
- );
1054
- }
1055
- return /* @__PURE__ */ p(
1044
+ return s ? (console.log(w.getHTML()), /* @__PURE__ */ o(
1045
+ "div",
1046
+ {
1047
+ className: D(d.wuContentEditor, e),
1048
+ dangerouslySetInnerHTML: {
1049
+ __html: A(u ? t || "" : w.getHTML())
1050
+ },
1051
+ ...p
1052
+ }
1053
+ )) : /* @__PURE__ */ g(
1056
1054
  "div",
1057
1055
  {
1058
- className: F(d.wuContentEditorContainer, e),
1059
- "data-position": s,
1056
+ className: D(d.wuContentEditorContainer, e),
1057
+ "data-position": i,
1060
1058
  "data-slot": "wu-content-editor-container",
1061
1059
  onClick: () => {
1062
- f == null || f.chain().focus().run();
1060
+ w == null || w.chain().focus().run();
1063
1061
  },
1064
- ...w,
1062
+ ...p,
1065
1063
  children: [
1066
- !c && /* @__PURE__ */ o(
1067
- Wt,
1064
+ !a && /* @__PURE__ */ o(
1065
+ Ut,
1068
1066
  {
1069
- editor: f,
1070
- customFonts: u,
1067
+ editor: w,
1068
+ customFonts: r,
1071
1069
  className: d.wuContentEditorToolbar,
1072
- items: a,
1070
+ items: c,
1073
1071
  "data-slot": "wu-content-editor-toolbar",
1074
- "data-position": s,
1072
+ "data-position": i,
1075
1073
  children: l
1076
1074
  }
1077
1075
  ),
1078
1076
  /* @__PURE__ */ o(
1079
- q,
1077
+ $,
1080
1078
  {
1081
- editor: f,
1079
+ editor: w,
1082
1080
  className: d.wuContentEditor,
1083
1081
  "data-slot": "wu-content-editor"
1084
1082
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm-questionpro/wick-ui-editor",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
4
4
  "description": "Wick Editor is a powerful and intuitive content editing component built with React. It provides a rich set of features for creating and managing content, making it ideal for applications that require dynamic and interactive content creation.",
5
5
  "keywords": [
6
6
  "react",
@@ -59,8 +59,8 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@eslint/js": "^9.39.1",
62
- "@npm-questionpro/wick-ui-icon": "^8.0.2",
63
- "@npm-questionpro/wick-ui-lib": "^1.29.3",
62
+ "@npm-questionpro/wick-ui-icon": "latest",
63
+ "@npm-questionpro/wick-ui-lib": "latest",
64
64
  "@radix-ui/react-dropdown-menu": "^2.1.16",
65
65
  "clsx": "^2.1.1",
66
66
  "@storybook/addon-a11y": "10.1.5",