Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2026-01-18 22:51:12 +08:00
commit b2f8807dc0
18 changed files with 217 additions and 20 deletions

View file

@ -27,8 +27,10 @@ export const unicode2Emoji = (unicode: string, className = "", needSpan = false,
let emoji = "";
if (unicode.startsWith("api/icon/getDynamicIcon")) {
emoji = `<img class="${className}" ${lazy ? "data-" : ""}src="${unicode}"/>`;
emoji = Lute.Sanitize(emoji);
} else if (unicode.indexOf(".") > -1) {
emoji = `<img class="${className}" ${lazy ? "data-" : ""}src="/emojis/${unicode}"/>`;
emoji = Lute.Sanitize(emoji);
} else {
try {
unicode.split("-").forEach(item => {

View file

@ -104,8 +104,12 @@ export class Title {
event.stopPropagation();
let textPlain = await readText() || "";
if (textPlain) {
// 对 <<assets/...>> 进行内部转义 https://github.com/siyuan-note/siyuan/issues/11992
textPlain = textPlain.replace(/<<assets\//g, "__@lt2assets/@__").replace(/>>/g, "__@gt2@__");
// 对 HTML 标签进行内部转义,避免被 Lute 解析以后变为小写 https://github.com/siyuan-note/siyuan/issues/10620
textPlain = textPlain.replace(/</g, ";;;lt;;;").replace(/>/g, ";;;gt;;;");
// 反转义 <<assets/...>>
textPlain = textPlain.replace(/__@lt2assets\/@__/g, "<<assets/").replace(/__@gt2@__/g, ">>");
enableLuteMarkdownSyntax(protyle);
let content = protyle.lute.BlockDOM2EscapeMarkerContent(protyle.lute.Md2BlockDOM(textPlain));
restoreLuteMarkdownSyntax(protyle);
@ -273,7 +277,9 @@ export class Title {
accelerator: "⇧⌘V",
click: async () => {
let textPlain = await readText() || "";
textPlain = textPlain.replace(/<<assets\//g, "__@lt2assets/@__").replace(/>>/g, "__@gt2@__");
textPlain = textPlain.replace(/</g, ";;;lt;;;").replace(/>/g, ";;;gt;;;");
textPlain = textPlain.replace(/__@lt2assets\/@__/g, "<<assets/").replace(/__@gt2@__/g, ">>");
enableLuteMarkdownSyntax(protyle);
let content = protyle.lute.BlockDOM2EscapeMarkerContent(protyle.lute.Md2BlockDOM(textPlain));
restoreLuteMarkdownSyntax(protyle);

View file

@ -175,9 +175,15 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
// 删掉 <span data-type\="text".*>text</span> 标签,只保留文本
textPlain = textPlain.replace(/<span data-type="text".*?>(.*?)<\/span>/g, "$1");
// 对 <<assets/...>> 进行内部转义 https://github.com/siyuan-note/siyuan/issues/11992
textPlain = textPlain.replace(/<<assets\//g, "__@lt2assets/@__").replace(/>>/g, "__@gt2@__");
// 对 HTML 标签进行内部转义,避免被 Lute 解析以后变为小写 https://github.com/siyuan-note/siyuan/issues/10620
textPlain = textPlain.replace(/</g, ";;;lt;;;").replace(/>/g, ";;;gt;;;");
// 反转义 <<assets/...>>
textPlain = textPlain.replace(/__@lt2assets\/@__/g, "<<assets/").replace(/__@gt2@__/g, ">>");
// 反转义内置需要解析的 HTML 标签
textPlain = textPlain.replace(/__@sub@__/g, "<sub>").replace(/__@\/sub@__/g, "</sub>");
textPlain = textPlain.replace(/__@sup@__/g, "<sup>").replace(/__@\/sup@__/g, "</sup>");