@progress/kendo-angular-editor
Version:
Kendo UI Editor for Angular
38 lines (37 loc) • 1.45 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { EditorCommandBaseDirective } from './editor-command-base';
import { take } from 'rxjs/operators';
/**
* @hidden
*/
export class EditorCommandButton extends EditorCommandBaseDirective {
command;
button;
localization;
providerService;
toolsService;
constructor(command, button, localization, providerService, toolsService) {
super(command, button, localization, providerService, toolsService);
this.command = command;
this.button = button;
this.localization = localization;
this.providerService = providerService;
this.toolsService = toolsService;
}
clickHandler() {
this.editor.exec(this.command, this.editor.applyToWord);
this.editor.focus();
}
pointerdownHandler(e) {
e.preventDefault();
}
onStateChange(toolBarState) {
this.providerService.editor.ngZone.onStable.pipe(take(1)).subscribe(() => {
this.button.selected = toolBarState[this.command].selected;
this.button.disabled = toolBarState[this.command].disabled;
});
}
}