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

Commit

Permalink
Merge pull request #138 from ckeditor/revert-132-t/85
Browse files Browse the repository at this point in the history
Revert: "t/85: Linking an image should not be possible".
  • Loading branch information
Reinmar authored Jul 13, 2017
2 parents 50da835 + 94a872b commit fe0981c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 173 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@ckeditor/ckeditor5-editor-classic": "^0.7.3",
"@ckeditor/ckeditor5-enter": "^0.9.1",
"@ckeditor/ckeditor5-heading": "^0.9.1",
"@ckeditor/ckeditor5-image": "^0.6.0",
"@ckeditor/ckeditor5-paragraph": "^0.8.0",
"@ckeditor/ckeditor5-typing": "^0.9.1",
"@ckeditor/ckeditor5-undo": "^0.8.1",
Expand Down
20 changes: 1 addition & 19 deletions src/linkcommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class LinkCommand extends Command {
const doc = this.editor.document;

this.value = doc.selection.getAttribute( 'linkHref' );
this.isEnabled = this._checkEnabled();
this.isEnabled = doc.schema.checkAttributeInSelection( doc.selection, 'linkHref' );
}

/**
Expand Down Expand Up @@ -94,22 +94,4 @@ export default class LinkCommand extends Command {
}
} );
}

/**
* Checks whether the command can be enabled in the current context.
*
* @private
* @returns {Boolean} Whether the command should be enabled.
*/
_checkEnabled() {
const doc = this.editor.document;
const selectedElement = doc.selection.getSelectedElement();

// https://github.com/ckeditor/ckeditor5-link/issues/85
if ( selectedElement && selectedElement.is( 'image' ) ) {
return false;
}

return doc.schema.checkAttributeInSelection( doc.selection, 'linkHref' );
}
}
153 changes: 0 additions & 153 deletions tests/integration.js

This file was deleted.

0 comments on commit fe0981c

Please sign in to comment.