|
@@ -78,14 +78,13 @@ export default class BootstrapEditor extends Editor {
|
|
|
static create( element, config ) {
|
|
static create( element, config ) {
|
|
|
return new Promise( resolve => {
|
|
return new Promise( resolve => {
|
|
|
const editor = new this( element, config );
|
|
const editor = new this( element, config );
|
|
|
- const editable = editor.ui.view.editable;
|
|
|
|
|
|
|
|
|
|
resolve(
|
|
resolve(
|
|
|
editor.initPlugins()
|
|
editor.initPlugins()
|
|
|
// Initialize the UI first. See the BootstrapEditorUI class to learn more.
|
|
// Initialize the UI first. See the BootstrapEditorUI class to learn more.
|
|
|
.then( () => editor.ui.init( element ) )
|
|
.then( () => editor.ui.init( element ) )
|
|
|
// Bind the editor editing layer to the editable in DOM.
|
|
// Bind the editor editing layer to the editable in DOM.
|
|
|
- .then( () => editor.editing.view.attachDomRoot( editable.element ) )
|
|
|
|
|
|
|
+ .then( () => editor.editing.view.attachDomRoot( editor.ui.getEditableElement() ) )
|
|
|
// Fill the editable with the initial data.
|
|
// Fill the editable with the initial data.
|
|
|
.then( () => editor.data.init( getDataFromElement( element ) ) )
|
|
.then( () => editor.data.init( getDataFromElement( element ) ) )
|
|
|
// Fire the events that announce that the editor is complete and ready to use.
|
|
// Fire the events that announce that the editor is complete and ready to use.
|
|
@@ -153,6 +152,9 @@ class BootstrapEditorUI extends EditorUI {
|
|
|
view.editable.bind( 'isFocused' ).to( editor.editing.view.document );
|
|
view.editable.bind( 'isFocused' ).to( editor.editing.view.document );
|
|
|
view.editable.name = editingRoot.rootName;
|
|
view.editable.name = editingRoot.rootName;
|
|
|
|
|
|
|
|
|
|
+ // Register editable element so it is available via getEditableElement() method.
|
|
|
|
|
+ this._editableElements.set( view.editable.name, view.editable.element );
|
|
|
|
|
+
|
|
|
// Setup the existing, external Bootstrap UI so it works with the rest of the editor.
|
|
// Setup the existing, external Bootstrap UI so it works with the rest of the editor.
|
|
|
this._setupBootstrapToolbarButtons();
|
|
this._setupBootstrapToolbarButtons();
|
|
|
this._setupBootstrapHeadingDropdown();
|
|
this._setupBootstrapHeadingDropdown();
|