fix: replace tags with space in html cleanup for search (#1160)
This commit is contained in:
		| @@ -354,7 +354,9 @@ module.exports = class Page extends Model { | |||||||
|  |  | ||||||
|     // -> Update Search Index |     // -> Update Search Index | ||||||
|     const pageContents = await WIKI.models.pages.query().findById(page.id).select('render') |     const pageContents = await WIKI.models.pages.query().findById(page.id).select('render') | ||||||
|  |     console.info(pageContents.render) | ||||||
|     page.safeContent = WIKI.models.pages.cleanHTML(pageContents.render) |     page.safeContent = WIKI.models.pages.cleanHTML(pageContents.render) | ||||||
|  |     console.info(page.safeContent) | ||||||
|     await WIKI.data.searchEngine.updated(page) |     await WIKI.data.searchEngine.updated(page) | ||||||
|  |  | ||||||
|     // -> Update on Storage |     // -> Update on Storage | ||||||
| @@ -842,7 +844,7 @@ module.exports = class Page extends Model { | |||||||
|    * @returns {string} Cleaned Content Text |    * @returns {string} Cleaned Content Text | ||||||
|    */ |    */ | ||||||
|   static cleanHTML(rawHTML = '') { |   static cleanHTML(rawHTML = '') { | ||||||
|     let data = striptags(rawHTML || '') |     let data = striptags(rawHTML || '', [], ' ') | ||||||
|       .replace(emojiRegex(), '') |       .replace(emojiRegex(), '') | ||||||
|       // .replace(htmlEntitiesRegex, '') |       // .replace(htmlEntitiesRegex, '') | ||||||
|     return he.decode(data) |     return he.decode(data) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user