From 23ad4af81fc2b7781e1fad8d2fd809e7145b744b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 27 Feb 2025 18:58:55 +0800 Subject: [PATCH 1/3] :art: https://github.com/siyuan-note/siyuan/issues/14206 --- app/src/asset/pdf/viewer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/asset/pdf/viewer.js b/app/src/asset/pdf/viewer.js index 6491b1a0d..7a6bcd3d8 100644 --- a/app/src/asset/pdf/viewer.js +++ b/app/src/asset/pdf/viewer.js @@ -19,6 +19,7 @@ import { LinkTarget } from "./pdf_link_service.js"; import { PDFViewerApplication } from "./app.js"; import {Constants} from "../../constants"; import {initAnno} from "../anno"; +import {AnnotationEditorType} from "./pdfjs"; /* eslint-disable-next-line no-unused-vars */ const pdfjsVersion = @@ -237,6 +238,7 @@ function webViewerLoad(file, element, pdfPage, annoId) { AppOptions.set("defaultUrl", file); AppOptions.set("cMapUrl", 'cmaps/'); AppOptions.set("standardFontDataUrl", 'standard_fonts/'); + AppOptions.set("annotationEditorMode", AnnotationEditorType.DISABLE); const pdf = new PDFViewerApplication(pdfPage) pdf.annoId = annoId const config = getViewerConfiguration(element); From 35ccbaa0f091d8fcc12303660a460bdf82ceeb95 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 27 Feb 2025 21:52:52 +0800 Subject: [PATCH 2/3] :art: https://github.com/siyuan-note/siyuan/issues/14204 --- app/src/protyle/toolbar/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index e12375db8..329275818 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -446,6 +446,7 @@ export class Toolbar { } } contents.childNodes.forEach((item: HTMLElement, index) => { + let removeText = ""; if (item.nodeType === 3) { if (index === 0 && previousElement && previousElement.nodeType !== 3 && type === previousElement.getAttribute("data-type") && @@ -467,6 +468,11 @@ export class Toolbar { newNodes.push(document.createTextNode(Constants.ZWSP)); item.textContent = item.textContent.substring(1); } + // https://github.com/siyuan-note/siyuan/issues/14204 + while (item.textContent.endsWith("\n")) { + item.textContent = item.textContent.substring(0, item.textContent.length - 1); + removeText += "\n"; + } const inlineElement = document.createElement("span"); inlineElement.setAttribute("data-type", type); inlineElement.textContent = item.textContent; @@ -588,6 +594,9 @@ export class Toolbar { newNodes.push(item); } } + if (removeText) { + newNodes.push(document.createTextNode(removeText)); + } }); } } From f67bd1ad7fa16f0dfa0cc7a184fc64fcaf8c065c Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 27 Feb 2025 22:13:41 +0800 Subject: [PATCH 3/3] :art: https://github.com/siyuan-note/siyuan/issues/14200 --- app/src/layout/dock/Files.ts | 7 ++++++- app/src/mobile/dock/MobileFiles.ts | 7 ++++++- app/src/protyle/toolbar/index.ts | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts index 95b826041..edbc94d03 100644 --- a/app/src/layout/dock/Files.ts +++ b/app/src/layout/dock/Files.ts @@ -780,7 +780,12 @@ export class Files extends Model { currentPath = dirname + ".sy"; } } else { - liElement.querySelector(".fn__hidden")?.classList.remove("fn__hidden"); + const hiddenElement = liElement.querySelector(".fn__hidden") + if (hiddenElement) { + hiddenElement.classList.remove("fn__hidden"); + } else { + this.getLeaf(liElement, notebookId, true); + } break; } } diff --git a/app/src/mobile/dock/MobileFiles.ts b/app/src/mobile/dock/MobileFiles.ts index 93f220b14..9762b0926 100644 --- a/app/src/mobile/dock/MobileFiles.ts +++ b/app/src/mobile/dock/MobileFiles.ts @@ -293,7 +293,12 @@ export class MobileFiles extends Model { currentPath = dirname + ".sy"; } } else { - liElement.querySelector(".fn__hidden")?.classList.remove("fn__hidden"); + const hiddenElement = liElement.querySelector(".fn__hidden") + if (hiddenElement) { + hiddenElement.classList.remove("fn__hidden"); + } else { + this.getLeaf(liElement, notebookId, true); + } break; } } diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 329275818..222c1bbaa 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -229,7 +229,7 @@ export class Toolbar { public setInlineMark(protyle: IProtyle, type: string, action: "range" | "toolbar", textObj?: ITextOption) { const nodeElement = hasClosestBlock(this.range.startContainer); - if (!nodeElement) { + if (!nodeElement || nodeElement.getAttribute("data-type") === "NodeCodeBlock") { return; } const endElement = hasClosestBlock(this.range.endContainer);