FIX: rich editor ENTER after non-text node (#34188)

This commit is contained in:
Renato Atilio
2025-08-09 07:33:55 -03:00
committed by GitHub
parent 3df5807d87
commit df03ef6d05
2 changed files with 11 additions and 1 deletions
@@ -75,7 +75,7 @@ export function buildKeymap(
return false;
}
if ($from.nodeBefore?.text.endsWith(" ")) {
if ($from.nodeBefore?.isText && $from.nodeBefore.text.endsWith(" ")) {
if (dispatch) {
const tr = state.tr.replaceRangeWith(
$from.pos - 2,
@@ -663,6 +663,16 @@ describe "Composer - ProseMirror editor", type: :system do
expect(composer).to have_value(nil)
expect(rich).to have_css("blockquote", text: "This is a test")
end
it "adds a new paragraph when ENTER is pressed after an image" do
open_composer
composer.type_content("![image](https://example.com/image.png)")
composer.send_keys(:right, :enter)
composer.type_content("This is a test")
composer.toggle_rich_editor
expect(composer).to have_value("\n![image](https://example.com/image.png)\n\nThis is a test")
end
end
describe "pasting content" do