This commit is contained in:
Vanessa 2022-10-19 21:47:47 +08:00
parent f1bdb4dcfd
commit 82eafca96d
10 changed files with 14 additions and 14 deletions

View file

@ -451,9 +451,9 @@ export const resizeTabs = () => {
models.backlink.forEach(item => { models.backlink.forEach(item => {
const mTreeElement = item.element.querySelector(".backlinkMList") as HTMLElement; const mTreeElement = item.element.querySelector(".backlinkMList") as HTMLElement;
if (mTreeElement.style.height && mTreeElement.style.height !== "0px") { if (mTreeElement.style.height && mTreeElement.style.height !== "0px") {
mTreeElement.style.height = (item.element.clientHeight - mTreeElement.previousElementSibling.clientHeight * 2) + "px" mTreeElement.style.height = (item.element.clientHeight - mTreeElement.previousElementSibling.clientHeight * 2) + "px";
} }
}) });
pdfResize(); pdfResize();
}, 200); }, 200);
}; };

View file

@ -103,7 +103,7 @@ export const initFramework = () => {
editIconElement.setAttribute("xlink:href", "#iconPreview"); editIconElement.setAttribute("xlink:href", "#iconPreview");
} }
editElement.addEventListener(getEventName(), () => { editElement.addEventListener(getEventName(), () => {
const isReadonly = editIconElement.getAttribute("xlink:href") === "#iconPreview" const isReadonly = editIconElement.getAttribute("xlink:href") === "#iconPreview";
window.siyuan.config.editor.readOnly = isReadonly; window.siyuan.config.editor.readOnly = isReadonly;
fetchPost("/api/setting/setEditor", window.siyuan.config.editor, () => { fetchPost("/api/setting/setEditor", window.siyuan.config.editor, () => {
if (!isReadonly) { if (!isReadonly) {
@ -115,7 +115,7 @@ export const initFramework = () => {
inputElement.readOnly = true; inputElement.readOnly = true;
editIconElement.setAttribute("xlink:href", "#iconEdit"); editIconElement.setAttribute("xlink:href", "#iconEdit");
} }
}) });
}); });
scrimElement.addEventListener(getEventName(), () => { scrimElement.addEventListener(getEventName(), () => {

View file

@ -385,7 +385,7 @@ const renderPDF = (id: string) => {
window.siyuan.printWin.once("ready-to-show", () => { window.siyuan.printWin.once("ready-to-show", () => {
// 导出 PDF 预览界面不受主界面缩放影响 https://github.com/siyuan-note/siyuan/issues/6262 // 导出 PDF 预览界面不受主界面缩放影响 https://github.com/siyuan-note/siyuan/issues/6262
window.siyuan.printWin.webContents.setZoomFactor(1); window.siyuan.printWin.webContents.setZoomFactor(1);
}) });
fetchPost("/api/export/exportTempContent", {content: html}, (response) => { fetchPost("/api/export/exportTempContent", {content: html}, (response) => {
window.siyuan.printWin.loadURL(response.data.url); window.siyuan.printWin.loadURL(response.data.url);
}); });

View file

@ -1200,7 +1200,7 @@ export class Gutter {
id, id,
attrs: {breadcrumb: inputElement.checked.toString()} attrs: {breadcrumb: inputElement.checked.toString()}
}); });
nodeElement.removeAttribute("data-render") nodeElement.removeAttribute("data-render");
blockRender(protyle, nodeElement); blockRender(protyle, nodeElement);
window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.remove();
}); });

View file

@ -28,9 +28,9 @@ export const blockRender = (protyle: IProtyle, element: Element) => {
const content = Lute.UnEscapeHTMLStr(item.getAttribute("data-content")); const content = Lute.UnEscapeHTMLStr(item.getAttribute("data-content"));
let breadcrumb: boolean | string = item.getAttribute("breadcrumb"); let breadcrumb: boolean | string = item.getAttribute("breadcrumb");
if (breadcrumb) { if (breadcrumb) {
breadcrumb = breadcrumb === "true" breadcrumb = breadcrumb === "true";
} else { } else {
breadcrumb = window.siyuan.config.editor.embedBlockBreadcrumb breadcrumb = window.siyuan.config.editor.embedBlockBreadcrumb;
} }
fetchPost("/api/search/searchEmbedBlock", { fetchPost("/api/search/searchEmbedBlock", {
embedBlockID: item.getAttribute("data-node-id"), embedBlockID: item.getAttribute("data-node-id"),

View file

@ -158,7 +158,7 @@ export const setFontStyle = (textElement: HTMLElement, textOption: ITextOption)
textElement.innerText = blockRefData[2]; textElement.innerText = blockRefData[2];
}; };
const setLink = (textOption: string) => { const setLink = (textOption: string) => {
const options = textOption.split(Constants.ZWSP) const options = textOption.split(Constants.ZWSP);
textElement.setAttribute("data-href", options[0]); textElement.setAttribute("data-href", options[0]);
textElement.removeAttribute("data-subtype"); textElement.removeAttribute("data-subtype");
textElement.removeAttribute("data-id"); textElement.removeAttribute("data-id");

View file

@ -39,7 +39,7 @@ export class Link extends ToolbarItem {
dataHref = clipText; dataHref = clipText;
} else { } else {
// 360 // 360
const lastSpace = clipText.lastIndexOf(' ') const lastSpace = clipText.lastIndexOf(" ");
if (lastSpace > -1) { if (lastSpace > -1) {
if (protyle.lute.IsValidLinkDest(clipText.substring(lastSpace))) { if (protyle.lute.IsValidLinkDest(clipText.substring(lastSpace))) {
dataHref = clipText.substring(lastSpace); dataHref = clipText.substring(lastSpace);

View file

@ -51,7 +51,7 @@ export const pasteAsPlainText = async (protyle:IProtyle) => {
writeText(""); writeText("");
} else { } else {
protyle.lute.SetHTMLTag2TextMark(true); // 临时设置 Lute 解析参数,行级元素键盘和下划线无法粘贴为纯文本 https://github.com/siyuan-note/siyuan/issues/6220 protyle.lute.SetHTMLTag2TextMark(true); // 临时设置 Lute 解析参数,行级元素键盘和下划线无法粘贴为纯文本 https://github.com/siyuan-note/siyuan/issues/6220
const dom = protyle.lute.InlineMd2BlockDOM(clipboard.readText()) const dom = protyle.lute.InlineMd2BlockDOM(clipboard.readText());
protyle.lute.SetHTMLTag2TextMark(false); protyle.lute.SetHTMLTag2TextMark(false);
insertHTML(protyle.lute.BlockDOM2Content(dom), protyle, false); insertHTML(protyle.lute.BlockDOM2Content(dom), protyle, false);
} }

View file

@ -74,7 +74,7 @@ export class Tree {
if (item.count) { if (item.count) {
countHTML = `<span class="counter">${item.count}</span>`; countHTML = `<span class="counter">${item.count}</span>`;
} }
const hasChild = (item.children && item.children.length > 0) || (item.blocks && item.blocks.length > 0) const hasChild = (item.children && item.children.length > 0) || (item.blocks && item.blocks.length > 0);
html += `<li class="b3-list-item" html += `<li class="b3-list-item"
${(item.nodeType !== "NodeDocument" && item.type === "backlink") ? 'draggable="true"' : ""} ${(item.nodeType !== "NodeDocument" && item.type === "backlink") ? 'draggable="true"' : ""}
${item.id ? 'data-node-id="' + item.id + '"' : ""} ${item.id ? 'data-node-id="' + item.id + '"' : ""}

View file

@ -23,8 +23,8 @@ const loadIcon = (iconURL: string, data: IAppearance) => {
addScript(iconURL, "iconScript"); addScript(iconURL, "iconScript");
} }
} }
}) });
} };
export const loadAssets = (data: IAppearance) => { export const loadAssets = (data: IAppearance) => {
const defaultStyleElement = document.getElementById("themeDefaultStyle"); const defaultStyleElement = document.getElementById("themeDefaultStyle");