Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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