editor.js/src/components/block-tunes/block-tune-delete.ts
Peter Savchenko b1b582b150
feat(icons): codex icons package is used instead of svg sprite (#2173)
* chore(icons): migrating to the coded icon pack

* conversion toolbar

* inline toolbar, part 1

* inline-link tool has the new icons

* added a test for creating a link by Enter keydown in link input

* rm last icons, svg sprite, loaders

* rollback .ce-settings styles

* Update CHANGELOG.md

* Update settings.json
2022-11-25 22:26:23 +04:00

56 lines
1.1 KiB
TypeScript

/**
* @class DeleteTune
* @classdesc Editor's default tune that moves up selected block
* @copyright <CodeX Team> 2018
*/
import { API, BlockTune, PopoverItem } from '../../../types';
import { IconCross } from '@codexteam/icons';
/**
*
*/
export default class DeleteTune implements BlockTune {
/**
* Set Tool is Tune
*/
public static readonly isTune = true;
/**
* Property that contains Editor.js API methods
*
* @see {@link docs/api.md}
*/
private readonly api: API;
/**
* DeleteTune constructor
*
* @param {API} api - Editor's API
*/
constructor({ api }) {
this.api = api;
}
/**
* Tune's appearance in block settings menu
*/
public render(): PopoverItem {
return {
icon: IconCross,
label: this.api.i18n.t('Delete'),
name: 'delete',
confirmation: {
label: this.api.i18n.t('Click to delete'),
onActivate: (): void => this.handleClick(),
},
};
}
/**
* Delete block conditions passed
*/
public handleClick(): void {
this.api.blocks.delete();
}
}