Skip to content

Commit 7f0de84

Browse files
committed
Revert "FIX: Decline attribute values core can only quote lossily"
This reverts commit 78ede37. Guarding it took a serialize-then-inspect call to find out whether core had dropped the quote characters, for a value that has to contain one character from each of the nine quotation pairs to get there. Reachable content is already covered.
1 parent 78ede37 commit 7f0de84

2 files changed

Lines changed: 2 additions & 13 deletions

File tree

assets/javascripts/discourse/lib/rich-editor-extension.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,9 @@ function inlineMarkFor(token, schema) {
100100
return null;
101101
}
102102

103+
// a bbcode tag is a single line, so no quoting can hold a newline
103104
function serializableAttr(value) {
104-
if (!value || value.includes("\n")) {
105-
return null;
106-
}
107-
108-
// with every quote pair used up core drops the quote characters instead of
109-
// failing, so check the value survives rather than let it change silently
110-
return serializeBBCodeAttr(value, "").includes(value) ? value : null;
105+
return value && !value.includes("\n") ? value : null;
111106
}
112107

113108
// a mark set holds one per type: an identical nesting adds nothing, a differing

test/javascripts/integration/rich-editor-extension-test.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,6 @@ module(
304304
'<p>An <a name="O\'Brien x">anchor</a> here</p>',
305305
'An [aname="O\'Brien x"]anchor[/aname] here',
306306
],
307-
// no quote pair is left to wrap it, and dropping the quote characters
308-
// would change the value
309-
"pasted unquotable aname html is not claimed": [
310-
'<p>An <a name="a &quot;\'«”’„‹ b">anchor</a> here</p>',
311-
"An anchor here",
312-
],
313307
"pasted quoted jumpto html": [
314308
'<p>go <a href="#tar\'get">here</a> now</p>',
315309
"go [jumpto=tar'get]here[/jumpto] now",

0 commit comments

Comments
 (0)