mirror of
https://github.com/codex-team/editor.js
synced 2024-05-17 05:46:46 +02:00
870e265af0
* Make label an alias for title in tunes item
* Cleanup
* Update version and changelog
* Update changelog
* Move resolveAlias to utils
* Add fallback for popover item title
* Lint
* Lint
* Add fallback icon and title to popover
* Update version
* Lint
* Fix changelog
* Fallback to empty string
This reverts commit ae9d643557
.
* Fix changelog again
* Cleanup
* Add deprecated
57 lines
1.1 KiB
TypeScript
57 lines
1.1 KiB
TypeScript
/**
|
|
* @class DeleteTune
|
|
* @classdesc Editor's default tune that moves up selected block
|
|
* @copyright <CodeX Team> 2018
|
|
*/
|
|
import { API, BlockTune } from '../../../types';
|
|
import { IconCross } from '@codexteam/icons';
|
|
import { TunesMenuConfig } from '../../../types/tools';
|
|
|
|
/**
|
|
*
|
|
*/
|
|
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(): TunesMenuConfig {
|
|
return {
|
|
icon: IconCross,
|
|
title: this.api.i18n.t('Delete'),
|
|
name: 'delete',
|
|
confirmation: {
|
|
title: this.api.i18n.t('Click to delete'),
|
|
onActivate: (): void => this.handleClick(),
|
|
},
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Delete block conditions passed
|
|
*/
|
|
public handleClick(): void {
|
|
this.api.blocks.delete();
|
|
}
|
|
}
|