2
2
import type { LinkedList } from "parchment" ;
3
3
import Quill from "quill" ;
4
4
import Delta from "quill-delta" ;
5
- import cellIcon from "../assets/icon/cell.svg" ;
6
- import columnIcon from "../assets/icon/column.svg" ;
7
- import copyIcon from "../assets/icon/copy.svg" ;
8
- import deleteIcon from "../assets/icon/delete.svg" ;
9
- import downIcon from "../assets/icon/down.svg" ;
10
- import mergeIcon from "../assets/icon/merge.svg" ;
11
- import rowIcon from "../assets/icon/row.svg" ;
12
- import tableIcon from "../assets/icon/table.svg" ;
13
- import wrapIcon from "../assets/icon/wrap.svg" ;
14
5
import { CELL_DEFAULT_VALUES , CELL_DEFAULT_WIDTH , CELL_PROPERTIES , DEVIATION , TABLE_PROPERTIES } from "../config" ;
15
6
import { TableCell , tableId } from "../formats/table" ;
16
7
import type {
@@ -62,7 +53,7 @@ function getMenusConfig(useLanguage: UseLanguageHandler, menus?: string[]): Menu
62
53
const DEFAULT : MenusDefaults = {
63
54
column : {
64
55
content : useLanguage ( "col" ) ,
65
- icon : columnIcon ,
56
+ icon : "icons icon-Column" ,
66
57
handler ( list : HTMLUListElement , tooltip : HTMLDivElement ) {
67
58
this . toggleAttribute ( list , tooltip ) ;
68
59
} ,
@@ -97,7 +88,7 @@ function getMenusConfig(useLanguage: UseLanguageHandler, menus?: string[]): Menu
97
88
} ,
98
89
row : {
99
90
content : useLanguage ( "row" ) ,
100
- icon : rowIcon ,
91
+ icon : "icons icon-Row" ,
101
92
handler ( list : HTMLUListElement , tooltip : HTMLDivElement ) {
102
93
this . toggleAttribute ( list , tooltip ) ;
103
94
} ,
@@ -128,7 +119,7 @@ function getMenusConfig(useLanguage: UseLanguageHandler, menus?: string[]): Menu
128
119
} ,
129
120
merge : {
130
121
content : useLanguage ( "mCells" ) ,
131
- icon : mergeIcon ,
122
+ icon : "icons icon-Merge" ,
132
123
handler ( list : HTMLUListElement , tooltip : HTMLDivElement ) {
133
124
this . toggleAttribute ( list , tooltip ) ;
134
125
} ,
@@ -151,7 +142,7 @@ function getMenusConfig(useLanguage: UseLanguageHandler, menus?: string[]): Menu
151
142
} ,
152
143
table : {
153
144
content : useLanguage ( "tblProps" ) ,
154
- icon : tableIcon ,
145
+ icon : "icons icon-Table" ,
155
146
handler ( list : HTMLUListElement , tooltip : HTMLDivElement ) {
156
147
const attribute = {
157
148
...getElementStyle ( this . table , TABLE_PROPERTIES ) ,
@@ -164,7 +155,7 @@ function getMenusConfig(useLanguage: UseLanguageHandler, menus?: string[]): Menu
164
155
} ,
165
156
cell : {
166
157
content : useLanguage ( "cellProps" ) ,
167
- icon : cellIcon ,
158
+ icon : "icons icon-Cell" ,
168
159
handler ( list : HTMLUListElement , tooltip : HTMLDivElement ) {
169
160
const { selectedTds } = this . tableBetter . cellSelection ;
170
161
const attribute =
@@ -178,7 +169,7 @@ function getMenusConfig(useLanguage: UseLanguageHandler, menus?: string[]): Menu
178
169
} ,
179
170
wrap : {
180
171
content : useLanguage ( "insParaOTbl" ) ,
181
- icon : wrapIcon ,
172
+ icon : "icons icon-Wrap" ,
182
173
handler ( list : HTMLUListElement , tooltip : HTMLDivElement ) {
183
174
this . toggleAttribute ( list , tooltip ) ;
184
175
} ,
@@ -199,7 +190,7 @@ function getMenusConfig(useLanguage: UseLanguageHandler, menus?: string[]): Menu
199
190
} ,
200
191
delete : {
201
192
content : useLanguage ( "delTable" ) ,
202
- icon : deleteIcon ,
193
+ icon : "icons icon-Delete" ,
203
194
handler ( ) {
204
195
this . deleteTable ( ) ;
205
196
}
@@ -208,7 +199,7 @@ function getMenusConfig(useLanguage: UseLanguageHandler, menus?: string[]): Menu
208
199
const EXTRA : MenusDefaults = {
209
200
copy : {
210
201
content : useLanguage ( "copyTable" ) ,
211
- icon : copyIcon ,
202
+ icon : "icons icon-Copy" ,
212
203
handler ( ) {
213
204
this . copyTable ( ) ;
214
205
}
@@ -282,17 +273,19 @@ class TableMenus {
282
273
283
274
createMenu ( left : string , right : string , isDropDown : boolean ) {
284
275
const container = this . quill . root . ownerDocument . createElement ( "div" ) ;
276
+ container . classList . add ( "ql-table-dropdown" ) ;
285
277
const dropDown = this . quill . root . ownerDocument . createElement ( "span" ) ;
286
- const leftIcon = this . quill . root . ownerDocument . createElement ( "img" ) ;
287
- leftIcon . setAttribute ( "src" , left ) ;
288
- dropDown . appendChild ( leftIcon ) ;
278
+ dropDown . classList . add ( "ql-table-tooltip-hover" ) ;
279
+ const classes = left . split ( " " ) ;
280
+ const icon = this . quill . root . ownerDocument . createElement ( "span" ) ;
281
+ icon . classList . add ( ...classes ) ;
282
+ dropDown . appendChild ( icon ) ;
289
283
if ( isDropDown ) {
290
- const rightIcon = this . quill . root . ownerDocument . createElement ( "img" ) ;
291
- rightIcon . setAttribute ( "src" , right ) ;
292
- dropDown . appendChild ( rightIcon ) ;
284
+ const classes = right . split ( " " ) ;
285
+ const dropDownIcon = this . quill . root . ownerDocument . createElement ( "span" ) ;
286
+ dropDownIcon . classList . add ( ...classes ) ;
287
+ dropDown . appendChild ( dropDownIcon ) ;
293
288
}
294
- container . classList . add ( "ql-table-dropdown" ) ;
295
- dropDown . classList . add ( "ql-table-tooltip-hover" ) ;
296
289
container . appendChild ( dropDown ) ;
297
290
return container ;
298
291
}
@@ -307,7 +300,7 @@ class TableMenus {
307
300
const { content, icon, children, handler } = val ;
308
301
const list = this . createList ( children ) ;
309
302
const tooltip = createTooltip ( content ) ;
310
- const menu = this . createMenu ( icon , downIcon , ! ! children ) ;
303
+ const menu = this . createMenu ( icon , "icons icon-Arrow-down" , ! ! children ) ;
311
304
menu . appendChild ( tooltip ) ;
312
305
list && menu . appendChild ( list ) ;
313
306
container . appendChild ( menu ) ;
0 commit comments