Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/11873

Vanessa2274b0b8dfc0
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 7170b20af3..16b66579f2 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -1035,6 +1035,7 @@ export class Gutter {
turnIntoSubmenu.push(this.turnsOneInto({
icon: "iconParagraph",
label: window.siyuan.languages.paragraph,
+ accelerator: window.siyuan.config.keymap.editor.heading.paragraph.custom,
protyle,
nodeElement,
id,
@@ -1102,6 +1103,7 @@ export class Gutter {
turnIntoSubmenu.push(this.turnsOneInto({
icon: "iconParagraph",
label: window.siyuan.languages.paragraph,
+ accelerator: window.siyuan.config.keymap.editor.heading.paragraph.custom,
protyle,
nodeElement,
id,
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 0d19d50af9..f7fec93752 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -1182,11 +1182,40 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// h1 - h6 hotkey
if (matchHotKey(window.siyuan.config.keymap.editor.heading.paragraph.custom, event)) {
- turnsIntoTransaction({
- protyle,
- nodeElement,
- type: "Blocks2Ps",
- });
+ const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))
+ if (selectsElement.length === 0) {
+ selectsElement.push(nodeElement);
+ }
+ if (selectsElement.length > 1) {
+ turnsIntoTransaction({
+ protyle,
+ nodeElement: selectsElement[0],
+ type: "Blocks2Ps",
+ });
+ } else {
+ const type = selectsElement[0].getAttribute("data-type");
+ if (type === "NodeHeading") {
+ turnsIntoTransaction({
+ protyle,
+ nodeElement: selectsElement[0],
+ type: "Blocks2Ps",
+ });
+ } else if (type === "NodeList") {
+ turnsOneInto({
+ protyle,
+ nodeElement: selectsElement[0],
+ id: selectsElement[0].getAttribute("data-node-id"),
+ type: "CancelList",
+ });
+ } else if (type === "NodeBlockquote") {
+ turnsOneInto({
+ protyle,
+ nodeElement: selectsElement[0],
+ id: selectsElement[0].getAttribute("data-node-id"),
+ type: "CancelBlockquote",
+ });
+ }
+ }
event.preventDefault();
event.stopPropagation();
return true;