Skip to content

A platform for community discussion. Free, open, simple.

DEV: remove duplicate code mark input rule (#35505)

Renato Atiliodd201fd999ae
diff --git a/app/assets/javascripts/discourse/app/static/prosemirror/core/inputrules.js b/app/assets/javascripts/discourse/app/static/prosemirror/core/inputrules.js
index 2b5e9d69569..3661cd7213a 100644
--- a/app/assets/javascripts/discourse/app/static/prosemirror/core/inputrules.js
+++ b/app/assets/javascripts/discourse/app/static/prosemirror/core/inputrules.js
@@ -38,7 +38,6 @@ export function buildInputRules(extensions, params, includeDefault = true) {
markInputRule(/(^|\s)__([^_]+)__$/, schema.marks.strong, getAttrs),
markInputRule(/(^|[^*])\*([^*]+)\*$/, schema.marks.em, getAttrs),
markInputRule(/(^|\s)_([^_]+)_$/, schema.marks.em, getAttrs),
- markInputRule(/`([^`]+)`$/, schema.marks.code),
new InputRule(
/^(\u2013-|\u2014-|___\s|\*\*\*\s)$/,
horizontalRuleHandler,
diff --git a/spec/system/composer/prosemirror_editor_spec.rb b/spec/system/composer/prosemirror_editor_spec.rb
index 64a8e578f72..fca766a5ec2 100644
--- a/spec/system/composer/prosemirror_editor_spec.rb
+++ b/spec/system/composer/prosemirror_editor_spec.rb
@@ -333,10 +333,16 @@ describe "Composer - ProseMirror editor", type: :system do
it "avoids applying input rules in inline code if part of the matched text" do
open_composer
- composer.type_content("This `__code` should not__ be bold")
+ composer.type_content("This `__code` should not__ be bold. `and this, ")
+ page.send_keys([SystemHelpers::PLATFORM_KEY_MODIFIER, "e"])
+ # should not trigger the conversion of "and this, " to code as the 2nd ` is typed inside inline code
+ composer.type_content("not code`")
expect(rich).to have_no_css("strong")
expect(rich).to have_css("code", text: "__code")
+
+ expect(rich).to have_css("code", text: "not code")
+ expect(rich).to have_no_css("code", text: "and this, not code")
end
end
@@ -1172,7 +1178,7 @@ describe "Composer - ProseMirror editor", type: :system do
expect(page).to have_css(".toolbar__button.code.--active", count: 0)
expect(page).to have_css(".toolbar__button.blockquote.--active", count: 0)
- composer.type_content("> - ` [***many styles***](https://example.com)`")
+ composer.type_content("> - [***many `styles`***](https://example.com)")
composer.send_keys(:left, :left)
expect(page).to have_css(".toolbar__button.bold.--active", count: 1)