Skip to content

UX: [rte] properly put cursor at end when putCursorAtEnd is called #34039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 4, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
DEV: different attempt
  • Loading branch information
renato committed Aug 2, 2025
commit a07a756a06846e8f15c6ac90ca4582c642952787
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,22 @@ export default class ProsemirrorEditor extends Component {
const doc = this.convertFromMarkdown(value);

const tr = this.view.state.tr;
tr.replaceWith(0, this.view.state.doc.content.size, doc.content);
tr.setMeta("addToHistory", false);

if (value.endsWith("\n\n")) {
tr.insert(tr.doc.content.size, this.schema.nodes.paragraph.create());
tr.replaceWith(
0,
this.view.state.doc.content.size,
Fragment.from([
...doc.content.content,
this.schema.nodes.paragraph.create(),
])
);
} else {
tr.replaceWith(0, this.view.state.doc.content.size, doc.content);
}

tr.setMeta("addToHistory", false);

this.view.updateState(this.view.state.apply(tr));
}

Expand Down
Loading