diff --git a/app/src/layout/dock/Bookmark.ts b/app/src/layout/dock/Bookmark.ts index 21771cb4c..ca9c08e59 100644 --- a/app/src/layout/dock/Bookmark.ts +++ b/app/src/layout/dock/Bookmark.ts @@ -88,7 +88,7 @@ export class Bookmark extends Model { }, rightClick: (element: HTMLElement, event: MouseEvent) => { window.siyuan.menus.menu.remove(); - const id = element.getAttribute("data-node-id") + const id = element.getAttribute("data-node-id"); if (!id) { window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.rename, @@ -129,7 +129,7 @@ export class Bookmark extends Model { icon: "iconTrashcan", label: window.siyuan.languages.remove, click: () => { - const bookmark = (id ? element.parentElement.previousElementSibling : element).querySelector(".b3-list-item__text").textContent + const bookmark = (id ? element.parentElement.previousElementSibling : element).querySelector(".b3-list-item__text").textContent; confirmDialog(window.siyuan.languages.delete, `${window.siyuan.languages.confirmDelete} ${escapeHtml(bookmark)}?`, () => { if (id) { fetchPost("/api/attr/setBlockAttrs", {id, attrs: {bookmark: ""}}, () => { diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts index a245c68d8..d7c9a00f8 100644 --- a/app/src/protyle/header/Title.ts +++ b/app/src/protyle/header/Title.ts @@ -30,7 +30,7 @@ import {code160to32} from "../util/code160to32"; export class Title { public element: HTMLElement; public editElement: HTMLElement; - private timeout: number + private timeout: number; constructor(protyle: IProtyle) { this.element = document.createElement("div"); @@ -229,7 +229,7 @@ export class Title { } private rename(protyle: IProtyle) { - clearTimeout(this.timeout) + clearTimeout(this.timeout); if (!validateName(this.editElement.textContent)) { return false; } @@ -240,8 +240,8 @@ export class Title { path: protyle.path, title: fileName, }); - this.setTitle(fileName) - }, Constants.TIMEOUT_INPUT) + this.setTitle(fileName); + }, Constants.TIMEOUT_INPUT); } private renderMenu(protyle: IProtyle, iconElement: Element, position: { x: number, y: number }) { diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 351ed0ed8..cb9444f27 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -172,9 +172,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { } } else if (previousElement) { // https://github.com/siyuan-note/siyuan/issues/3913 - const foldElement = hasTopClosestByAttribute(previousElement, "fold", "1") + const foldElement = hasTopClosestByAttribute(previousElement, "fold", "1"); if (foldElement && (foldElement.classList.contains("sb") || foldElement.classList.contains("bq"))) { - previousElement = foldElement + previousElement = foldElement; } } } else if (protyle.title && (protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") === "true" || @@ -485,7 +485,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { } // https://github.com/siyuan-note/siyuan/issues/5185 if (range.startOffset === 0 && range.startContainer.nodeType === 3) { - const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement + const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement; if (previousSibling && previousSibling.nodeType !== 3 && previousSibling.getAttribute("data-type") === "inline-math") { protyle.toolbar.showRender(protyle, previousSibling); return; @@ -550,7 +550,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (previousElement) { previousElement = getLastBlock(previousElement) as HTMLElement; if (previousElement) { - previousElement = hasClosestByAttribute(previousElement, "fold", "1") as HTMLElement + previousElement = hasClosestByAttribute(previousElement, "fold", "1") as HTMLElement; if (previousElement && previousElement.getAttribute("data-type") !== "NodeListItem") { // 遇到折叠块 focusBlock(previousElement, undefined, true); @@ -581,7 +581,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { } } if (event.key === "ArrowDown") { - const foldElement = hasClosestByAttribute(range.startContainer, "fold", "1") + const foldElement = hasClosestByAttribute(range.startContainer, "fold", "1"); if (foldElement) { let nextElement = getNextBlock(foldElement) as HTMLElement; if (nextElement) { @@ -645,6 +645,10 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { event.preventDefault(); return; } + } else if (position.end === editElement.textContent.length - 1 && nodeElement.getAttribute("data-type") === "NodeCodeBlock") { + event.stopPropagation(); + event.preventDefault(); + return; } } else { const currentNode = range.startContainer.childNodes[range.startOffset - 1] as HTMLElement; diff --git a/app/src/protyle/wysiwyg/list.ts b/app/src/protyle/wysiwyg/list.ts index d45802dc6..d036b2df7 100644 --- a/app/src/protyle/wysiwyg/list.ts +++ b/app/src/protyle/wysiwyg/list.ts @@ -242,7 +242,7 @@ export const breakList = (protyle: IProtyle, blockElement: Element, range: Range } }); - const parentId = listItemElement.parentElement.getAttribute("data-node-id") + const parentId = listItemElement.parentElement.getAttribute("data-node-id"); if (listItemElement.parentElement.childElementCount === 2) { undoOperations.splice(0, 0, { id: parentId,