Skip to content

Commit 70c7bc6

Browse files
committed
[SPIKE] Fix typing on Android
1 parent 358cd9d commit 70c7bc6

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/js/editor/editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ class Editor {
462462
});
463463
this.rerender();
464464
if (currentRange) {
465-
this.selectRange(currentRange);
465+
this.selectRange(currentRange.move(DIRECTION.FORWARD));
466466
}
467467

468468
this.runCallbacks(CALLBACK_QUEUES.DID_REPARSE);

tests/acceptance/editor-reparse-test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,29 @@ test('inserting text into text node on left/right of atom is reparsed correctly'
239239
});
240240
});
241241

242+
test('inserting a single character into an empty section moves the cursor forward', (assert) => {
243+
let done = assert.async();
244+
let expected;
245+
editor = Helpers.mobiledoc.renderInto(editorElement, ({post, markupSection, marker}) => {
246+
expected = post([
247+
markupSection('p', [marker('Z')]),
248+
]);
249+
250+
return post([markupSection('p', [])]);
251+
}, editorOptions);
252+
253+
let node = editorElement.firstChild.firstChild;
254+
node.textContent = 'Z';
255+
256+
Helpers.wait(() => {
257+
assert.postIsSimilar(editor.post, expected);
258+
assert.equal(editor.range.head.offset, 1);
259+
assert.equal(editor.range.tail.offset, 1);
260+
261+
done();
262+
});
263+
});
264+
242265
test('mutation inside card element does not cause reparse', (assert) => {
243266
let done = assert.async();
244267
let parseCount = 0;

0 commit comments

Comments
 (0)