Новости для главной

This commit is contained in:
iriska-gri committed 2023-11-29 12:50:36 +03:00
1 parent e0bf00ee9d
commit be136d0f4f
1 file changed
+5 -6
+5 -6
View File
@@ -149,12 +149,11 @@ export default {
const limitText=(text)=> {
text = text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`)
const t = text.split(' ').slice(0, 25)
return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
let parser = new DOMParser().parseFromString(text, "text/html");
let doc = parser.body.textContent || ""
doc = doc.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`)
const t = doc.split(' ').slice(0, 25)
return `${doc.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
}
const splitname = (name) => {