Browse Source

Updated to changes in engine.

Szymon Kupś 7 years ago
parent
commit
19bb871eb3

+ 2 - 2
packages/ckeditor5-link/src/link.js

@@ -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();
@@ -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();
 

+ 3 - 5
packages/ckeditor5-link/src/utils.js

@@ -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;
 }

+ 2 - 2
packages/ckeditor5-link/tests/link.js

@@ -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( () => {} );