This commit is contained in:
Vanessa 2025-02-09 13:34:47 +08:00
parent 1da6bd10dd
commit fac82ad618
5 changed files with 10 additions and 10 deletions

View file

@ -766,7 +766,7 @@ export class Files extends Model {
return; return;
} }
let currentPath = filePath; let currentPath = filePath;
let liElement let liElement;
while (!liElement) { while (!liElement) {
liElement = treeElement.querySelector(`[data-path="${currentPath}"]`); liElement = treeElement.querySelector(`[data-path="${currentPath}"]`);
if (!liElement) { if (!liElement) {
@ -777,7 +777,7 @@ export class Files extends Model {
currentPath = dirname + ".sy"; currentPath = dirname + ".sy";
} }
} else { } else {
liElement.querySelector(".fn__hidden").classList.remove("fn__hidden"); liElement.querySelector(".fn__hidden")?.classList.remove("fn__hidden");
break; break;
} }
} }

View file

@ -549,7 +549,7 @@ const workspaceItem = (item: IWorkspace) => {
writeText(item.path); writeText(item.path);
showMessage(window.siyuan.languages.copied); showMessage(window.siyuan.languages.copied);
} }
}] }];
if (item.path !== window.siyuan.config.system.workspaceDir) { if (item.path !== window.siyuan.config.system.workspaceDir) {
submenu.splice(0, 0, { submenu.splice(0, 0, {
id: "openBy", id: "openBy",
@ -558,7 +558,7 @@ const workspaceItem = (item: IWorkspace) => {
click() { click() {
openWorkspace(item.path); openWorkspace(item.path);
} }
}) });
if (item.closed) { if (item.closed) {
submenu.push({ submenu.push({
id: "removeWorkspaceTip", id: "removeWorkspaceTip",

View file

@ -279,7 +279,7 @@ export class MobileFiles extends Model {
return; return;
} }
let currentPath = filePath; let currentPath = filePath;
let liElement let liElement;
while (!liElement) { while (!liElement) {
liElement = treeElement.querySelector(`[data-path="${currentPath}"]`); liElement = treeElement.querySelector(`[data-path="${currentPath}"]`);
if (!liElement) { if (!liElement) {
@ -290,7 +290,7 @@ export class MobileFiles extends Model {
currentPath = dirname + ".sy"; currentPath = dirname + ".sy";
} }
} else { } else {
liElement.querySelector(".fn__hidden").classList.remove("fn__hidden"); liElement.querySelector(".fn__hidden")?.classList.remove("fn__hidden");
break; break;
} }
} }

View file

@ -168,7 +168,7 @@ export const isEndOfBlock = (range: Range) => {
return false; return false;
} }
let nextSibling = range.endContainer let nextSibling = range.endContainer;
while (nextSibling) { while (nextSibling) {
if (hasNextSibling(nextSibling)) { if (hasNextSibling(nextSibling)) {
return false; return false;
@ -176,12 +176,12 @@ export const isEndOfBlock = (range: Range) => {
if (nextSibling.parentElement.getAttribute("spellcheck")) { if (nextSibling.parentElement.getAttribute("spellcheck")) {
return true; return true;
} }
nextSibling = nextSibling.parentElement nextSibling = nextSibling.parentElement;
} }
} }
return true; return true;
} };
export const hasPreviousSibling = (element: Node) => { export const hasPreviousSibling = (element: Node) => {
let previousSibling = element.previousSibling; let previousSibling = element.previousSibling;

View file

@ -342,7 +342,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
event.stopPropagation(); event.stopPropagation();
return; return;
} }
const nodeEditableElement = getContenteditableElement(nodeElement) const nodeEditableElement = getContenteditableElement(nodeElement);
const position = getSelectionOffset(nodeEditableElement, protyle.wysiwyg.element, range); const position = getSelectionOffset(nodeEditableElement, protyle.wysiwyg.element, range);
if (position.start === 0 && event.key === "ArrowLeft") { if (position.start === 0 && event.key === "ArrowLeft") {
event.preventDefault(); event.preventDefault();