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

Commit

Permalink
Updated to changes in engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonkups committed Feb 15, 2018
1 parent 6b0ba4e commit 569aebc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export default class Link extends Plugin {

const editingView = this.editor.editing.view;

this.stopListening( editingView.document, 'change' );
this.stopListening( editingView, 'render' );

// Remove form first because it's on top of the stack.
this._removeFormView();
Expand Down Expand Up @@ -369,7 +369,7 @@ export default class Link extends Plugin {
let prevSelectedLink = this._getSelectedLinkElement();
let prevSelectionParent = getSelectionParent();

this.listenTo( editingView.document, 'change', () => {
this.listenTo( editingView, 'render', () => {
const selectedLink = this._getSelectedLinkElement();
const selectionParent = getSelectionParent();

Expand Down
8 changes: 3 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ export function isLinkElement( node ) {
* @return {module:engine/view/attributeelement~AttributeElement}
*/
export function createLinkElement( href, writer ) {
const linkElement = writer.createAttributeElement( 'a', { href } );
linkElement.setCustomProperty( linkElementSymbol, true );

// https://github.com/ckeditor/ckeditor5-link/issues/121
linkElement.priority = 5;
// Priority 5 - https://github.com/ckeditor/ckeditor5-link/issues/121.
const linkElement = writer.createAttributeElement( 'a', { href }, 5 );
writer.setCustomProperty( linkElementSymbol, true, linkElement );

return linkElement;
}
4 changes: 2 additions & 2 deletions tests/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ describe( 'Link', () => {
} ).to.not.throw();
} );

it( 'should clear #change listener from the ViewDocument', () => {
it( 'should clear #render listener from the ViewDocument', () => {
const spy = sinon.spy();

linkFeature.listenTo( editor.editing.view.document, 'change', spy );
linkFeature.listenTo( editor.editing.view, 'render', spy );
linkFeature._hideUI();
editor.editing.view.change( () => {} );

Expand Down

0 comments on commit 569aebc

Please sign in to comment.