1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 23:47:32 +02:00

Remove blockquotes from post previews

Closes flarum/core#144
This commit is contained in:
Toby Zerner
2015-08-06 13:28:26 +09:30
parent 7f82bc8251
commit b42cbc761a
2 changed files with 8 additions and 4 deletions

View File

@@ -34,9 +34,15 @@ export function slug(string) {
* @return {String}
*/
export function getPlainContent(string) {
return $('<div/>').html(string.replace(/(<\/p>|<br>)/g, '$1 ')).text();
const dom = $('<div/>').html(string.replace(/(<\/p>|<br>)/g, '$1 &nbsp;'));
dom.find(getPlainContent.removeSelectors.join(',')).remove();
return dom.text();
}
getPlainContent.removeSelectors = ['blockquote'];
/**
* Make a string's first character uppercase.
*