mirror of
https://github.com/discourse/discourse.git
synced 2025-10-03 17:21:20 +08:00
FIX: rich editor ENTER after non-text node (#34188)
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Publish Assets / publish-assets (push) Waiting to run
Tests / core backend (push) Waiting to run
Tests / plugins backend (push) Waiting to run
Tests / core frontend (Chrome) (push) Waiting to run
Tests / plugins frontend (push) Waiting to run
Tests / themes frontend (push) Waiting to run
Tests / core system (push) Waiting to run
Tests / plugins system (push) Waiting to run
Tests / themes system (push) Waiting to run
Tests / core frontend (Firefox ESR) (push) Waiting to run
Tests / core frontend (Firefox Evergreen) (push) Waiting to run
Tests / chat system (push) Waiting to run
Tests / merge (push) Blocked by required conditions
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Publish Assets / publish-assets (push) Waiting to run
Tests / core backend (push) Waiting to run
Tests / plugins backend (push) Waiting to run
Tests / core frontend (Chrome) (push) Waiting to run
Tests / plugins frontend (push) Waiting to run
Tests / themes frontend (push) Waiting to run
Tests / core system (push) Waiting to run
Tests / plugins system (push) Waiting to run
Tests / themes system (push) Waiting to run
Tests / core frontend (Firefox ESR) (push) Waiting to run
Tests / core frontend (Firefox Evergreen) (push) Waiting to run
Tests / chat system (push) Waiting to run
Tests / merge (push) Blocked by required conditions
This commit is contained in:
parent
3df5807d87
commit
df03ef6d05
2 changed files with 11 additions and 1 deletions
|
@ -75,7 +75,7 @@ export function buildKeymap(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($from.nodeBefore?.text.endsWith(" ")) {
|
if ($from.nodeBefore?.isText && $from.nodeBefore.text.endsWith(" ")) {
|
||||||
if (dispatch) {
|
if (dispatch) {
|
||||||
const tr = state.tr.replaceRangeWith(
|
const tr = state.tr.replaceRangeWith(
|
||||||
$from.pos - 2,
|
$from.pos - 2,
|
||||||
|
|
|
@ -663,6 +663,16 @@ describe "Composer - ProseMirror editor", type: :system do
|
||||||
expect(composer).to have_value(nil)
|
expect(composer).to have_value(nil)
|
||||||
expect(rich).to have_css("blockquote", text: "This is a test")
|
expect(rich).to have_css("blockquote", text: "This is a test")
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "pasting content" do
|
describe "pasting content" do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue