onchain-lexical-ui 0.0.2 → 0.0.3
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 +92 -86
- package/src/Icon/index.tsx +22 -1
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.3",
|
|
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.3",
|
|
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>,
|
|
@@ -61,92 +61,98 @@ div.editor-shell {
|
|
|
61
61
|
line-height: 1.7;
|
|
62
62
|
}
|
|
63
63
|
:global {
|
|
64
|
+
i.add-comment {
|
|
65
|
+
background-size: cover !important;
|
|
66
|
+
background-image: url(/richText/chat-left-text.svg);
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
64
70
|
i.palette {
|
|
65
|
-
background-image: url(
|
|
71
|
+
background-image: url(/richText/palette.svg);
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
i.bucket {
|
|
69
|
-
background-image: url(
|
|
75
|
+
background-image: url(/richText/paint-bucket.svg);
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
i.bold {
|
|
73
|
-
background-image: url(
|
|
79
|
+
background-image: url(/richText/type-bold.svg);
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
i.italic {
|
|
77
|
-
background-image: url(
|
|
83
|
+
background-image: url(/richText/type-italic.svg);
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
i.clear {
|
|
81
|
-
background-image: url(
|
|
87
|
+
background-image: url(/richText/trash.svg);
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
i.code {
|
|
85
|
-
background-image: url(
|
|
91
|
+
background-image: url(/richText/code.svg);
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
i.underline {
|
|
89
|
-
background-image: url(
|
|
95
|
+
background-image: url(/richText/type-underline.svg);
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
i.uppercase {
|
|
93
|
-
background-image: url(
|
|
99
|
+
background-image: url(/richText/type-uppercase.svg);
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
i.lowercase {
|
|
97
|
-
background-image: url(
|
|
103
|
+
background-image: url(/richText/type-lowercase.svg);
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
i.capitalize {
|
|
101
|
-
background-image: url(
|
|
107
|
+
background-image: url(/richText/type-capitalize.svg);
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
i.strikethrough {
|
|
105
|
-
background-image: url(
|
|
111
|
+
background-image: url(/richText/type-strikethrough.svg);
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
i.subscript {
|
|
109
|
-
background-image: url(
|
|
115
|
+
background-image: url(/richText/type-subscript.svg);
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
i.superscript {
|
|
113
|
-
background-image: url(
|
|
119
|
+
background-image: url(/richText/type-superscript.svg);
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
i.highlight {
|
|
117
|
-
background-image: url(
|
|
123
|
+
background-image: url(/richText/highlighter.svg);
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
i.link {
|
|
121
|
-
background-image: url(
|
|
127
|
+
background-image: url(/richText/link.svg);
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
i.horizontal-rule {
|
|
125
|
-
background-image: url(
|
|
131
|
+
background-image: url(/richText/horizontal-rule.svg);
|
|
126
132
|
}
|
|
127
133
|
|
|
128
134
|
.icon.plus {
|
|
129
|
-
background-image: url(
|
|
135
|
+
background-image: url(/richText/plus.svg);
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
.icon.caret-right {
|
|
133
|
-
background-image: url(
|
|
139
|
+
background-image: url(/richText/caret-right-fill.svg);
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
.icon.dropdown-more {
|
|
137
|
-
background-image: url(
|
|
143
|
+
background-image: url(/richText/dropdown-more.svg);
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
.icon.font-color {
|
|
141
|
-
background-image: url(
|
|
147
|
+
background-image: url(/richText/font-color.svg);
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
.icon.font-family {
|
|
145
|
-
background-image: url(
|
|
151
|
+
background-image: url(/richText/font-family.svg);
|
|
146
152
|
}
|
|
147
153
|
|
|
148
154
|
.icon.bg-color {
|
|
149
|
-
background-image: url(
|
|
155
|
+
background-image: url(/richText/bg-color.svg);
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
.icon.table {
|
|
@@ -160,262 +166,262 @@ div.editor-shell {
|
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
i.image {
|
|
163
|
-
background-image: url(
|
|
169
|
+
background-image: url(/richText/file-image.svg);
|
|
164
170
|
}
|
|
165
171
|
|
|
166
172
|
i.table {
|
|
167
|
-
background-image: url(
|
|
173
|
+
background-image: url(/richText/table.svg);
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
i.close {
|
|
171
|
-
background-image: url(
|
|
177
|
+
background-image: url(/richText/close.svg);
|
|
172
178
|
}
|
|
173
179
|
|
|
174
180
|
i.figma {
|
|
175
|
-
background-image: url(
|
|
181
|
+
background-image: url(/richText/figma.svg);
|
|
176
182
|
}
|
|
177
183
|
|
|
178
184
|
i.poll {
|
|
179
|
-
background-image: url(
|
|
185
|
+
background-image: url(/richText/card-checklist.svg);
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
i.columns {
|
|
183
|
-
background-image: url(
|
|
189
|
+
background-image: url(/richText/3-columns.svg);
|
|
184
190
|
}
|
|
185
191
|
|
|
186
192
|
i.x {
|
|
187
|
-
background-image: url(
|
|
193
|
+
background-image: url(/richText/x.svg);
|
|
188
194
|
}
|
|
189
195
|
|
|
190
196
|
i.youtube {
|
|
191
|
-
background-image: url(
|
|
197
|
+
background-image: url(/richText/youtube.svg);
|
|
192
198
|
}
|
|
193
199
|
|
|
194
200
|
.icon.left-align,
|
|
195
201
|
i.left-align {
|
|
196
|
-
background-image: url(
|
|
202
|
+
background-image: url(/richText/text-left.svg);
|
|
197
203
|
}
|
|
198
204
|
|
|
199
205
|
.icon.center-align,
|
|
200
206
|
i.center-align {
|
|
201
|
-
background-image: url(
|
|
207
|
+
background-image: url(/richText/text-center.svg);
|
|
202
208
|
}
|
|
203
209
|
|
|
204
210
|
.icon.right-align,
|
|
205
211
|
i.right-align {
|
|
206
|
-
background-image: url(
|
|
212
|
+
background-image: url(/richText/text-right.svg);
|
|
207
213
|
}
|
|
208
214
|
|
|
209
215
|
.icon.justify-align,
|
|
210
216
|
i.justify-align {
|
|
211
|
-
background-image: url(
|
|
217
|
+
background-image: url(/richText/justify.svg);
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
.icon.vertical-top,
|
|
215
221
|
i.left-align {
|
|
216
|
-
background-image: url(
|
|
222
|
+
background-image: url(/richText/vertical-top.svg);
|
|
217
223
|
}
|
|
218
224
|
|
|
219
225
|
.icon.vertical-middle,
|
|
220
226
|
i.center-align {
|
|
221
|
-
background-image: url(
|
|
227
|
+
background-image: url(/richText/vertical-middle.svg);
|
|
222
228
|
}
|
|
223
229
|
|
|
224
230
|
.icon.vertical-bottom,
|
|
225
231
|
i.right-align {
|
|
226
|
-
background-image: url(
|
|
232
|
+
background-image: url(/richText/vertical-bottom.svg);
|
|
227
233
|
}
|
|
228
234
|
|
|
229
235
|
i.indent {
|
|
230
|
-
background-image: url(
|
|
236
|
+
background-image: url(/richText/indent.svg);
|
|
231
237
|
}
|
|
232
238
|
|
|
233
239
|
i.markdown {
|
|
234
|
-
background-image: url(
|
|
240
|
+
background-image: url(/richText/markdown.svg);
|
|
235
241
|
}
|
|
236
242
|
|
|
237
243
|
i.outdent {
|
|
238
|
-
background-image: url(
|
|
244
|
+
background-image: url(/richText/outdent.svg);
|
|
239
245
|
}
|
|
240
246
|
|
|
241
247
|
i.undo {
|
|
242
|
-
background-image: url(
|
|
248
|
+
background-image: url(/richText/arrow-counterclockwise.svg);
|
|
243
249
|
}
|
|
244
250
|
|
|
245
251
|
i.redo {
|
|
246
|
-
background-image: url(
|
|
252
|
+
background-image: url(/richText/arrow-clockwise.svg);
|
|
247
253
|
}
|
|
248
254
|
|
|
249
255
|
i.sticky {
|
|
250
|
-
background-image: url(
|
|
256
|
+
background-image: url(/richText/sticky.svg);
|
|
251
257
|
}
|
|
252
258
|
|
|
253
259
|
i.mic {
|
|
254
|
-
background-image: url(
|
|
260
|
+
background-image: url(/richText/mic.svg);
|
|
255
261
|
}
|
|
256
262
|
|
|
257
263
|
i.import {
|
|
258
|
-
background-image: url(
|
|
264
|
+
background-image: url(/richText/upload.svg);
|
|
259
265
|
}
|
|
260
266
|
|
|
261
267
|
i.export {
|
|
262
|
-
background-image: url(
|
|
268
|
+
background-image: url(/richText/download.svg);
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
i.share {
|
|
266
|
-
background-image: url(
|
|
272
|
+
background-image: url(/richText/send.svg);
|
|
267
273
|
}
|
|
268
274
|
|
|
269
275
|
i.diagram-2 {
|
|
270
|
-
background-image: url(
|
|
276
|
+
background-image: url(/richText/diagram-2.svg);
|
|
271
277
|
}
|
|
272
278
|
|
|
273
279
|
i.user {
|
|
274
|
-
background-image: url(
|
|
280
|
+
background-image: url(/richText/user.svg);
|
|
275
281
|
}
|
|
276
282
|
|
|
277
283
|
i.equation {
|
|
278
|
-
background-image: url(
|
|
284
|
+
background-image: url(/richText/plus-slash-minus.svg);
|
|
279
285
|
}
|
|
280
286
|
|
|
281
287
|
i.gif {
|
|
282
|
-
background-image: url(
|
|
288
|
+
background-image: url(/richText/filetype-gif.svg);
|
|
283
289
|
}
|
|
284
290
|
|
|
285
291
|
i.copy {
|
|
286
|
-
background-image: url(
|
|
292
|
+
background-image: url(/richText/copy.svg);
|
|
287
293
|
}
|
|
288
294
|
|
|
289
295
|
i.success {
|
|
290
|
-
background-image: url(
|
|
296
|
+
background-image: url(/richText/success.svg);
|
|
291
297
|
}
|
|
292
298
|
|
|
293
299
|
i.prettier {
|
|
294
|
-
background-image: url(
|
|
300
|
+
background-image: url(/richText/prettier.svg);
|
|
295
301
|
}
|
|
296
302
|
|
|
297
303
|
i.prettier-error {
|
|
298
|
-
background-image: url(
|
|
304
|
+
background-image: url(/richText/prettier-error.svg);
|
|
299
305
|
}
|
|
300
306
|
|
|
301
307
|
i.page-break,
|
|
302
308
|
.icon.page-break {
|
|
303
|
-
background-image: url(
|
|
309
|
+
background-image: url(/richText/scissors.svg);
|
|
304
310
|
}
|
|
305
311
|
|
|
306
312
|
.actions i.indent {
|
|
307
|
-
background-image: url(
|
|
313
|
+
background-image: url(/richText/indent.svg);
|
|
308
314
|
}
|
|
309
315
|
|
|
310
316
|
.actions i.outdent {
|
|
311
|
-
background-image: url(
|
|
317
|
+
background-image: url(/richText/outdent.svg);
|
|
312
318
|
}
|
|
313
319
|
|
|
314
320
|
.actions i.lock {
|
|
315
|
-
background-image: url(
|
|
321
|
+
background-image: url(/richText/lock-fill.svg);
|
|
316
322
|
}
|
|
317
323
|
|
|
318
324
|
.actions i.image {
|
|
319
|
-
background-image: url(
|
|
325
|
+
background-image: url(/richText/file-image.svg);
|
|
320
326
|
}
|
|
321
327
|
|
|
322
328
|
.actions i.table {
|
|
323
|
-
background-image: url(
|
|
329
|
+
background-image: url(/richText/table.svg);
|
|
324
330
|
}
|
|
325
331
|
|
|
326
332
|
.actions i.unlock {
|
|
327
|
-
background-image: url(
|
|
333
|
+
background-image: url(/richText/lock.svg);
|
|
328
334
|
}
|
|
329
335
|
|
|
330
336
|
.actions i.left-align {
|
|
331
|
-
background-image: url(
|
|
337
|
+
background-image: url(/richText/text-left.svg);
|
|
332
338
|
}
|
|
333
339
|
|
|
334
340
|
.actions i.center-align {
|
|
335
|
-
background-image: url(
|
|
341
|
+
background-image: url(/richText/text-center.svg);
|
|
336
342
|
}
|
|
337
343
|
|
|
338
344
|
.actions i.right-align {
|
|
339
|
-
background-image: url(
|
|
345
|
+
background-image: url(/richText/text-right.svg);
|
|
340
346
|
}
|
|
341
347
|
|
|
342
348
|
.actions i.justify-align {
|
|
343
|
-
background-image: url(
|
|
349
|
+
background-image: url(/richText/justify.svg);
|
|
344
350
|
}
|
|
345
351
|
|
|
346
352
|
.actions i.disconnect {
|
|
347
|
-
background-image: url(
|
|
353
|
+
background-image: url(/richText/plug.svg);
|
|
348
354
|
}
|
|
349
355
|
|
|
350
356
|
.actions i.connect {
|
|
351
|
-
background-image: url(
|
|
357
|
+
background-image: url(/richText/plug-fill.svg);
|
|
352
358
|
}
|
|
353
359
|
.link-editor div.link-edit {
|
|
354
|
-
background-image: url(
|
|
360
|
+
background-image: url(/richText/pencil-fill.svg);
|
|
355
361
|
}
|
|
356
362
|
|
|
357
363
|
.link-editor div.link-trash {
|
|
358
|
-
background-image: url(
|
|
364
|
+
background-image: url(/richText/trash.svg);
|
|
359
365
|
}
|
|
360
366
|
|
|
361
367
|
.link-editor div.link-cancel {
|
|
362
|
-
background-image: url(
|
|
368
|
+
background-image: url(/richText/close.svg);
|
|
363
369
|
}
|
|
364
370
|
|
|
365
371
|
.link-editor div.link-confirm {
|
|
366
|
-
background-image: url(
|
|
372
|
+
background-image: url(/richText/success-alt.svg);
|
|
367
373
|
}
|
|
368
374
|
i.chevron-down {
|
|
369
|
-
background-image: url(
|
|
375
|
+
background-image: url(/richText/chevron-down.svg);
|
|
370
376
|
}
|
|
371
377
|
.icon.paragraph {
|
|
372
|
-
background-image: url(
|
|
378
|
+
background-image: url(/richText/text-paragraph.svg);
|
|
373
379
|
}
|
|
374
380
|
|
|
375
381
|
.icon.h1 {
|
|
376
|
-
background-image: url(
|
|
382
|
+
background-image: url(/richText/type-h1.svg);
|
|
377
383
|
}
|
|
378
384
|
|
|
379
385
|
.icon.h2 {
|
|
380
|
-
background-image: url(
|
|
386
|
+
background-image: url(/richText/type-h2.svg);
|
|
381
387
|
}
|
|
382
388
|
|
|
383
389
|
.icon.h3 {
|
|
384
|
-
background-image: url(
|
|
390
|
+
background-image: url(/richText/type-h3.svg);
|
|
385
391
|
}
|
|
386
392
|
|
|
387
393
|
.icon.h4 {
|
|
388
|
-
background-image: url(
|
|
394
|
+
background-image: url(/richText/type-h4.svg);
|
|
389
395
|
}
|
|
390
396
|
|
|
391
397
|
.icon.h5 {
|
|
392
|
-
background-image: url(
|
|
398
|
+
background-image: url(/richText/type-h5.svg);
|
|
393
399
|
}
|
|
394
400
|
|
|
395
401
|
.icon.h6 {
|
|
396
|
-
background-image: url(
|
|
402
|
+
background-image: url(/richText/type-h6.svg);
|
|
397
403
|
}
|
|
398
404
|
|
|
399
405
|
.icon.bullet-list,
|
|
400
406
|
.icon.bullet {
|
|
401
|
-
background-image: url(
|
|
407
|
+
background-image: url(/richText/list-ul.svg);
|
|
402
408
|
}
|
|
403
409
|
|
|
404
410
|
.icon.check-list,
|
|
405
411
|
.icon.check {
|
|
406
|
-
background-image: url(
|
|
412
|
+
background-image: url(/richText/square-check.svg);
|
|
407
413
|
}
|
|
408
414
|
|
|
409
415
|
.icon.numbered-list,
|
|
410
416
|
.icon.number {
|
|
411
|
-
background-image: url(
|
|
417
|
+
background-image: url(/richText/list-ol.svg);
|
|
412
418
|
}
|
|
413
419
|
|
|
414
420
|
.icon.quote {
|
|
415
|
-
background-image: url(
|
|
421
|
+
background-image: url(/richText/chat-square-quote.svg);
|
|
416
422
|
}
|
|
417
423
|
|
|
418
424
|
.icon.code {
|
|
419
|
-
background-image: url(
|
|
425
|
+
background-image: url(/richText/code.svg);
|
|
420
426
|
}
|
|
421
|
-
}
|
|
427
|
+
}
|
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
|
|
|
@@ -34,3 +34,24 @@ export const Icon: React.FC<IconFontProps<string>> = ({
|
|
|
34
34
|
/>
|
|
35
35
|
);
|
|
36
36
|
};
|
|
37
|
+
|
|
38
|
+
export const StaticIcon: React.FC<IconFontProps<string>> = ({
|
|
39
|
+
type,
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}) => {
|
|
43
|
+
const {extra} = useSettings();
|
|
44
|
+
const AliIconFont = AliIconFontFn(extra.iconScriptUrl);
|
|
45
|
+
|
|
46
|
+
const staticIcon = useMemo(() => {
|
|
47
|
+
return (
|
|
48
|
+
<AliIconFont
|
|
49
|
+
{...props}
|
|
50
|
+
className={`${Styles.icon} ${className}`}
|
|
51
|
+
type={type}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
return staticIcon;
|
|
57
|
+
};
|