[Hide Details] Button not functioning: splitting text into multiple details!

Reproduced this on meta:

// If the editor contains the following text
first line
second line

// Selecting them and clicking the `Hide Details` button would produce:
[details="Summary"]
first line
[/details]


[details="Summary"]
second line
[/details]

// While the desired behaviour should produce:
[details="Summary"]
first line
second line
[/details]

Took the liberty to fix it and added a test:

https://github.com/discourse/discourse/pull/5290


P.S. I did notice @sam’s previous commit, but I believe the { multiline: true } change was unintentional.

6 Mi Piace