diff --git a/js/forum/dist/app.js b/js/forum/dist/app.js
index 47b003f73..b2aa69779 100644
--- a/js/forum/dist/app.js
+++ b/js/forum/dist/app.js
@@ -31481,11 +31481,13 @@ System.register('flarum/utils/string', [], function (_export, _context) {
_export('slug', slug);
function getPlainContent(string) {
- var dom = $('
').html(string.replace(/(<\/p>|
)/g, '$1 '));
+ var html = string.replace(/(<\/p>|
)/g, '$1 ').replace(/]*>/ig, ' ');
+
+ var dom = $('').html(html);
dom.find(getPlainContent.removeSelectors.join(',')).remove();
- return dom.text();
+ return dom.text().replace(/\s+/g, ' ').trim();
}
/**
diff --git a/js/lib/utils/string.js b/js/lib/utils/string.js
index d8d11d257..92ad98ae7 100644
--- a/js/lib/utils/string.js
+++ b/js/lib/utils/string.js
@@ -34,11 +34,15 @@ export function slug(string) {
* @return {String}
*/
export function getPlainContent(string) {
- const dom = $('').html(string.replace(/(<\/p>|
)/g, '$1 '));
+ const html = string
+ .replace(/(<\/p>|
)/g, '$1 ')
+ .replace(/]*>/ig, ' ');
+
+ const dom = $('').html(html);
dom.find(getPlainContent.removeSelectors.join(',')).remove();
- return dom.text();
+ return dom.text().replace(/\s+/g, ' ').trim();
}
/**