@ctzhian/tiptap 1.11.4 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/demo.js +17 -22
- package/dist/EditorMarkdown/index.js +1 -1
- package/dist/asset/css/index.css +19 -8
- package/dist/component/ActionDropdown/index.d.ts +25 -0
- package/dist/component/ActionDropdown/index.js +147 -0
- package/dist/component/CustomDragHandle/index.js +2 -2
- package/dist/component/FloatingPopover/index.d.ts +2 -0
- package/dist/component/FloatingPopover/index.js +7 -1
- package/dist/component/HoverPopover/index.d.ts +29 -0
- package/dist/component/HoverPopover/index.js +143 -0
- package/dist/component/Icons/chrome-icon.d.ts +6 -0
- package/dist/component/Icons/chrome-icon.js +31 -0
- package/dist/component/Icons/edit-line-icon.d.ts +6 -0
- package/dist/component/Icons/edit-line-icon.js +13 -0
- package/dist/component/Icons/file-icon.d.ts +6 -0
- package/dist/component/Icons/file-icon.js +20 -0
- package/dist/component/Icons/index.d.ts +3 -0
- package/dist/component/Icons/index.js +3 -0
- package/dist/component/index.d.ts +2 -0
- package/dist/component/index.js +2 -0
- package/dist/extension/component/Alert/index.js +73 -85
- package/dist/extension/component/Attachment/AttachmentContent.d.ts +14 -0
- package/dist/extension/component/Attachment/AttachmentContent.js +142 -0
- package/dist/extension/component/Attachment/index.js +144 -201
- package/dist/extension/component/CodeBlock/Readonly.js +42 -35
- package/dist/extension/component/CodeBlock/index.js +137 -90
- package/dist/extension/component/Image/Insert.js +41 -26
- package/dist/extension/component/Image/Readonly.js +13 -6
- package/dist/extension/component/Image/index.d.ts +1 -0
- package/dist/extension/component/Image/index.js +234 -92
- package/dist/extension/component/Link/Insert.js +1 -1
- package/dist/extension/component/Link/LinkContent.d.ts +13 -0
- package/dist/extension/component/Link/LinkContent.js +169 -0
- package/dist/extension/component/Link/index.js +182 -264
- package/dist/extension/component/MentionList/index.js +1 -1
- package/dist/extension/index.js +1 -1
- package/dist/index.css +65 -63
- package/dist/themes/dark.js +2 -2
- package/dist/themes/light.d.ts +1 -1
- package/dist/themes/light.js +2 -2
- package/dist/themes/palette.d.ts +1 -1
- package/package.json +1 -1
- package/dist/extension/component/Attachment/Readonly.d.ts +0 -9
- package/dist/extension/component/Attachment/Readonly.js +0 -91
- package/dist/extension/component/CustomLink/Insert.d.ts +0 -0
- package/dist/extension/component/CustomLink/Insert.js +0 -176
- package/dist/extension/component/CustomLink/Readonly.d.ts +0 -0
- package/dist/extension/component/CustomLink/Readonly.js +0 -106
- package/dist/extension/component/CustomLink/index.d.ts +0 -0
- package/dist/extension/component/CustomLink/index.js +0 -440
- package/dist/extension/component/Link/Readonly.d.ts +0 -8
- package/dist/extension/component/Link/Readonly.js +0 -110
package/dist/index.css
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
@import url('./asset/css/index.css');
|
|
2
2
|
|
|
3
|
+
:root {
|
|
4
|
+
--common-row-font-size: 16px;
|
|
5
|
+
--common-row-line-height: 26px;
|
|
6
|
+
--udtoken-quote-bar-bg: #bbbfc4;
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
.tiptap.ProseMirror {
|
|
4
10
|
overflow-y: auto;
|
|
5
11
|
outline: none;
|
|
6
12
|
color: var(--mui-palette-text-primary);
|
|
13
|
+
line-height: 1.8;
|
|
7
14
|
}
|
|
8
15
|
|
|
9
16
|
/* 节点缩进(依赖 data-indent 属性) */
|
|
@@ -51,28 +58,19 @@
|
|
|
51
58
|
margin-bottom: 0 !important;
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
.tiptap.ProseMirror a {
|
|
55
|
-
text-decoration: underline;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
61
|
.tiptap.ProseMirror p {
|
|
59
|
-
line-height:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
margin-bottom: 20px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.tiptap.ProseMirror blockquote p,
|
|
66
|
-
.tiptap.ProseMirror .node-alert p {
|
|
67
|
-
margin: 10px;
|
|
62
|
+
line-height: var(--common-row-line-height);
|
|
63
|
+
font-size: var(--common-row-font-size);
|
|
64
|
+
margin: 8px 0;
|
|
68
65
|
}
|
|
69
66
|
|
|
70
67
|
/* blockquote */
|
|
71
68
|
.tiptap.ProseMirror blockquote {
|
|
72
69
|
position: relative;
|
|
73
|
-
padding:
|
|
74
|
-
margin:
|
|
75
|
-
|
|
70
|
+
padding-left: 12px;
|
|
71
|
+
margin: 8px 0;
|
|
72
|
+
line-height: var(--common-row-line-height);
|
|
73
|
+
color: var(--mui-palette-text-auxiliary);
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
.tiptap.ProseMirror blockquote::after {
|
|
@@ -80,53 +78,60 @@
|
|
|
80
78
|
position: absolute;
|
|
81
79
|
top: 0;
|
|
82
80
|
left: 0;
|
|
83
|
-
width:
|
|
81
|
+
width: 2px;
|
|
84
82
|
height: 100%;
|
|
85
|
-
background-color: var(--
|
|
83
|
+
background-color: var(--udtoken-quote-bar-bg);
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
/* list */
|
|
89
87
|
.tiptap.ProseMirror ol,
|
|
90
88
|
.tiptap.ProseMirror ul {
|
|
91
89
|
padding: 0 32px;
|
|
92
|
-
margin:
|
|
90
|
+
margin: 8px 0;
|
|
93
91
|
list-style: none;
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
.tiptap.ProseMirror li
|
|
97
|
-
|
|
98
|
-
margin: 0;
|
|
94
|
+
.tiptap.ProseMirror li {
|
|
95
|
+
margin: 8px 0;
|
|
99
96
|
}
|
|
100
97
|
|
|
101
|
-
.tiptap.ProseMirror ol {
|
|
98
|
+
.tiptap.ProseMirror ol ol ol ol {
|
|
102
99
|
list-style: decimal;
|
|
103
100
|
}
|
|
104
101
|
|
|
102
|
+
.tiptap.ProseMirror ol ol ol {
|
|
103
|
+
list-style: lower-roman;
|
|
104
|
+
}
|
|
105
|
+
|
|
105
106
|
.tiptap.ProseMirror ol ol {
|
|
106
107
|
list-style: lower-alpha;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
.tiptap.ProseMirror ol
|
|
110
|
-
list-style:
|
|
110
|
+
.tiptap.ProseMirror ol {
|
|
111
|
+
list-style: decimal;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
.tiptap.ProseMirror ul:not([data-type='taskList']) {
|
|
114
115
|
list-style: disc;
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
.tiptap.ProseMirror ul:not([data-type='taskList']) li {
|
|
118
|
-
position: relative;
|
|
119
|
-
padding-left: 0;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
118
|
.tiptap.ProseMirror ul:not([data-type='taskList']) ul {
|
|
123
|
-
list-style:
|
|
119
|
+
list-style: circle;
|
|
124
120
|
}
|
|
125
121
|
|
|
126
122
|
.tiptap.ProseMirror ul:not([data-type='taskList']) ul ul {
|
|
123
|
+
list-style: square;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.tiptap.ProseMirror ul:not([data-type='taskList']) ul ul ul {
|
|
127
127
|
list-style: disc;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
.tiptap.ProseMirror ul:not([data-type='taskList']) li {
|
|
131
|
+
position: relative;
|
|
132
|
+
padding-left: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
130
135
|
.tiptap.ProseMirror ul[data-type='taskList'] {
|
|
131
136
|
list-style: none;
|
|
132
137
|
margin-left: 0;
|
|
@@ -141,7 +146,7 @@
|
|
|
141
146
|
.tiptap.ProseMirror ul[data-type='taskList'] li>label {
|
|
142
147
|
flex: 0 0 auto;
|
|
143
148
|
user-select: none;
|
|
144
|
-
margin-right:
|
|
149
|
+
margin-right: 8px;
|
|
145
150
|
height: 28px;
|
|
146
151
|
display: flex;
|
|
147
152
|
align-items: center;
|
|
@@ -153,7 +158,8 @@
|
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
.tiptap.ProseMirror ul[data-type='taskList'] li[data-checked='true']>div {
|
|
156
|
-
color: var(--mui-palette-text-
|
|
161
|
+
color: var(--mui-palette-text-auxiliary);
|
|
162
|
+
opacity: 0.7;
|
|
157
163
|
text-decoration: line-through;
|
|
158
164
|
}
|
|
159
165
|
|
|
@@ -169,14 +175,10 @@
|
|
|
169
175
|
margin: 0;
|
|
170
176
|
}
|
|
171
177
|
|
|
172
|
-
.tiptap.ProseMirror
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.tiptap.ProseMirror ol li::marker {
|
|
179
|
-
font-family: monospace;
|
|
178
|
+
.tiptap.ProseMirror li::marker {
|
|
179
|
+
font-size: 16px;
|
|
180
|
+
line-height: 26px;
|
|
181
|
+
color: var(--mui-palette-primary-main);
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
/* code */
|
|
@@ -186,8 +188,12 @@
|
|
|
186
188
|
|
|
187
189
|
.tiptap.ProseMirror pre {
|
|
188
190
|
position: relative;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
border: 1px solid;
|
|
192
|
+
line-height: 22px;
|
|
193
|
+
border-color: var(--mui-palette-divider);
|
|
194
|
+
border-radius: var(--mui-shape-borderRadius);
|
|
195
|
+
color: var(--mui-palette-text-auxiliary);
|
|
196
|
+
background-color: var(--mui-palette-background-paper3);
|
|
191
197
|
}
|
|
192
198
|
|
|
193
199
|
.tiptap.ProseMirror pre[data-type="yaml-frontmatter"] {
|
|
@@ -315,48 +321,38 @@
|
|
|
315
321
|
position: relative;
|
|
316
322
|
color: inherit;
|
|
317
323
|
font-style: inherit;
|
|
324
|
+
line-height: 1.4;
|
|
325
|
+
font-weight: 500;
|
|
318
326
|
}
|
|
319
327
|
|
|
320
328
|
.tiptap.ProseMirror h1 {
|
|
321
|
-
font-size:
|
|
322
|
-
|
|
323
|
-
font-weight: 700;
|
|
324
|
-
margin: 48px 0 20px;
|
|
329
|
+
font-size: 26px;
|
|
330
|
+
margin: 26px 0 10px;
|
|
325
331
|
}
|
|
326
332
|
|
|
327
333
|
.tiptap.ProseMirror h2 {
|
|
328
|
-
font-size:
|
|
329
|
-
|
|
330
|
-
font-weight: 700;
|
|
331
|
-
margin: 40px 0 20px;
|
|
334
|
+
font-size: 22px;
|
|
335
|
+
margin: 22px 0 8px;
|
|
332
336
|
}
|
|
333
337
|
|
|
334
338
|
.tiptap.ProseMirror h3 {
|
|
335
339
|
font-size: 20px;
|
|
336
|
-
|
|
337
|
-
font-weight: 600;
|
|
338
|
-
margin: 36px 0 20px;
|
|
340
|
+
margin: 20px 0 8px;
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
.tiptap.ProseMirror h4 {
|
|
342
344
|
font-size: 18px;
|
|
343
|
-
|
|
344
|
-
font-weight: 600;
|
|
345
|
-
margin: 32px 0 20px;
|
|
345
|
+
margin: 18px 0 8px;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
.tiptap.ProseMirror h5 {
|
|
349
349
|
font-size: 18px;
|
|
350
|
-
|
|
351
|
-
font-weight: 600;
|
|
352
|
-
margin: 32px 0 20px;
|
|
350
|
+
margin: 16px 0 8px;
|
|
353
351
|
}
|
|
354
352
|
|
|
355
353
|
.tiptap.ProseMirror h6 {
|
|
356
354
|
font-size: 16px;
|
|
357
|
-
|
|
358
|
-
font-weight: 600;
|
|
359
|
-
margin: 32px 0 20px;
|
|
355
|
+
margin: 16px 0 8px;
|
|
360
356
|
}
|
|
361
357
|
|
|
362
358
|
/* horizontal rule */
|
|
@@ -534,4 +530,10 @@
|
|
|
534
530
|
.tiptap.ProseMirror table *[data-placeholder]::before,
|
|
535
531
|
.tiptap.ProseMirror li p[data-placeholder]::before {
|
|
536
532
|
display: none;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.text-ellipsis {
|
|
536
|
+
overflow: hidden;
|
|
537
|
+
text-overflow: ellipsis;
|
|
538
|
+
white-space: nowrap;
|
|
537
539
|
}
|
package/dist/themes/dark.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var dark = {
|
|
2
2
|
primary: {
|
|
3
|
-
main: '#
|
|
3
|
+
main: '#4c88ff',
|
|
4
4
|
contrastText: '#000'
|
|
5
5
|
},
|
|
6
6
|
secondary: {
|
|
@@ -57,7 +57,7 @@ var dark = {
|
|
|
57
57
|
inverseAuxiliary: 'rgba(0,0,0,0.5)',
|
|
58
58
|
inverseDisabled: 'rgba(0,0,0,0.15)'
|
|
59
59
|
},
|
|
60
|
-
divider: '#
|
|
60
|
+
divider: '#505050',
|
|
61
61
|
background: {
|
|
62
62
|
default: '#141923',
|
|
63
63
|
paper: '#141923',
|
package/dist/themes/light.d.ts
CHANGED
package/dist/themes/light.js
CHANGED
|
@@ -48,9 +48,9 @@ var light = {
|
|
|
48
48
|
contrastText: '#FFFFFF'
|
|
49
49
|
},
|
|
50
50
|
text: {
|
|
51
|
-
primary: '#
|
|
51
|
+
primary: '#1f2329',
|
|
52
52
|
secondary: '#3f4441',
|
|
53
|
-
|
|
53
|
+
auxiliary: '#646a73',
|
|
54
54
|
disabled: '#6e7781',
|
|
55
55
|
slave: 'rgba(33,34,35,0.3)',
|
|
56
56
|
inverse: '#FFFFFF',
|
package/dist/themes/palette.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NodeViewProps } from "@tiptap/react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { AttachmentAttributes } from ".";
|
|
4
|
-
interface ReadonlyAttachmentProps extends Partial<NodeViewProps> {
|
|
5
|
-
attrs: AttachmentAttributes;
|
|
6
|
-
type: 'icon' | 'block';
|
|
7
|
-
}
|
|
8
|
-
declare const ReadonlyAttachment: ({ attrs, type }: ReadonlyAttachmentProps) => React.JSX.Element;
|
|
9
|
-
export default ReadonlyAttachment;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Attachment2Icon } from "../../../component/Icons";
|
|
2
|
-
import { Box, Stack } from "@mui/material";
|
|
3
|
-
import { NodeViewWrapper } from "@tiptap/react";
|
|
4
|
-
import React from "react";
|
|
5
|
-
var ReadonlyAttachment = function ReadonlyAttachment(_ref) {
|
|
6
|
-
var attrs = _ref.attrs,
|
|
7
|
-
type = _ref.type;
|
|
8
|
-
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
9
|
-
className: "attachment-wrapper".concat(type === 'block' ? ' block-attachment-wrapper' : ''),
|
|
10
|
-
as: type === 'block' ? 'div' : 'span'
|
|
11
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
12
|
-
component: "a",
|
|
13
|
-
href: attrs.url,
|
|
14
|
-
target: "_blank",
|
|
15
|
-
download: attrs.title,
|
|
16
|
-
sx: {
|
|
17
|
-
textDecoration: 'none !important',
|
|
18
|
-
color: 'inherit'
|
|
19
|
-
}
|
|
20
|
-
}, type === 'block' ? /*#__PURE__*/React.createElement(Stack, {
|
|
21
|
-
direction: 'row',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
gap: 2,
|
|
24
|
-
sx: {
|
|
25
|
-
border: '1px solid',
|
|
26
|
-
borderColor: attrs.url === 'error' ? 'error.main' : 'divider',
|
|
27
|
-
cursor: 'pointer',
|
|
28
|
-
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
29
|
-
p: 2,
|
|
30
|
-
':hover': {
|
|
31
|
-
borderColor: attrs.url === 'error' ? 'error.main' : 'primary.main',
|
|
32
|
-
color: attrs.url === 'error' ? 'error.main' : 'primary.main'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}, /*#__PURE__*/React.createElement(Attachment2Icon, {
|
|
36
|
-
sx: {
|
|
37
|
-
fontSize: '2rem',
|
|
38
|
-
cursor: 'grab',
|
|
39
|
-
color: attrs.url === 'error' ? 'error.main' : 'primary.main',
|
|
40
|
-
alignSelf: 'center',
|
|
41
|
-
':active': {
|
|
42
|
-
cursor: 'grabbing'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}), /*#__PURE__*/React.createElement(Stack, {
|
|
46
|
-
sx: {
|
|
47
|
-
flex: 1
|
|
48
|
-
},
|
|
49
|
-
gap: 0.5
|
|
50
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
51
|
-
sx: {
|
|
52
|
-
fontSize: '0.875rem',
|
|
53
|
-
fontWeight: 'bold'
|
|
54
|
-
}
|
|
55
|
-
}, attrs.title), /*#__PURE__*/React.createElement(Box, {
|
|
56
|
-
sx: {
|
|
57
|
-
fontSize: '0.75rem',
|
|
58
|
-
color: 'text.secondary'
|
|
59
|
-
}
|
|
60
|
-
}, attrs.size))) : /*#__PURE__*/React.createElement(Box, {
|
|
61
|
-
component: 'span',
|
|
62
|
-
sx: {
|
|
63
|
-
color: 'primary.main',
|
|
64
|
-
textDecoration: 'none',
|
|
65
|
-
cursor: 'pointer',
|
|
66
|
-
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
67
|
-
transition: 'background-color 0.2s ease',
|
|
68
|
-
':hover': {
|
|
69
|
-
bgcolor: 'background.paper'
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
73
|
-
component: 'span',
|
|
74
|
-
sx: {
|
|
75
|
-
display: 'inline-flex',
|
|
76
|
-
alignItems: 'center',
|
|
77
|
-
gap: 0.5
|
|
78
|
-
}
|
|
79
|
-
}, /*#__PURE__*/React.createElement(Attachment2Icon, {
|
|
80
|
-
sx: {
|
|
81
|
-
fontSize: '0.875rem',
|
|
82
|
-
cursor: 'grab',
|
|
83
|
-
color: 'primary.main',
|
|
84
|
-
alignSelf: 'center',
|
|
85
|
-
':active': {
|
|
86
|
-
cursor: 'grabbing'
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}), attrs.title))));
|
|
90
|
-
};
|
|
91
|
-
export default ReadonlyAttachment;
|
|
File without changes
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
// import { Box, Button, FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, Stack, TextField } from "@mui/material"
|
|
2
|
-
// import { MarkViewContent } from "@tiptap/react"
|
|
3
|
-
// import FloatingPopover from "@ctzhian/tiptap/component/FloatingPopover"
|
|
4
|
-
// import { LinkIcon } from "@ctzhian/tiptap/component/Icons"
|
|
5
|
-
// import React, { useRef, useState } from "react"
|
|
6
|
-
// import { LinkAttributes } from "."
|
|
7
|
-
|
|
8
|
-
// interface InsertLinkProps {
|
|
9
|
-
// updateAttributes?: (attrs: Partial<LinkAttributes>) => void
|
|
10
|
-
// }
|
|
11
|
-
|
|
12
|
-
// export const InsertLink: React.FC<InsertLinkProps> = ({ updateAttributes }) => {
|
|
13
|
-
// const [title, setTitle] = useState('')
|
|
14
|
-
// const [href, setHref] = useState('')
|
|
15
|
-
// const [type, setType] = useState<'link' | 'card'>('link')
|
|
16
|
-
// const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
|
|
17
|
-
// const containerRef = useRef<HTMLAnchorElement>(null)
|
|
18
|
-
|
|
19
|
-
// const handleShowPopover = (event: React.MouseEvent<HTMLElement>) => {
|
|
20
|
-
// setAnchorEl(event.currentTarget)
|
|
21
|
-
// }
|
|
22
|
-
|
|
23
|
-
// const handleClosePopover = () => {
|
|
24
|
-
// setAnchorEl(null)
|
|
25
|
-
// // 重置表单
|
|
26
|
-
// setTitle('')
|
|
27
|
-
// setHref('')
|
|
28
|
-
// setType('link')
|
|
29
|
-
// }
|
|
30
|
-
|
|
31
|
-
// const handleSave = () => {
|
|
32
|
-
// if (href.trim() && updateAttributes) {
|
|
33
|
-
// updateAttributes({
|
|
34
|
-
// href: href.trim(),
|
|
35
|
-
// title: title.trim() || href.trim(),
|
|
36
|
-
// type
|
|
37
|
-
// })
|
|
38
|
-
// handleClosePopover()
|
|
39
|
-
// }
|
|
40
|
-
// }
|
|
41
|
-
|
|
42
|
-
// const handleKeyDown = (event: React.KeyboardEvent) => {
|
|
43
|
-
// if (event.key === 'Enter') {
|
|
44
|
-
// event.preventDefault()
|
|
45
|
-
// handleSave()
|
|
46
|
-
// } else if (event.key === 'Escape') {
|
|
47
|
-
// event.preventDefault()
|
|
48
|
-
// handleClosePopover()
|
|
49
|
-
// }
|
|
50
|
-
// }
|
|
51
|
-
|
|
52
|
-
// return <>
|
|
53
|
-
// <MarkViewContent
|
|
54
|
-
// as="span"
|
|
55
|
-
// ref={containerRef}
|
|
56
|
-
// className="link-insert-wrapper"
|
|
57
|
-
// data-drag-handle
|
|
58
|
-
// role="button"
|
|
59
|
-
// tabIndex={0}
|
|
60
|
-
// onClick={handleShowPopover}
|
|
61
|
-
// onKeyDown={handleKeyDown}
|
|
62
|
-
// style={{
|
|
63
|
-
// display: 'inline-block',
|
|
64
|
-
// margin: '0 2px',
|
|
65
|
-
// }}
|
|
66
|
-
// >
|
|
67
|
-
// <Stack
|
|
68
|
-
// direction="row"
|
|
69
|
-
// alignItems="center"
|
|
70
|
-
// gap={1}
|
|
71
|
-
// sx={{
|
|
72
|
-
// border: '1px dashed',
|
|
73
|
-
// borderColor: 'divider',
|
|
74
|
-
// borderRadius: 1,
|
|
75
|
-
// px: 2,
|
|
76
|
-
// py: 1,
|
|
77
|
-
// minWidth: 120,
|
|
78
|
-
// color: 'text.secondary',
|
|
79
|
-
// bgcolor: 'action.hover',
|
|
80
|
-
// cursor: 'pointer',
|
|
81
|
-
// transition: 'all 0.2s ease',
|
|
82
|
-
// '&:hover': {
|
|
83
|
-
// bgcolor: 'action.selected',
|
|
84
|
-
// borderColor: 'primary.main',
|
|
85
|
-
// color: 'primary.main',
|
|
86
|
-
// },
|
|
87
|
-
// '&:focus-within': {
|
|
88
|
-
// outline: '2px solid',
|
|
89
|
-
// outlineColor: 'primary.main',
|
|
90
|
-
// outlineOffset: 1,
|
|
91
|
-
// },
|
|
92
|
-
// }}
|
|
93
|
-
// >
|
|
94
|
-
// <LinkIcon sx={{ fontSize: '1rem' }} />
|
|
95
|
-
// <Box sx={{
|
|
96
|
-
// fontSize: '0.875rem',
|
|
97
|
-
// fontWeight: 500,
|
|
98
|
-
// whiteSpace: 'nowrap'
|
|
99
|
-
// }}>
|
|
100
|
-
// 插入链接
|
|
101
|
-
// </Box>
|
|
102
|
-
// </Stack>
|
|
103
|
-
// </MarkViewContent>
|
|
104
|
-
// <FloatingPopover
|
|
105
|
-
// open={Boolean(anchorEl)}
|
|
106
|
-
// anchorEl={anchorEl}
|
|
107
|
-
// onClose={handleClosePopover}
|
|
108
|
-
// placement="bottom"
|
|
109
|
-
// >
|
|
110
|
-
// <Stack gap={2} sx={{ p: 2, width: 320 }}>
|
|
111
|
-
// <TextField
|
|
112
|
-
// fullWidth
|
|
113
|
-
// size="small"
|
|
114
|
-
// label="标题"
|
|
115
|
-
// value={title}
|
|
116
|
-
// onChange={(e) => setTitle(e.target.value)}
|
|
117
|
-
// placeholder="链接标题(可选)"
|
|
118
|
-
// onKeyDown={handleKeyDown}
|
|
119
|
-
// />
|
|
120
|
-
// <TextField
|
|
121
|
-
// fullWidth
|
|
122
|
-
// size="small"
|
|
123
|
-
// label="地址"
|
|
124
|
-
// value={href}
|
|
125
|
-
// onChange={(e) => setHref(e.target.value)}
|
|
126
|
-
// placeholder="https://example.com"
|
|
127
|
-
// required
|
|
128
|
-
// autoFocus
|
|
129
|
-
// error={href.length > 0 && !href.trim()}
|
|
130
|
-
// helperText={href.length > 0 && !href.trim() ? "请输入有效的链接地址" : ""}
|
|
131
|
-
// onKeyDown={handleKeyDown}
|
|
132
|
-
// />
|
|
133
|
-
// <FormControl component="fieldset">
|
|
134
|
-
// <FormLabel component="legend" sx={{ fontSize: '0.875rem' }}>显示风格</FormLabel>
|
|
135
|
-
// <RadioGroup
|
|
136
|
-
// row
|
|
137
|
-
// value={type}
|
|
138
|
-
// onChange={(e) => setType(e.target.value as 'link' | 'card')}
|
|
139
|
-
// >
|
|
140
|
-
// <FormControlLabel
|
|
141
|
-
// value="link"
|
|
142
|
-
// control={<Radio size="small" />}
|
|
143
|
-
// label="文字链接"
|
|
144
|
-
// />
|
|
145
|
-
// <FormControlLabel
|
|
146
|
-
// value="card"
|
|
147
|
-
// control={<Radio size="small" />}
|
|
148
|
-
// label="卡片链接"
|
|
149
|
-
// />
|
|
150
|
-
// </RadioGroup>
|
|
151
|
-
// </FormControl>
|
|
152
|
-
// <Stack direction="row" gap={1}>
|
|
153
|
-
// <Button
|
|
154
|
-
// variant="outlined"
|
|
155
|
-
// size="small"
|
|
156
|
-
// fullWidth
|
|
157
|
-
// onClick={handleClosePopover}
|
|
158
|
-
// >
|
|
159
|
-
// 取消
|
|
160
|
-
// </Button>
|
|
161
|
-
// <Button
|
|
162
|
-
// variant="contained"
|
|
163
|
-
// size="small"
|
|
164
|
-
// fullWidth
|
|
165
|
-
// onClick={handleSave}
|
|
166
|
-
// disabled={!href.trim()}
|
|
167
|
-
// >
|
|
168
|
-
// 插入链接
|
|
169
|
-
// </Button>
|
|
170
|
-
// </Stack>
|
|
171
|
-
// </Stack>
|
|
172
|
-
// </FloatingPopover>
|
|
173
|
-
// </>
|
|
174
|
-
// }
|
|
175
|
-
|
|
176
|
-
// export default InsertLink
|
|
File without changes
|