@ctzhian/tiptap 2.0.0 → 2.1.0
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/Editor/demo.js +133 -123
- package/dist/EditorToolbar/index.js +11 -9
- package/dist/asset/css/index.css +5 -7
- package/dist/component/ActionDropdown/index.d.ts +5 -0
- package/dist/component/ActionDropdown/index.js +8 -3
- package/dist/component/FloatingPopover/index.d.ts +2 -2
- package/dist/component/HoverPopover/index.d.ts +2 -0
- package/dist/component/HoverPopover/index.js +22 -3
- package/dist/component/Icons/{expand-horizontal-line.js → expand-horizontal-line-icon.js} +1 -1
- package/dist/component/Icons/index.d.ts +3 -2
- package/dist/component/Icons/index.js +4 -3
- package/dist/extension/component/Alert/index.js +141 -137
- package/dist/extension/component/Flow/Edit.d.ts +1 -1
- package/dist/extension/component/Flow/Edit.js +3 -31
- package/dist/extension/component/Flow/index.js +20 -19
- package/dist/extension/component/Image/index.d.ts +1 -0
- package/dist/extension/component/Image/index.js +16 -2
- package/dist/extension/component/Link/index.js +1 -1
- package/dist/extension/component/TableCellHandleMenu/index.js +60 -3
- package/dist/extension/component/TableHandle/TableHandleMenu.js +1 -1
- package/dist/extension/component/TableSelectionOverlay/index.js +4 -12
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/component/Video/Insert.js +4 -2
- package/dist/extension/component/Video/Readonly.js +4 -11
- package/dist/extension/component/Video/index.d.ts +2 -1
- package/dist/extension/component/Video/index.js +447 -65
- package/dist/extension/extension/ImeComposition.d.ts +2 -0
- package/dist/extension/extension/ImeComposition.js +145 -0
- package/dist/extension/extension/index.d.ts +1 -0
- package/dist/extension/extension/index.js +1 -0
- package/dist/extension/index.js +2 -2
- package/dist/extension/node/Flow/index.d.ts +0 -3
- package/dist/extension/node/Flow/index.js +7 -4
- package/dist/extension/node/Link/index.js +4 -3
- package/dist/extension/node/Table.js +18 -82
- package/dist/extension/node/TableOfContents/index.d.ts +5 -3
- package/dist/extension/node/TableOfContents/index.js +22 -2
- package/dist/extension/node/Video.d.ts +1 -0
- package/dist/extension/node/Video.js +38 -6
- package/dist/hook/index.js +1 -1
- package/dist/index.css +16 -19
- package/dist/util/index.d.ts +9 -0
- package/dist/util/index.js +26 -0
- package/package.json +1 -1
- /package/dist/component/Icons/{expand-horizontal-line.d.ts → expand-horizontal-line-icon.d.ts} +0 -0
package/dist/index.css
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
4
|
--common-row-font-size: 16px;
|
|
5
|
-
--common-row-line-height:
|
|
5
|
+
--common-row-line-height: 1.625;
|
|
6
6
|
--udtoken-quote-bar-bg: #bbbfc4;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.tiptap.ProseMirror {
|
|
10
10
|
overflow-y: auto;
|
|
11
11
|
outline: none;
|
|
12
|
+
font-size: var(--common-row-font-size);
|
|
12
13
|
color: var(--mui-palette-text-primary);
|
|
13
|
-
line-height:
|
|
14
|
+
line-height: var(--common-row-line-height);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
/* 节点缩进(依赖 data-indent 属性) */
|
|
@@ -59,17 +60,13 @@
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
.tiptap.ProseMirror p {
|
|
62
|
-
line-height: var(--common-row-line-height);
|
|
63
|
-
font-size: var(--common-row-font-size);
|
|
64
63
|
margin: 8px 0;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
/* blockquote */
|
|
68
66
|
.tiptap.ProseMirror blockquote {
|
|
69
67
|
position: relative;
|
|
70
68
|
padding: 8px 16px 8px 24px;
|
|
71
69
|
margin: 8px 0;
|
|
72
|
-
line-height: var(--common-row-line-height);
|
|
73
70
|
color: var(--mui-palette-text-tertiary);
|
|
74
71
|
background-color: var(--mui-palette-background-paper3);
|
|
75
72
|
}
|
|
@@ -111,8 +108,6 @@
|
|
|
111
108
|
top: 0;
|
|
112
109
|
left: -24px;
|
|
113
110
|
content: counter(list-counter) '.' !important;
|
|
114
|
-
font-size: 16px;
|
|
115
|
-
line-height: 26px;
|
|
116
111
|
color: var(--mui-palette-primary-main);
|
|
117
112
|
}
|
|
118
113
|
|
|
@@ -146,8 +141,6 @@
|
|
|
146
141
|
position: absolute;
|
|
147
142
|
top: 0;
|
|
148
143
|
left: -24px;
|
|
149
|
-
font-size: 16px;
|
|
150
|
-
line-height: 26px;
|
|
151
144
|
font-size: 20px;
|
|
152
145
|
color: var(--mui-palette-primary-main);
|
|
153
146
|
}
|
|
@@ -223,7 +216,6 @@
|
|
|
223
216
|
.tiptap.ProseMirror pre {
|
|
224
217
|
position: relative;
|
|
225
218
|
border: 1px solid;
|
|
226
|
-
line-height: 22px;
|
|
227
219
|
border-color: var(--mui-palette-divider);
|
|
228
220
|
border-radius: var(--mui-shape-borderRadius);
|
|
229
221
|
color: var(--mui-palette-text-tertiary);
|
|
@@ -240,8 +232,6 @@
|
|
|
240
232
|
.tiptap.ProseMirror code {
|
|
241
233
|
padding: 2px 8px;
|
|
242
234
|
margin: 0 4px;
|
|
243
|
-
line-height: 1.625;
|
|
244
|
-
font-size: inherit;
|
|
245
235
|
word-break: break-all;
|
|
246
236
|
/* font-weight: 500; */
|
|
247
237
|
border: 1px solid;
|
|
@@ -269,7 +259,6 @@
|
|
|
269
259
|
.tiptap.ProseMirror .cq-details {
|
|
270
260
|
display: flex;
|
|
271
261
|
gap: 0.25rem;
|
|
272
|
-
line-height: 1.625;
|
|
273
262
|
margin: 20px 0;
|
|
274
263
|
border: 1px solid var(--mui-palette-divider);
|
|
275
264
|
border-radius: var(--mui-shape-borderRadius);
|
|
@@ -355,7 +344,6 @@
|
|
|
355
344
|
position: relative;
|
|
356
345
|
color: inherit;
|
|
357
346
|
font-style: inherit;
|
|
358
|
-
line-height: 1.4;
|
|
359
347
|
font-weight: 500;
|
|
360
348
|
}
|
|
361
349
|
|
|
@@ -410,7 +398,6 @@
|
|
|
410
398
|
|
|
411
399
|
.tiptap.ProseMirror table p {
|
|
412
400
|
font-size: 14px;
|
|
413
|
-
line-height: 24px;
|
|
414
401
|
}
|
|
415
402
|
|
|
416
403
|
.tiptap.ProseMirror table th *,
|
|
@@ -515,6 +502,17 @@
|
|
|
515
502
|
pointer-events: auto;
|
|
516
503
|
}
|
|
517
504
|
|
|
505
|
+
.tiptap.ProseMirror .table-selection-overlay-container {
|
|
506
|
+
position: relative;
|
|
507
|
+
overflow: visible;
|
|
508
|
+
pointer-events: none;
|
|
509
|
+
z-index: 10;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.tiptap.ProseMirror .table-selection-overlay-container>* {
|
|
513
|
+
pointer-events: auto;
|
|
514
|
+
}
|
|
515
|
+
|
|
518
516
|
.tiptap.ProseMirror .tableWrapper::-webkit-scrollbar {
|
|
519
517
|
height: 5px;
|
|
520
518
|
cursor: pointer;
|
|
@@ -558,18 +556,17 @@
|
|
|
558
556
|
}
|
|
559
557
|
}
|
|
560
558
|
|
|
561
|
-
.slash-decoration[data-decoration-content].is-empty {
|
|
559
|
+
.tiptap.ProseMirror .slash-decoration[data-decoration-content].is-empty {
|
|
562
560
|
padding: 4px 8px;
|
|
563
561
|
background-color: var(--mui-palette-background-paper2);
|
|
564
562
|
border-radius: var(--mui-shape-borderRadius);
|
|
565
563
|
}
|
|
566
564
|
|
|
567
|
-
.slash-decoration[data-decoration-content].is-empty::after {
|
|
565
|
+
.tiptap.ProseMirror .slash-decoration[data-decoration-content].is-empty::after {
|
|
568
566
|
content: attr(data-decoration-content);
|
|
569
567
|
color: var(--mui-palette-text-disabled);
|
|
570
568
|
padding-left: 0.25rem;
|
|
571
569
|
font-size: 14px;
|
|
572
|
-
line-height: 24px;
|
|
573
570
|
}
|
|
574
571
|
|
|
575
572
|
.tiptap.ProseMirror .ai-writing-suggestion {
|
package/dist/util/index.d.ts
CHANGED
|
@@ -13,3 +13,12 @@ export declare const hasMarksInBlock: (node: Node | null | undefined) => boolean
|
|
|
13
13
|
export declare const hasMarksInSelection: (state: EditorState) => boolean;
|
|
14
14
|
export declare function addOpacityToColor(color: string, opacity: number): string;
|
|
15
15
|
export declare const getLinkTitle: (href: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* 获取当前选中文本并返回链接属性
|
|
18
|
+
* 如果有选中文本,将文本设置为 title
|
|
19
|
+
* @param editor Tiptap 编辑器实例
|
|
20
|
+
* @returns 包含 title 的链接属性对象(如果有选中文本)
|
|
21
|
+
*/
|
|
22
|
+
export declare const getLinkAttributesWithSelectedText: (editor: Editor) => {
|
|
23
|
+
title?: string;
|
|
24
|
+
};
|
package/dist/util/index.js
CHANGED
|
@@ -62,4 +62,30 @@ export var getLinkTitle = function getLinkTitle(href) {
|
|
|
62
62
|
return it.trim().length > 0;
|
|
63
63
|
});
|
|
64
64
|
return paths[paths.length - 1];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 获取当前选中文本并返回链接属性
|
|
69
|
+
* 如果有选中文本,将文本设置为 title
|
|
70
|
+
* @param editor Tiptap 编辑器实例
|
|
71
|
+
* @returns 包含 title 的链接属性对象(如果有选中文本)
|
|
72
|
+
*/
|
|
73
|
+
export var getLinkAttributesWithSelectedText = function getLinkAttributesWithSelectedText(editor) {
|
|
74
|
+
if (!editor) {
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
var selection = editor.state.selection;
|
|
78
|
+
var from = selection.from,
|
|
79
|
+
to = selection.to;
|
|
80
|
+
if (selection.empty || from === to) {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
var selectedText = editor.state.doc.textBetween(from, to, '');
|
|
84
|
+
var trimmedText = selectedText.trim();
|
|
85
|
+
if (trimmedText.length > 0) {
|
|
86
|
+
return {
|
|
87
|
+
title: trimmedText
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {};
|
|
65
91
|
};
|
package/package.json
CHANGED
/package/dist/component/Icons/{expand-horizontal-line.d.ts → expand-horizontal-line-icon.d.ts}
RENAMED
|
File without changes
|