mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 10:57:04 +08:00
FIX: remove whitespaces around inline HTML tags next to text. (#10803)
This commit is contained in:
parent
495c79da1a
commit
d0d61e4118
|
@ -25,7 +25,16 @@ export class Tag {
|
|||
}
|
||||
|
||||
if (this.inline) {
|
||||
text = " " + text + " ";
|
||||
const prev = this.element.prev;
|
||||
const next = this.element.next;
|
||||
|
||||
if (prev && prev.name !== "#text") {
|
||||
text = " " + text;
|
||||
}
|
||||
|
||||
if (next && next.name !== "#text") {
|
||||
text = text + " ";
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
|
|
|
@ -8,6 +8,7 @@ QUnit.test("converts styles between normal words", (assert) => {
|
|||
assert.equal(toMarkdown(html), markdown);
|
||||
|
||||
assert.equal(toMarkdown("A <b>bold </b>word"), "A **bold** word");
|
||||
assert.equal(toMarkdown("A <b>bold</b>, word"), "A **bold**, word");
|
||||
});
|
||||
|
||||
QUnit.test("converts inline nested styles", (assert) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user