onchain-lexical-ui 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/DropDown.module.less +24 -7
- package/src/DropDown.tsx +34 -2
- package/src/EditorShellStyles/index.module.less +97 -96
- package/src/Icon/index.tsx +33 -8
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onchain-lexical-ui",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@ant-design/icons": "^6.0.0",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@lexical/utils": "^0.30.0",
|
|
11
11
|
"katex": "^0.16.22",
|
|
12
12
|
"lexical": "0.30.0",
|
|
13
|
-
"onchain-lexical-context": "^0.0.
|
|
13
|
+
"onchain-lexical-context": "^0.0.4",
|
|
14
14
|
"react-draggable": "^4.5.0"
|
|
15
15
|
},
|
|
16
16
|
"browser": {
|
package/src/DropDown.module.less
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
.arrow {
|
|
2
|
+
position: relative;
|
|
3
|
+
&::before {
|
|
4
|
+
content: '';
|
|
5
|
+
display: block;
|
|
6
|
+
width: 8px;
|
|
7
|
+
height: 8px;
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: -2px;
|
|
10
|
+
left: 4px;
|
|
11
|
+
background-color: #fff;
|
|
12
|
+
z-index: -1;
|
|
13
|
+
transform: rotate(45deg);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
.dropdown {
|
|
2
18
|
z-index: 100;
|
|
3
19
|
display: block;
|
|
@@ -7,13 +23,13 @@
|
|
|
7
23
|
0 2px 4px 0 rgba(0, 0, 0, 0.1),
|
|
8
24
|
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
|
|
9
25
|
// border-radius: 8px;
|
|
10
|
-
min-height: 40px;
|
|
26
|
+
// min-height: 40px;
|
|
11
27
|
background-color: #fff;
|
|
12
28
|
z-index: 1000;
|
|
13
29
|
:global {
|
|
14
30
|
.item {
|
|
15
|
-
margin: 0
|
|
16
|
-
padding:
|
|
31
|
+
margin: 0 6px 0 6px;
|
|
32
|
+
padding: 6px;
|
|
17
33
|
color: #050505;
|
|
18
34
|
cursor: pointer;
|
|
19
35
|
line-height: 16px;
|
|
@@ -25,15 +41,16 @@
|
|
|
25
41
|
justify-content: space-between;
|
|
26
42
|
background-color: #fff;
|
|
27
43
|
// border-radius: 8px;
|
|
44
|
+
font-size: 14px;
|
|
28
45
|
border: 0;
|
|
29
46
|
max-width: 250px;
|
|
30
47
|
min-width: 100px;
|
|
31
48
|
&:first-child {
|
|
32
|
-
margin-top:
|
|
49
|
+
margin-top: 6px;
|
|
33
50
|
}
|
|
34
51
|
|
|
35
52
|
&:last-child {
|
|
36
|
-
margin-bottom:
|
|
53
|
+
margin-bottom: 6px;
|
|
37
54
|
}
|
|
38
55
|
|
|
39
56
|
&:hover {
|
|
@@ -74,8 +91,8 @@
|
|
|
74
91
|
|
|
75
92
|
.icon {
|
|
76
93
|
display: flex;
|
|
77
|
-
width:
|
|
78
|
-
height:
|
|
94
|
+
width: 18px;
|
|
95
|
+
height: 18px;
|
|
79
96
|
user-select: none;
|
|
80
97
|
margin-right: 12px;
|
|
81
98
|
line-height: 16px;
|
package/src/DropDown.tsx
CHANGED
|
@@ -73,12 +73,16 @@ export function DropDownItem({
|
|
|
73
73
|
function DropDownItems({
|
|
74
74
|
children,
|
|
75
75
|
dropDownRef,
|
|
76
|
+
arrow = false,
|
|
76
77
|
zIndex = 100,
|
|
78
|
+
arrowX,
|
|
77
79
|
onClose,
|
|
78
80
|
}: {
|
|
79
81
|
children: React.ReactNode;
|
|
80
82
|
dropDownRef: React.Ref<HTMLDivElement>;
|
|
81
83
|
zIndex?: number;
|
|
84
|
+
arrow?: boolean;
|
|
85
|
+
arrowX?: number;
|
|
82
86
|
onClose: () => void;
|
|
83
87
|
}) {
|
|
84
88
|
const [items, setItems] = useState<React.RefObject<HTMLButtonElement>[]>();
|
|
@@ -143,9 +147,9 @@ function DropDownItems({
|
|
|
143
147
|
return (
|
|
144
148
|
<DropDownContext.Provider value={contextValue}>
|
|
145
149
|
<div
|
|
146
|
-
className={`${Styles.dropdown}`}
|
|
150
|
+
className={`${Styles.dropdown} ${arrow ? Styles.arrow : ''}`}
|
|
147
151
|
ref={dropDownRef}
|
|
148
|
-
style={{zIndex}}
|
|
152
|
+
style={{left: arrowX, zIndex}}
|
|
149
153
|
onKeyDown={handleKeyDown}>
|
|
150
154
|
{children}
|
|
151
155
|
</div>
|
|
@@ -156,12 +160,15 @@ function DropDownItems({
|
|
|
156
160
|
export default function DropDown({
|
|
157
161
|
disabled = false,
|
|
158
162
|
showIcon = true,
|
|
163
|
+
arrow = false,
|
|
164
|
+
arrowX,
|
|
159
165
|
buttonLabel,
|
|
160
166
|
buttonAriaLabel,
|
|
161
167
|
buttonClassName,
|
|
162
168
|
buttonIconClassName,
|
|
163
169
|
children,
|
|
164
170
|
stopCloseOnClickSelf,
|
|
171
|
+
onOpen,
|
|
165
172
|
}: {
|
|
166
173
|
disabled?: boolean;
|
|
167
174
|
buttonAriaLabel?: string;
|
|
@@ -171,6 +178,9 @@ export default function DropDown({
|
|
|
171
178
|
showIcon?: boolean;
|
|
172
179
|
children: ReactNode;
|
|
173
180
|
stopCloseOnClickSelf?: boolean;
|
|
181
|
+
arrow?: boolean;
|
|
182
|
+
arrowX?: number;
|
|
183
|
+
onOpen?: (value: boolean) => void;
|
|
174
184
|
}): JSX.Element {
|
|
175
185
|
const dropDownRef = useRef<HTMLDivElement>(null);
|
|
176
186
|
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
@@ -259,6 +269,26 @@ export default function DropDown({
|
|
|
259
269
|
};
|
|
260
270
|
}, [buttonRef, dropDownRef, showDropDown]);
|
|
261
271
|
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
const wheel = (e: WheelEvent) => {
|
|
274
|
+
if (e.target instanceof HTMLElement) {
|
|
275
|
+
if (!e.target.closest(`.${Styles.dropdown}`)) {
|
|
276
|
+
setShowDropDown(false);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
window.addEventListener('wheel', wheel);
|
|
281
|
+
return () => {
|
|
282
|
+
window.removeEventListener('wheel', wheel);
|
|
283
|
+
};
|
|
284
|
+
}, []);
|
|
285
|
+
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
if (onOpen) {
|
|
288
|
+
onOpen(showDropDown);
|
|
289
|
+
}
|
|
290
|
+
}, [showDropDown]);
|
|
291
|
+
|
|
262
292
|
return (
|
|
263
293
|
<>
|
|
264
294
|
<button
|
|
@@ -280,6 +310,8 @@ export default function DropDown({
|
|
|
280
310
|
<DropDownItems
|
|
281
311
|
dropDownRef={dropDownRef}
|
|
282
312
|
zIndex={zIndex}
|
|
313
|
+
arrow={arrow}
|
|
314
|
+
arrowX={arrowX}
|
|
283
315
|
onClose={handleClose}>
|
|
284
316
|
{children}
|
|
285
317
|
</DropDownItems>,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import './const.less';
|
|
2
|
+
|
|
1
3
|
.editor-shell {
|
|
2
4
|
width: 100%;
|
|
3
5
|
// border-radius: 2px;
|
|
@@ -61,361 +63,360 @@ div.editor-shell {
|
|
|
61
63
|
line-height: 1.7;
|
|
62
64
|
}
|
|
63
65
|
:global {
|
|
66
|
+
i.add-comment {
|
|
67
|
+
background-size: cover !important;
|
|
68
|
+
background-image: url(/richText/chat-left-text.svg);
|
|
69
|
+
}
|
|
70
|
+
|
|
64
71
|
i.palette {
|
|
65
|
-
background-image: url(
|
|
72
|
+
background-image: url(/richText/palette.svg);
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
i.bucket {
|
|
69
|
-
background-image: url(
|
|
76
|
+
background-image: url(/richText/paint-bucket.svg);
|
|
70
77
|
}
|
|
71
78
|
|
|
72
79
|
i.bold {
|
|
73
|
-
background-image: url(
|
|
80
|
+
background-image: url(/richText/type-bold.svg);
|
|
74
81
|
}
|
|
75
82
|
|
|
76
83
|
i.italic {
|
|
77
|
-
background-image: url(
|
|
84
|
+
background-image: url(/richText/type-italic.svg);
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
i.clear {
|
|
81
|
-
background-image: url(
|
|
88
|
+
background-image: url(/richText/trash.svg);
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
i.code {
|
|
85
|
-
background-image: url(
|
|
92
|
+
background-image: url(/richText/code.svg);
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
i.underline {
|
|
89
|
-
background-image: url(
|
|
96
|
+
background-image: url(/richText/type-underline.svg);
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
i.uppercase {
|
|
93
|
-
background-image: url(
|
|
100
|
+
background-image: url(/richText/type-uppercase.svg);
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
i.lowercase {
|
|
97
|
-
background-image: url(
|
|
104
|
+
background-image: url(/richText/type-lowercase.svg);
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
i.capitalize {
|
|
101
|
-
background-image: url(
|
|
108
|
+
background-image: url(/richText/type-capitalize.svg);
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
i.strikethrough {
|
|
105
|
-
background-image: url(
|
|
112
|
+
background-image: url(/richText/type-strikethrough.svg);
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
i.subscript {
|
|
109
|
-
background-image: url(
|
|
116
|
+
background-image: url(/richText/type-subscript.svg);
|
|
110
117
|
}
|
|
111
118
|
|
|
112
119
|
i.superscript {
|
|
113
|
-
background-image: url(
|
|
120
|
+
background-image: url(/richText/type-superscript.svg);
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
i.highlight {
|
|
117
|
-
background-image: url(
|
|
124
|
+
background-image: url(/richText/highlighter.svg);
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
i.link {
|
|
121
|
-
background-image: url(
|
|
128
|
+
background-image: url(/richText/link.svg);
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
i.horizontal-rule {
|
|
125
|
-
background-image: url(
|
|
132
|
+
background-image: url(/richText/horizontal-rule.svg);
|
|
126
133
|
}
|
|
127
134
|
|
|
128
135
|
.icon.plus {
|
|
129
|
-
background-image: url(
|
|
136
|
+
background-image: url(/richText/plus.svg);
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
.icon.caret-right {
|
|
133
|
-
background-image: url(
|
|
140
|
+
background-image: url(/richText/caret-right-fill.svg);
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
.icon.dropdown-more {
|
|
137
|
-
background-image: url(
|
|
144
|
+
background-image: url(/richText/dropdown-more.svg);
|
|
138
145
|
}
|
|
139
146
|
|
|
140
147
|
.icon.font-color {
|
|
141
|
-
background-image: url(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
background-image: url(/richText/font-color.svg);
|
|
149
|
+
mask-repeat: no-repeat;
|
|
150
|
+
-webkit-mask-repeat: no-repeat;
|
|
151
|
+
mask-size: contain;
|
|
152
|
+
-webkit-mask-size: contain;
|
|
146
153
|
}
|
|
147
154
|
|
|
148
155
|
.icon.bg-color {
|
|
149
|
-
background-image: url(
|
|
156
|
+
background-image: url(/richText/bg-color.svg);
|
|
150
157
|
}
|
|
151
158
|
|
|
152
|
-
.icon.
|
|
153
|
-
background-
|
|
154
|
-
mask-image: url(../images/icons/table.svg);
|
|
155
|
-
-webkit-mask-image: url(../images/icons/table.svg);
|
|
156
|
-
mask-repeat: no-repeat;
|
|
157
|
-
-webkit-mask-repeat: no-repeat;
|
|
158
|
-
mask-size: contain;
|
|
159
|
-
-webkit-mask-size: contain;
|
|
159
|
+
.icon.font-family {
|
|
160
|
+
background-image: url(/richText/font-family.svg);
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
i.image {
|
|
163
|
-
background-image: url(
|
|
164
|
+
background-image: url(/richText/file-image.svg);
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
i.table {
|
|
167
|
-
background-image: url(
|
|
168
|
+
background-image: url(/richText/table.svg);
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
i.close {
|
|
171
|
-
background-image: url(
|
|
172
|
+
background-image: url(/richText/close.svg);
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
i.figma {
|
|
175
|
-
background-image: url(
|
|
176
|
+
background-image: url(/richText/figma.svg);
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
i.poll {
|
|
179
|
-
background-image: url(
|
|
180
|
+
background-image: url(/richText/card-checklist.svg);
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
i.columns {
|
|
183
|
-
background-image: url(
|
|
184
|
+
background-image: url(/richText/3-columns.svg);
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
i.x {
|
|
187
|
-
background-image: url(
|
|
188
|
+
background-image: url(/richText/x.svg);
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
i.youtube {
|
|
191
|
-
background-image: url(
|
|
192
|
+
background-image: url(/richText/youtube.svg);
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
.icon.left-align,
|
|
195
196
|
i.left-align {
|
|
196
|
-
background-image: url(
|
|
197
|
+
background-image: url(/richText/text-left.svg);
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
.icon.center-align,
|
|
200
201
|
i.center-align {
|
|
201
|
-
background-image: url(
|
|
202
|
+
background-image: url(/richText/text-center.svg);
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
.icon.right-align,
|
|
205
206
|
i.right-align {
|
|
206
|
-
background-image: url(
|
|
207
|
+
background-image: url(/richText/text-right.svg);
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
.icon.justify-align,
|
|
210
211
|
i.justify-align {
|
|
211
|
-
background-image: url(
|
|
212
|
+
background-image: url(/richText/justify.svg);
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
.icon.vertical-top,
|
|
215
216
|
i.left-align {
|
|
216
|
-
background-image: url(
|
|
217
|
+
background-image: url(/richText/vertical-top.svg);
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
.icon.vertical-middle,
|
|
220
221
|
i.center-align {
|
|
221
|
-
background-image: url(
|
|
222
|
+
background-image: url(/richText/vertical-middle.svg);
|
|
222
223
|
}
|
|
223
224
|
|
|
224
225
|
.icon.vertical-bottom,
|
|
225
226
|
i.right-align {
|
|
226
|
-
background-image: url(
|
|
227
|
+
background-image: url(/richText/vertical-bottom.svg);
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
i.indent {
|
|
230
|
-
background-image: url(
|
|
231
|
+
background-image: url(/richText/indent.svg);
|
|
231
232
|
}
|
|
232
233
|
|
|
233
234
|
i.markdown {
|
|
234
|
-
background-image: url(
|
|
235
|
+
background-image: url(/richText/markdown.svg);
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
i.outdent {
|
|
238
|
-
background-image: url(
|
|
239
|
+
background-image: url(/richText/outdent.svg);
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
i.undo {
|
|
242
|
-
background-image: url(
|
|
243
|
+
background-image: url(/richText/arrow-counterclockwise.svg);
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
i.redo {
|
|
246
|
-
background-image: url(
|
|
247
|
+
background-image: url(/richText/arrow-clockwise.svg);
|
|
247
248
|
}
|
|
248
249
|
|
|
249
250
|
i.sticky {
|
|
250
|
-
background-image: url(
|
|
251
|
+
background-image: url(/richText/sticky.svg);
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
i.mic {
|
|
254
|
-
background-image: url(
|
|
255
|
+
background-image: url(/richText/mic.svg);
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
i.import {
|
|
258
|
-
background-image: url(
|
|
259
|
+
background-image: url(/richText/upload.svg);
|
|
259
260
|
}
|
|
260
261
|
|
|
261
262
|
i.export {
|
|
262
|
-
background-image: url(
|
|
263
|
+
background-image: url(/richText/download.svg);
|
|
263
264
|
}
|
|
264
265
|
|
|
265
266
|
i.share {
|
|
266
|
-
background-image: url(
|
|
267
|
+
background-image: url(/richText/send.svg);
|
|
267
268
|
}
|
|
268
269
|
|
|
269
270
|
i.diagram-2 {
|
|
270
|
-
background-image: url(
|
|
271
|
+
background-image: url(/richText/diagram-2.svg);
|
|
271
272
|
}
|
|
272
273
|
|
|
273
274
|
i.user {
|
|
274
|
-
background-image: url(
|
|
275
|
+
background-image: url(/richText/user.svg);
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
i.equation {
|
|
278
|
-
background-image: url(
|
|
279
|
+
background-image: url(/richText/plus-slash-minus.svg);
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
i.gif {
|
|
282
|
-
background-image: url(
|
|
283
|
+
background-image: url(/richText/filetype-gif.svg);
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
i.copy {
|
|
286
|
-
background-image: url(
|
|
287
|
+
background-image: url(/richText/copy.svg);
|
|
287
288
|
}
|
|
288
289
|
|
|
289
290
|
i.success {
|
|
290
|
-
background-image: url(
|
|
291
|
+
background-image: url(/richText/success.svg);
|
|
291
292
|
}
|
|
292
293
|
|
|
293
294
|
i.prettier {
|
|
294
|
-
background-image: url(
|
|
295
|
+
background-image: url(/richText/prettier.svg);
|
|
295
296
|
}
|
|
296
297
|
|
|
297
298
|
i.prettier-error {
|
|
298
|
-
background-image: url(
|
|
299
|
+
background-image: url(/richText/prettier-error.svg);
|
|
299
300
|
}
|
|
300
301
|
|
|
301
302
|
i.page-break,
|
|
302
303
|
.icon.page-break {
|
|
303
|
-
background-image: url(
|
|
304
|
+
background-image: url(/richText/scissors.svg);
|
|
304
305
|
}
|
|
305
306
|
|
|
306
307
|
.actions i.indent {
|
|
307
|
-
background-image: url(
|
|
308
|
+
background-image: url(/richText/indent.svg);
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
.actions i.outdent {
|
|
311
|
-
background-image: url(
|
|
312
|
+
background-image: url(/richText/outdent.svg);
|
|
312
313
|
}
|
|
313
314
|
|
|
314
315
|
.actions i.lock {
|
|
315
|
-
background-image: url(
|
|
316
|
+
background-image: url(/richText/lock-fill.svg);
|
|
316
317
|
}
|
|
317
318
|
|
|
318
319
|
.actions i.image {
|
|
319
|
-
background-image: url(
|
|
320
|
+
background-image: url(/richText/file-image.svg);
|
|
320
321
|
}
|
|
321
322
|
|
|
322
323
|
.actions i.table {
|
|
323
|
-
background-image: url(
|
|
324
|
+
background-image: url(/richText/table.svg);
|
|
324
325
|
}
|
|
325
326
|
|
|
326
327
|
.actions i.unlock {
|
|
327
|
-
background-image: url(
|
|
328
|
+
background-image: url(/richText/lock.svg);
|
|
328
329
|
}
|
|
329
330
|
|
|
330
331
|
.actions i.left-align {
|
|
331
|
-
background-image: url(
|
|
332
|
+
background-image: url(/richText/text-left.svg);
|
|
332
333
|
}
|
|
333
334
|
|
|
334
335
|
.actions i.center-align {
|
|
335
|
-
background-image: url(
|
|
336
|
+
background-image: url(/richText/text-center.svg);
|
|
336
337
|
}
|
|
337
338
|
|
|
338
339
|
.actions i.right-align {
|
|
339
|
-
background-image: url(
|
|
340
|
+
background-image: url(/richText/text-right.svg);
|
|
340
341
|
}
|
|
341
342
|
|
|
342
343
|
.actions i.justify-align {
|
|
343
|
-
background-image: url(
|
|
344
|
+
background-image: url(/richText/justify.svg);
|
|
344
345
|
}
|
|
345
346
|
|
|
346
347
|
.actions i.disconnect {
|
|
347
|
-
background-image: url(
|
|
348
|
+
background-image: url(/richText/plug.svg);
|
|
348
349
|
}
|
|
349
350
|
|
|
350
351
|
.actions i.connect {
|
|
351
|
-
background-image: url(
|
|
352
|
+
background-image: url(/richText/plug-fill.svg);
|
|
352
353
|
}
|
|
353
354
|
.link-editor div.link-edit {
|
|
354
|
-
background-image: url(
|
|
355
|
+
background-image: url(/richText/pencil-fill.svg);
|
|
355
356
|
}
|
|
356
357
|
|
|
357
358
|
.link-editor div.link-trash {
|
|
358
|
-
background-image: url(
|
|
359
|
+
background-image: url(/richText/trash.svg);
|
|
359
360
|
}
|
|
360
361
|
|
|
361
362
|
.link-editor div.link-cancel {
|
|
362
|
-
background-image: url(
|
|
363
|
+
background-image: url(/richText/close.svg);
|
|
363
364
|
}
|
|
364
365
|
|
|
365
366
|
.link-editor div.link-confirm {
|
|
366
|
-
background-image: url(
|
|
367
|
+
background-image: url(/richText/success-alt.svg);
|
|
367
368
|
}
|
|
368
369
|
i.chevron-down {
|
|
369
|
-
background-image: url(
|
|
370
|
+
background-image: url(/richText/chevron-down.svg);
|
|
370
371
|
}
|
|
371
372
|
.icon.paragraph {
|
|
372
|
-
background-image: url(
|
|
373
|
+
background-image: url(/richText/text-paragraph.svg);
|
|
373
374
|
}
|
|
374
375
|
|
|
375
376
|
.icon.h1 {
|
|
376
|
-
background-image: url(
|
|
377
|
+
background-image: url(/richText/type-h1.svg);
|
|
377
378
|
}
|
|
378
379
|
|
|
379
380
|
.icon.h2 {
|
|
380
|
-
background-image: url(
|
|
381
|
+
background-image: url(/richText/type-h2.svg);
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
.icon.h3 {
|
|
384
|
-
background-image: url(
|
|
385
|
+
background-image: url(/richText/type-h3.svg);
|
|
385
386
|
}
|
|
386
387
|
|
|
387
388
|
.icon.h4 {
|
|
388
|
-
background-image: url(
|
|
389
|
+
background-image: url(/richText/type-h4.svg);
|
|
389
390
|
}
|
|
390
391
|
|
|
391
392
|
.icon.h5 {
|
|
392
|
-
background-image: url(
|
|
393
|
+
background-image: url(/richText/type-h5.svg);
|
|
393
394
|
}
|
|
394
395
|
|
|
395
396
|
.icon.h6 {
|
|
396
|
-
background-image: url(
|
|
397
|
+
background-image: url(/richText/type-h6.svg);
|
|
397
398
|
}
|
|
398
399
|
|
|
399
400
|
.icon.bullet-list,
|
|
400
401
|
.icon.bullet {
|
|
401
|
-
background-image: url(
|
|
402
|
+
background-image: url(/richText/list-ul.svg);
|
|
402
403
|
}
|
|
403
404
|
|
|
404
405
|
.icon.check-list,
|
|
405
406
|
.icon.check {
|
|
406
|
-
background-image: url(
|
|
407
|
+
background-image: url(/richText/square-check.svg);
|
|
407
408
|
}
|
|
408
409
|
|
|
409
410
|
.icon.numbered-list,
|
|
410
411
|
.icon.number {
|
|
411
|
-
background-image: url(
|
|
412
|
+
background-image: url(/richText/list-ol.svg);
|
|
412
413
|
}
|
|
413
414
|
|
|
414
415
|
.icon.quote {
|
|
415
|
-
background-image: url(
|
|
416
|
+
background-image: url(/richText/chat-square-quote.svg);
|
|
416
417
|
}
|
|
417
418
|
|
|
418
419
|
.icon.code {
|
|
419
|
-
background-image: url(
|
|
420
|
+
background-image: url(/richText/code.svg);
|
|
420
421
|
}
|
|
421
422
|
}
|
package/src/Icon/index.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import type {IconFontProps} from '@ant-design/icons/lib/components/IconFont';
|
|
|
9
9
|
|
|
10
10
|
import {createFromIconfontCN} from '@ant-design/icons';
|
|
11
11
|
import {useSettings} from 'onchain-lexical-context/settings';
|
|
12
|
-
import React from 'react';
|
|
12
|
+
import React, {useMemo} from 'react';
|
|
13
13
|
|
|
14
14
|
import Styles from './index.module.less';
|
|
15
15
|
|
|
@@ -26,11 +26,36 @@ export const Icon: React.FC<IconFontProps<string>> = ({
|
|
|
26
26
|
}) => {
|
|
27
27
|
const {extra} = useSettings();
|
|
28
28
|
const AliIconFont = AliIconFontFn(extra.iconScriptUrl);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
const staticIcon = useMemo(() => {
|
|
30
|
+
return (
|
|
31
|
+
<AliIconFont
|
|
32
|
+
{...props}
|
|
33
|
+
className={`${Styles.icon} ${className}`}
|
|
34
|
+
type={type}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
return staticIcon;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const StaticIcon: React.FC<IconFontProps<string>> = ({
|
|
43
|
+
type,
|
|
44
|
+
className,
|
|
45
|
+
...props
|
|
46
|
+
}) => {
|
|
47
|
+
const {extra} = useSettings();
|
|
48
|
+
const AliIconFont = AliIconFontFn(extra.iconScriptUrl);
|
|
49
|
+
|
|
50
|
+
const staticIcon = useMemo(() => {
|
|
51
|
+
return (
|
|
52
|
+
<AliIconFont
|
|
53
|
+
{...props}
|
|
54
|
+
className={`${Styles.icon} ${className}`}
|
|
55
|
+
type={type}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
return staticIcon;
|
|
36
61
|
};
|