This commit is contained in:
Tanya Fomina 2022-07-04 21:31:12 +08:00
commit a0c87fbf0a
2 changed files with 6 additions and 12 deletions

View file

@ -4,6 +4,8 @@ import * as _ from '../../utils';
import SelectionUtils from '../../selection';
import Block from '../../block';
import Popover from '../../utils/popover';
import I18n from '../../i18n';
import { I18nInternalNS } from '../../i18n/namespace-internal';
/**
* HTML Elements that used for BlockSettings
@ -16,14 +18,6 @@ interface BlockSettingsNodes {
/**
* Block Settings
*
* ____ Settings Panel ____
* | ...................... |
* | . Tool Settings . |
* | ...................... |
* | . Default Settings . |
* | ...................... |
* |________________________|
*
* @todo Make Block Settings no-module but a standalone class, like Toolbox
*/
export default class BlockSettings extends Module<BlockSettingsNodes> {
@ -113,10 +107,9 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
this.makeToolTunesButtonsNavigatable();
this.popover = new Popover({
className: '',
searchable: true,
filterLabel: 'Filter',
nothingFoundLabel: 'Nothing found',
filterLabel: I18n.ui(I18nInternalNS.ui.toolbar.toolbox, 'Filter'),
nothingFoundLabel: I18n.ui(I18nInternalNS.ui.toolbar.toolbox, 'Nothing found'),
items: targetBlock.getTunesItems(),
customContent: this.nodes.toolSettings,
});
@ -168,6 +161,7 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
this.eventsDispatcher.emit(this.events.closed);
if (this.popover) {
this.popover.destroy();
this.popover.getElement().remove();
}
}

View file

@ -417,7 +417,7 @@ export default class Popover extends EventsDispatcher<PopoverEvent> {
* Item click handler
*
* @param itemEl - clicked item
* @param event
* @param event - click event
*/
private itemClicked(itemEl: HTMLElement, event: MouseEvent): void {
const allItems = this.nodes.wrapper.querySelectorAll(`.${Popover.CSS.item}`);