Skip to content

Commit

Permalink
[SPIKE] Fix typing on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
whatthewhat committed May 6, 2019
1 parent 358cd9d commit 70c7bc6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class Editor {
});
this.rerender();
if (currentRange) {
this.selectRange(currentRange);
this.selectRange(currentRange.move(DIRECTION.FORWARD));
}

this.runCallbacks(CALLBACK_QUEUES.DID_REPARSE);
Expand Down
23 changes: 23 additions & 0 deletions tests/acceptance/editor-reparse-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,29 @@ test('inserting text into text node on left/right of atom is reparsed correctly'
});
});

test('inserting a single character into an empty section moves the cursor forward', (assert) => {
let done = assert.async();
let expected;
editor = Helpers.mobiledoc.renderInto(editorElement, ({post, markupSection, marker}) => {
expected = post([
markupSection('p', [marker('Z')]),
]);

return post([markupSection('p', [])]);
}, editorOptions);

let node = editorElement.firstChild.firstChild;
node.textContent = 'Z';

Helpers.wait(() => {
assert.postIsSimilar(editor.post, expected);
assert.equal(editor.range.head.offset, 1);
assert.equal(editor.range.tail.offset, 1);

done();
});
});

test('mutation inside card element does not cause reparse', (assert) => {
let done = assert.async();
let parseCount = 0;
Expand Down

0 comments on commit 70c7bc6

Please sign in to comment.