[console] update

This commit is contained in:
kwaroran
2023-11-14 17:55:48 +09:00
parent 526ce55405
commit 244febc911
2 changed files with 37 additions and 32 deletions

View File

@@ -106,7 +106,8 @@
} catch (error) {
//retry
if(tries > 2){
alertError(`Error while parsing chat message: ${error}`)
alertError(`Error while parsing chat message: ${translateText}, ${error.message}`)
return data
}
return await markParsing(data, charArg, mode, chatID, translateText, (tries ?? 0) + 1)

View File

@@ -52,9 +52,11 @@ DOMPurify.addHook("uponSanitizeAttribute", (node, data) => {
break
}
case 'class':{
if(data.attrValue){
data.attrValue = data.attrValue.split(' ').map((v) => {
return "x-risu-" + v
}).join(' ')
}
break
}
}
@@ -180,7 +182,8 @@ function decodeStyle(text:string){
if(rule.selectors){
for(let i=0;i<rule.selectors.length;i++){
let slt:string = rule.selectors[i]
let selectors = slt.split(' ').map((v) => {
if(slt){
let selectors = (slt.split(' ') ?? []).map((v) => {
if(v.startsWith('.')){
return ".x-risu-" + v.substring(1)
}
@@ -193,6 +196,7 @@ function decodeStyle(text:string){
}
}
}
}
return `<style>${css.stringify(ast)}</style>`
} catch (error) {