@@ -7,13 +7,12 @@ import { I18nInternalNS } from '../../i18n/namespace-internal';
7
7
import Flipper from '../../flipper' ;
8
8
import { TunesMenuConfigItem } from '../../../../types/tools' ;
9
9
import { resolveAliases } from '../../utils/resolve-aliases' ;
10
- import { type Popover , PopoverDesktop , PopoverMobile , PopoverItemParams , PopoverItemDefaultParams , PopoverItemType } from '../../utils/popover' ;
10
+ import { type Popover , PopoverDesktop , PopoverMobile , PopoverItemParams , PopoverItemType } from '../../utils/popover' ;
11
11
import { PopoverEvent } from '../../utils/popover/popover.types' ;
12
12
import { isMobileScreen } from '../../utils' ;
13
13
import { EditorMobileLayoutToggled } from '../../events' ;
14
- import * as _ from '../../utils' ;
15
14
import { IconReplace } from '@codexteam/icons' ;
16
- import { getConvertToItems , isSameBlockData } from '../../utils/blocks' ;
15
+ import { getConvertToItems } from '../../utils/blocks' ;
17
16
18
17
/**
19
18
* HTML Elements that used for BlockSettings
@@ -234,77 +233,6 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
234
233
return items . map ( tune => this . resolveTuneAliases ( tune ) ) ;
235
234
}
236
235
237
- /**
238
- * Returns list of all available conversion menu items
239
- *
240
- * @param currentBlock - block we are about to open block tunes for
241
- */
242
- private async getConvertToItems ( currentBlock : Block ) : Promise < PopoverItemDefaultParams [ ] > {
243
- const conversionEntries = Array . from ( this . Editor . Tools . blockTools . entries ( ) ) ;
244
-
245
- const resultItems : PopoverItemDefaultParams [ ] = [ ] ;
246
-
247
- const blockData = await currentBlock . data ;
248
-
249
- conversionEntries . forEach ( ( [ toolName , tool ] ) => {
250
- const conversionConfig = tool . conversionConfig ;
251
-
252
- /**
253
- * Skip tools without «import» rule specified
254
- */
255
- if ( ! conversionConfig || ! conversionConfig . import ) {
256
- return ;
257
- }
258
-
259
- tool . toolbox ?. forEach ( ( toolboxItem ) => {
260
- /**
261
- * Skip tools that don't pass 'toolbox' property
262
- */
263
- if ( _ . isEmpty ( toolboxItem ) || ! toolboxItem . icon ) {
264
- return ;
265
- }
266
-
267
- let shouldSkip = false ;
268
-
269
- if ( toolboxItem . data !== undefined ) {
270
- /**
271
- * When a tool has several toolbox entries, we need to make sure we do not add
272
- * toolbox item with the same data to the resulting array. This helps exclude duplicates
273
- */
274
- const hasSameData = isSameBlockData ( toolboxItem . data , blockData ) ;
275
-
276
- shouldSkip = hasSameData ;
277
- } else {
278
- shouldSkip = toolName === currentBlock . name ;
279
- }
280
-
281
-
282
- if ( shouldSkip ) {
283
- return ;
284
- }
285
-
286
- resultItems . push ( {
287
- icon : toolboxItem . icon ,
288
- title : toolboxItem . title ,
289
- name : toolName ,
290
- onActivate : async ( ) => {
291
- const { BlockManager, BlockSelection, Caret } = this . Editor ;
292
-
293
- const newBlock = await BlockManager . convert ( this . Editor . BlockManager . currentBlock , toolName , toolboxItem . data ) ;
294
-
295
- BlockSelection . clearSelection ( ) ;
296
-
297
- this . close ( ) ;
298
-
299
- Caret . setToBlock ( newBlock , Caret . positions . END ) ;
300
- } ,
301
- } ) ;
302
- } ) ;
303
- } ) ;
304
-
305
- return resultItems ;
306
- }
307
-
308
236
/**
309
237
* Handles popover close event
310
238
*/
0 commit comments