@@ -98,8 +98,8 @@ export default class Range {
9898 * @returns {module:engine/view/range~Range } Enlarged range.
9999 */
100100 getEnlarged ( ) {
101- let start = this . start . getLastMatchingPosition ( enlargeShrinkSkip , { direction : 'backward' } ) ;
102- let end = this . end . getLastMatchingPosition ( enlargeShrinkSkip ) ;
101+ let start = this . start . getLastMatchingPosition ( enlargeTrimSkip , { direction : 'backward' } ) ;
102+ let end = this . end . getLastMatchingPosition ( enlargeTrimSkip ) ;
103103
104104 // Fix positions, in case if they are in Text node.
105105 if ( start . parent . is ( 'text' ) && start . isAtStart ) {
@@ -130,8 +130,8 @@ export default class Range {
130130 * @returns {module:engine/view/range~Range } Shrink range.
131131 */
132132 getTrimmed ( ) {
133- let start = this . start . getLastMatchingPosition ( enlargeShrinkSkip ) ;
134- let end = this . end . getLastMatchingPosition ( enlargeShrinkSkip , { direction : 'backward' } ) ;
133+ let start = this . start . getLastMatchingPosition ( enlargeTrimSkip , { boundaries : new Range ( this . start , this . end ) } ) ;
134+ let end = this . end . getLastMatchingPosition ( enlargeTrimSkip , { boundaries : new Range ( start , this . end ) , direction : 'backward' } ) ;
135135 const nodeAfterStart = start . nodeAfter ;
136136 const nodeBeforeEnd = end . nodeBefore ;
137137
@@ -438,7 +438,7 @@ export default class Range {
438438}
439439
440440// Function used by getEnlagred and getShrinked methods.
441- function enlargeShrinkSkip ( value ) {
441+ function enlargeTrimSkip ( value ) {
442442 if ( value . item . is ( 'attributeElement' ) || value . item . is ( 'uiElement' ) ) {
443443 return true ;
444444 }
0 commit comments