mirror of
https://github.com/discourse/discourse.git
synced 2026-08-02 09:29:37 -05:00
FIX: rich editor ENTER after non-text node (#34188)
This commit is contained in:
@@ -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("")
|
||||
composer.send_keys(:right, :enter)
|
||||
composer.type_content("This is a test")
|
||||
|
||||
composer.toggle_rich_editor
|
||||
expect(composer).to have_value("\n\n\nThis is a test")
|
||||
end
|
||||
end
|
||||
|
||||
describe "pasting content" do
|
||||
|
||||
Reference in New Issue
Block a user