mirror of https://gitee.com/answerdev/answer.git
fix: html remove escape character optimization
This commit is contained in:
parent
cc5eed7a09
commit
82dfb42aef
1131
ui/pnpm-lock.yaml
1131
ui/pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -26,6 +26,7 @@ const Index: FC<Props> = ({ data }) => {
|
||||||
answerId: data.object.id,
|
answerId: data.object.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListGroupItem className="py-3 px-0 border-start-0 border-end-0 bg-transparent">
|
<ListGroupItem className="py-3 px-0 border-start-0 border-end-0 bg-transparent">
|
||||||
<div className="mb-2 clearfix">
|
<div className="mb-2 clearfix">
|
||||||
|
|
|
@ -81,20 +81,13 @@ function formatUptime(value) {
|
||||||
return `< 1 ${t('dates.hour')}`;
|
return `< 1 ${t('dates.hour')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeRemove(str) {
|
function escapeRemove(str: string) {
|
||||||
if (!str || typeof str !== 'string') return str;
|
if (!str || typeof str !== 'string') return str;
|
||||||
const arrEntities = {
|
let temp: HTMLDivElement | null = document.createElement('div');
|
||||||
lt: '<',
|
temp.innerHTML = str;
|
||||||
gt: '>',
|
const output = temp?.innerText || temp.textContent;
|
||||||
nbsp: ' ',
|
temp = null;
|
||||||
amp: '&',
|
return output;
|
||||||
quot: '"',
|
|
||||||
'#39': "'",
|
|
||||||
};
|
|
||||||
|
|
||||||
return str.replace(/&(lt|gt|nbsp|amp|quot|#39);/gi, function (all, t) {
|
|
||||||
return arrEntities[t];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function mixColor(color_1, color_2, weight) {
|
function mixColor(color_1, color_2, weight) {
|
||||||
function d2h(d) {
|
function d2h(d) {
|
||||||
|
|
Loading…
Reference in New Issue