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

Commit

Permalink
Used Range#getContainedElement() in Selection#getSelectedElement().
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Mar 6, 2020
1 parent d063199 commit 0c4cb54
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/model/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

import Position from './position';
import Element from './element';
import Node from './node';
import Range from './range';
import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';
Expand Down Expand Up @@ -615,11 +614,7 @@ export default class Selection {
return null;
}

const range = this.getFirstRange();
const nodeAfterStart = range.start.nodeAfter;
const nodeBeforeEnd = range.end.nodeBefore;

return ( nodeAfterStart instanceof Element && nodeAfterStart == nodeBeforeEnd ) ? nodeAfterStart : null;
return this.getFirstRange().getContainedElement();
}

/**
Expand Down

0 comments on commit 0c4cb54

Please sign in to comment.