mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-12 09:26:33 +01:00
Merge branch 'release' into staging
This commit is contained in:
commit
a6e6677c32
@ -466,11 +466,11 @@ export function decodeStyleTags(text) {
|
||||
const mediaAllowed = isExternalMediaAllowed();
|
||||
|
||||
function sanitizeRule(rule) {
|
||||
if (rule.selectors) {
|
||||
if (Array.isArray(rule.selectors)) {
|
||||
for (let i = 0; i < rule.selectors.length; i++) {
|
||||
let selector = rule.selectors[i];
|
||||
const selector = rule.selectors[i];
|
||||
if (selector) {
|
||||
let selectors = (selector.split(' ') ?? []).map((v) => {
|
||||
const selectors = (selector.split(' ') ?? []).map((v) => {
|
||||
if (v.startsWith('.')) {
|
||||
return '.custom-' + v.substring(1);
|
||||
}
|
||||
@ -482,16 +482,12 @@ export function decodeStyleTags(text) {
|
||||
}
|
||||
}
|
||||
if (!mediaAllowed && Array.isArray(rule.declarations) && rule.declarations.length > 0) {
|
||||
for (const declaration of rule.declarations) {
|
||||
if (declaration.value.includes('://')) {
|
||||
rule.declarations.splice(rule.declarations.indexOf(declaration), 1);
|
||||
}
|
||||
}
|
||||
rule.declarations = rule.declarations.filter(declaration => !declaration.value.includes('://'));
|
||||
}
|
||||
}
|
||||
|
||||
function sanitizeRuleSet(ruleSet) {
|
||||
if (ruleSet.type === 'rule') {
|
||||
if (Array.isArray(ruleSet.selectors) || Array.isArray(ruleSet.declarations)) {
|
||||
sanitizeRule(ruleSet);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user