Skip to content

Commit

Permalink
Internal (link): Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Aug 14, 2020
1 parent c04508f commit e980570
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions packages/ckeditor5-link/src/linkui.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,19 +587,14 @@ export default class LinkUI extends Plugin {
*/
_getBalloonPositionData() {
const view = this.editor.editing.view;
const model = this.editor.model;
const viewDocument = view.document;
const targetLink = this._getSelectedLinkElement();
const model = this.editor.model;
// const range = model.markers.has( VISUAL_SELECTION_MARKER_NAME ) ?
// model.markers.get( VISUAL_SELECTION_MARKER_NAME ).getRange() : viewDocument.selection.getFirstRange();
let range;

if ( model.markers.has( VISUAL_SELECTION_MARKER_NAME ) ) {
range = model.markers.get( VISUAL_SELECTION_MARKER_NAME ).getRange();
range = this.editor.editing.mapper.toViewRange( range );
} else {
range = viewDocument.selection.getFirstRange();
}
const range = model.markers.has( VISUAL_SELECTION_MARKER_NAME ) ?
// There are cases when we highlight selection using a marker (#7705, #4721).
this.editor.editing.mapper.toViewRange( model.markers.get( VISUAL_SELECTION_MARKER_NAME ).getRange() ) :
// If no markers are available refer to a regular selection.
viewDocument.selection.getFirstRange();

const target = targetLink ?
// When selection is inside link element, then attach panel to this element.
Expand Down

0 comments on commit e980570

Please sign in to comment.