|
|
@@ -10,6 +10,7 @@
|
|
|
import EditorUI from '@ckeditor/ckeditor5-core/src/editor/editorui';
|
|
|
import enableToolbarKeyboardFocus from '@ckeditor/ckeditor5-ui/src/toolbar/enabletoolbarkeyboardfocus';
|
|
|
import normalizeToolbarConfig from '@ckeditor/ckeditor5-ui/src/toolbar/normalizetoolbarconfig';
|
|
|
+import { attachPlaceholder, getPlaceholderElement } from '@ckeditor/ckeditor5-engine/src/view/placeholder';
|
|
|
|
|
|
/**
|
|
|
* The decoupled editor UI class.
|
|
|
@@ -38,16 +39,25 @@ export default class DecoupledEditorUI extends EditorUI {
|
|
|
init() {
|
|
|
const editor = this.editor;
|
|
|
const view = this.view;
|
|
|
+ const editingView = editor.editing.view;
|
|
|
|
|
|
view.render();
|
|
|
|
|
|
- // Set up the editable.
|
|
|
- const editingRoot = editor.editing.view.document.getRoot();
|
|
|
- view.editable.bind( 'isReadOnly' ).to( editingRoot );
|
|
|
- view.editable.bind( 'isFocused' ).to( editor.editing.view.document );
|
|
|
editor.editing.view.attachDomRoot( view.editableElement );
|
|
|
+
|
|
|
+ const editingRoot = editor.editing.view.document.getRoot();
|
|
|
+
|
|
|
view.editable.name = editingRoot.rootName;
|
|
|
|
|
|
+ editor.on( 'dataReady', () => {
|
|
|
+ view.editable.enableDomRootActions();
|
|
|
+
|
|
|
+ attachPlaceholder( editingView, getPlaceholderElement( editingRoot ), 'Type some text...' );
|
|
|
+ } );
|
|
|
+
|
|
|
+ // Set up the editable.
|
|
|
+ view.editable.bind( 'isFocused' ).to( editor.editing.view.document );
|
|
|
+
|
|
|
this.focusTracker.add( this.view.editableElement );
|
|
|
this.view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );
|
|
|
|