@npm-questionpro/wick-ui-editor 0.14.3 → 2.0.0-next.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.
package/dist/index.d.ts
CHANGED
|
@@ -1,45 +1 @@
|
|
|
1
|
-
import { default as default_2 } from 'react';
|
|
2
|
-
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
declare type IToolbarExtensionKey = keyof typeof TOOLBAR_EXTENSIONS;
|
|
5
|
-
|
|
6
|
-
export declare interface IWuContentEditorProps extends default_2.HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
defaultValue?: string;
|
|
8
|
-
onUpdate?: (content: string) => void;
|
|
9
|
-
customFonts?: string[];
|
|
10
|
-
toolbarPosition?: 'top' | 'bottom';
|
|
11
|
-
customToolbarChildren?: default_2.ReactNode;
|
|
12
|
-
toolbarItems?: IToolbarExtensionKey[];
|
|
13
|
-
hideToolbar?: boolean;
|
|
14
|
-
readonly?: boolean;
|
|
15
|
-
isHtml?: boolean;
|
|
16
|
-
setIsHtml?: (isHtml: boolean) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare const TOOLBAR_EXTENSIONS: {
|
|
20
|
-
block: JSX_2.Element;
|
|
21
|
-
fontFamily: JSX_2.Element;
|
|
22
|
-
fontSize: JSX_2.Element;
|
|
23
|
-
bold: JSX_2.Element;
|
|
24
|
-
italic: JSX_2.Element;
|
|
25
|
-
underline: JSX_2.Element;
|
|
26
|
-
strike: JSX_2.Element;
|
|
27
|
-
color: JSX_2.Element;
|
|
28
|
-
bgColor: JSX_2.Element;
|
|
29
|
-
list: JSX_2.Element;
|
|
30
|
-
alignment: JSX_2.Element;
|
|
31
|
-
image: JSX_2.Element;
|
|
32
|
-
link: JSX_2.Element;
|
|
33
|
-
table: JSX_2.Element;
|
|
34
|
-
blockquote: JSX_2.Element;
|
|
35
|
-
superscript: JSX_2.Element;
|
|
36
|
-
subscript: JSX_2.Element;
|
|
37
|
-
codeline: JSX_2.Element;
|
|
38
|
-
clear: JSX_2.Element;
|
|
39
|
-
'|': JSX_2.Element;
|
|
40
|
-
html: JSX_2.Element;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export declare function WuContentEditor({ defaultValue, onUpdate, className, toolbarPosition, customToolbarChildren, toolbarItems, hideToolbar, readonly, customFonts, isHtml: isHtmlProp, setIsHtml: setIsHtmlProp, ...props }: IWuContentEditorProps): default_2.JSX.Element;
|
|
44
|
-
|
|
45
1
|
export { }
|
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@import "https://fonts.googleapis.com/css2?family=Fira+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap";.
|
|
1
|
+
@import "https://fonts.googleapis.com/css2?family=Fira+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap";._wuContentEditor_cl3h6_7 img{margin:0;display:inline-block}._wuContentEditor_cl3h6_7 [data-resize-handle]{z-index:9;background:#00000080;border:1px solid #fffc;border-radius:2px;position:absolute}._wuContentEditor_cl3h6_7 [data-resize-handle]:hover{background:#000c}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=bottom-left],._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=bottom-right],._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=top-left],._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=top-right]{width:8px;height:8px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=top-left]{cursor:nwse-resize;top:0;left:-4px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=top-right]{cursor:nesw-resize;top:-4px;right:-4px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=bottom-left]{cursor:nesw-resize;bottom:-4px;left:-4px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=bottom-right]{cursor:nwse-resize;bottom:-4px;right:-4px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=bottom],._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=top]{height:6px;left:8px;right:8px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=top]{cursor:ns-resize;top:-3px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=bottom]{cursor:ns-resize;bottom:-3px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=left],._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=right]{width:6px;top:8px;bottom:8px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=left]{cursor:ew-resize;left:-3px}._wuContentEditor_cl3h6_7 [data-resize-handle][data-resize-handle=right]{cursor:ew-resize;right:-3px}:scope [data-resize-state=true] [data-resize-wrapper]{border-radius:.125rem;outline:1px solid #00000040}[data-resize-wrapper]{display:inline-block!important}._wuContentEditorTable_cl3h6_1{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 12px;display:grid}._wuContentEditorTable_cl3h6_1 button{justify-content:flex-start;align-items:center;font-size:12px;display:flex}._wuContentEditor_cl3h6_7 table{border-collapse:collapse;table-layout:fixed;width:100%;margin:0;overflow:hidden}._wuContentEditor_cl3h6_7 table td,._wuContentEditor_cl3h6_7 table th{box-sizing:border-box;vertical-align:top;border:1px solid #e6e6e6;min-width:1em;padding:6px 8px;position:relative}:is(._wuContentEditor_cl3h6_7 table td,._wuContentEditor_cl3h6_7 table th)>*{margin-bottom:0}._wuContentEditor_cl3h6_7 table th{text-align:left;background-color:#f5f5f5;font-weight:700}._wuContentEditor_cl3h6_7 table ._selectedCell_cl3h6_1:after{content:"";pointer-events:none;z-index:2;background:green;position:absolute;inset:0}._wuContentEditor_cl3h6_7 table ._column-resize-handle_cl3h6_1{pointer-events:none;background-color:#00f;width:4px;position:absolute;top:0;bottom:-2px;right:-2px}._wuContentEditor_cl3h6_7 ._tableWrapper_cl3h6_1{scrollbar-color:rgb(var(--wu-gray-20)) transparent;scrollbar-width:thin;margin:1.5rem 0;overflow-x:auto}._wuContentEditor_cl3h6_7 ._tableWrapper_cl3h6_1::-webkit-scrollbar{width:6px;height:6px}._wuContentEditor_cl3h6_7 ._tableWrapper_cl3h6_1::-webkit-scrollbar-track{background:0 0}._wuContentEditor_cl3h6_7 ._tableWrapper_cl3h6_1::-webkit-scrollbar-thumb{background-color:rgb(var(--wu-gray-20));border-radius:4px}._wuContentEditor_cl3h6_7 ._tableWrapper_cl3h6_1::-webkit-scrollbar-corner{background:0 0}._wuContentEditor_cl3h6_7 ._resize-cursor_cl3h6_1{cursor:ew-resize;cursor:col-resize}._wuContentEditor_cl3h6_7 ol,._wuContentEditor_cl3h6_7 ul{all:unset;box-sizing:border-box;display:revert}._wuContentEditor_cl3h6_7 ul{list-style-type:disc}._wuContentEditor_cl3h6_7 ol,._wuContentEditor_cl3h6_7 ul{padding-left:2rem}._wuContentEditor_cl3h6_7 ol{list-style-type:decimal}._wuContentEditor_cl3h6_7 ul[data-type=taskList]{padding-left:1rem;list-style-type:none}._wuContentEditor_cl3h6_7 ul[data-type=taskList] li{justify-content:flex-start;align-items:center;gap:8px;display:flex}._wuContentEditor_cl3h6_7 ul[data-type=taskList] li label{position:relative;top:2px}._wuContentEditor_cl3h6_7 h1{font-size:2rem;line-height:40px}._wuContentEditor_cl3h6_7 h1,._wuContentEditor_cl3h6_7 h2{font-weight:400}._wuContentEditor_cl3h6_7 h2{font-size:1.5rem}._wuContentEditor_cl3h6_7 h2,._wuContentEditor_cl3h6_7 h3{line-height:32px}._wuContentEditor_cl3h6_7 h3{font-size:1.25rem}._wuContentEditor_cl3h6_7 h3,._wuContentEditor_cl3h6_7 h4{font-weight:500}._wuContentEditor_cl3h6_7 h4{font-size:1.125rem;line-height:24px}._wuContentEditorContainer_cl3h6_7{--blue-p:rgb(var(--wu-blue-p));--blue-q:rgb(var(--wu-blue-q));--gray-20:rgb(var(--wu-gray-20));--gray-10:#ddd;border:1px solid var(--gray-10);scrollbar-color:var(--gray-20) transparent;scrollbar-width:thin;background-color:#fff;border-radius:8px;flex-direction:column;min-height:160px;line-height:1.5;display:flex;position:relative;overflow:auto}._wuContentEditorContainer_cl3h6_7[data-position=bottom]{flex-direction:column-reverse}._wuContentEditorContainer_cl3h6_7::-webkit-scrollbar{width:6px;height:6px}._wuContentEditorContainer_cl3h6_7::-webkit-scrollbar-track{background:0 0}._wuContentEditorContainer_cl3h6_7::-webkit-scrollbar-thumb{background-color:var(--gray-20);border-radius:4px}._wuContentEditorContainer_cl3h6_7::-webkit-scrollbar-corner{background:0 0}._wuContentEditorContainer_cl3h6_7 :focus{outline:none}._wuContentEditorContainer_cl3h6_7 a{color:var(--blue-p);font-weight:400;text-decoration:underline}._wuContentEditorContainer_cl3h6_7 blockquote{background-color:rgb(var(--wu-blue-p)/10%);border-left:4px solid rgb(var(--wu-blue-p)/50%);border-radius:0 8px 8px 0;margin:1.5rem 0;padding:1rem;font-style:italic}._wuContentEditorContainer_cl3h6_7 code{background-color:var(--gray-20);color:var(--blue-q);border-radius:2px;padding:4px;font-family:JetBrains Mono,monospace;font-size:.75em}._wuContentEditorContainer_cl3h6_7 code:after,._wuContentEditorContainer_cl3h6_7 code:before{content:""}._wuContentEditorToolbar_cl3h6_82{border-color:var(--gray-10);z-index:10;background-color:#fff;justify-content:start;align-items:center;gap:.25rem;padding:.5rem;display:flex;position:sticky}._wuContentEditorToolbar_cl3h6_82[data-position=top]{border-width:0 0 1px;top:0}._wuContentEditorToolbar_cl3h6_82[data-position=bottom]{border-width:1px 0 0;bottom:0}._wuContentEditor_cl3h6_7{flex-grow:1;padding:1rem;overflow:auto}._wuContentEditorAction_cl3h6_110{cursor:pointer;border-radius:.25rem;justify-content:center;align-items:center;width:1.5rem;height:1.5rem;font-size:1.125rem;line-height:1.75rem;display:flex}._wuContentEditorAction_cl3h6_110:hover{background-color:rgb(var(--wu-blue-p)/15%)}._wuContentEditorAction_cl3h6_110[data-active=true]{background-color:rgb(var(--wu-blue-p)/5%);color:rgb(var(--wu-blue-p))}._wuContentEditorAction_cl3h6_110 input{width:0;height:0}._wuContentEditorDropdown_cl3h6_136{border:1px solid rgb(var(--wu-blue-p));background-color:#fff;border-radius:.25rem;display:flex}._wuContentEditorDropdown_cl3h6_136[data-inline]{gap:.25rem;padding:.25rem}._wuContentEditorDropdown_cl3h6_136[data-block]{flex-direction:column}._wuContentEditorDropdown_cl3h6_136[data-block] ._wuContentEditorDropdownItem_cl3h6_150{cursor:pointer;padding:.25rem .5rem;font-size:12px}._wuContentEditorDropdown_cl3h6_136[data-block] ._wuContentEditorDropdownItem_cl3h6_150:hover{background-color:rgb(var(--wu-blue-p)/5%)}._wuContentEditorFontSize_cl3h6_162{gap:.25rem;display:flex}._wuContentEditorFontSize_cl3h6_162 input{text-align:center;border-style:solid;border-width:1px;border-radius:.25rem;width:2.5rem;height:1.5rem}._wuContentEditorModal_cl3h6_176{border-radius:12px 12px 0 0}._wuCodeEditor_cl3h6_180{--font-size:12px;--line-height:24px;--font-family:"JetBrains Mono",monospace;width:100%;min-width:fit-content;position:relative;overflow:auto}._wuCodeEditor_cl3h6_180 ._wuFormatCode_cl3h6_190{opacity:.5;z-index:10;padding:0;font-size:1rem;position:absolute;top:0;right:0}._wuCodeEditor_cl3h6_180 ._wuFormatCode_cl3h6_190:hover{opacity:1}._wuCodeEditorPreview_cl3h6_205{pointer-events:none;-webkit-user-select:none;user-select:none}._wuCodeEditorPreview_cl3h6_205 pre code{font-size:var(--font-size);line-height:var(--line-height);background:0 0;padding:0}._wuCodeEditorPreview_cl3h6_205 pre code span{font-family:var(--font-family)!important}._wuCodeEditorInput_cl3h6_222{caret-color:#000;color:#0000;font-family:var(--font-family);font-size:var(--font-size);line-height:var(--line-height);resize:none;white-space:pre;background:0 0;border:none;outline:none;position:absolute;inset:0;overflow:hidden}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -7,25 +7,25 @@ import et from "@tiptap/extension-subscript";
|
|
|
7
7
|
import ot from "@tiptap/extension-superscript";
|
|
8
8
|
import { TableKit as nt } from "@tiptap/extension-table";
|
|
9
9
|
import it from "@tiptap/extension-text-align";
|
|
10
|
-
import { BackgroundColor as rt, Color as
|
|
10
|
+
import { BackgroundColor as rt, Color as lt, FontFamily as at, FontSize as st, LineHeight as ct, TextStyle as ut } from "@tiptap/extension-text-style";
|
|
11
11
|
import dt from "@tiptap/starter-kit";
|
|
12
12
|
import { Fragment as x, jsx as e, jsxs as v } from "react/jsx-runtime";
|
|
13
|
-
import { WuButton as q, WuIcon as h, WuInput as F, WuModal as H, WuModalClose as _, WuModalContent as
|
|
13
|
+
import { WuButton as q, WuIcon as h, WuInput as F, WuModal as H, WuModalClose as _, WuModalContent as D, WuModalFooter as R, WuModalHeader as z, WuToggle as mt } from "@npm-questionpro/wick-ui-lib";
|
|
14
14
|
import { DropdownMenu as U, DropdownMenuContent as j, DropdownMenuItem as $, DropdownMenuTrigger as K } from "@radix-ui/react-dropdown-menu";
|
|
15
15
|
import ht from "dompurify";
|
|
16
|
-
var pt = "
|
|
16
|
+
var pt = "_wuContentEditor_cl3h6_7", ft = "_wuContentEditorTable_cl3h6_1", gt = "_selectedCell_cl3h6_1", vt = "_tableWrapper_cl3h6_1", wt = "_wuContentEditorContainer_cl3h6_7", Ct = "_wuContentEditorToolbar_cl3h6_82", bt = "_wuContentEditorAction_cl3h6_110", At = "_wuContentEditorDropdown_cl3h6_136", yt = "_wuContentEditorDropdownItem_cl3h6_150", kt = "_wuContentEditorFontSize_cl3h6_162", Et = "_wuContentEditorModal_cl3h6_176", Tt = "_wuCodeEditor_cl3h6_180", St = "_wuFormatCode_cl3h6_190", _t = "_wuCodeEditorPreview_cl3h6_205", xt = "_wuCodeEditorInput_cl3h6_222", a = {
|
|
17
17
|
wuContentEditor: pt,
|
|
18
18
|
wuContentEditorTable: ft,
|
|
19
19
|
selectedCell: gt,
|
|
20
|
-
"column-resize-handle": "_column-resize-
|
|
20
|
+
"column-resize-handle": "_column-resize-handle_cl3h6_1",
|
|
21
21
|
tableWrapper: vt,
|
|
22
|
-
"resize-cursor": "_resize-
|
|
23
|
-
wuContentEditorContainer:
|
|
24
|
-
wuContentEditorToolbar:
|
|
25
|
-
wuContentEditorAction:
|
|
22
|
+
"resize-cursor": "_resize-cursor_cl3h6_1",
|
|
23
|
+
wuContentEditorContainer: wt,
|
|
24
|
+
wuContentEditorToolbar: Ct,
|
|
25
|
+
wuContentEditorAction: bt,
|
|
26
26
|
wuContentEditorDropdown: At,
|
|
27
|
-
wuContentEditorDropdownItem:
|
|
28
|
-
wuContentEditorFontSize:
|
|
27
|
+
wuContentEditorDropdownItem: yt,
|
|
28
|
+
wuContentEditorFontSize: kt,
|
|
29
29
|
wuContentEditorModal: Et,
|
|
30
30
|
wuCodeEditor: Tt,
|
|
31
31
|
wuFormatCode: St,
|
|
@@ -46,7 +46,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
46
46
|
"file",
|
|
47
47
|
"mailto"
|
|
48
48
|
], r = n.protocol.replace(":", "");
|
|
49
|
-
if (i.includes(r) || !o.protocols.map((
|
|
49
|
+
if (i.includes(r) || !o.protocols.map((l) => typeof l == "string" ? l : l.scheme).includes(r)) return !1;
|
|
50
50
|
const u = ["example-phishing.com", "malicious-site.net"], c = n.hostname;
|
|
51
51
|
return !u.includes(c);
|
|
52
52
|
} catch {
|
|
@@ -66,13 +66,13 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
66
66
|
ot,
|
|
67
67
|
et,
|
|
68
68
|
ut,
|
|
69
|
-
|
|
69
|
+
lt,
|
|
70
70
|
rt,
|
|
71
71
|
tt,
|
|
72
72
|
Q,
|
|
73
73
|
ct,
|
|
74
|
-
lt,
|
|
75
74
|
st,
|
|
75
|
+
at,
|
|
76
76
|
Z.configure({
|
|
77
77
|
resize: {
|
|
78
78
|
enabled: !0,
|
|
@@ -98,13 +98,13 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
98
98
|
return m.useEffect(() => {
|
|
99
99
|
i(o || t.items.find((r) => r.active) || t.items[0]);
|
|
100
100
|
}, [t, o]), /* @__PURE__ */ v(U, { children: [/* @__PURE__ */ e(K, {
|
|
101
|
-
className:
|
|
101
|
+
className: a.wuContentEditorAction,
|
|
102
102
|
"data-active": t.active,
|
|
103
103
|
children: /* @__PURE__ */ e(h, { icon: n.icon })
|
|
104
104
|
}), /* @__PURE__ */ e(j, {
|
|
105
105
|
align: "start",
|
|
106
106
|
onCloseAutoFocus: (r) => r.preventDefault(),
|
|
107
|
-
className:
|
|
107
|
+
className: a.wuContentEditorDropdown,
|
|
108
108
|
"data-inline": !0,
|
|
109
109
|
children: t.items?.map((r) => /* @__PURE__ */ e($, {
|
|
110
110
|
onClick: () => {
|
|
@@ -113,7 +113,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
113
113
|
title: r.tooltip,
|
|
114
114
|
children: /* @__PURE__ */ e("button", {
|
|
115
115
|
type: "button",
|
|
116
|
-
className:
|
|
116
|
+
className: a.wuContentEditorAction,
|
|
117
117
|
"data-active": r.active,
|
|
118
118
|
children: /* @__PURE__ */ e(h, { icon: r.icon })
|
|
119
119
|
})
|
|
@@ -171,7 +171,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
171
171
|
selector: ({ editor: n }) => ({ bgColor: n.getAttributes("textStyle").backgroundColor })
|
|
172
172
|
});
|
|
173
173
|
return /* @__PURE__ */ v("label", {
|
|
174
|
-
className:
|
|
174
|
+
className: a.wuContentEditorAction,
|
|
175
175
|
htmlFor: "bg-color",
|
|
176
176
|
title: "Background Color",
|
|
177
177
|
children: [/* @__PURE__ */ e(h, {
|
|
@@ -237,7 +237,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
237
237
|
},
|
|
238
238
|
defaultValue: n.find((i) => i.active)
|
|
239
239
|
});
|
|
240
|
-
},
|
|
240
|
+
}, Dt = () => {
|
|
241
241
|
const { editor: t } = p(), o = f({
|
|
242
242
|
editor: t,
|
|
243
243
|
selector: (n) => ({ blockquote: n.editor?.isActive("blockquote") })
|
|
@@ -245,14 +245,14 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
245
245
|
return /* @__PURE__ */ e("button", {
|
|
246
246
|
type: "button",
|
|
247
247
|
title: "quote",
|
|
248
|
-
className:
|
|
248
|
+
className: a.wuContentEditorAction,
|
|
249
249
|
"data-active": o.blockquote,
|
|
250
250
|
onClick: (n) => {
|
|
251
251
|
n.preventDefault(), t.chain().focus().toggleBlockquote().run();
|
|
252
252
|
},
|
|
253
253
|
children: /* @__PURE__ */ e(h, { icon: "wm-format-quote" })
|
|
254
254
|
});
|
|
255
|
-
},
|
|
255
|
+
}, Rt = () => {
|
|
256
256
|
const { editor: t } = p(), o = f({
|
|
257
257
|
editor: t,
|
|
258
258
|
selector: (n) => ({ bold: n.editor?.isActive("bold") })
|
|
@@ -260,14 +260,14 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
260
260
|
return /* @__PURE__ */ e("button", {
|
|
261
261
|
type: "button",
|
|
262
262
|
title: "Bold",
|
|
263
|
-
className:
|
|
263
|
+
className: a.wuContentEditorAction,
|
|
264
264
|
"data-active": o.bold,
|
|
265
265
|
onClick: (n) => {
|
|
266
266
|
n.preventDefault(), t.chain().focus().toggleBold().run();
|
|
267
267
|
},
|
|
268
268
|
children: /* @__PURE__ */ e(h, { icon: "wm-format-bold" })
|
|
269
269
|
});
|
|
270
|
-
},
|
|
270
|
+
}, zt = () => {
|
|
271
271
|
const { editor: t } = p();
|
|
272
272
|
return /* @__PURE__ */ e(x, { children: [{
|
|
273
273
|
id: "clear",
|
|
@@ -277,7 +277,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
277
277
|
}].map((o) => /* @__PURE__ */ e("button", {
|
|
278
278
|
type: "button",
|
|
279
279
|
title: o.tooltip,
|
|
280
|
-
className:
|
|
280
|
+
className: a.wuContentEditorAction,
|
|
281
281
|
onClick: (n) => {
|
|
282
282
|
n.preventDefault(), o.event();
|
|
283
283
|
},
|
|
@@ -290,7 +290,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
290
290
|
});
|
|
291
291
|
return /* @__PURE__ */ e("button", {
|
|
292
292
|
type: "button",
|
|
293
|
-
className:
|
|
293
|
+
className: a.wuContentEditorAction,
|
|
294
294
|
"data-active": o.code,
|
|
295
295
|
title: "Code line",
|
|
296
296
|
onMouseDown: (n) => {
|
|
@@ -301,9 +301,9 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
301
301
|
}, Wt = () => {
|
|
302
302
|
const { editor: t } = p(), o = f({
|
|
303
303
|
editor: t,
|
|
304
|
-
selector: (
|
|
305
|
-
isImage:
|
|
306
|
-
imageAttrs:
|
|
304
|
+
selector: (l) => ({
|
|
305
|
+
isImage: l.editor?.isActive("image"),
|
|
306
|
+
imageAttrs: l.editor?.getAttributes("image")
|
|
307
307
|
})
|
|
308
308
|
}), [n, i] = m.useState(o.imageAttrs.src || ""), [r, u] = m.useState(o.imageAttrs.alt || ""), c = () => {
|
|
309
309
|
t.chain().focus().setImage({
|
|
@@ -314,29 +314,29 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
314
314
|
return /* @__PURE__ */ v(H, {
|
|
315
315
|
Trigger: /* @__PURE__ */ e("button", {
|
|
316
316
|
type: "button",
|
|
317
|
-
className:
|
|
317
|
+
className: a.wuContentEditorAction,
|
|
318
318
|
"data-active": o.isImage,
|
|
319
319
|
children: /* @__PURE__ */ e(h, { icon: "wm-image" })
|
|
320
320
|
}),
|
|
321
321
|
maxWidth: "400px",
|
|
322
322
|
children: [
|
|
323
|
-
/* @__PURE__ */ e(
|
|
324
|
-
/* @__PURE__ */ v(
|
|
325
|
-
className:
|
|
323
|
+
/* @__PURE__ */ e(z, { style: { display: "none" } }),
|
|
324
|
+
/* @__PURE__ */ v(D, {
|
|
325
|
+
className: a.wuContentEditorModal,
|
|
326
326
|
children: [/* @__PURE__ */ e(F, {
|
|
327
327
|
Label: "Image URL",
|
|
328
328
|
type: "url",
|
|
329
329
|
value: n,
|
|
330
|
-
onChange: (
|
|
330
|
+
onChange: (l) => i(l.target.value),
|
|
331
331
|
required: !0
|
|
332
332
|
}), /* @__PURE__ */ e(F, {
|
|
333
333
|
Label: "Alt Text",
|
|
334
334
|
type: "text",
|
|
335
335
|
value: r,
|
|
336
|
-
onChange: (
|
|
336
|
+
onChange: (l) => u(l.target.value)
|
|
337
337
|
})]
|
|
338
338
|
}),
|
|
339
|
-
/* @__PURE__ */ v(
|
|
339
|
+
/* @__PURE__ */ v(R, { children: [/* @__PURE__ */ e(_, {
|
|
340
340
|
variant: "secondary",
|
|
341
341
|
children: "Cancel"
|
|
342
342
|
}), /* @__PURE__ */ e(_, {
|
|
@@ -349,9 +349,9 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
349
349
|
}, Ot = () => {
|
|
350
350
|
const { editor: t } = p(), o = f({
|
|
351
351
|
editor: t,
|
|
352
|
-
selector: (
|
|
353
|
-
isLink:
|
|
354
|
-
linkAttrs:
|
|
352
|
+
selector: (s) => ({
|
|
353
|
+
isLink: s.editor?.isActive("link"),
|
|
354
|
+
linkAttrs: s.editor?.getAttributes("link")
|
|
355
355
|
})
|
|
356
356
|
}), [n, i] = m.useState(o.linkAttrs.href || ""), [r, u] = m.useState(o.linkAttrs.alt || ""), c = () => {
|
|
357
357
|
t.chain().focus().insertContent({
|
|
@@ -362,45 +362,45 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
362
362
|
attrs: { href: n }
|
|
363
363
|
}]
|
|
364
364
|
}).run();
|
|
365
|
-
},
|
|
366
|
-
const { $from:
|
|
367
|
-
let
|
|
368
|
-
for (;
|
|
369
|
-
for (;
|
|
370
|
-
const E =
|
|
365
|
+
}, l = () => {
|
|
366
|
+
const { $from: s } = t.state.selection, C = s.parent.textContent, k = s.parentOffset;
|
|
367
|
+
let b = k, w = k;
|
|
368
|
+
for (; b > 0 && !/\s/.test(C[b - 1]); ) b--;
|
|
369
|
+
for (; w < C.length && !/\s/.test(C[w]); ) w++;
|
|
370
|
+
const E = s.start(), A = E + b, y = E + w, g = C.slice(b, w);
|
|
371
371
|
t.commands.setTextSelection({
|
|
372
372
|
from: A,
|
|
373
|
-
to:
|
|
373
|
+
to: y
|
|
374
374
|
}), i(o.linkAttrs.href || ""), u(g || o.linkAttrs.alt || "");
|
|
375
375
|
};
|
|
376
376
|
return /* @__PURE__ */ v(H, {
|
|
377
377
|
Trigger: /* @__PURE__ */ e("button", {
|
|
378
378
|
type: "button",
|
|
379
379
|
title: "Link",
|
|
380
|
-
className:
|
|
380
|
+
className: a.wuContentEditorAction,
|
|
381
381
|
"data-active": o.isLink,
|
|
382
382
|
children: /* @__PURE__ */ e(h, { icon: "wm-link" })
|
|
383
383
|
}),
|
|
384
384
|
maxWidth: "400px",
|
|
385
|
-
onOpenChange: (
|
|
385
|
+
onOpenChange: (s) => s && l(),
|
|
386
386
|
children: [
|
|
387
|
-
/* @__PURE__ */ e(
|
|
388
|
-
/* @__PURE__ */ v(
|
|
389
|
-
className:
|
|
387
|
+
/* @__PURE__ */ e(z, { style: { display: "none" } }),
|
|
388
|
+
/* @__PURE__ */ v(D, {
|
|
389
|
+
className: a.wuContentEditorModal,
|
|
390
390
|
children: [/* @__PURE__ */ e(F, {
|
|
391
391
|
Label: "Link",
|
|
392
392
|
type: "url",
|
|
393
393
|
value: n,
|
|
394
|
-
onChange: (
|
|
394
|
+
onChange: (s) => i(s.target.value),
|
|
395
395
|
required: !0
|
|
396
396
|
}), /* @__PURE__ */ e(F, {
|
|
397
397
|
Label: "Text to display",
|
|
398
398
|
type: "text",
|
|
399
399
|
value: r,
|
|
400
|
-
onChange: (
|
|
400
|
+
onChange: (s) => u(s.target.value)
|
|
401
401
|
})]
|
|
402
402
|
}),
|
|
403
|
-
/* @__PURE__ */ v(
|
|
403
|
+
/* @__PURE__ */ v(R, { children: [o.isLink && /* @__PURE__ */ e(_, {
|
|
404
404
|
color: "error",
|
|
405
405
|
onClick: () => t.chain().focus().unsetLink().run(),
|
|
406
406
|
variant: "secondary",
|
|
@@ -415,9 +415,9 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
415
415
|
}, Pt = () => {
|
|
416
416
|
const { editor: t } = p(), o = f({
|
|
417
417
|
editor: t,
|
|
418
|
-
selector: (
|
|
419
|
-
isTable:
|
|
420
|
-
tableAttrs:
|
|
418
|
+
selector: (l) => ({
|
|
419
|
+
isTable: l.editor.isActive("table"),
|
|
420
|
+
tableAttrs: l.editor.getAttributes("table")
|
|
421
421
|
})
|
|
422
422
|
}), [n, i] = N(!1), r = Y(null), u = O(() => {
|
|
423
423
|
r.current = setTimeout(() => {
|
|
@@ -428,7 +428,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
428
428
|
}).run();
|
|
429
429
|
}, 100);
|
|
430
430
|
}, [t, n]), c = O(() => {
|
|
431
|
-
i((
|
|
431
|
+
i((l) => !l), r.current = setTimeout(() => {
|
|
432
432
|
t.chain().focus().toggleHeaderRow().run();
|
|
433
433
|
}, 100);
|
|
434
434
|
}, [t]);
|
|
@@ -436,22 +436,22 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
436
436
|
Trigger: /* @__PURE__ */ e("button", {
|
|
437
437
|
type: "button",
|
|
438
438
|
title: "Table",
|
|
439
|
-
className:
|
|
439
|
+
className: a.wuContentEditorAction,
|
|
440
440
|
"data-active": o.isTable,
|
|
441
441
|
children: /* @__PURE__ */ e(h, { icon: "wm-table" })
|
|
442
442
|
}),
|
|
443
443
|
maxWidth: "320px",
|
|
444
444
|
children: [
|
|
445
|
-
/* @__PURE__ */ e(
|
|
446
|
-
/* @__PURE__ */ v(
|
|
447
|
-
className:
|
|
445
|
+
/* @__PURE__ */ e(z, { style: { display: "none" } }),
|
|
446
|
+
/* @__PURE__ */ v(D, {
|
|
447
|
+
className: a.wuContentEditorModal,
|
|
448
448
|
children: [/* @__PURE__ */ e(mt, {
|
|
449
449
|
checked: n,
|
|
450
450
|
onClick: c,
|
|
451
451
|
Label: "Title Row",
|
|
452
452
|
labelPosition: "left"
|
|
453
453
|
}), /* @__PURE__ */ e("div", {
|
|
454
|
-
className:
|
|
454
|
+
className: a.wuContentEditorTable,
|
|
455
455
|
children: [
|
|
456
456
|
{
|
|
457
457
|
text: "Column left",
|
|
@@ -483,15 +483,15 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
483
483
|
icon: "wm-delete",
|
|
484
484
|
event: () => t.chain().focus().deleteRow().run()
|
|
485
485
|
}
|
|
486
|
-
].map(({ text:
|
|
487
|
-
onClick:
|
|
486
|
+
].map(({ text: l, icon: s, event: C }) => /* @__PURE__ */ e(q, {
|
|
487
|
+
onClick: C,
|
|
488
488
|
variant: "secondary",
|
|
489
|
-
Icon: /* @__PURE__ */ e(h, { icon:
|
|
490
|
-
children:
|
|
491
|
-
},
|
|
489
|
+
Icon: /* @__PURE__ */ e(h, { icon: s }),
|
|
490
|
+
children: l
|
|
491
|
+
}, l))
|
|
492
492
|
})]
|
|
493
493
|
}),
|
|
494
|
-
/* @__PURE__ */ e(
|
|
494
|
+
/* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(_, {
|
|
495
495
|
onClick: () => t.chain().focus().deleteTable().run(),
|
|
496
496
|
variant: "outline",
|
|
497
497
|
color: "error",
|
|
@@ -504,7 +504,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
504
504
|
type: "button",
|
|
505
505
|
title: "Table",
|
|
506
506
|
onClick: u,
|
|
507
|
-
className:
|
|
507
|
+
className: a.wuContentEditorAction,
|
|
508
508
|
children: /* @__PURE__ */ e(h, { icon: "wm-table" })
|
|
509
509
|
});
|
|
510
510
|
}, Bt = () => {
|
|
@@ -522,19 +522,19 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
522
522
|
return m.useEffect(() => {
|
|
523
523
|
u(n.currentFontFamily?.replace(/"/g, "") || i[0]);
|
|
524
524
|
}, [n.currentFontFamily]), /* @__PURE__ */ v(U, { children: [/* @__PURE__ */ e(K, {
|
|
525
|
-
className:
|
|
525
|
+
className: a.wuContentEditorAction,
|
|
526
526
|
"data-active": r !== "Fira Sans",
|
|
527
527
|
style: { fontFamily: r },
|
|
528
528
|
title: r || "Font Family",
|
|
529
529
|
children: r?.[0]
|
|
530
530
|
}), /* @__PURE__ */ e(j, {
|
|
531
531
|
align: "start",
|
|
532
|
-
className:
|
|
532
|
+
className: a.wuContentEditorDropdown,
|
|
533
533
|
"data-block": !0,
|
|
534
534
|
onCloseAutoFocus: (c) => c.preventDefault(),
|
|
535
535
|
children: i.map((c) => /* @__PURE__ */ e($, {
|
|
536
536
|
title: c,
|
|
537
|
-
className:
|
|
537
|
+
className: a.wuContentEditorDropdownItem,
|
|
538
538
|
onSelect: () => {
|
|
539
539
|
t.chain().focus().setFontFamily(c).run(), u(c);
|
|
540
540
|
},
|
|
@@ -549,7 +549,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
549
549
|
return /* @__PURE__ */ e("button", {
|
|
550
550
|
type: "button",
|
|
551
551
|
title: "Italic",
|
|
552
|
-
className:
|
|
552
|
+
className: a.wuContentEditorAction,
|
|
553
553
|
"data-active": o.italic,
|
|
554
554
|
onClick: (n) => {
|
|
555
555
|
n.preventDefault(), t.chain().focus().toggleItalic().run();
|
|
@@ -602,23 +602,23 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
602
602
|
], P = 1, $t = () => {
|
|
603
603
|
const { editor: t } = p(), [o, n] = N(16), i = f({
|
|
604
604
|
editor: t,
|
|
605
|
-
selector: (
|
|
606
|
-
}), r = (
|
|
607
|
-
t.chain().focus().setFontSize(
|
|
608
|
-
}, u = (
|
|
609
|
-
const
|
|
610
|
-
n(
|
|
611
|
-
}, c = (
|
|
612
|
-
jt.includes(
|
|
605
|
+
selector: (l) => ({ fontSize: l.editor.getAttributes("textStyle").fontSize })
|
|
606
|
+
}), r = (l) => {
|
|
607
|
+
t.chain().focus().setFontSize(l + "px").run();
|
|
608
|
+
}, u = (l) => {
|
|
609
|
+
const s = Math.max(P, l);
|
|
610
|
+
n(s), r(s);
|
|
611
|
+
}, c = (l) => {
|
|
612
|
+
jt.includes(l.key) ? l.preventDefault() : l.key === "Enter" && r(o);
|
|
613
613
|
};
|
|
614
614
|
return m.useEffect(() => {
|
|
615
615
|
n(Number(i.fontSize?.replace("px", "")) || 16);
|
|
616
616
|
}, [i.fontSize]), /* @__PURE__ */ v("div", {
|
|
617
|
-
className:
|
|
617
|
+
className: a.wuContentEditorFontSize,
|
|
618
618
|
children: [
|
|
619
619
|
/* @__PURE__ */ e("button", {
|
|
620
620
|
type: "button",
|
|
621
|
-
className:
|
|
621
|
+
className: a.wuContentEditorAction,
|
|
622
622
|
onClick: () => u(o - 1),
|
|
623
623
|
disabled: o <= P,
|
|
624
624
|
children: "−"
|
|
@@ -629,12 +629,12 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
629
629
|
pattern: "[0-9]*",
|
|
630
630
|
value: o,
|
|
631
631
|
onKeyDown: c,
|
|
632
|
-
onChange: (
|
|
632
|
+
onChange: (l) => n(l.target.valueAsNumber),
|
|
633
633
|
onBlur: () => r(o)
|
|
634
634
|
}),
|
|
635
635
|
/* @__PURE__ */ e("button", {
|
|
636
636
|
type: "button",
|
|
637
|
-
className:
|
|
637
|
+
className: a.wuContentEditorAction,
|
|
638
638
|
onClick: () => u(o + 1),
|
|
639
639
|
disabled: o >= 128,
|
|
640
640
|
children: "+"
|
|
@@ -649,7 +649,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
649
649
|
return /* @__PURE__ */ e("button", {
|
|
650
650
|
type: "button",
|
|
651
651
|
title: "strikethrough",
|
|
652
|
-
className:
|
|
652
|
+
className: a.wuContentEditorAction,
|
|
653
653
|
"data-active": o.strikethrough,
|
|
654
654
|
onClick: (n) => {
|
|
655
655
|
n.preventDefault(), t.chain().focus().toggleStrike().run();
|
|
@@ -664,7 +664,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
664
664
|
return /* @__PURE__ */ e("button", {
|
|
665
665
|
type: "button",
|
|
666
666
|
title: "Subscript",
|
|
667
|
-
className:
|
|
667
|
+
className: a.wuContentEditorAction,
|
|
668
668
|
"data-active": o.subscript,
|
|
669
669
|
onClick: (n) => {
|
|
670
670
|
n.preventDefault(), t.chain().focus().toggleSubscript().run();
|
|
@@ -679,7 +679,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
679
679
|
return /* @__PURE__ */ e("button", {
|
|
680
680
|
type: "button",
|
|
681
681
|
title: "Superscript",
|
|
682
|
-
className:
|
|
682
|
+
className: a.wuContentEditorAction,
|
|
683
683
|
"data-active": o.superscript,
|
|
684
684
|
onClick: (n) => {
|
|
685
685
|
n.preventDefault(), t.chain().focus().toggleSuperscript().run();
|
|
@@ -692,16 +692,16 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
692
692
|
selector: ({ editor: n }) => ({ textColor: n.getAttributes("textStyle").color })
|
|
693
693
|
});
|
|
694
694
|
return /* @__PURE__ */ v("label", {
|
|
695
|
-
className:
|
|
695
|
+
className: a.wuContentEditorAction,
|
|
696
696
|
htmlFor: "text-color",
|
|
697
697
|
title: "Text Color",
|
|
698
698
|
children: [/* @__PURE__ */ e(h, {
|
|
699
699
|
icon: "wm-format-color-text",
|
|
700
|
-
className:
|
|
700
|
+
className: a.bgColorCursorPointer,
|
|
701
701
|
style: { color: o.textColor }
|
|
702
702
|
}), /* @__PURE__ */ e("input", {
|
|
703
703
|
type: "color",
|
|
704
|
-
className:
|
|
704
|
+
className: a.bgColorHiddenInput,
|
|
705
705
|
id: "text-color",
|
|
706
706
|
defaultValue: "#545E6B",
|
|
707
707
|
onChange: (n) => t.chain().focus().setColor(n.target.value).run()
|
|
@@ -715,7 +715,7 @@ var pt = "_wuContentEditor_1kzbo_8", ft = "_wuContentEditorTable_1kzbo_1", gt =
|
|
|
715
715
|
return /* @__PURE__ */ e("button", {
|
|
716
716
|
type: "button",
|
|
717
717
|
title: "Underline",
|
|
718
|
-
className:
|
|
718
|
+
className: a.wuContentEditorAction,
|
|
719
719
|
"data-active": o.underline,
|
|
720
720
|
onClick: (n) => {
|
|
721
721
|
n.preventDefault(), t.chain().focus().toggleUnderline().run();
|
|
@@ -728,7 +728,7 @@ function Yt() {
|
|
|
728
728
|
return /* @__PURE__ */ e("button", {
|
|
729
729
|
type: "button",
|
|
730
730
|
title: "HTML source",
|
|
731
|
-
className:
|
|
731
|
+
className: a.wuContentEditorAction,
|
|
732
732
|
"data-active": t,
|
|
733
733
|
onClick: (n) => {
|
|
734
734
|
n.preventDefault(), o(!t);
|
|
@@ -740,7 +740,7 @@ var B = {
|
|
|
740
740
|
block: /* @__PURE__ */ e(Ht, {}),
|
|
741
741
|
fontFamily: /* @__PURE__ */ e(Bt, {}),
|
|
742
742
|
fontSize: /* @__PURE__ */ e($t, {}),
|
|
743
|
-
bold: /* @__PURE__ */ e(
|
|
743
|
+
bold: /* @__PURE__ */ e(Rt, {}),
|
|
744
744
|
italic: /* @__PURE__ */ e(qt, {}),
|
|
745
745
|
underline: /* @__PURE__ */ e(Xt, {}),
|
|
746
746
|
strike: /* @__PURE__ */ e(Kt, {}),
|
|
@@ -751,11 +751,11 @@ var B = {
|
|
|
751
751
|
image: /* @__PURE__ */ e(Wt, {}),
|
|
752
752
|
link: /* @__PURE__ */ e(Ot, {}),
|
|
753
753
|
table: /* @__PURE__ */ e(Pt, {}),
|
|
754
|
-
blockquote: /* @__PURE__ */ e(
|
|
754
|
+
blockquote: /* @__PURE__ */ e(Dt, {}),
|
|
755
755
|
superscript: /* @__PURE__ */ e(Gt, {}),
|
|
756
756
|
subscript: /* @__PURE__ */ e(Jt, {}),
|
|
757
757
|
codeline: /* @__PURE__ */ e(Mt, {}),
|
|
758
|
-
clear: /* @__PURE__ */ e(
|
|
758
|
+
clear: /* @__PURE__ */ e(zt, {}),
|
|
759
759
|
"|": /* @__PURE__ */ e("div", { style: {
|
|
760
760
|
height: 16,
|
|
761
761
|
width: 1,
|
|
@@ -791,21 +791,21 @@ var B = {
|
|
|
791
791
|
"html",
|
|
792
792
|
"clear"
|
|
793
793
|
], Qt = (t) => {
|
|
794
|
-
const { editor: o, customFonts: n, children: i, items: r = Zt, isHtml: u, setIsHtml: c, ...
|
|
794
|
+
const { editor: o, customFonts: n, children: i, items: r = Zt, isHtml: u, setIsHtml: c, ...l } = t;
|
|
795
795
|
return /* @__PURE__ */ e("div", {
|
|
796
|
-
...
|
|
796
|
+
...l,
|
|
797
797
|
children: /* @__PURE__ */ v(Lt, {
|
|
798
798
|
editor: o,
|
|
799
799
|
customFonts: n,
|
|
800
800
|
isHtml: u,
|
|
801
801
|
setIsHtml: c,
|
|
802
|
-
children: [r.map((
|
|
802
|
+
children: [r.map((s, C) => /* @__PURE__ */ e(x, { children: u && s !== "html" ? /* @__PURE__ */ e("span", {
|
|
803
803
|
style: {
|
|
804
804
|
pointerEvents: "none",
|
|
805
805
|
opacity: 0.4
|
|
806
806
|
},
|
|
807
|
-
children: B[
|
|
808
|
-
}) : B[
|
|
807
|
+
children: B[s]
|
|
808
|
+
}) : B[s] }, s + C)), i]
|
|
809
809
|
})
|
|
810
810
|
});
|
|
811
811
|
}, W = ht();
|
|
@@ -878,17 +878,17 @@ function te() {
|
|
|
878
878
|
}))), I;
|
|
879
879
|
}
|
|
880
880
|
function ee({ defaultValue: t, onUpdate: o, readonly: n }) {
|
|
881
|
-
const [i, r] = m.useState(t || ""), [u, c] = m.useState(""), [
|
|
881
|
+
const [i, r] = m.useState(t || ""), [u, c] = m.useState(""), [l, s] = m.useState(!1), [C, k] = m.useState(!1), b = m.useRef(!1), w = m.useCallback(async (g) => {
|
|
882
882
|
try {
|
|
883
|
-
const [{ format: d }, { default: T }] = await Promise.all([import("../../standalone-
|
|
883
|
+
const [{ format: d }, { default: T }] = await Promise.all([import("../../standalone-DSxjHhed.js"), import("../../html-Ccb8eKR4.js")]), L = await d(g, {
|
|
884
884
|
parser: "html",
|
|
885
885
|
plugins: [T],
|
|
886
886
|
htmlWhitespaceSensitivity: "css",
|
|
887
887
|
printWidth: 80
|
|
888
888
|
});
|
|
889
|
-
return
|
|
889
|
+
return s(!1), L;
|
|
890
890
|
} catch (d) {
|
|
891
|
-
return console.error("Format error:", d),
|
|
891
|
+
return console.error("Format error:", d), s(!0), g;
|
|
892
892
|
}
|
|
893
893
|
}, []), E = m.useCallback((g) => {
|
|
894
894
|
te().then((d) => {
|
|
@@ -905,11 +905,11 @@ function ee({ defaultValue: t, onUpdate: o, readonly: n }) {
|
|
|
905
905
|
E,
|
|
906
906
|
o
|
|
907
907
|
]), m.useEffect(() => {
|
|
908
|
-
|
|
909
|
-
}, [t,
|
|
908
|
+
b.current || !t || (b.current = !0, w(t).then(r));
|
|
909
|
+
}, [t, w]);
|
|
910
910
|
const A = async (g) => {
|
|
911
|
-
g.preventDefault(),
|
|
912
|
-
},
|
|
911
|
+
g.preventDefault(), k(!0), r(await w(i)), k(!1);
|
|
912
|
+
}, y = (g) => {
|
|
913
913
|
if (g.key === "Tab") {
|
|
914
914
|
g.preventDefault();
|
|
915
915
|
const d = g.currentTarget, T = d.selectionStart, L = d.selectionEnd;
|
|
@@ -918,73 +918,73 @@ function ee({ defaultValue: t, onUpdate: o, readonly: n }) {
|
|
|
918
918
|
});
|
|
919
919
|
}
|
|
920
920
|
};
|
|
921
|
-
return /* @__PURE__ */ e(x, { children:
|
|
922
|
-
className:
|
|
921
|
+
return /* @__PURE__ */ e(x, { children: C ? /* @__PURE__ */ e(x, { children: "Formatting..." }) : /* @__PURE__ */ e("div", {
|
|
922
|
+
className: a.wuContentEditor,
|
|
923
923
|
children: /* @__PURE__ */ v("div", {
|
|
924
|
-
className:
|
|
924
|
+
className: a.wuCodeEditor,
|
|
925
925
|
children: [
|
|
926
926
|
/* @__PURE__ */ e(q, {
|
|
927
927
|
variant: "iconOnly",
|
|
928
928
|
Icon: /* @__PURE__ */ e(h, { icon: "wm-data-object" }),
|
|
929
929
|
onClick: A,
|
|
930
|
-
className:
|
|
931
|
-
style: { color:
|
|
930
|
+
className: a.wuFormatCode,
|
|
931
|
+
style: { color: l ? "red" : "" }
|
|
932
932
|
}),
|
|
933
933
|
/* @__PURE__ */ e("div", {
|
|
934
934
|
dangerouslySetInnerHTML: { __html: u },
|
|
935
|
-
className:
|
|
935
|
+
className: a.wuCodeEditorPreview
|
|
936
936
|
}),
|
|
937
937
|
/* @__PURE__ */ e("textarea", {
|
|
938
938
|
value: i,
|
|
939
939
|
onChange: (g) => r(g.target.value),
|
|
940
|
-
onKeyDown:
|
|
941
|
-
className:
|
|
940
|
+
onKeyDown: y,
|
|
941
|
+
className: a.wuCodeEditorInput,
|
|
942
942
|
disabled: n
|
|
943
943
|
})
|
|
944
944
|
]
|
|
945
945
|
})
|
|
946
946
|
}) });
|
|
947
947
|
}
|
|
948
|
-
function ve({ defaultValue: t, onUpdate: o, className: n, toolbarPosition: i = "top", customToolbarChildren: r, toolbarItems: u, hideToolbar: c, readonly:
|
|
949
|
-
const [
|
|
950
|
-
editable: !
|
|
948
|
+
function ve({ defaultValue: t, onUpdate: o, className: n, toolbarPosition: i = "top", customToolbarChildren: r, toolbarItems: u, hideToolbar: c, readonly: l, customFonts: s, isHtml: C, setIsHtml: k, ...b }) {
|
|
949
|
+
const [w, E] = m.useState(C ?? !1), A = m.useRef(t || ""), y = V({
|
|
950
|
+
editable: !l,
|
|
951
951
|
extensions: Ft,
|
|
952
952
|
content: S(t || ""),
|
|
953
953
|
onUpdate: ({ editor: d }) => {
|
|
954
954
|
o && o(S(d.getHTML()));
|
|
955
955
|
}
|
|
956
956
|
}), g = (d) => {
|
|
957
|
-
d ? A.current =
|
|
957
|
+
d ? A.current = y?.getHTML() ?? "" : y?.commands.setContent(S(A.current)), o && o(S(A.current)), E(d), k?.(d);
|
|
958
958
|
};
|
|
959
959
|
return /* @__PURE__ */ v("div", {
|
|
960
|
-
className: X(
|
|
960
|
+
className: X(a.wuContentEditorContainer, n),
|
|
961
961
|
"data-position": i,
|
|
962
962
|
"data-slot": "wu-content-editor-container",
|
|
963
963
|
onClick: () => {
|
|
964
|
-
|
|
964
|
+
w || y?.chain().focus().run();
|
|
965
965
|
},
|
|
966
|
-
...
|
|
966
|
+
...b,
|
|
967
967
|
children: [!c && /* @__PURE__ */ e(Qt, {
|
|
968
|
-
editor:
|
|
969
|
-
customFonts:
|
|
970
|
-
className:
|
|
968
|
+
editor: y,
|
|
969
|
+
customFonts: s,
|
|
970
|
+
className: a.wuContentEditorToolbar,
|
|
971
971
|
items: u,
|
|
972
|
-
isHtml:
|
|
972
|
+
isHtml: w,
|
|
973
973
|
setIsHtml: g,
|
|
974
974
|
"data-slot": "wu-content-editor-toolbar",
|
|
975
975
|
"data-position": i,
|
|
976
976
|
children: r
|
|
977
|
-
}),
|
|
977
|
+
}), w ? /* @__PURE__ */ e(ee, {
|
|
978
978
|
defaultValue: A.current,
|
|
979
979
|
onUpdate: (d) => {
|
|
980
980
|
A.current = d ?? "", o && o(d ?? "");
|
|
981
981
|
},
|
|
982
982
|
"data-position": i,
|
|
983
983
|
"data-slot": "wu-content-editor",
|
|
984
|
-
readonly:
|
|
984
|
+
readonly: l
|
|
985
985
|
}) : /* @__PURE__ */ e(G, {
|
|
986
|
-
editor:
|
|
987
|
-
className:
|
|
986
|
+
editor: y,
|
|
987
|
+
className: a.wuContentEditor,
|
|
988
988
|
"data-slot": "wu-content-editor"
|
|
989
989
|
})]
|
|
990
990
|
});
|
package/llms.txt
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @npm-questionpro/wick-ui-editor
|
|
2
|
+
|
|
3
|
+
> 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.
|
|
4
|
+
|
|
5
|
+
Version: 2.0.0-next.4
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
```
|
|
9
|
+
pnpm add @npm-questionpro/wick-ui-editor
|
|
10
|
+
# Peer dependencies:
|
|
11
|
+
pnpm add react react-dom @npm-questionpro/wick-ui-icon @npm-questionpro/wick-ui-lib @radix-ui/react-dropdown-menu @tiptap/extension-image @tiptap/extension-list @tiptap/extension-subscript @tiptap/extension-superscript @tiptap/extension-table @tiptap/extension-text-align @tiptap/extension-text-style @tiptap/pm @tiptap/react @tiptap/starter-kit clsx dompurify shiki
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
```tsx
|
|
16
|
+
import {WuContentEditor} from '@npm-questionpro/wick-ui-editor'
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
return (
|
|
20
|
+
<WuContentEditor
|
|
21
|
+
defaultValue="<p>Start typing...</p>"
|
|
22
|
+
onUpdate={html => console.log(html)}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Links
|
|
29
|
+
- npm: https://npmjs.com/package/@npm-questionpro/wick-ui-editor
|
|
30
|
+
- llms.txt (unpkg): https://unpkg.com/@npm-questionpro/wick-ui-editor/llms.txt
|
|
31
|
+
- llms.txt (jsDelivr): https://cdn.jsdelivr.net/npm/@npm-questionpro/wick-ui-editor/llms.txt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npm-questionpro/wick-ui-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0-next.4",
|
|
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",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"url": "https://github.com/QuestionPro/wick-ui/issues"
|
|
22
22
|
},
|
|
23
23
|
"type": "module",
|
|
24
|
-
"main": "./dist/wick-ui-editor/umd/index.js",
|
|
25
24
|
"module": "./dist/wick-ui-editor/es/index.js",
|
|
26
25
|
"types": "./dist/index.d.ts",
|
|
27
26
|
"exports": {
|
|
@@ -35,12 +34,13 @@
|
|
|
35
34
|
"**/*.css"
|
|
36
35
|
],
|
|
37
36
|
"files": [
|
|
38
|
-
"dist"
|
|
37
|
+
"dist",
|
|
38
|
+
"llms.txt"
|
|
39
39
|
],
|
|
40
40
|
"private": false,
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@npm-questionpro/wick-ui-icon": ">=
|
|
43
|
-
"@npm-questionpro/wick-ui-lib": ">=
|
|
42
|
+
"@npm-questionpro/wick-ui-icon": ">= 2.0.0",
|
|
43
|
+
"@npm-questionpro/wick-ui-lib": ">= 2.0.0",
|
|
44
44
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
45
45
|
"@tiptap/extension-image": "^3.14.0",
|
|
46
46
|
"@tiptap/extension-list": "^3.14.0",
|
|
@@ -54,23 +54,16 @@
|
|
|
54
54
|
"@tiptap/starter-kit": "^3.14.0",
|
|
55
55
|
"clsx": "^2.1.1",
|
|
56
56
|
"dompurify": "^3.3.1",
|
|
57
|
-
"react": "
|
|
58
|
-
"react-dom": "
|
|
57
|
+
"react": "^19.0.0",
|
|
58
|
+
"react-dom": "^19.0.0",
|
|
59
59
|
"shiki": "^4.0.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@eslint/js": "^9.39.4",
|
|
63
|
-
"@npm-questionpro/wick-ui-icon": "latest",
|
|
64
|
-
"@npm-questionpro/wick-ui-lib": "latest",
|
|
65
62
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
66
|
-
"@storybook/addon-a11y": "^10.4.0",
|
|
67
|
-
"@storybook/addon-designs": "^11.1.0",
|
|
68
|
-
"@storybook/addon-docs": "^10.4.0",
|
|
69
|
-
"@storybook/addon-links": "^10.4.0",
|
|
70
63
|
"@storybook/react-vite": "^10.4.0",
|
|
71
64
|
"@testing-library/dom": "^10.4.1",
|
|
72
65
|
"@testing-library/jest-dom": "^6.9.1",
|
|
73
|
-
"@testing-library/react": "^16.3.
|
|
66
|
+
"@testing-library/react": "^16.3.2",
|
|
74
67
|
"@testing-library/user-event": "^14.6.1",
|
|
75
68
|
"@tiptap/extension-image": "^3.14.0",
|
|
76
69
|
"@tiptap/extension-list": "^3.14.0",
|
|
@@ -83,48 +76,46 @@
|
|
|
83
76
|
"@tiptap/react": "^3.14.0",
|
|
84
77
|
"@tiptap/starter-kit": "^3.14.0",
|
|
85
78
|
"@types/node": "^22.19.1",
|
|
86
|
-
"@types/react": "^
|
|
87
|
-
"@types/react-dom": "^
|
|
88
|
-
"@
|
|
89
|
-
"@
|
|
90
|
-
"@
|
|
91
|
-
"@vitest/coverage-v8": "^4.1.6",
|
|
92
|
-
"@vitest/ui": "^4.1.6",
|
|
79
|
+
"@types/react": "^19.0.0",
|
|
80
|
+
"@types/react-dom": "^19.0.0",
|
|
81
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
82
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
83
|
+
"@vitest/ui": "^4.1.8",
|
|
93
84
|
"autoprefixer": "^10.4.22",
|
|
94
85
|
"clsx": "^2.1.1",
|
|
95
86
|
"cssnano": "^7.1.2",
|
|
96
|
-
"eslint": "^
|
|
97
|
-
"eslint-plugin-import": "^2.32.0",
|
|
98
|
-
"eslint-plugin-react": "^7.37.5",
|
|
99
|
-
"eslint-plugin-react-hooks": "^7.1.1",
|
|
100
|
-
"eslint-plugin-react-refresh": "^0.5.2",
|
|
101
|
-
"eslint-plugin-storybook": "^10.4.0",
|
|
102
|
-
"eslint-plugin-unicorn": "^56.0.1",
|
|
103
|
-
"globals": "^17.6.0",
|
|
87
|
+
"eslint": "^10.4.1",
|
|
104
88
|
"jsdom": "^26.1.0",
|
|
105
89
|
"postcss": "^8.5.6",
|
|
106
90
|
"prettier": "^3.8.3",
|
|
107
|
-
"react": "^
|
|
108
|
-
"react-dom": "^
|
|
109
|
-
"
|
|
110
|
-
"typescript": "
|
|
111
|
-
"typescript-eslint": "^8.
|
|
112
|
-
"vite": "^8.0.
|
|
91
|
+
"react": "^19.0.0",
|
|
92
|
+
"react-dom": "^19.0.0",
|
|
93
|
+
"stylelint": "^16.3.1",
|
|
94
|
+
"typescript": "^6.0.3",
|
|
95
|
+
"typescript-eslint": "^8.60.0",
|
|
96
|
+
"vite": "^8.0.15",
|
|
113
97
|
"vite-bundle-analyzer": "^0.22.3",
|
|
114
98
|
"vite-plugin-dts": "^4.5.4",
|
|
115
|
-
"
|
|
116
|
-
"
|
|
99
|
+
"vitest": "^4.1.8",
|
|
100
|
+
"@npm-questionpro/wick-ui-icon": "2.0.0-next.4",
|
|
101
|
+
"@npm-questionpro/wick-ui-lib": "2.0.0-next.4",
|
|
102
|
+
"@npm-questionpro/wick-ui-eslint-config": "1.0.0",
|
|
103
|
+
"@npm-questionpro/wick-ui-prettier-config": "1.0.0",
|
|
104
|
+
"@npm-questionpro/wick-ui-stylelint-config": "1.0.0",
|
|
105
|
+
"@wick-ui/tsconfig": "1.0.0"
|
|
117
106
|
},
|
|
107
|
+
"prettier": "@npm-questionpro/wick-ui-prettier-config",
|
|
118
108
|
"scripts": {
|
|
119
|
-
"build": "tsc
|
|
120
|
-
"lint": "eslint ./src --fix",
|
|
121
|
-
"lint:
|
|
122
|
-
"
|
|
109
|
+
"build": "tsc --noEmit && vite build",
|
|
110
|
+
"lint": "eslint ./src --fix && stylelint 'src/**/*.css' --fix",
|
|
111
|
+
"lint:css": "stylelint 'src/**/*.css' --fix",
|
|
112
|
+
"lint:ci": "tsc --noEmit && eslint --max-warnings 0 ./src && stylelint 'src/**/*.css'",
|
|
113
|
+
"format": "prettier --write .",
|
|
123
114
|
"format:ci": "prettier --check .",
|
|
124
115
|
"test": "vitest run",
|
|
125
|
-
"test:
|
|
126
|
-
"test:
|
|
127
|
-
"
|
|
128
|
-
"
|
|
116
|
+
"test:watch": "vitest",
|
|
117
|
+
"test:ui": "vitest --ui",
|
|
118
|
+
"test:ci": "vitest run --coverage",
|
|
119
|
+
"postbuild": "node ../../scripts/generate-llms-txt.mjs --package packages/wick-ui-editor"
|
|
129
120
|
}
|
|
130
121
|
}
|
|
File without changes
|
|
File without changes
|