mirror of
https://github.com/codex-team/editor.js
synced 2024-05-03 07:03:47 +02:00
b1b582b150
* 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
56 lines
1.1 KiB
TypeScript
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();
|
|
}
|
|
}
|