import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
import BpmnIcon from '../../themes/icons/bpmn.svg';
import BpmnDialogCommand from './bpmndialogcommand';
export default class QMSCKEditorBpmnPlugin extends Plugin {
    init() {
        const editor = this.editor;
        const t = editor.t;
        editor.ui.componentFactory.add('qmsBpmn', locale => {
            const view = new ButtonView(locale);
            const command = editor.commands.get('bpmnDialog');
            view.set({
                label: t('Business Process Model and Notation'),
                icon: BpmnIcon,
                tooltip: true
            });
            view.bind('isEnabled').to(command);
            view.on('execute', () => {
              command.execute();
            });
            return view;
        });

        editor.commands.add('bpmnDialog', new BpmnDialogCommand(editor));
    }
}
