🎨 前端限定 window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen

This commit is contained in:
Vanessa 2022-10-30 23:03:26 +08:00
parent 998665a171
commit 174eb89910
2 changed files with 3 additions and 3 deletions

View file

@ -177,6 +177,6 @@ export const newFileBySelect = (fileName: string, protyle: IProtyle) => {
title: newName,
md: ""
}, () => {
insertHTML(genEmptyBlock(false, false, `<span data-type="block-ref" data-id="${id}" data-subtype="d">${escapeHtml(newName)}</span>`), protyle);
insertHTML(genEmptyBlock(false, false, `<span data-type="block-ref" data-id="${id}" data-subtype="d">${escapeHtml(newName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`), protyle);
});
};

View file

@ -421,9 +421,9 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
markdown: ""
}, response => {
let tempElement = document.createElement("div");
let blockRefHTML = `<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${escapeHtml(realFileName)}</span>`;
let blockRefHTML = `<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${escapeHtml(realFileName.substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`;
if (fileNames.length === 2) {
blockRefHTML = `<span data-type="block-ref" data-id="${response.data}" data-subtype="s">${escapeHtml(fileNames[0])}</span>`;
blockRefHTML = `<span data-type="block-ref" data-id="${response.data}" data-subtype="s">${escapeHtml(fileNames[0].substring(0, window.siyuan.config.editor.blockRefDynamicAnchorTextMaxLen))}</span>`;
}
tempElement.innerHTML = blockRefHTML;
tempElement = tempElement.firstElementChild as HTMLDivElement;