Add parameter filter for size and color bbcodes

This commit is contained in:
Visman 2023-08-30 14:55:01 +07:00
parent 1c6f7f271b
commit a0e241d548

View file

@ -397,7 +397,11 @@
size = fontSize;
}
return '[size=' + size + ']' + content + '[/size]';
if (/^[1-7]$/.test(size.toString())) {
return '[size=' + size + ']' + content + '[/size]';
} else {
return content;
}
},
html: '<font size="{defaultattr}">{!0}</font>'
},
@ -421,8 +425,13 @@
color = elm.style.color || css(elm, 'color');
}
return '[color=' + _normaliseColour(color) + ']' +
content + '[/color]';
color = _normaliseColour(color);
if (/^(?:\#[0-9A-Fa-f]{6}|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|yellow|white)$/.test(color)) {
return '[color=' + color + ']' + content + '[/color]';
} else {
return content;
}
},
html: function (token, attrs, content) {
return '<font color="' +