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

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Jan 21, 2019
1 parent ffda1e2 commit 81d751f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 deletions.
8 changes: 4 additions & 4 deletions src/inlineeditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class InlineEditorUI extends EditorUI {
// showing up when there's no focus in the UI.
if ( view.panel.isVisible ) {
view.panel.pin( {
target: view.editable.editableElement,
target: view.editable.element,
positions: view.panelPositions
} );
}
Expand All @@ -95,12 +95,12 @@ export default class InlineEditorUI extends EditorUI {
// Bind to focusTracker instead of editor.editing.view because otherwise
// focused editable styles disappear when view#toolbar is focused.
view.editable.bind( 'isFocused' ).to( this.focusTracker );
editor.editing.view.attachDomRoot( view.editable.editableElement );
editor.editing.view.attachDomRoot( view.editable.element );
view.editable.name = editingRoot.rootName;

this._editableElements.push( view.editable );
this._editableElements.set( view.editable.name, view.editable.element );

this.focusTracker.add( view.editable.editableElement );
this.focusTracker.add( view.editable.element );

view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );

Expand Down
18 changes: 0 additions & 18 deletions src/inlineeditoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/i
import BalloonPanelView from '@ckeditor/ckeditor5-ui/src/panel/balloon/balloonpanelview';
import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';

import log from '@ckeditor/ckeditor5-utils/src/log';

/**
* Inline editor UI view. Uses an nline editable and a floating toolbar.
*
Expand Down Expand Up @@ -145,22 +143,6 @@ export default class InlineEditorUIView extends EditorUIView {
this.panel.content.add( this.toolbar );
}

/**
* **Deprecated** since `v12.0.0`. The {@link module:ui/editableui/editableuiview~EditableUIView#editableElement
* `EditableUIView editableElement`} could be used instead.
*
* The element which is the main editable element (usually the one with `contentEditable="true"`).
*
* @deprecated v12.0.0 The {@link module:ui/editableui/editableuiview~EditableUIView#editableElement
* `EditableUIView editableElement`} could be used instead.
* @readonly
* @member {HTMLElement} #editableElement
*/
get editableElement() {
log.warn( 'deprecated-ui-view-editableElement: The InlineEditorUIView#editableElement property is deprecated.' );
return this.editable.editableElement;
}

/**
* Determines the panel top position of the {@link #panel} in {@link #panelPositions}.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/inlineeditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe( 'InlineEditorUI', () => {
editor.ui.fire( 'update' );
sinon.assert.calledOnce( spy );
sinon.assert.calledWithExactly( spy, {
target: view.editable.editableElement,
target: view.editable.element,
positions: sinon.match.array
} );
} );
Expand Down
11 changes: 0 additions & 11 deletions tests/inlineeditoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/i
import Locale from '@ckeditor/ckeditor5-utils/src/locale';

import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import log from '@ckeditor/ckeditor5-utils/src/log';

describe( 'InlineEditorUIView', () => {
let locale, view;
Expand Down Expand Up @@ -122,16 +121,6 @@ describe( 'InlineEditorUIView', () => {
} );
} );

describe( 'editableElement', () => {
it( 'returns editable\'s view element', () => {
testUtils.sinon.stub( log, 'warn' ).callsFake( () => {} );

view.render();
expect( view.editableElement.getAttribute( 'contentEditable' ) ).to.equal( 'true' );
view.destroy();
} );
} );

describe( 'panelPositions', () => {
it( 'returns the positions in the right order', () => {
const positions = view.panelPositions;
Expand Down

0 comments on commit 81d751f

Please sign in to comment.