Преглед изворни кода

Fix: Changing highlight should not change collapsed selection.

Maciej Gołaszewski пре 8 година
родитељ
комит
7f5b5d0c15

+ 0 - 3
packages/ckeditor5-highlight/src/highlightcommand.js

@@ -83,9 +83,6 @@ export default class HighlightCommand extends Command {
 					} else {
 						// ...update `highlight` value.
 						writer.setAttribute( 'highlight', highlighter, highlightRange );
-
-						// And create new range wrapping changed highlighter.
-						writer.setSelection( [ highlightRange ] );
 					}
 				} else if ( highlighter ) {
 					writer.setSelectionAttribute( 'highlight', highlighter );

+ 1 - 13
packages/ckeditor5-highlight/tests/highlightcommand.js

@@ -85,7 +85,7 @@ describe( 'HighlightCommand', () => {
 
 					command.execute( { value: 'greenMarker' } );
 
-					expect( getData( model ) ).to.equal( '<p>abc[<$text highlight="greenMarker">foobar</$text>]xyz</p>' );
+					expect( getData( model ) ).to.equal( '<p>abc<$text highlight="greenMarker">foo[]bar</$text>xyz</p>' );
 
 					expect( command.value ).to.equal( 'greenMarker' );
 				} );
@@ -172,18 +172,6 @@ describe( 'HighlightCommand', () => {
 					expect( command.value ).to.be.undefined;
 					expect( doc.selection.hasAttribute( 'highlight' ) ).to.be.false;
 				} );
-
-				it( 'should change entire highlight when inside highlighted text', () => {
-					setData( model, '<p>abc<$text highlight="marker">foo[]bar</$text>xyz</p>' );
-
-					expect( command.value ).to.equal( 'marker' );
-
-					command.execute( { value: 'greenMarker' } );
-
-					expect( getData( model ) ).to.equal( '<p>abc[<$text highlight="greenMarker">foobar</$text>]xyz</p>' );
-
-					expect( command.value ).to.equal( 'greenMarker' );
-				} );
 			} );
 
 			describe( 'on not collapsed range', () => {