Merge branch 'dev' of github.com:siyuan-note/siyuan into dev

This commit is contained in:
Daniel 2025-02-27 23:14:33 +08:00
commit 0a1d524b0e
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 24 additions and 3 deletions

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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);
@ -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));
}
});
}
}