mirror of
https://github.com/codex-team/editor.js
synced 2026-03-15 23:25:47 +01:00
cleanup
This commit is contained in:
parent
28ca17d8d8
commit
aece45df28
2 changed files with 31 additions and 5 deletions
|
|
@ -656,15 +656,22 @@ export default class Block extends EventsDispatcher<BlockEvents> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns list of tunes available for block as popover items
|
||||
* Returns list of tunes available for block in popover format
|
||||
*/
|
||||
public getTunesList(): PopoverItem[] {
|
||||
const tunes = Array.from(this.tunesInstances.values());
|
||||
const defaultTunes = Array.from(this.defaultTunesInstances.values());
|
||||
const customTunesInstances = Array.from(this.tunesInstances.values());
|
||||
const defaultTunesInstances = Array.from(this.defaultTunesInstances.values());
|
||||
const tunesDefinedInTool =
|
||||
Array.isArray(this.toolInstance.blockSettings)
|
||||
? this.toolInstance.blockSettings
|
||||
: [ this.toolInstance.blockSettings ];
|
||||
|
||||
return tunes.concat(defaultTunes)
|
||||
const otherTunes = customTunesInstances.concat(defaultTunesInstances)
|
||||
.map(tune => tune.blockSettings)
|
||||
.filter(item => !!item);
|
||||
|
||||
// @ts-ignore
|
||||
return tunesDefinedInTool.concat(otherTunes).filter(item => !item.isActive);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -742,6 +749,19 @@ export default class Block extends EventsDispatcher<BlockEvents> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
// public get blockSettings(): PopoverItem | PopoverItem[] {
|
||||
// if (_.isFunction(this.toolInstance.blockSettings)) {
|
||||
// return this.toolInstance.blockSettings();
|
||||
// }
|
||||
// }
|
||||
|
||||
// public async getActiveTunesEntry() {
|
||||
|
||||
// }
|
||||
|
||||
/**
|
||||
* Tool could specify several entries to be displayed at the Toolbox (for example, "Heading 1", "Heading 2", "Heading 3")
|
||||
* This method returns the entry that is related to the Block (depended on the Block data)
|
||||
|
|
|
|||
6
types/tools/block-tool.d.ts
vendored
6
types/tools/block-tool.d.ts
vendored
|
|
@ -5,6 +5,7 @@ import { ToolConfig } from './tool-config';
|
|||
import { API, BlockAPI, ToolboxConfig } from '../index';
|
||||
import { PasteEvent } from './paste-events';
|
||||
import { MoveEvent } from './hook-events';
|
||||
import { PopoverItem } from '../../src/components/utils/popover';
|
||||
|
||||
/**
|
||||
* Describe Block Tool object
|
||||
|
|
@ -29,6 +30,11 @@ export interface BlockTool extends BaseTool {
|
|||
*/
|
||||
renderSettings?(): HTMLElement;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
blockSettings?: PopoverItem | PopoverItem[];
|
||||
|
||||
/**
|
||||
* Validate Block's data
|
||||
* @param {BlockToolData} blockData
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue