@wair/editor 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +449 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +47 -0
- package/dist/index.d.mts +48 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +81 -0
package/dist/index.css
ADDED
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
@layer base {
|
|
6
|
+
:root {
|
|
7
|
+
--background: 0 0% 100%;
|
|
8
|
+
--foreground: 0 0% 3.9%;
|
|
9
|
+
--card: 0 0% 100%;
|
|
10
|
+
--card-foreground: 0 0% 3.9%;
|
|
11
|
+
--popover: 0 0% 100%;
|
|
12
|
+
--popover-foreground: 0 0% 3.9%;
|
|
13
|
+
--primary: 0 0% 9%;
|
|
14
|
+
--primary-foreground: 0 0% 98%;
|
|
15
|
+
--secondary: 0 0% 96.1%;
|
|
16
|
+
--secondary-foreground: 0 0% 9%;
|
|
17
|
+
--muted: 0 0% 96.1%;
|
|
18
|
+
--muted-foreground: 0 0% 45.1%;
|
|
19
|
+
--accent: 0 0% 96.1%;
|
|
20
|
+
--accent-foreground: 0 0% 9%;
|
|
21
|
+
--destructive: 0 84.2% 60.2%;
|
|
22
|
+
--destructive-foreground: 0 0% 98%;
|
|
23
|
+
--input: 0 0% 89.8%;
|
|
24
|
+
--ring: 0 0% 3.9%;
|
|
25
|
+
--chart-1: 12 76% 61%;
|
|
26
|
+
--chart-2: 173 58% 39%;
|
|
27
|
+
--chart-3: 197 37% 24%;
|
|
28
|
+
--chart-4: 43 74% 66%;
|
|
29
|
+
--chart-5: 27 87% 67%;
|
|
30
|
+
/* 新增变量 */
|
|
31
|
+
--brand: 211 100% 49%;
|
|
32
|
+
--brand-heavy: 212 100% 27%;
|
|
33
|
+
--radius: 8px;
|
|
34
|
+
--gray-rgb: 28, 31, 35;
|
|
35
|
+
--text-primary: 214 11% 12%;
|
|
36
|
+
--text-second: 210 4% 30%;
|
|
37
|
+
--text-auxiliary: 210 2% 47%;
|
|
38
|
+
--text-disabled: 210 1% 74%;
|
|
39
|
+
|
|
40
|
+
--border-default: 214 11% 12% / 0.06;
|
|
41
|
+
--border-focus: 211 100% 49%;
|
|
42
|
+
|
|
43
|
+
--status-success: 126 50% 47%;
|
|
44
|
+
--status-success-heavy: 126 51% 25%;
|
|
45
|
+
|
|
46
|
+
--status-warning: 32 100% 49%;
|
|
47
|
+
--status-warning-heavy: 32 100% 27%;
|
|
48
|
+
|
|
49
|
+
--status-danger: 7 95% 55%;
|
|
50
|
+
--status-danger-heavy: 7 77% 30%;
|
|
51
|
+
|
|
52
|
+
--cyan: 186 95% 37%;
|
|
53
|
+
--cyan-heavy: 186 94% 20%;
|
|
54
|
+
|
|
55
|
+
--purple: 291 63% 43%;
|
|
56
|
+
--purple-heavy: 291 63% 24%;
|
|
57
|
+
|
|
58
|
+
--color-1: 0 100% 63%;
|
|
59
|
+
--color-2: 270 100% 63%;
|
|
60
|
+
--color-3: 210 100% 63%;
|
|
61
|
+
--color-4: 195 100% 63%;
|
|
62
|
+
--color-5: 90 100% 63%;
|
|
63
|
+
}
|
|
64
|
+
.dark {
|
|
65
|
+
--background: 0 0% 3.9%;
|
|
66
|
+
--foreground: 0 0% 98%;
|
|
67
|
+
--card: 0 0% 3.9%;
|
|
68
|
+
--card-foreground: 0 0% 98%;
|
|
69
|
+
--popover: 0 0% 3.9%;
|
|
70
|
+
--popover-foreground: 0 0% 98%;
|
|
71
|
+
--primary: 0 0% 98%;
|
|
72
|
+
--primary-foreground: 0 0% 9%;
|
|
73
|
+
--secondary: 0 0% 14.9%;
|
|
74
|
+
--secondary-foreground: 0 0% 98%;
|
|
75
|
+
--muted: 0 0% 14.9%;
|
|
76
|
+
--muted-foreground: 0 0% 63.9%;
|
|
77
|
+
--accent: 0 0% 14.9%;
|
|
78
|
+
--accent-foreground: 0 0% 98%;
|
|
79
|
+
--destructive: 0 62.8% 30.6%;
|
|
80
|
+
--destructive-foreground: 0 0% 98%;
|
|
81
|
+
--border: 0 0% 14.9%;
|
|
82
|
+
--input: 0 0% 14.9%;
|
|
83
|
+
--ring: 0 0% 83.1%;
|
|
84
|
+
--chart-1: 220 70% 50%;
|
|
85
|
+
--chart-2: 160 60% 45%;
|
|
86
|
+
--chart-3: 30 80% 55%;
|
|
87
|
+
--chart-4: 280 65% 60%;
|
|
88
|
+
--chart-5: 340 75% 55%;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.tiptap {
|
|
93
|
+
p {
|
|
94
|
+
@apply my-3;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.tiptap {
|
|
99
|
+
@apply relative min-h-[500px] px-20 py-10 focus:outline-none;
|
|
100
|
+
outline: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* 标题样式 */
|
|
104
|
+
.tiptap h1 {
|
|
105
|
+
@apply my-4 text-3xl font-bold tracking-tight;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.tiptap h2 {
|
|
109
|
+
@apply my-3 text-2xl font-semibold tracking-tight;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* 占位符样式 (Placeholder Extension) */
|
|
113
|
+
.tiptap p.is-editor-empty:first-child::before {
|
|
114
|
+
@apply pointer-events-none float-left h-0 text-muted-foreground;
|
|
115
|
+
content: attr(data-placeholder);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.tiptap h1.is-empty::before,
|
|
119
|
+
.tiptap h2.is-empty::before,
|
|
120
|
+
.tiptap h3.is-empty::before,
|
|
121
|
+
.tiptap h4.is-empty::before,
|
|
122
|
+
.tiptap h5.is-empty::before,
|
|
123
|
+
.tiptap h6.is-empty::before,
|
|
124
|
+
.tiptap p.is-empty::before {
|
|
125
|
+
color: hsl(var(--muted-foreground) / 0.5);
|
|
126
|
+
content: attr(data-placeholder);
|
|
127
|
+
float: left;
|
|
128
|
+
height: 0;
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
.tiptap pre.is-empty::before {
|
|
132
|
+
color: black;
|
|
133
|
+
content: attr(data-placeholder);
|
|
134
|
+
float: left;
|
|
135
|
+
height: 0;
|
|
136
|
+
pointer-events: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* 选中文本样式 */
|
|
140
|
+
.tiptap *::selection {
|
|
141
|
+
@apply bg-blue-100 text-blue-900;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* 图片样式 */
|
|
145
|
+
.tiptap img {
|
|
146
|
+
@apply my-4 h-auto max-w-full rounded-lg border shadow-sm transition-all;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.tiptap img.ProseMirror-selectednode {
|
|
150
|
+
@apply border-blue-500 outline outline-4 outline-blue-500/30;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* 列表样式优化 */
|
|
154
|
+
.tiptap ul {
|
|
155
|
+
@apply ml-6 list-disc space-y-1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.tiptap ol {
|
|
159
|
+
@apply ml-6 list-decimal space-y-1;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* src/styles/tiptap.css */
|
|
163
|
+
|
|
164
|
+
.tiptap ul[data-type="taskList"] {
|
|
165
|
+
list-style: none;
|
|
166
|
+
padding: 0;
|
|
167
|
+
margin-left: 0.5rem;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.tiptap ul[data-type="taskList"] li {
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* 隐藏原生 checkbox 的默认样式,可以使用 shadcn 风格定制 */
|
|
176
|
+
.tiptap ul[data-type="taskList"] li > label {
|
|
177
|
+
@apply mr-3 flex-shrink-0 cursor-pointer select-none pt-1;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.tiptap ul[data-type="taskList"] li > label input[type="checkbox"] {
|
|
181
|
+
@apply h-4 w-4 cursor-pointer rounded border-muted-foreground/30 accent-primary;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* 任务内容容器 */
|
|
185
|
+
.tiptap ul[data-type="taskList"] li > div {
|
|
186
|
+
@apply min-w-0 flex-1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* --- 核心功能:勾选后的中划线效果 --- */
|
|
190
|
+
.tiptap ul[data-type="taskList"] li[data-checked="true"] > div {
|
|
191
|
+
@apply text-muted-foreground;
|
|
192
|
+
text-decoration: line-through;
|
|
193
|
+
text-decoration-thickness: 2px;
|
|
194
|
+
text-decoration-color: hsl(var(--muted-foreground) / 0.5);
|
|
195
|
+
transition: all 0.2s ease;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* 嵌套列表的缩进 */
|
|
199
|
+
.tiptap ul[data-type="taskList"] ul[data-type="taskList"] {
|
|
200
|
+
margin-left: 1.5rem;
|
|
201
|
+
margin-top: 0.25rem;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* 引用块样式 */
|
|
205
|
+
.tiptap blockquote {
|
|
206
|
+
@apply border-l-4 border-muted-foreground/30 pl-4 italic text-muted-foreground;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.tiptap code {
|
|
210
|
+
@apply rounded-md bg-muted px-1.5 py-0.5 text-sm text-black;
|
|
211
|
+
}
|
|
212
|
+
.tiptap pre {
|
|
213
|
+
@apply my-6 rounded-lg bg-muted p-4 font-mono text-black;
|
|
214
|
+
}
|
|
215
|
+
.tiptap pre code {
|
|
216
|
+
@apply bg-transparent p-0 text-sm;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* 编辑器基础样式 */
|
|
220
|
+
.tiptap {
|
|
221
|
+
/* 第一个子元素移除上边距 */
|
|
222
|
+
:first-child {
|
|
223
|
+
@apply mt-0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* 图片样式:块级元素、高度自动、上下边距为0、最大宽度100% */
|
|
227
|
+
img {
|
|
228
|
+
@apply my-0 block h-auto max-w-full;
|
|
229
|
+
|
|
230
|
+
/* 图片被选中时的样式:紫色3px轮廓线 */
|
|
231
|
+
&.ProseMirror-selectednode {
|
|
232
|
+
@apply outline-[3px] outline-purple-500;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* 调整大小手柄的基础样式 */
|
|
237
|
+
[data-resize-handle] {
|
|
238
|
+
@apply absolute z-10 rounded-[2px];
|
|
239
|
+
@apply border border-white/80 bg-gray-500/10;
|
|
240
|
+
|
|
241
|
+
/* 悬停时背景更深 */
|
|
242
|
+
&:hover {
|
|
243
|
+
@apply bg-black/30;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* 四个角落的手柄:8x8像素 */
|
|
247
|
+
&[data-resize-handle="top-left"],
|
|
248
|
+
&[data-resize-handle="top-right"],
|
|
249
|
+
&[data-resize-handle="bottom-left"],
|
|
250
|
+
&[data-resize-handle="bottom-right"] {
|
|
251
|
+
@apply h-2 w-2;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* 左上角手柄:位置和光标样式 */
|
|
255
|
+
&[data-resize-handle="top-left"] {
|
|
256
|
+
@apply -left-1 -top-1 cursor-nwse-resize;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* 右上角手柄:位置和光标样式 */
|
|
260
|
+
&[data-resize-handle="top-right"] {
|
|
261
|
+
@apply -right-1 -top-1 cursor-nesw-resize;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* 左下角手柄:位置和光标样式 */
|
|
265
|
+
&[data-resize-handle="bottom-left"] {
|
|
266
|
+
@apply -bottom-1 -left-1 cursor-nesw-resize;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* 右下角手柄:位置和光标样式 */
|
|
270
|
+
&[data-resize-handle="bottom-right"] {
|
|
271
|
+
@apply -bottom-1 -right-1 cursor-nwse-resize;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* 上下边缘手柄:高度6px,左右各留8px */
|
|
275
|
+
&[data-resize-handle="top"],
|
|
276
|
+
&[data-resize-handle="bottom"] {
|
|
277
|
+
@apply left-2 right-2 h-0.5;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* 顶部边缘手柄:位置和光标样式 */
|
|
281
|
+
&[data-resize-handle="top"] {
|
|
282
|
+
@apply -top-[3px] cursor-ns-resize;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* 底部边缘手柄:位置和光标样式 */
|
|
286
|
+
&[data-resize-handle="bottom"] {
|
|
287
|
+
@apply -bottom-[3px] cursor-ns-resize;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/* 左右边缘手柄:宽度6px,上下各留8px */
|
|
291
|
+
&[data-resize-handle="left"],
|
|
292
|
+
&[data-resize-handle="right"] {
|
|
293
|
+
@apply bottom-2 top-2 w-0.5;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* 左侧边缘手柄:位置和光标样式 */
|
|
297
|
+
&[data-resize-handle="left"] {
|
|
298
|
+
@apply -left-[3px] cursor-ew-resize;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* 右侧边缘手柄:位置和光标样式 */
|
|
302
|
+
&[data-resize-handle="right"] {
|
|
303
|
+
@apply -right-[3px] cursor-ew-resize;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/* 调整大小状态激活时的包装器样式:1px黑色半透明轮廓 */
|
|
308
|
+
[data-resize-state="true"] [data-resize-wrapper] {
|
|
309
|
+
@apply rounded-sm outline outline-1 outline-black/25;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.tiptap {
|
|
314
|
+
.tableWrapper {
|
|
315
|
+
@apply my-6 overflow-x-auto overflow-y-hidden pl-3 pt-3;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
table {
|
|
319
|
+
@apply my-0 box-border w-full border-collapse rounded border-black/10;
|
|
320
|
+
@apply dark:border-white/20;
|
|
321
|
+
|
|
322
|
+
td,
|
|
323
|
+
th {
|
|
324
|
+
@apply relative min-w-[20px] border border-black/10 p-2 text-left align-top;
|
|
325
|
+
@apply dark:border-white/20;
|
|
326
|
+
|
|
327
|
+
&:first-of-type:not(a) {
|
|
328
|
+
@apply mt-0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
p {
|
|
332
|
+
@apply m-0;
|
|
333
|
+
|
|
334
|
+
& + p {
|
|
335
|
+
@apply mt-3;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
th {
|
|
341
|
+
@apply font-bold;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.column-resize-handle {
|
|
345
|
+
@apply pointer-events-none absolute -bottom-0.5 -right-0.5 top-0 w-1 bg-blue-500;
|
|
346
|
+
&::before {
|
|
347
|
+
@apply ml-2 h-full w-[1px] bg-black/20;
|
|
348
|
+
@apply dark:bg-white/20;
|
|
349
|
+
content: "";
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.selectedCell {
|
|
354
|
+
@apply border-double border-black/20 bg-black/5;
|
|
355
|
+
@apply dark:border-white/20 dark:bg-white/10;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.grip-column,
|
|
359
|
+
.grip-row {
|
|
360
|
+
@apply absolute flex cursor-pointer items-center justify-center bg-black/5;
|
|
361
|
+
@apply dark:bg-white/10;
|
|
362
|
+
}
|
|
363
|
+
.grip-column {
|
|
364
|
+
@apply -top-3 left-0 -ml-[1px] h-3 w-[calc(100%+1px)] border-l border-black/20;
|
|
365
|
+
@apply dark:border-white/20;
|
|
366
|
+
|
|
367
|
+
&:hover,
|
|
368
|
+
&.selected {
|
|
369
|
+
&::before {
|
|
370
|
+
content: "";
|
|
371
|
+
@apply w-2.5;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
&:hover {
|
|
376
|
+
@apply bg-black/10;
|
|
377
|
+
@apply dark:bg-white/20;
|
|
378
|
+
|
|
379
|
+
&::before {
|
|
380
|
+
@apply border-b-2 border-dotted border-black/60;
|
|
381
|
+
@apply dark:border-white/60;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
&.first {
|
|
386
|
+
@apply rounded-tl-sm border-transparent;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
&.last {
|
|
390
|
+
@apply rounded-tr-sm;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
&.selected {
|
|
394
|
+
@apply border-black/30 bg-black/30 shadow-sm;
|
|
395
|
+
@apply dark:border-white/30 dark:bg-white/30;
|
|
396
|
+
|
|
397
|
+
&::before {
|
|
398
|
+
@apply border-b-2 border-dotted;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.grip-row {
|
|
404
|
+
@apply -left-3 top-0 -mt-[1px] h-[calc(100%+1px)] w-3 border-t border-black/20;
|
|
405
|
+
@apply dark:border-white/20;
|
|
406
|
+
|
|
407
|
+
&:hover,
|
|
408
|
+
&.selected {
|
|
409
|
+
&::before {
|
|
410
|
+
@apply h-2.5;
|
|
411
|
+
content: "";
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
&:hover {
|
|
415
|
+
@apply bg-black/10;
|
|
416
|
+
@apply dark:bg-white/20;
|
|
417
|
+
|
|
418
|
+
&::before {
|
|
419
|
+
@apply border-l-2 border-dotted border-black/60;
|
|
420
|
+
@apply dark:border-white/60;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
&.first {
|
|
425
|
+
@apply rounded-tl-sm border-transparent;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
&.last {
|
|
429
|
+
@apply rounded-bl-sm;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
&.selected {
|
|
433
|
+
@apply border-black/30 bg-black/30 shadow-sm;
|
|
434
|
+
@apply dark:border-white/30 dark:bg-white/30;
|
|
435
|
+
|
|
436
|
+
&::before {
|
|
437
|
+
@apply border-l-2 border-dotted;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
&.resize-cursor {
|
|
444
|
+
@apply cursor-col-resize;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
/*# sourceMappingURL=index.css.map*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.css","names":[],"sources":["../src/styles/index.css","../src/styles/tiptap.css","../src/styles/image.css","../src/styles/table.css"],"sourcesContent":["@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer base {\n :root {\n --background: 0 0% 100%;\n --foreground: 0 0% 3.9%;\n --card: 0 0% 100%;\n --card-foreground: 0 0% 3.9%;\n --popover: 0 0% 100%;\n --popover-foreground: 0 0% 3.9%;\n --primary: 0 0% 9%;\n --primary-foreground: 0 0% 98%;\n --secondary: 0 0% 96.1%;\n --secondary-foreground: 0 0% 9%;\n --muted: 0 0% 96.1%;\n --muted-foreground: 0 0% 45.1%;\n --accent: 0 0% 96.1%;\n --accent-foreground: 0 0% 9%;\n --destructive: 0 84.2% 60.2%;\n --destructive-foreground: 0 0% 98%;\n --input: 0 0% 89.8%;\n --ring: 0 0% 3.9%;\n --chart-1: 12 76% 61%;\n --chart-2: 173 58% 39%;\n --chart-3: 197 37% 24%;\n --chart-4: 43 74% 66%;\n --chart-5: 27 87% 67%;\n /* 新增变量 */\n --brand: 211 100% 49%;\n --brand-heavy: 212 100% 27%;\n --radius: 8px;\n --gray-rgb: 28, 31, 35;\n --text-primary: 214 11% 12%;\n --text-second: 210 4% 30%;\n --text-auxiliary: 210 2% 47%;\n --text-disabled: 210 1% 74%;\n\n --border-default: 214 11% 12% / 0.06;\n --border-focus: 211 100% 49%;\n\n --status-success: 126 50% 47%;\n --status-success-heavy: 126 51% 25%;\n\n --status-warning: 32 100% 49%;\n --status-warning-heavy: 32 100% 27%;\n\n --status-danger: 7 95% 55%;\n --status-danger-heavy: 7 77% 30%;\n\n --cyan: 186 95% 37%;\n --cyan-heavy: 186 94% 20%;\n\n --purple: 291 63% 43%;\n --purple-heavy: 291 63% 24%;\n\n --color-1: 0 100% 63%;\n --color-2: 270 100% 63%;\n --color-3: 210 100% 63%;\n --color-4: 195 100% 63%;\n --color-5: 90 100% 63%;\n }\n .dark {\n --background: 0 0% 3.9%;\n --foreground: 0 0% 98%;\n --card: 0 0% 3.9%;\n --card-foreground: 0 0% 98%;\n --popover: 0 0% 3.9%;\n --popover-foreground: 0 0% 98%;\n --primary: 0 0% 98%;\n --primary-foreground: 0 0% 9%;\n --secondary: 0 0% 14.9%;\n --secondary-foreground: 0 0% 98%;\n --muted: 0 0% 14.9%;\n --muted-foreground: 0 0% 63.9%;\n --accent: 0 0% 14.9%;\n --accent-foreground: 0 0% 98%;\n --destructive: 0 62.8% 30.6%;\n --destructive-foreground: 0 0% 98%;\n --border: 0 0% 14.9%;\n --input: 0 0% 14.9%;\n --ring: 0 0% 83.1%;\n --chart-1: 220 70% 50%;\n --chart-2: 160 60% 45%;\n --chart-3: 30 80% 55%;\n --chart-4: 280 65% 60%;\n --chart-5: 340 75% 55%;\n }\n}\n\n.tiptap {\n p {\n @apply my-3;\n }\n}\n",".tiptap {\n @apply relative min-h-[500px] px-20 py-10 focus:outline-none;\n outline: none;\n}\n\n/* 标题样式 */\n.tiptap h1 {\n @apply my-4 text-3xl font-bold tracking-tight;\n}\n\n.tiptap h2 {\n @apply my-3 text-2xl font-semibold tracking-tight;\n}\n\n/* 占位符样式 (Placeholder Extension) */\n.tiptap p.is-editor-empty:first-child::before {\n @apply pointer-events-none float-left h-0 text-muted-foreground;\n content: attr(data-placeholder);\n}\n\n.tiptap h1.is-empty::before,\n.tiptap h2.is-empty::before,\n.tiptap h3.is-empty::before,\n.tiptap h4.is-empty::before,\n.tiptap h5.is-empty::before,\n.tiptap h6.is-empty::before,\n.tiptap p.is-empty::before {\n color: hsl(var(--muted-foreground) / 0.5);\n content: attr(data-placeholder);\n float: left;\n height: 0;\n pointer-events: none;\n}\n.tiptap pre.is-empty::before {\n color: black;\n content: attr(data-placeholder);\n float: left;\n height: 0;\n pointer-events: none;\n}\n\n/* 选中文本样式 */\n.tiptap *::selection {\n @apply bg-blue-100 text-blue-900;\n}\n\n/* 图片样式 */\n.tiptap img {\n @apply my-4 h-auto max-w-full rounded-lg border shadow-sm transition-all;\n}\n\n.tiptap img.ProseMirror-selectednode {\n @apply border-blue-500 outline outline-4 outline-blue-500/30;\n}\n\n/* 列表样式优化 */\n.tiptap ul {\n @apply ml-6 list-disc space-y-1;\n}\n\n.tiptap ol {\n @apply ml-6 list-decimal space-y-1;\n}\n\n/* src/styles/tiptap.css */\n\n.tiptap ul[data-type=\"taskList\"] {\n list-style: none;\n padding: 0;\n margin-left: 0.5rem;\n}\n\n.tiptap ul[data-type=\"taskList\"] li {\n display: flex;\n align-items: center;\n}\n\n/* 隐藏原生 checkbox 的默认样式,可以使用 shadcn 风格定制 */\n.tiptap ul[data-type=\"taskList\"] li > label {\n @apply mr-3 flex-shrink-0 cursor-pointer select-none pt-1;\n}\n\n.tiptap ul[data-type=\"taskList\"] li > label input[type=\"checkbox\"] {\n @apply h-4 w-4 cursor-pointer rounded border-muted-foreground/30 accent-primary;\n}\n\n/* 任务内容容器 */\n.tiptap ul[data-type=\"taskList\"] li > div {\n @apply min-w-0 flex-1;\n}\n\n/* --- 核心功能:勾选后的中划线效果 --- */\n.tiptap ul[data-type=\"taskList\"] li[data-checked=\"true\"] > div {\n @apply text-muted-foreground;\n text-decoration: line-through;\n text-decoration-thickness: 2px;\n text-decoration-color: hsl(var(--muted-foreground) / 0.5);\n transition: all 0.2s ease;\n}\n\n/* 嵌套列表的缩进 */\n.tiptap ul[data-type=\"taskList\"] ul[data-type=\"taskList\"] {\n margin-left: 1.5rem;\n margin-top: 0.25rem;\n}\n\n/* 引用块样式 */\n.tiptap blockquote {\n @apply border-l-4 border-muted-foreground/30 pl-4 italic text-muted-foreground;\n}\n\n.tiptap code {\n @apply rounded-md bg-muted px-1.5 py-0.5 text-sm text-black;\n}\n.tiptap pre {\n @apply my-6 rounded-lg bg-muted p-4 font-mono text-black;\n}\n.tiptap pre code {\n @apply bg-transparent p-0 text-sm;\n}\n","/* 编辑器基础样式 */\n.tiptap {\n /* 第一个子元素移除上边距 */\n :first-child {\n @apply mt-0;\n }\n\n /* 图片样式:块级元素、高度自动、上下边距为0、最大宽度100% */\n img {\n @apply my-0 block h-auto max-w-full;\n\n /* 图片被选中时的样式:紫色3px轮廓线 */\n &.ProseMirror-selectednode {\n @apply outline-[3px] outline-purple-500;\n }\n }\n\n /* 调整大小手柄的基础样式 */\n [data-resize-handle] {\n @apply absolute z-10 rounded-[2px];\n @apply border border-white/80 bg-gray-500/10;\n\n /* 悬停时背景更深 */\n &:hover {\n @apply bg-black/30;\n }\n\n /* 四个角落的手柄:8x8像素 */\n &[data-resize-handle=\"top-left\"],\n &[data-resize-handle=\"top-right\"],\n &[data-resize-handle=\"bottom-left\"],\n &[data-resize-handle=\"bottom-right\"] {\n @apply h-2 w-2;\n }\n\n /* 左上角手柄:位置和光标样式 */\n &[data-resize-handle=\"top-left\"] {\n @apply -left-1 -top-1 cursor-nwse-resize;\n }\n\n /* 右上角手柄:位置和光标样式 */\n &[data-resize-handle=\"top-right\"] {\n @apply -right-1 -top-1 cursor-nesw-resize;\n }\n\n /* 左下角手柄:位置和光标样式 */\n &[data-resize-handle=\"bottom-left\"] {\n @apply -bottom-1 -left-1 cursor-nesw-resize;\n }\n\n /* 右下角手柄:位置和光标样式 */\n &[data-resize-handle=\"bottom-right\"] {\n @apply -bottom-1 -right-1 cursor-nwse-resize;\n }\n\n /* 上下边缘手柄:高度6px,左右各留8px */\n &[data-resize-handle=\"top\"],\n &[data-resize-handle=\"bottom\"] {\n @apply left-2 right-2 h-0.5;\n }\n\n /* 顶部边缘手柄:位置和光标样式 */\n &[data-resize-handle=\"top\"] {\n @apply -top-[3px] cursor-ns-resize;\n }\n\n /* 底部边缘手柄:位置和光标样式 */\n &[data-resize-handle=\"bottom\"] {\n @apply -bottom-[3px] cursor-ns-resize;\n }\n\n /* 左右边缘手柄:宽度6px,上下各留8px */\n &[data-resize-handle=\"left\"],\n &[data-resize-handle=\"right\"] {\n @apply bottom-2 top-2 w-0.5;\n }\n\n /* 左侧边缘手柄:位置和光标样式 */\n &[data-resize-handle=\"left\"] {\n @apply -left-[3px] cursor-ew-resize;\n }\n\n /* 右侧边缘手柄:位置和光标样式 */\n &[data-resize-handle=\"right\"] {\n @apply -right-[3px] cursor-ew-resize;\n }\n }\n\n /* 调整大小状态激活时的包装器样式:1px黑色半透明轮廓 */\n [data-resize-state=\"true\"] [data-resize-wrapper] {\n @apply rounded-sm outline outline-1 outline-black/25;\n }\n}\n",".tiptap {\n .tableWrapper {\n @apply my-6 overflow-x-auto overflow-y-hidden pl-3 pt-3;\n }\n\n table {\n @apply my-0 box-border w-full border-collapse rounded border-black/10;\n @apply dark:border-white/20;\n\n td,\n th {\n @apply relative min-w-[20px] border border-black/10 p-2 text-left align-top;\n @apply dark:border-white/20;\n\n &:first-of-type:not(a) {\n @apply mt-0;\n }\n\n p {\n @apply m-0;\n\n & + p {\n @apply mt-3;\n }\n }\n }\n\n th {\n @apply font-bold;\n }\n\n .column-resize-handle {\n @apply pointer-events-none absolute -bottom-0.5 -right-0.5 top-0 w-1 bg-blue-500;\n &::before {\n @apply ml-2 h-full w-[1px] bg-black/20;\n @apply dark:bg-white/20;\n content: \"\";\n }\n }\n\n .selectedCell {\n @apply border-double border-black/20 bg-black/5;\n @apply dark:border-white/20 dark:bg-white/10;\n }\n\n .grip-column,\n .grip-row {\n @apply absolute flex cursor-pointer items-center justify-center bg-black/5;\n @apply dark:bg-white/10;\n }\n .grip-column {\n @apply -top-3 left-0 -ml-[1px] h-3 w-[calc(100%+1px)] border-l border-black/20;\n @apply dark:border-white/20;\n\n &:hover,\n &.selected {\n &::before {\n content: \"\";\n @apply w-2.5;\n }\n }\n\n &:hover {\n @apply bg-black/10;\n @apply dark:bg-white/20;\n\n &::before {\n @apply border-b-2 border-dotted border-black/60;\n @apply dark:border-white/60;\n }\n }\n\n &.first {\n @apply rounded-tl-sm border-transparent;\n }\n\n &.last {\n @apply rounded-tr-sm;\n }\n\n &.selected {\n @apply border-black/30 bg-black/30 shadow-sm;\n @apply dark:border-white/30 dark:bg-white/30;\n\n &::before {\n @apply border-b-2 border-dotted;\n }\n }\n }\n\n .grip-row {\n @apply -left-3 top-0 -mt-[1px] h-[calc(100%+1px)] w-3 border-t border-black/20;\n @apply dark:border-white/20;\n\n &:hover,\n &.selected {\n &::before {\n @apply h-2.5;\n content: \"\";\n }\n }\n &:hover {\n @apply bg-black/10;\n @apply dark:bg-white/20;\n\n &::before {\n @apply border-l-2 border-dotted border-black/60;\n @apply dark:border-white/60;\n }\n }\n\n &.first {\n @apply rounded-tl-sm border-transparent;\n }\n\n &.last {\n @apply rounded-bl-sm;\n }\n\n &.selected {\n @apply border-black/30 bg-black/30 shadow-sm;\n @apply dark:border-white/30 dark:bg-white/30;\n\n &::before {\n @apply border-l-2 border-dotted;\n }\n }\n }\n }\n\n &.resize-cursor {\n @apply cursor-col-resize;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AC/FA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvHA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { Editor } from "@tiptap/core";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/toolbar/index.d.ts
|
|
6
|
+
type ToolbarItemKey = "undo" | "redo" | "node-selector" | "text-selector" | "link" | "color" | "bg" | "align" | "image" | "table" | "separator";
|
|
7
|
+
interface ToolbarConfigItem {
|
|
8
|
+
key: ToolbarItemKey | string;
|
|
9
|
+
render?: (editor: Editor) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
interface ToolbarProps {
|
|
12
|
+
config?: (ToolbarItemKey | ToolbarConfigItem)[];
|
|
13
|
+
appendItems?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const Toolbar: ({
|
|
16
|
+
config,
|
|
17
|
+
appendItems
|
|
18
|
+
}: ToolbarProps) => react_jsx_runtime0.JSX.Element | null;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/editor/index.d.ts
|
|
21
|
+
interface TiptapComponentsProps {
|
|
22
|
+
value: string;
|
|
23
|
+
onChange: (value: string) => void;
|
|
24
|
+
onImageUpload?: () => Promise<string>;
|
|
25
|
+
className?: string;
|
|
26
|
+
showToolbar?: boolean;
|
|
27
|
+
showBubbleMenu?: boolean;
|
|
28
|
+
showTableMenu?: boolean;
|
|
29
|
+
showBlockMenu?: boolean;
|
|
30
|
+
toolbarProps?: ToolbarProps;
|
|
31
|
+
onInitEditor?: (editor: Editor) => void;
|
|
32
|
+
}
|
|
33
|
+
declare const TiptapComponent: ({
|
|
34
|
+
value,
|
|
35
|
+
onChange,
|
|
36
|
+
onImageUpload,
|
|
37
|
+
className,
|
|
38
|
+
showToolbar,
|
|
39
|
+
showBubbleMenu,
|
|
40
|
+
showTableMenu,
|
|
41
|
+
showBlockMenu,
|
|
42
|
+
toolbarProps,
|
|
43
|
+
onInitEditor
|
|
44
|
+
}: TiptapComponentsProps) => react_jsx_runtime0.JSX.Element | null;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { TiptapComponent, TiptapComponentsProps, Toolbar, ToolbarConfigItem, ToolbarItemKey, ToolbarProps };
|
|
47
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
import { Editor } from "@tiptap/core";
|
|
5
|
+
|
|
6
|
+
//#region src/toolbar/index.d.ts
|
|
7
|
+
type ToolbarItemKey = "undo" | "redo" | "node-selector" | "text-selector" | "link" | "color" | "bg" | "align" | "image" | "table" | "separator";
|
|
8
|
+
interface ToolbarConfigItem {
|
|
9
|
+
key: ToolbarItemKey | string;
|
|
10
|
+
render?: (editor: Editor) => React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface ToolbarProps {
|
|
13
|
+
config?: (ToolbarItemKey | ToolbarConfigItem)[];
|
|
14
|
+
appendItems?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const Toolbar: ({
|
|
17
|
+
config,
|
|
18
|
+
appendItems
|
|
19
|
+
}: ToolbarProps) => react_jsx_runtime0.JSX.Element | null;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/editor/index.d.ts
|
|
22
|
+
interface TiptapComponentsProps {
|
|
23
|
+
value: string;
|
|
24
|
+
onChange: (value: string) => void;
|
|
25
|
+
onImageUpload?: () => Promise<string>;
|
|
26
|
+
className?: string;
|
|
27
|
+
showToolbar?: boolean;
|
|
28
|
+
showBubbleMenu?: boolean;
|
|
29
|
+
showTableMenu?: boolean;
|
|
30
|
+
showBlockMenu?: boolean;
|
|
31
|
+
toolbarProps?: ToolbarProps;
|
|
32
|
+
onInitEditor?: (editor: Editor) => void;
|
|
33
|
+
}
|
|
34
|
+
declare const TiptapComponent: ({
|
|
35
|
+
value,
|
|
36
|
+
onChange,
|
|
37
|
+
onImageUpload,
|
|
38
|
+
className,
|
|
39
|
+
showToolbar,
|
|
40
|
+
showBubbleMenu,
|
|
41
|
+
showTableMenu,
|
|
42
|
+
showBlockMenu,
|
|
43
|
+
toolbarProps,
|
|
44
|
+
onInitEditor
|
|
45
|
+
}: TiptapComponentsProps) => react_jsx_runtime0.JSX.Element | null;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { TiptapComponent, TiptapComponentsProps, Toolbar, ToolbarConfigItem, ToolbarItemKey, ToolbarProps };
|
|
48
|
+
//# sourceMappingURL=index.d.mts.map
|