diff --git a/src/model/selection.js b/src/model/selection.js index aad3538c3..18e7ebef4 100644 --- a/src/model/selection.js +++ b/src/model/selection.js @@ -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'; @@ -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(); } /**