Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Removed deprecated code.
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Jan 22, 2019
1 parent 3babb31 commit 93bcb11
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 48 deletions.
9 changes: 0 additions & 9 deletions src/classiceditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import ClassicEditorUI from './classiceditorui';
import ClassicEditorUIView from './classiceditoruiview';
import getDataFromElement from '@ckeditor/ckeditor5-utils/src/dom/getdatafromelement';
import mix from '@ckeditor/ckeditor5-utils/src/mix';
import log from '@ckeditor/ckeditor5-utils/src/log';
import { isElement } from 'lodash-es';

/**
Expand Down Expand Up @@ -75,14 +74,6 @@ export default class ClassicEditor extends Editor {
attachToForm( this );
}

/**
* @inheritDoc
*/
get element() {
log.warn( 'deprecated-editor-element: The editor#element is deprecated.' );
return this.ui.element;
}

/**
* Destroys the editor instance, releasing all resources used by it.
*
Expand Down
2 changes: 2 additions & 0 deletions src/classiceditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export default class ClassicEditorUI extends EditorUI {
destroy() {
this._elementReplacer.restore();

this._view.destroy();

super.destroy();
}
}
39 changes: 1 addition & 38 deletions tests/classiceditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,6 @@ describe( 'ClassicEditor', () => {
it( 'attaches editable UI as view\'s DOM root', () => {
expect( editor.editing.view.getDomRoot() ).to.equal( editor.ui.view.editable.element );
} );

it( 'editor.element points to the editor\'s UI when editor was initialized on the DOM element', () => {
expect( editor.element ).to.equal( editor.ui.view.element );
} );

it( 'editor.element points to the editor\'s UI when editor was initialized with data', () => {
return ClassicEditor.create( '<p>Hello world!</p>', {
plugins: [ Paragraph ]
} ).then( editor => {
expect( editor.element ).to.equal( editor.ui.view.element );

return editor.destroy();
} );
} );
} );
} );

Expand All @@ -205,7 +191,6 @@ describe( 'ClassicEditor', () => {
init() {
this.editor.on( 'pluginsReady', spy );
this.editor.ui.on( 'ready', spy );
this.editor.on( 'uiReady', spy );
this.editor.on( 'dataReady', spy );
this.editor.on( 'ready', spy );
}
Expand All @@ -216,7 +201,7 @@ describe( 'ClassicEditor', () => {
plugins: [ EventWatcher ]
} )
.then( newEditor => {
expect( fired ).to.deep.equal( [ 'pluginsReady', 'ready', 'uiReady', 'dataReady', 'ready' ] );
expect( fired ).to.deep.equal( [ 'pluginsReady', 'ready', 'dataReady', 'ready' ] );

editor = newEditor;
} );
Expand Down Expand Up @@ -244,28 +229,6 @@ describe( 'ClassicEditor', () => {
} );
} );

it( 'fires uiReady once UI is rendered', () => {
let isReady;

class EventWatcher extends Plugin {
init() {
this.editor.on( 'uiReady', () => {
isReady = this.editor.ui.view.isRendered;
} );
}
}

return ClassicEditor
.create( editorElement, {
plugins: [ EventWatcher ]
} )
.then( newEditor => {
expect( isReady ).to.be.true;

editor = newEditor;
} );
} );

it( 'fires ready once UI is rendered', () => {
let isReady;

Expand Down
9 changes: 8 additions & 1 deletion tests/classiceditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import utils from '@ckeditor/ckeditor5-utils/tests/_utils/utils';

describe( 'ClassicEditorUI', () => {
let editor, view, ui;
let editor, view, ui, viewElement;

testUtils.createSinonSandbox();

Expand All @@ -31,6 +31,7 @@ describe( 'ClassicEditorUI', () => {

ui = editor.ui;
view = ui.view;
viewElement = view.element;
} );
} );

Expand Down Expand Up @@ -185,6 +186,12 @@ describe( 'ClassicEditorUI', () => {
} );
} );

describe( 'element()', () => {
it( 'returns correct element instance', () => {
expect( ui.element ).to.equal( viewElement );
} );
} );

describe( 'getEditableElement()', () => {
it( 'returns editable element (default)', () => {
expect( ui.getEditableElement() ).to.equal( view.editable.element );
Expand Down

0 comments on commit 93bcb11

Please sign in to comment.