fix: 任务栏优化
This commit is contained in:
@@ -106,7 +106,6 @@ renderer.list = function (body, ordered, start) {
|
|||||||
const type = ordered ? 'ol' : 'ul';
|
const type = ordered ? 'ol' : 'ul';
|
||||||
const startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
|
const startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
|
||||||
|
|
||||||
|
|
||||||
// 移除 `<div>` 和 `</div>` 标签
|
// 移除 `<div>` 和 `</div>` 标签
|
||||||
const cleanedBody = body.replace(/<\/?div>/g, '');
|
const cleanedBody = body.replace(/<\/?div>/g, '');
|
||||||
|
|
||||||
@@ -129,21 +128,27 @@ renderer.list = function (body, ordered, start) {
|
|||||||
// ┊ │ ╏
|
// ┊ │ ╏
|
||||||
const string = texts
|
const string = texts
|
||||||
.map((value, index) => {
|
.map((value, index) => {
|
||||||
|
console.log('value--', value);
|
||||||
|
// 判断是否是任务
|
||||||
|
let task = false;
|
||||||
|
if (value.includes('🔸❌') || value.includes('🔸✅')) {
|
||||||
|
task = true;
|
||||||
|
}
|
||||||
return value.indexOf(listSinbal) !== -1
|
return value.indexOf(listSinbal) !== -1
|
||||||
? `<div>${
|
? `<div>${
|
||||||
type === 'ol' ? numbers[newArray.indexOf(value)] : listSinbal
|
type === 'ol'
|
||||||
|
? numbers[newArray.indexOf(value)]
|
||||||
|
: task
|
||||||
|
? ''
|
||||||
|
: listSinbal
|
||||||
}${value.replace(listSinbal, '')} </div>`
|
}${value.replace(listSinbal, '')} </div>`
|
||||||
: // : `<div style="white-space:pre;">\t${value}</div>`;
|
: `<div style="white-space:pre;">         ┊ ${value}</div>`;
|
||||||
`<div style="white-space:pre;">         ┊ ${value}</div>`;
|
|
||||||
})
|
})
|
||||||
.join('');
|
.join('');
|
||||||
|
|
||||||
return `${string}`;
|
return `${string}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 示例输入
|
// 示例输入
|
||||||
const input = `🔸11<br/>🔸22<br/><br/>🔸33`;
|
const input = `🔸11<br/>🔸22<br/><br/>🔸33`;
|
||||||
console.log(renderer.list(input, false, 1));
|
console.log(renderer.list(input, false, 1));
|
||||||
@@ -349,14 +354,14 @@ const Index = () => {
|
|||||||
// ╰────────────────╯<br>💬 随时欢迎聊天`;
|
// ╰────────────────╯<br>💬 随时欢迎聊天`;
|
||||||
|
|
||||||
let contactMe = `<br>➖➖➖➖➖<br>💬 欢迎交流<br>后台私信发送『关键词』: 加群`;
|
let contactMe = `<br>➖➖➖➖➖<br>💬 欢迎交流<br>后台私信发送『关键词』: 加群`;
|
||||||
// setmarkText(value);
|
setmarkText(value);
|
||||||
// setmarkText(value + contactMe);
|
// setmarkText(value + contactMe);
|
||||||
|
|
||||||
if (value?.length < 10) {
|
// if (value?.length < 10) {
|
||||||
setmarkText(value);
|
// setmarkText(value);
|
||||||
} else {
|
// } else {
|
||||||
setmarkText(value + contactMe);
|
// setmarkText(value + contactMe);
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {}, []);
|
useEffect(() => {}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user