浏览代码

Merge branch 'master' into t/923

Piotrek Koszuliński 8 年之前
父节点
当前提交
b8829046a0

+ 3 - 8
packages/ckeditor5-engine/src/view/filler.js

@@ -143,7 +143,7 @@ export function isBlockFiller( domNode, blockFiller ) {
 }
 
 /**
- * Assign key observer which move cursor from the end of the inline filler to the begging of it when
+ * Assign key observer which move cursor from the end of the inline filler to the beginning of it when
  * the left arrow is pressed, so the filler does not break navigation.
  *
  * @param {module:engine/view/document~Document} document Document instance we should inject quirks handling on.
@@ -152,7 +152,7 @@ export function injectQuirksHandling( document ) {
 	document.on( 'keydown', jumpOverInlineFiller );
 }
 
-// Move cursor from the end of the inline filler to the begging of it when, so the filler does not break navigation.
+// Move cursor from the end of the inline filler to the beginning of it when, so the filler does not break navigation.
 function jumpOverInlineFiller( evt, data ) {
 	if ( data.keyCode == keyCodes.arrowleft ) {
 		const domSelection = data.domTarget.ownerDocument.defaultView.getSelection();
@@ -162,12 +162,7 @@ function jumpOverInlineFiller( evt, data ) {
 			const domOffset = domSelection.getRangeAt( 0 ).startOffset;
 
 			if ( startsWithFiller( domParent ) && domOffset <= INLINE_FILLER_LENGTH ) {
-				const domRange = domParent.ownerDocument.createRange();
-
-				domRange.setStart( domParent, 0 );
-				domRange.collapse( true );
-				domSelection.removeAllRanges();
-				domSelection.addRange( domRange );
+				domSelection.collapse( domParent, 0 );
 			}
 		}
 	}

+ 11 - 2
packages/ckeditor5-engine/tests/view/document/jumpoverinlinefiller.js

@@ -46,8 +46,17 @@ describe( 'Document', () => {
 
 			const domSelection = document.getSelection();
 
-			expect( domSelection.anchorNode.data ).to.equal( 'foo' );
-			expect( domSelection.anchorOffset ).to.equal( 3 );
+			// There's a problem now. We expect that the selection was moved to "foo<b>^FILLER</b>", but Safari
+			// will render it on "foo^<b>...". Both options are correct.
+
+			if ( domSelection.anchorNode.data == 'foo' ) {
+				expect( domSelection.anchorNode.data ).to.equal( 'foo' );
+				expect( domSelection.anchorOffset ).to.equal( 3 );
+			} else {
+				expect( isInlineFiller( domSelection.anchorNode ) ).to.be.true;
+				expect( domSelection.anchorOffset ).to.equal( 0 );
+			}
+
 			expect( domSelection.isCollapsed ).to.be.true;
 		} );