ngx-editor-plus
Version:
WYSIWYG Editor for Angular Applications
38 lines (30 loc) • 977 B
text/typescript
import { Component, Input, Output, EventEmitter } from '@angular/core';
import * as Utils from '../common/utils/ngx-editor.utils';
({
selector: 'app-ngx-editor-toolbar',
templateUrl: './ngx-editor-toolbar.component.html',
styleUrls: ['./ngx-editor-toolbar.component.scss']
})
export class NgxEditorToolbarComponent {
() config: any;
() enableToolbar = false;
() showToolbar = true;
() execute: EventEmitter<string> = new EventEmitter<string>();
constructor() { }
/**
* enable or diable toolbar based on configuration
*
* @param value toolbar buttons
*/
canEnableToolbarOptions(value): boolean {
return Utils.canEnableToolbarOptions(value, this.config['toolbar']);
}
/**
* triggers command from the toolbar to be executed
*
* @param command command to be executed
*/
triggerCommand(command: string): void {
this.execute.emit(command);
}
}