@andreagiugni/tailwind-dashboard-ui 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/{Editor-CHBOfOWf.d.cts → Editor-DEv5IZeb.d.cts} +2 -0
- package/dist/{Editor-CHBOfOWf.d.ts → Editor-DEv5IZeb.d.ts} +2 -0
- package/dist/{chunk-YSON6RJC.cjs → chunk-5DEBWZY7.cjs} +178 -43
- package/dist/chunk-5DEBWZY7.cjs.map +1 -0
- package/dist/{chunk-S4ADL5B7.cjs → chunk-6NC3VS54.cjs} +35 -115
- package/dist/chunk-6NC3VS54.cjs.map +1 -0
- package/dist/{chunk-DXUWFHPF.js → chunk-OYBYDSNI.js} +35 -115
- package/dist/chunk-OYBYDSNI.js.map +1 -0
- package/dist/{chunk-QGLKSM7S.js → chunk-PYZG7RY7.js} +179 -44
- package/dist/chunk-PYZG7RY7.js.map +1 -0
- package/dist/{chunk-U2SEFEOB.js → chunk-W3TC7P3Z.js} +8 -21
- package/dist/chunk-W3TC7P3Z.js.map +1 -0
- package/dist/{chunk-553PIOZS.cjs → chunk-ZQ6544NY.cjs} +8 -21
- package/dist/chunk-ZQ6544NY.cjs.map +1 -0
- package/dist/components/Calendar/Calendar.cjs +2 -2
- package/dist/components/Calendar/Calendar.js +1 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +2 -2
- package/dist/components/ColorPicker/ColorPicker.js +1 -1
- package/dist/components/Editor/Editor.cjs +2 -2
- package/dist/components/Editor/Editor.d.cts +1 -1
- package/dist/components/Editor/Editor.d.ts +1 -1
- package/dist/components/Editor/Editor.js +1 -1
- package/dist/index.cjs +61 -555
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +57 -551
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-553PIOZS.cjs.map +0 -1
- package/dist/chunk-DXUWFHPF.js.map +0 -1
- package/dist/chunk-QGLKSM7S.js.map +0 -1
- package/dist/chunk-S4ADL5B7.cjs.map +0 -1
- package/dist/chunk-U2SEFEOB.js.map +0 -1
- package/dist/chunk-YSON6RJC.cjs.map +0 -1
|
@@ -9,6 +9,7 @@ var Link = require('@tiptap/extension-link');
|
|
|
9
9
|
var Placeholder = require('@tiptap/extension-placeholder');
|
|
10
10
|
var Superscript = require('@tiptap/extension-superscript');
|
|
11
11
|
var Subscript = require('@tiptap/extension-subscript');
|
|
12
|
+
var lucideReact = require('lucide-react');
|
|
12
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
14
|
|
|
14
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -20,100 +21,6 @@ var Placeholder__default = /*#__PURE__*/_interopDefault(Placeholder);
|
|
|
20
21
|
var Superscript__default = /*#__PURE__*/_interopDefault(Superscript);
|
|
21
22
|
var Subscript__default = /*#__PURE__*/_interopDefault(Subscript);
|
|
22
23
|
|
|
23
|
-
var base = {
|
|
24
|
-
width: 18,
|
|
25
|
-
height: 18,
|
|
26
|
-
viewBox: "0 0 24 24",
|
|
27
|
-
fill: "none",
|
|
28
|
-
stroke: "currentColor",
|
|
29
|
-
strokeWidth: 2,
|
|
30
|
-
strokeLinecap: "round",
|
|
31
|
-
strokeLinejoin: "round",
|
|
32
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
33
|
-
};
|
|
34
|
-
var BoldIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
35
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 4h7a4 4 0 0 1 0 8H6z" }),
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 12h8a4 4 0 0 1 0 8H6z" })
|
|
37
|
-
] });
|
|
38
|
-
var ItalicIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
39
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
40
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
41
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
42
|
-
] });
|
|
43
|
-
var StrikeIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
44
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
|
|
45
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
|
|
46
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
47
|
-
] });
|
|
48
|
-
var CodeIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
49
|
-
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "16 18 22 12 16 6" }),
|
|
50
|
-
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "8 6 2 12 8 18" })
|
|
51
|
-
] });
|
|
52
|
-
var Heading1Icon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
53
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 12h8" }),
|
|
54
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 18V6" }),
|
|
55
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 18V6" }),
|
|
56
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 12l3-2v8" })
|
|
57
|
-
] });
|
|
58
|
-
var Heading2Icon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 12h8" }),
|
|
60
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 18V6" }),
|
|
61
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 18V6" }),
|
|
62
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 10c2 0 3 1 3 2.5S18 15 17 16l-2 2h5" })
|
|
63
|
-
] });
|
|
64
|
-
var Heading3Icon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
65
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 12h8" }),
|
|
66
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 18V6" }),
|
|
67
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 18V6" }),
|
|
68
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 10c2.5-1 3.5 1 2.5 2c1 1 0.5 4-2.5 3" })
|
|
69
|
-
] });
|
|
70
|
-
var BulletListIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
71
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "9", y1: "6", x2: "20", y2: "6" }),
|
|
72
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "9", y1: "12", x2: "20", y2: "12" }),
|
|
73
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "9", y1: "18", x2: "20", y2: "18" }),
|
|
74
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "4", cy: "6", r: "1" }),
|
|
75
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "4", cy: "12", r: "1" }),
|
|
76
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "4", cy: "18", r: "1" })
|
|
77
|
-
] });
|
|
78
|
-
var OrderedListIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
79
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "10", y1: "6", x2: "20", y2: "6" }),
|
|
80
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "10", y1: "12", x2: "20", y2: "12" }),
|
|
81
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "10", y1: "18", x2: "20", y2: "18" }),
|
|
82
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 6V3.5L3 4" }),
|
|
83
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 12h2l-2 3h2" }),
|
|
84
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 17h2v3H3" })
|
|
85
|
-
] });
|
|
86
|
-
var BlockquoteIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
87
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 21c3 0 7-1 7-8V5H3v7h4" }),
|
|
88
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14 21c3 0 7-1 7-8V5h-7v7h4" })
|
|
89
|
-
] });
|
|
90
|
-
var CodeBlockIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
91
|
-
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
92
|
-
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "9 9 7 12 9 15" }),
|
|
93
|
-
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "15 9 17 12 15 15" })
|
|
94
|
-
] });
|
|
95
|
-
var LinkIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
96
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1 1" }),
|
|
97
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1-1" })
|
|
98
|
-
] });
|
|
99
|
-
var UndoIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
100
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 7v6h6" }),
|
|
101
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 13a9 9 0 1 0 3-7.7L3 8" })
|
|
102
|
-
] });
|
|
103
|
-
var RedoIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
104
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 7v6h-6" }),
|
|
105
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 13a9 9 0 1 1-3-7.7L21 8" })
|
|
106
|
-
] });
|
|
107
|
-
var SuperscriptIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
108
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4 19 8-10" }),
|
|
109
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m12 19-8-10" }),
|
|
110
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 9h-4c0-1.5.44-2 1.5-2.5S20 5.6 20 4.5C20 3.7 19.3 3 18.5 3S17 3.7 17 4.5" })
|
|
111
|
-
] });
|
|
112
|
-
var SubscriptIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...base, children: [
|
|
113
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4 5 8 10" }),
|
|
114
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m12 5-8 10" }),
|
|
115
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 21h-4c0-1.5.44-2 1.5-2.5S20 17.6 20 16.5c0-.8-.7-1.5-1.5-1.5s-1.5.7-1.5 1.5" })
|
|
116
|
-
] });
|
|
117
24
|
var DEFAULT_TOOLBAR = [
|
|
118
25
|
"bold",
|
|
119
26
|
"italic",
|
|
@@ -138,85 +45,85 @@ var DEFAULT_TOOLBAR = [
|
|
|
138
45
|
];
|
|
139
46
|
var BUILTINS = {
|
|
140
47
|
bold: {
|
|
141
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bold, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
142
49
|
title: "Bold",
|
|
143
50
|
onClick: (e) => e.chain().focus().toggleBold().run(),
|
|
144
51
|
isActive: (e) => e.isActive("bold")
|
|
145
52
|
},
|
|
146
53
|
italic: {
|
|
147
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Italic, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
148
55
|
title: "Italic",
|
|
149
56
|
onClick: (e) => e.chain().focus().toggleItalic().run(),
|
|
150
57
|
isActive: (e) => e.isActive("italic")
|
|
151
58
|
},
|
|
152
59
|
strike: {
|
|
153
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Strikethrough, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
154
61
|
title: "Strikethrough",
|
|
155
62
|
onClick: (e) => e.chain().focus().toggleStrike().run(),
|
|
156
63
|
isActive: (e) => e.isActive("strike")
|
|
157
64
|
},
|
|
158
65
|
code: {
|
|
159
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
160
67
|
title: "Inline code",
|
|
161
68
|
onClick: (e) => e.chain().focus().toggleCode().run(),
|
|
162
69
|
isActive: (e) => e.isActive("code")
|
|
163
70
|
},
|
|
164
71
|
superscript: {
|
|
165
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
72
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Superscript, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
166
73
|
title: "Superscript",
|
|
167
74
|
onClick: (e) => e.chain().focus().toggleSuperscript().run(),
|
|
168
75
|
isActive: (e) => e.isActive("superscript")
|
|
169
76
|
},
|
|
170
77
|
subscript: {
|
|
171
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Subscript, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
172
79
|
title: "Subscript",
|
|
173
80
|
onClick: (e) => e.chain().focus().toggleSubscript().run(),
|
|
174
81
|
isActive: (e) => e.isActive("subscript")
|
|
175
82
|
},
|
|
176
83
|
heading1: {
|
|
177
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
84
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading1, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
178
85
|
title: "Heading 1",
|
|
179
86
|
onClick: (e) => e.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
180
87
|
isActive: (e) => e.isActive("heading", { level: 1 })
|
|
181
88
|
},
|
|
182
89
|
heading2: {
|
|
183
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading2, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
184
91
|
title: "Heading 2",
|
|
185
92
|
onClick: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
186
93
|
isActive: (e) => e.isActive("heading", { level: 2 })
|
|
187
94
|
},
|
|
188
95
|
heading3: {
|
|
189
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading3, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
190
97
|
title: "Heading 3",
|
|
191
98
|
onClick: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
192
99
|
isActive: (e) => e.isActive("heading", { level: 3 })
|
|
193
100
|
},
|
|
194
101
|
bulletList: {
|
|
195
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
102
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
196
103
|
title: "Bullet list",
|
|
197
104
|
onClick: (e) => e.chain().focus().toggleBulletList().run(),
|
|
198
105
|
isActive: (e) => e.isActive("bulletList")
|
|
199
106
|
},
|
|
200
107
|
orderedList: {
|
|
201
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
202
109
|
title: "Ordered list",
|
|
203
110
|
onClick: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
204
111
|
isActive: (e) => e.isActive("orderedList")
|
|
205
112
|
},
|
|
206
113
|
blockquote: {
|
|
207
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Quote, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
208
115
|
title: "Blockquote",
|
|
209
116
|
onClick: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
210
117
|
isActive: (e) => e.isActive("blockquote")
|
|
211
118
|
},
|
|
212
119
|
codeBlock: {
|
|
213
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CodeXml, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
214
121
|
title: "Code block",
|
|
215
122
|
onClick: (e) => e.chain().focus().toggleCodeBlock().run(),
|
|
216
123
|
isActive: (e) => e.isActive("codeBlock")
|
|
217
124
|
},
|
|
218
125
|
link: {
|
|
219
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
220
127
|
title: "Link",
|
|
221
128
|
// Minimal UX: window.prompt for the URL (no extra UI deps). Empty input
|
|
222
129
|
// clears any existing link on the selection.
|
|
@@ -233,13 +140,13 @@ var BUILTINS = {
|
|
|
233
140
|
isActive: (e) => e.isActive("link")
|
|
234
141
|
},
|
|
235
142
|
undo: {
|
|
236
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Undo2, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
237
144
|
title: "Undo",
|
|
238
145
|
onClick: (e) => e.chain().focus().undo().run(),
|
|
239
146
|
isDisabled: (e) => !e.can().undo()
|
|
240
147
|
},
|
|
241
148
|
redo: {
|
|
242
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
149
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Redo2, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
243
150
|
title: "Redo",
|
|
244
151
|
onClick: (e) => e.chain().focus().redo().run(),
|
|
245
152
|
isDisabled: (e) => !e.can().redo()
|
|
@@ -264,9 +171,15 @@ var Editor = ({
|
|
|
264
171
|
placeholder = "Start writing\u2026",
|
|
265
172
|
editable = true,
|
|
266
173
|
toolbar = DEFAULT_TOOLBAR,
|
|
174
|
+
rows = 8,
|
|
267
175
|
className,
|
|
268
176
|
editorClassName
|
|
269
177
|
}) => {
|
|
178
|
+
const visibleRows = Math.max(1, Math.floor(rows));
|
|
179
|
+
const minHeight = `${visibleRows * 1.5}rem`;
|
|
180
|
+
const editorHeightStyle = {
|
|
181
|
+
"--tdui-editor-min-height": minHeight
|
|
182
|
+
};
|
|
270
183
|
const editor = react.useEditor({
|
|
271
184
|
extensions: [
|
|
272
185
|
StarterKit__default.default,
|
|
@@ -298,7 +211,13 @@ var Editor = ({
|
|
|
298
211
|
),
|
|
299
212
|
children: [
|
|
300
213
|
editable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 border-b border-gray-200 bg-gray-50 dark:border-gray-800 dark:bg-white/[0.02]" }),
|
|
301
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
className: "min-h-[var(--tdui-editor-min-height)] animate-pulse bg-gray-50/50 dark:bg-white/[0.01]",
|
|
218
|
+
style: editorHeightStyle
|
|
219
|
+
}
|
|
220
|
+
)
|
|
302
221
|
]
|
|
303
222
|
}
|
|
304
223
|
);
|
|
@@ -358,11 +277,12 @@ var Editor = ({
|
|
|
358
277
|
react.EditorContent,
|
|
359
278
|
{
|
|
360
279
|
editor,
|
|
280
|
+
style: editorHeightStyle,
|
|
361
281
|
className: chunkYERNSNT4_cjs.cn(
|
|
362
|
-
"min-h-[
|
|
282
|
+
"min-h-[var(--tdui-editor-min-height)] px-4 py-3 text-sm text-gray-700 dark:text-gray-300",
|
|
363
283
|
"rounded-b-xl",
|
|
364
284
|
// Explicit element styling (no @tailwindcss/typography assumed).
|
|
365
|
-
"[&_.ProseMirror]:min-h-[
|
|
285
|
+
"[&_.ProseMirror]:min-h-[var(--tdui-editor-min-height)] [&_.ProseMirror]:outline-none",
|
|
366
286
|
"[&_h1]:mb-3 [&_h1]:mt-4 [&_h1]:text-2xl [&_h1]:font-semibold [&_h1]:text-gray-900 dark:[&_h1]:text-white/90",
|
|
367
287
|
"[&_h2]:mb-2 [&_h2]:mt-4 [&_h2]:text-xl [&_h2]:font-semibold [&_h2]:text-gray-900 dark:[&_h2]:text-white/90",
|
|
368
288
|
"[&_h3]:mb-2 [&_h3]:mt-3 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:text-gray-900 dark:[&_h3]:text-white/90",
|
|
@@ -388,5 +308,5 @@ var Editor = ({
|
|
|
388
308
|
};
|
|
389
309
|
|
|
390
310
|
exports.Editor = Editor;
|
|
391
|
-
//# sourceMappingURL=chunk-
|
|
392
|
-
//# sourceMappingURL=chunk-
|
|
311
|
+
//# sourceMappingURL=chunk-6NC3VS54.cjs.map
|
|
312
|
+
//# sourceMappingURL=chunk-6NC3VS54.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Editor/Editor.tsx"],"names":["jsx","Bold","Italic","Strikethrough","Code","SuperscriptIcon","SubscriptIcon","Heading1","Heading2","Heading3","List","ListOrdered","Quote","CodeXml","LinkIcon","Undo2","Redo2","cn","useEditor","StarterKit","Link","Placeholder","Superscript","Subscript","editor","React","jsxs","active","EditorContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmFA,IAAM,eAAA,GAAoC;AAAA,EACxC,MAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,SAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA;AAWA,IAAM,QAAA,GAAkE;AAAA,EACtE,IAAA,EAAM;AAAA,IACJ,sBAAMA,cAAA,CAACC,gBAAA,EAAA,EAAK,SAAA,EAAU,mBAAA,EAAoB,eAAY,MAAA,EAAO,CAAA;AAAA,IAC7D,KAAA,EAAO,MAAA;AAAA,IACP,OAAA,EAAS,CAAC,CAAA,KAAM,CAAA,CAAE,KAAA,GAAQ,KAAA,EAAM,CAAE,UAAA,EAAW,CAAE,GAAA,EAAI;AAAA,IACnD,QAAA,EAAU,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,MAAM;AAAA,GACpC;AAAA,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,kCAAA;AAAA,cACA,0CAAA;AAAA,cACA,6CAAA;AAAA,cACA,2BAAA;AAAA,cACA,2FAAA;AAAA,cACA,2NAAA;AAAA,cACA,oMAAA;AAAA,cACA,0KAAA;AAAA,cACA,wEAAA;AAAA,cACA,gEAAA;AAAA;AAAA,cAEA,4VAAA;AAAA,cACA;AAAA;AACF;AAAA;AACF;AAAA;AAAA,GACF;AAEJ","file":"chunk-6NC3VS54.cjs","sourcesContent":["\"use client\";\nimport React from \"react\";\nimport { useEditor, EditorContent, type Editor as TiptapEditor } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport Link from \"@tiptap/extension-link\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport Superscript from \"@tiptap/extension-superscript\";\nimport Subscript from \"@tiptap/extension-subscript\";\nimport {\n Bold,\n Code,\n CodeXml,\n Heading1,\n Heading2,\n Heading3,\n Italic,\n Link as LinkIcon,\n List,\n ListOrdered,\n Quote,\n Redo2,\n Strikethrough,\n Subscript as SubscriptIcon,\n Superscript as SuperscriptIcon,\n Undo2,\n} from \"lucide-react\";\nimport { cn } from \"../../lib/cn\";\nimport { type ColorOverrideProps } from \"../../lib/styleOverride\";\n\n/** Built-in toolbar tool ids. */\nexport type ToolbarItemId =\n | \"bold\"\n | \"italic\"\n | \"strike\"\n | \"code\"\n | \"superscript\"\n | \"subscript\"\n | \"heading1\"\n | \"heading2\"\n | \"heading3\"\n | \"bulletList\"\n | \"orderedList\"\n | \"blockquote\"\n | \"codeBlock\"\n | \"link\"\n | \"undo\"\n | \"redo\"\n | \"divider\";\n\n/** A fully custom toolbar button. */\nexport interface CustomToolbarItem {\n id: string;\n icon: React.ReactNode;\n title: string;\n onClick: (editor: TiptapEditor) => void;\n isActive?: (editor: TiptapEditor) => boolean;\n}\n\n/** A toolbar entry: either a built-in id or a custom button object. */\nexport type EditorToolItem = ToolbarItemId | CustomToolbarItem;\n\n/** @deprecated Alias kept for naming flexibility. Use `EditorToolItem`. */\nexport type ToolbarItem = EditorToolItem;\n\nexport interface EditorProps extends ColorOverrideProps {\n /** Initial HTML content. */\n content?: string;\n /** Fires with the current HTML whenever the document changes. */\n onChange?: (html: string) => void;\n /** Placeholder shown when the document is empty. */\n placeholder?: string;\n /** When false the editor is read-only and the toolbar is hidden. */\n editable?: boolean;\n /** Ordered toolbar configuration. Defaults to a sensible full set. */\n toolbar?: EditorToolItem[];\n /** Minimum visible text rows. Drives the editor content height. Default: 8. */\n rows?: number;\n /** Wrapper class. */\n className?: string;\n /** Class for the prose content area. */\n editorClassName?: string;\n}\n\nconst DEFAULT_TOOLBAR: EditorToolItem[] = [\n \"bold\",\n \"italic\",\n \"strike\",\n \"code\",\n \"superscript\",\n \"subscript\",\n \"divider\",\n \"heading1\",\n \"heading2\",\n \"heading3\",\n \"divider\",\n \"bulletList\",\n \"orderedList\",\n \"blockquote\",\n \"codeBlock\",\n \"divider\",\n \"link\",\n \"divider\",\n \"undo\",\n \"redo\",\n];\n\ninterface BuiltInDef {\n icon: React.ReactNode;\n title: string;\n onClick: (editor: TiptapEditor) => void;\n isActive?: (editor: TiptapEditor) => boolean;\n /** Disable callback (used for undo/redo). */\n isDisabled?: (editor: TiptapEditor) => boolean;\n}\n\nconst BUILTINS: Record<Exclude<ToolbarItemId, \"divider\">, BuiltInDef> = {\n bold: {\n icon: <Bold className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Bold\",\n onClick: (e) => e.chain().focus().toggleBold().run(),\n isActive: (e) => e.isActive(\"bold\"),\n },\n italic: {\n icon: <Italic className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Italic\",\n onClick: (e) => e.chain().focus().toggleItalic().run(),\n isActive: (e) => e.isActive(\"italic\"),\n },\n strike: {\n icon: <Strikethrough className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Strikethrough\",\n onClick: (e) => e.chain().focus().toggleStrike().run(),\n isActive: (e) => e.isActive(\"strike\"),\n },\n code: {\n icon: <Code className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Inline code\",\n onClick: (e) => e.chain().focus().toggleCode().run(),\n isActive: (e) => e.isActive(\"code\"),\n },\n superscript: {\n icon: <SuperscriptIcon className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Superscript\",\n onClick: (e) => e.chain().focus().toggleSuperscript().run(),\n isActive: (e) => e.isActive(\"superscript\"),\n },\n subscript: {\n icon: <SubscriptIcon className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Subscript\",\n onClick: (e) => e.chain().focus().toggleSubscript().run(),\n isActive: (e) => e.isActive(\"subscript\"),\n },\n heading1: {\n icon: <Heading1 className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Heading 1\",\n onClick: (e) => e.chain().focus().toggleHeading({ level: 1 }).run(),\n isActive: (e) => e.isActive(\"heading\", { level: 1 }),\n },\n heading2: {\n icon: <Heading2 className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Heading 2\",\n onClick: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(),\n isActive: (e) => e.isActive(\"heading\", { level: 2 }),\n },\n heading3: {\n icon: <Heading3 className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Heading 3\",\n onClick: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(),\n isActive: (e) => e.isActive(\"heading\", { level: 3 }),\n },\n bulletList: {\n icon: <List className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Bullet list\",\n onClick: (e) => e.chain().focus().toggleBulletList().run(),\n isActive: (e) => e.isActive(\"bulletList\"),\n },\n orderedList: {\n icon: <ListOrdered className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Ordered list\",\n onClick: (e) => e.chain().focus().toggleOrderedList().run(),\n isActive: (e) => e.isActive(\"orderedList\"),\n },\n blockquote: {\n icon: <Quote className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Blockquote\",\n onClick: (e) => e.chain().focus().toggleBlockquote().run(),\n isActive: (e) => e.isActive(\"blockquote\"),\n },\n codeBlock: {\n icon: <CodeXml className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Code block\",\n onClick: (e) => e.chain().focus().toggleCodeBlock().run(),\n isActive: (e) => e.isActive(\"codeBlock\"),\n },\n link: {\n icon: <LinkIcon className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Link\",\n // Minimal UX: window.prompt for the URL (no extra UI deps). Empty input\n // clears any existing link on the selection.\n onClick: (e) => {\n const prev = (e.getAttributes(\"link\") as { href?: string }).href ?? \"\";\n const url =\n typeof window !== \"undefined\"\n ? window.prompt(\"Enter URL\", prev)\n : null;\n if (url === null) return; // cancelled\n if (url === \"\") {\n e.chain().focus().extendMarkRange(\"link\").unsetLink().run();\n return;\n }\n e.chain().focus().extendMarkRange(\"link\").setLink({ href: url }).run();\n },\n isActive: (e) => e.isActive(\"link\"),\n },\n undo: {\n icon: <Undo2 className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Undo\",\n onClick: (e) => e.chain().focus().undo().run(),\n isDisabled: (e) => !e.can().undo(),\n },\n redo: {\n icon: <Redo2 className=\"h-[18px] w-[18px]\" aria-hidden=\"true\" />,\n title: \"Redo\",\n onClick: (e) => e.chain().focus().redo().run(),\n isDisabled: (e) => !e.can().redo(),\n },\n};\n\nconst toolButtonClass = (active: boolean) =>\n cn(\n \"inline-flex h-8 w-8 items-center justify-center rounded-lg text-gray-600 transition\",\n \"hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-40\",\n \"dark:text-gray-400 dark:hover:bg-white/[0.06] dark:hover:text-gray-200\",\n active &&\n \"bg-brand-50 text-brand-600 hover:bg-brand-50 hover:text-brand-600 dark:bg-brand-500/15 dark:text-brand-400 dark:hover:bg-brand-500/15 dark:hover:text-brand-400\"\n );\n\nconst Divider: React.FC = () => (\n <span\n aria-hidden\n className=\"mx-1 h-5 w-px self-center bg-gray-200 dark:bg-gray-700\"\n />\n);\n\n/**\n * Tiptap-powered WYSIWYG editor.\n *\n * Heavy, optional peer-dependency component (`@tiptap/*`). It is a client\n * component and touches the DOM at import time, so in SSR frameworks render it\n * client-only (e.g. next/dynamic with `ssr:false`), like the charts.\n */\nexport const Editor: React.FC<EditorProps> = ({\n content,\n onChange,\n placeholder = \"Start writing…\",\n editable = true,\n toolbar = DEFAULT_TOOLBAR,\n rows = 8,\n className,\n editorClassName,\n}) => {\n const visibleRows = Math.max(1, Math.floor(rows));\n const minHeight = `${visibleRows * 1.5}rem`;\n const editorHeightStyle = {\n \"--tdui-editor-min-height\": minHeight,\n } as React.CSSProperties;\n\n const editor = useEditor({\n extensions: [\n StarterKit,\n Link.configure({ openOnClick: false }),\n Placeholder.configure({ placeholder }),\n Superscript,\n Subscript,\n ],\n content,\n editable,\n immediatelyRender: false,\n editorProps: {\n attributes: {\n class: \"focus:outline-none\",\n },\n },\n onUpdate: ({ editor }) => onChange?.(editor.getHTML()),\n });\n\n // Keep editability in sync if the prop changes after mount.\n React.useEffect(() => {\n editor?.setEditable(editable);\n }, [editor, editable]);\n\n // Not yet mounted (SSR / first paint): render a skeleton placeholder.\n if (!editor) {\n return (\n <div\n className={cn(\n \"w-full overflow-hidden rounded-xl border border-gray-200 dark:border-gray-800\",\n className\n )}\n >\n {editable && (\n <div className=\"h-12 border-b border-gray-200 bg-gray-50 dark:border-gray-800 dark:bg-white/[0.02]\" />\n )}\n <div\n className=\"min-h-[var(--tdui-editor-min-height)] animate-pulse bg-gray-50/50 dark:bg-white/[0.01]\"\n style={editorHeightStyle}\n />\n </div>\n );\n }\n\n const renderToolbar = () => {\n let dividerKey = 0;\n return toolbar.map((item, index) => {\n // Custom button object.\n if (typeof item === \"object\") {\n const active = item.isActive?.(editor) ?? false;\n return (\n <button\n key={item.id || `custom-${index}`}\n type=\"button\"\n title={item.title}\n aria-label={item.title}\n aria-pressed={active}\n onClick={() => item.onClick(editor)}\n className={toolButtonClass(active)}\n >\n {item.icon}\n </button>\n );\n }\n\n if (item === \"divider\") {\n return <Divider key={`divider-${dividerKey++}`} />;\n }\n\n const def = BUILTINS[item];\n if (!def) return null;\n const active = def.isActive?.(editor) ?? false;\n const disabled = def.isDisabled?.(editor) ?? false;\n return (\n <button\n key={item}\n type=\"button\"\n title={def.title}\n aria-label={def.title}\n aria-pressed={active}\n disabled={disabled}\n onClick={() => def.onClick(editor)}\n className={toolButtonClass(active)}\n >\n {def.icon}\n </button>\n );\n });\n };\n\n return (\n <div\n className={cn(\n \"w-full overflow-hidden rounded-xl border border-gray-200 bg-white shadow-theme-xs dark:border-gray-800 dark:bg-white/[0.02]\",\n className\n )}\n >\n {editable && (\n <div className=\"flex flex-wrap items-center gap-0.5 border-b border-gray-200 bg-gray-50 px-2 py-1.5 dark:border-gray-800 dark:bg-white/[0.02]\">\n {renderToolbar()}\n </div>\n )}\n <EditorContent\n editor={editor}\n style={editorHeightStyle}\n className={cn(\n \"min-h-[var(--tdui-editor-min-height)] px-4 py-3 text-sm text-gray-700 dark:text-gray-300\",\n \"rounded-b-xl\",\n // Explicit element styling (no @tailwindcss/typography assumed).\n \"[&_.ProseMirror]:min-h-[var(--tdui-editor-min-height)] [&_.ProseMirror]:outline-none\",\n \"[&_h1]:mb-3 [&_h1]:mt-4 [&_h1]:text-2xl [&_h1]:font-semibold [&_h1]:text-gray-900 dark:[&_h1]:text-white/90\",\n \"[&_h2]:mb-2 [&_h2]:mt-4 [&_h2]:text-xl [&_h2]:font-semibold [&_h2]:text-gray-900 dark:[&_h2]:text-white/90\",\n \"[&_h3]:mb-2 [&_h3]:mt-3 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:text-gray-900 dark:[&_h3]:text-white/90\",\n \"[&_p]:my-2 [&_p]:leading-relaxed\",\n \"[&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-6\",\n \"[&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-6\",\n \"[&_li]:my-1 [&_li>p]:my-0\",\n \"[&_a]:text-brand-500 [&_a]:underline hover:[&_a]:text-brand-600 dark:[&_a]:text-brand-400\",\n \"[&_blockquote]:my-3 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:text-gray-600 dark:[&_blockquote]:border-gray-700 dark:[&_blockquote]:text-gray-400\",\n \"[&_code]:rounded [&_code]:bg-gray-100 [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em] [&_code]:text-brand-600 dark:[&_code]:bg-white/[0.06] dark:[&_code]:text-brand-400\",\n \"[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-gray-900 [&_pre]:p-4 [&_pre]:font-mono [&_pre]:text-sm [&_pre]:text-gray-100 dark:[&_pre]:bg-black/40\",\n \"[&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-inherit\",\n \"[&_hr]:my-4 [&_hr]:border-gray-200 dark:[&_hr]:border-gray-800\",\n // Placeholder styling for the empty-document first node.\n \"[&_.is-editor-empty:first-child::before]:pointer-events-none [&_.is-editor-empty:first-child::before]:float-left [&_.is-editor-empty:first-child::before]:h-0 [&_.is-editor-empty:first-child::before]:text-gray-400 [&_.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] dark:[&_.is-editor-empty:first-child::before]:text-gray-600\",\n editorClassName\n )}\n />\n </div>\n );\n};\n"]}
|
|
@@ -7,102 +7,9 @@ import Link from '@tiptap/extension-link';
|
|
|
7
7
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
8
8
|
import Superscript from '@tiptap/extension-superscript';
|
|
9
9
|
import Subscript from '@tiptap/extension-subscript';
|
|
10
|
+
import { Redo2, Undo2, Link as Link$1, CodeXml, Quote, ListOrdered, List, Heading3, Heading2, Heading1, Subscript as Subscript$1, Superscript as Superscript$1, Code, Strikethrough, Italic, Bold } from 'lucide-react';
|
|
10
11
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
12
|
|
|
12
|
-
var base = {
|
|
13
|
-
width: 18,
|
|
14
|
-
height: 18,
|
|
15
|
-
viewBox: "0 0 24 24",
|
|
16
|
-
fill: "none",
|
|
17
|
-
stroke: "currentColor",
|
|
18
|
-
strokeWidth: 2,
|
|
19
|
-
strokeLinecap: "round",
|
|
20
|
-
strokeLinejoin: "round",
|
|
21
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
22
|
-
};
|
|
23
|
-
var BoldIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
24
|
-
/* @__PURE__ */ jsx("path", { d: "M6 4h7a4 4 0 0 1 0 8H6z" }),
|
|
25
|
-
/* @__PURE__ */ jsx("path", { d: "M6 12h8a4 4 0 0 1 0 8H6z" })
|
|
26
|
-
] });
|
|
27
|
-
var ItalicIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
28
|
-
/* @__PURE__ */ jsx("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
29
|
-
/* @__PURE__ */ jsx("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
30
|
-
/* @__PURE__ */ jsx("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
31
|
-
] });
|
|
32
|
-
var StrikeIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
33
|
-
/* @__PURE__ */ jsx("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
|
|
34
|
-
/* @__PURE__ */ jsx("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
|
|
35
|
-
/* @__PURE__ */ jsx("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
36
|
-
] });
|
|
37
|
-
var CodeIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
38
|
-
/* @__PURE__ */ jsx("polyline", { points: "16 18 22 12 16 6" }),
|
|
39
|
-
/* @__PURE__ */ jsx("polyline", { points: "8 6 2 12 8 18" })
|
|
40
|
-
] });
|
|
41
|
-
var Heading1Icon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
42
|
-
/* @__PURE__ */ jsx("path", { d: "M4 12h8" }),
|
|
43
|
-
/* @__PURE__ */ jsx("path", { d: "M4 18V6" }),
|
|
44
|
-
/* @__PURE__ */ jsx("path", { d: "M12 18V6" }),
|
|
45
|
-
/* @__PURE__ */ jsx("path", { d: "M17 12l3-2v8" })
|
|
46
|
-
] });
|
|
47
|
-
var Heading2Icon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
48
|
-
/* @__PURE__ */ jsx("path", { d: "M4 12h8" }),
|
|
49
|
-
/* @__PURE__ */ jsx("path", { d: "M4 18V6" }),
|
|
50
|
-
/* @__PURE__ */ jsx("path", { d: "M12 18V6" }),
|
|
51
|
-
/* @__PURE__ */ jsx("path", { d: "M17 10c2 0 3 1 3 2.5S18 15 17 16l-2 2h5" })
|
|
52
|
-
] });
|
|
53
|
-
var Heading3Icon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
54
|
-
/* @__PURE__ */ jsx("path", { d: "M4 12h8" }),
|
|
55
|
-
/* @__PURE__ */ jsx("path", { d: "M4 18V6" }),
|
|
56
|
-
/* @__PURE__ */ jsx("path", { d: "M12 18V6" }),
|
|
57
|
-
/* @__PURE__ */ jsx("path", { d: "M17 10c2.5-1 3.5 1 2.5 2c1 1 0.5 4-2.5 3" })
|
|
58
|
-
] });
|
|
59
|
-
var BulletListIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
60
|
-
/* @__PURE__ */ jsx("line", { x1: "9", y1: "6", x2: "20", y2: "6" }),
|
|
61
|
-
/* @__PURE__ */ jsx("line", { x1: "9", y1: "12", x2: "20", y2: "12" }),
|
|
62
|
-
/* @__PURE__ */ jsx("line", { x1: "9", y1: "18", x2: "20", y2: "18" }),
|
|
63
|
-
/* @__PURE__ */ jsx("circle", { cx: "4", cy: "6", r: "1" }),
|
|
64
|
-
/* @__PURE__ */ jsx("circle", { cx: "4", cy: "12", r: "1" }),
|
|
65
|
-
/* @__PURE__ */ jsx("circle", { cx: "4", cy: "18", r: "1" })
|
|
66
|
-
] });
|
|
67
|
-
var OrderedListIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
68
|
-
/* @__PURE__ */ jsx("line", { x1: "10", y1: "6", x2: "20", y2: "6" }),
|
|
69
|
-
/* @__PURE__ */ jsx("line", { x1: "10", y1: "12", x2: "20", y2: "12" }),
|
|
70
|
-
/* @__PURE__ */ jsx("line", { x1: "10", y1: "18", x2: "20", y2: "18" }),
|
|
71
|
-
/* @__PURE__ */ jsx("path", { d: "M4 6V3.5L3 4" }),
|
|
72
|
-
/* @__PURE__ */ jsx("path", { d: "M3 12h2l-2 3h2" }),
|
|
73
|
-
/* @__PURE__ */ jsx("path", { d: "M3 17h2v3H3" })
|
|
74
|
-
] });
|
|
75
|
-
var BlockquoteIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
76
|
-
/* @__PURE__ */ jsx("path", { d: "M3 21c3 0 7-1 7-8V5H3v7h4" }),
|
|
77
|
-
/* @__PURE__ */ jsx("path", { d: "M14 21c3 0 7-1 7-8V5h-7v7h4" })
|
|
78
|
-
] });
|
|
79
|
-
var CodeBlockIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
80
|
-
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
81
|
-
/* @__PURE__ */ jsx("polyline", { points: "9 9 7 12 9 15" }),
|
|
82
|
-
/* @__PURE__ */ jsx("polyline", { points: "15 9 17 12 15 15" })
|
|
83
|
-
] });
|
|
84
|
-
var LinkIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
85
|
-
/* @__PURE__ */ jsx("path", { d: "M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1 1" }),
|
|
86
|
-
/* @__PURE__ */ jsx("path", { d: "M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1-1" })
|
|
87
|
-
] });
|
|
88
|
-
var UndoIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
89
|
-
/* @__PURE__ */ jsx("path", { d: "M3 7v6h6" }),
|
|
90
|
-
/* @__PURE__ */ jsx("path", { d: "M3 13a9 9 0 1 0 3-7.7L3 8" })
|
|
91
|
-
] });
|
|
92
|
-
var RedoIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
93
|
-
/* @__PURE__ */ jsx("path", { d: "M21 7v6h-6" }),
|
|
94
|
-
/* @__PURE__ */ jsx("path", { d: "M21 13a9 9 0 1 1-3-7.7L21 8" })
|
|
95
|
-
] });
|
|
96
|
-
var SuperscriptIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
97
|
-
/* @__PURE__ */ jsx("path", { d: "m4 19 8-10" }),
|
|
98
|
-
/* @__PURE__ */ jsx("path", { d: "m12 19-8-10" }),
|
|
99
|
-
/* @__PURE__ */ jsx("path", { d: "M20 9h-4c0-1.5.44-2 1.5-2.5S20 5.6 20 4.5C20 3.7 19.3 3 18.5 3S17 3.7 17 4.5" })
|
|
100
|
-
] });
|
|
101
|
-
var SubscriptIcon = () => /* @__PURE__ */ jsxs("svg", { ...base, children: [
|
|
102
|
-
/* @__PURE__ */ jsx("path", { d: "m4 5 8 10" }),
|
|
103
|
-
/* @__PURE__ */ jsx("path", { d: "m12 5-8 10" }),
|
|
104
|
-
/* @__PURE__ */ jsx("path", { d: "M20 21h-4c0-1.5.44-2 1.5-2.5S20 17.6 20 16.5c0-.8-.7-1.5-1.5-1.5s-1.5.7-1.5 1.5" })
|
|
105
|
-
] });
|
|
106
13
|
var DEFAULT_TOOLBAR = [
|
|
107
14
|
"bold",
|
|
108
15
|
"italic",
|
|
@@ -127,85 +34,85 @@ var DEFAULT_TOOLBAR = [
|
|
|
127
34
|
];
|
|
128
35
|
var BUILTINS = {
|
|
129
36
|
bold: {
|
|
130
|
-
icon: /* @__PURE__ */ jsx(
|
|
37
|
+
icon: /* @__PURE__ */ jsx(Bold, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
131
38
|
title: "Bold",
|
|
132
39
|
onClick: (e) => e.chain().focus().toggleBold().run(),
|
|
133
40
|
isActive: (e) => e.isActive("bold")
|
|
134
41
|
},
|
|
135
42
|
italic: {
|
|
136
|
-
icon: /* @__PURE__ */ jsx(
|
|
43
|
+
icon: /* @__PURE__ */ jsx(Italic, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
137
44
|
title: "Italic",
|
|
138
45
|
onClick: (e) => e.chain().focus().toggleItalic().run(),
|
|
139
46
|
isActive: (e) => e.isActive("italic")
|
|
140
47
|
},
|
|
141
48
|
strike: {
|
|
142
|
-
icon: /* @__PURE__ */ jsx(
|
|
49
|
+
icon: /* @__PURE__ */ jsx(Strikethrough, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
143
50
|
title: "Strikethrough",
|
|
144
51
|
onClick: (e) => e.chain().focus().toggleStrike().run(),
|
|
145
52
|
isActive: (e) => e.isActive("strike")
|
|
146
53
|
},
|
|
147
54
|
code: {
|
|
148
|
-
icon: /* @__PURE__ */ jsx(
|
|
55
|
+
icon: /* @__PURE__ */ jsx(Code, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
149
56
|
title: "Inline code",
|
|
150
57
|
onClick: (e) => e.chain().focus().toggleCode().run(),
|
|
151
58
|
isActive: (e) => e.isActive("code")
|
|
152
59
|
},
|
|
153
60
|
superscript: {
|
|
154
|
-
icon: /* @__PURE__ */ jsx(
|
|
61
|
+
icon: /* @__PURE__ */ jsx(Superscript$1, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
155
62
|
title: "Superscript",
|
|
156
63
|
onClick: (e) => e.chain().focus().toggleSuperscript().run(),
|
|
157
64
|
isActive: (e) => e.isActive("superscript")
|
|
158
65
|
},
|
|
159
66
|
subscript: {
|
|
160
|
-
icon: /* @__PURE__ */ jsx(
|
|
67
|
+
icon: /* @__PURE__ */ jsx(Subscript$1, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
161
68
|
title: "Subscript",
|
|
162
69
|
onClick: (e) => e.chain().focus().toggleSubscript().run(),
|
|
163
70
|
isActive: (e) => e.isActive("subscript")
|
|
164
71
|
},
|
|
165
72
|
heading1: {
|
|
166
|
-
icon: /* @__PURE__ */ jsx(
|
|
73
|
+
icon: /* @__PURE__ */ jsx(Heading1, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
167
74
|
title: "Heading 1",
|
|
168
75
|
onClick: (e) => e.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
169
76
|
isActive: (e) => e.isActive("heading", { level: 1 })
|
|
170
77
|
},
|
|
171
78
|
heading2: {
|
|
172
|
-
icon: /* @__PURE__ */ jsx(
|
|
79
|
+
icon: /* @__PURE__ */ jsx(Heading2, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
173
80
|
title: "Heading 2",
|
|
174
81
|
onClick: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
175
82
|
isActive: (e) => e.isActive("heading", { level: 2 })
|
|
176
83
|
},
|
|
177
84
|
heading3: {
|
|
178
|
-
icon: /* @__PURE__ */ jsx(
|
|
85
|
+
icon: /* @__PURE__ */ jsx(Heading3, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
179
86
|
title: "Heading 3",
|
|
180
87
|
onClick: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
181
88
|
isActive: (e) => e.isActive("heading", { level: 3 })
|
|
182
89
|
},
|
|
183
90
|
bulletList: {
|
|
184
|
-
icon: /* @__PURE__ */ jsx(
|
|
91
|
+
icon: /* @__PURE__ */ jsx(List, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
185
92
|
title: "Bullet list",
|
|
186
93
|
onClick: (e) => e.chain().focus().toggleBulletList().run(),
|
|
187
94
|
isActive: (e) => e.isActive("bulletList")
|
|
188
95
|
},
|
|
189
96
|
orderedList: {
|
|
190
|
-
icon: /* @__PURE__ */ jsx(
|
|
97
|
+
icon: /* @__PURE__ */ jsx(ListOrdered, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
191
98
|
title: "Ordered list",
|
|
192
99
|
onClick: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
193
100
|
isActive: (e) => e.isActive("orderedList")
|
|
194
101
|
},
|
|
195
102
|
blockquote: {
|
|
196
|
-
icon: /* @__PURE__ */ jsx(
|
|
103
|
+
icon: /* @__PURE__ */ jsx(Quote, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
197
104
|
title: "Blockquote",
|
|
198
105
|
onClick: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
199
106
|
isActive: (e) => e.isActive("blockquote")
|
|
200
107
|
},
|
|
201
108
|
codeBlock: {
|
|
202
|
-
icon: /* @__PURE__ */ jsx(
|
|
109
|
+
icon: /* @__PURE__ */ jsx(CodeXml, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
203
110
|
title: "Code block",
|
|
204
111
|
onClick: (e) => e.chain().focus().toggleCodeBlock().run(),
|
|
205
112
|
isActive: (e) => e.isActive("codeBlock")
|
|
206
113
|
},
|
|
207
114
|
link: {
|
|
208
|
-
icon: /* @__PURE__ */ jsx(
|
|
115
|
+
icon: /* @__PURE__ */ jsx(Link$1, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
209
116
|
title: "Link",
|
|
210
117
|
// Minimal UX: window.prompt for the URL (no extra UI deps). Empty input
|
|
211
118
|
// clears any existing link on the selection.
|
|
@@ -222,13 +129,13 @@ var BUILTINS = {
|
|
|
222
129
|
isActive: (e) => e.isActive("link")
|
|
223
130
|
},
|
|
224
131
|
undo: {
|
|
225
|
-
icon: /* @__PURE__ */ jsx(
|
|
132
|
+
icon: /* @__PURE__ */ jsx(Undo2, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
226
133
|
title: "Undo",
|
|
227
134
|
onClick: (e) => e.chain().focus().undo().run(),
|
|
228
135
|
isDisabled: (e) => !e.can().undo()
|
|
229
136
|
},
|
|
230
137
|
redo: {
|
|
231
|
-
icon: /* @__PURE__ */ jsx(
|
|
138
|
+
icon: /* @__PURE__ */ jsx(Redo2, { className: "h-[18px] w-[18px]", "aria-hidden": "true" }),
|
|
232
139
|
title: "Redo",
|
|
233
140
|
onClick: (e) => e.chain().focus().redo().run(),
|
|
234
141
|
isDisabled: (e) => !e.can().redo()
|
|
@@ -253,9 +160,15 @@ var Editor = ({
|
|
|
253
160
|
placeholder = "Start writing\u2026",
|
|
254
161
|
editable = true,
|
|
255
162
|
toolbar = DEFAULT_TOOLBAR,
|
|
163
|
+
rows = 8,
|
|
256
164
|
className,
|
|
257
165
|
editorClassName
|
|
258
166
|
}) => {
|
|
167
|
+
const visibleRows = Math.max(1, Math.floor(rows));
|
|
168
|
+
const minHeight = `${visibleRows * 1.5}rem`;
|
|
169
|
+
const editorHeightStyle = {
|
|
170
|
+
"--tdui-editor-min-height": minHeight
|
|
171
|
+
};
|
|
259
172
|
const editor = useEditor({
|
|
260
173
|
extensions: [
|
|
261
174
|
StarterKit,
|
|
@@ -287,7 +200,13 @@ var Editor = ({
|
|
|
287
200
|
),
|
|
288
201
|
children: [
|
|
289
202
|
editable && /* @__PURE__ */ jsx("div", { className: "h-12 border-b border-gray-200 bg-gray-50 dark:border-gray-800 dark:bg-white/[0.02]" }),
|
|
290
|
-
/* @__PURE__ */ jsx(
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
className: "min-h-[var(--tdui-editor-min-height)] animate-pulse bg-gray-50/50 dark:bg-white/[0.01]",
|
|
207
|
+
style: editorHeightStyle
|
|
208
|
+
}
|
|
209
|
+
)
|
|
291
210
|
]
|
|
292
211
|
}
|
|
293
212
|
);
|
|
@@ -347,11 +266,12 @@ var Editor = ({
|
|
|
347
266
|
EditorContent,
|
|
348
267
|
{
|
|
349
268
|
editor,
|
|
269
|
+
style: editorHeightStyle,
|
|
350
270
|
className: cn(
|
|
351
|
-
"min-h-[
|
|
271
|
+
"min-h-[var(--tdui-editor-min-height)] px-4 py-3 text-sm text-gray-700 dark:text-gray-300",
|
|
352
272
|
"rounded-b-xl",
|
|
353
273
|
// Explicit element styling (no @tailwindcss/typography assumed).
|
|
354
|
-
"[&_.ProseMirror]:min-h-[
|
|
274
|
+
"[&_.ProseMirror]:min-h-[var(--tdui-editor-min-height)] [&_.ProseMirror]:outline-none",
|
|
355
275
|
"[&_h1]:mb-3 [&_h1]:mt-4 [&_h1]:text-2xl [&_h1]:font-semibold [&_h1]:text-gray-900 dark:[&_h1]:text-white/90",
|
|
356
276
|
"[&_h2]:mb-2 [&_h2]:mt-4 [&_h2]:text-xl [&_h2]:font-semibold [&_h2]:text-gray-900 dark:[&_h2]:text-white/90",
|
|
357
277
|
"[&_h3]:mb-2 [&_h3]:mt-3 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:text-gray-900 dark:[&_h3]:text-white/90",
|
|
@@ -377,5 +297,5 @@ var Editor = ({
|
|
|
377
297
|
};
|
|
378
298
|
|
|
379
299
|
export { Editor };
|
|
380
|
-
//# sourceMappingURL=chunk-
|
|
381
|
-
//# sourceMappingURL=chunk-
|
|
300
|
+
//# sourceMappingURL=chunk-OYBYDSNI.js.map
|
|
301
|
+
//# sourceMappingURL=chunk-OYBYDSNI.js.map
|