|
@@ -6,10 +6,14 @@
|
|
|
'use strict';
|
|
'use strict';
|
|
|
|
|
|
|
|
import Creator from '/ckeditor5/core/creator.js';
|
|
import Creator from '/ckeditor5/core/creator.js';
|
|
|
-import View from '/ckeditor5/core/ui/view.js';
|
|
|
|
|
|
|
+import EditorUIView from '/ckeditor5/core/editorui/editoruiview.js';
|
|
|
import BoxlessEditorUI from '/tests/core/_utils/ui/boxlesseditorui/boxlesseditorui.js';
|
|
import BoxlessEditorUI from '/tests/core/_utils/ui/boxlesseditorui/boxlesseditorui.js';
|
|
|
import InlineEditable from '/tests/core/_utils/ui/editable/inline/inlineeditable.js';
|
|
import InlineEditable from '/tests/core/_utils/ui/editable/inline/inlineeditable.js';
|
|
|
import InlineEditableView from '/tests/core/_utils/ui/editable/inline/inlineeditableview.js';
|
|
import InlineEditableView from '/tests/core/_utils/ui/editable/inline/inlineeditableview.js';
|
|
|
|
|
+import Model from '/ckeditor5/core/ui/model.js';
|
|
|
|
|
+import FloatingToolbar from '/tests/core/_utils/ui/floatingtoolbar/floatingtoolbar.js';
|
|
|
|
|
+import FloatingToolbarView from '/tests/core/_utils/ui/floatingtoolbar/floatingtoolbarview.js';
|
|
|
|
|
+import { imitateFeatures, imitateDestroyFeatures } from '../imitatefeatures.js';
|
|
|
|
|
|
|
|
export default class InlineCreator extends Creator {
|
|
export default class InlineCreator extends Creator {
|
|
|
constructor( editor ) {
|
|
constructor( editor ) {
|
|
@@ -19,13 +23,18 @@ export default class InlineCreator extends Creator {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
create() {
|
|
|
|
|
+ imitateFeatures( this.editor );
|
|
|
|
|
+
|
|
|
this._setupEditable();
|
|
this._setupEditable();
|
|
|
|
|
+ this._setupToolbar();
|
|
|
|
|
|
|
|
return super.create()
|
|
return super.create()
|
|
|
.then( () => this.loadDataFromEditorElement() );
|
|
.then( () => this.loadDataFromEditorElement() );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
destroy() {
|
|
destroy() {
|
|
|
|
|
+ imitateDestroyFeatures();
|
|
|
|
|
+
|
|
|
this.updateEditorElement();
|
|
this.updateEditorElement();
|
|
|
|
|
|
|
|
return super.destroy();
|
|
return super.destroy();
|
|
@@ -37,6 +46,20 @@ export default class InlineCreator extends Creator {
|
|
|
this.editor.ui.add( 'editable', this.editor.editable );
|
|
this.editor.ui.add( 'editable', this.editor.editable );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ _setupToolbar() {
|
|
|
|
|
+ const toolbar1Model = new Model();
|
|
|
|
|
+ const toolbar2Model = new Model();
|
|
|
|
|
+
|
|
|
|
|
+ const toolbar1 = new FloatingToolbar( this.editor, toolbar1Model, new FloatingToolbarView( toolbar1Model ) );
|
|
|
|
|
+ const toolbar2 = new FloatingToolbar( this.editor, toolbar2Model, new FloatingToolbarView( toolbar2Model ) );
|
|
|
|
|
+
|
|
|
|
|
+ toolbar1.addButtons( this.editor.config.toolbar );
|
|
|
|
|
+ toolbar2.addButtons( this.editor.config.toolbar.reverse() );
|
|
|
|
|
+
|
|
|
|
|
+ this.editor.ui.add( 'body', toolbar1 );
|
|
|
|
|
+ this.editor.ui.add( 'body', toolbar2 );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
_createEditable() {
|
|
_createEditable() {
|
|
|
const editable = new InlineEditable( this.editor );
|
|
const editable = new InlineEditable( this.editor );
|
|
|
const editableView = new InlineEditableView( editable.viewModel, this.editor.element );
|
|
const editableView = new InlineEditableView( editable.viewModel, this.editor.element );
|
|
@@ -49,7 +72,7 @@ export default class InlineCreator extends Creator {
|
|
|
_createEditorUI() {
|
|
_createEditorUI() {
|
|
|
const editorUI = new BoxlessEditorUI( this.editor );
|
|
const editorUI = new BoxlessEditorUI( this.editor );
|
|
|
|
|
|
|
|
- editorUI.view = new View( editorUI.viewModel );
|
|
|
|
|
|
|
+ editorUI.view = new EditorUIView( editorUI.viewModel );
|
|
|
|
|
|
|
|
return editorUI;
|
|
return editorUI;
|
|
|
}
|
|
}
|