Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/12073

Vanessa9ccb1f173e13
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 9656aca82c..c43026a18e 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -989,6 +989,14 @@ export class Gutter {
selectsElement: [nodeElement],
type: "Blocks2Ps",
}));
+ turnIntoSubmenu.push(this.turnsIntoOne({
+ icon: "iconQuote",
+ accelerator: window.siyuan.config.keymap.editor.insert.quote.custom,
+ label: window.siyuan.languages.quote,
+ protyle,
+ selectsElement: [nodeElement],
+ type: "Blocks2Blockquote"
+ }));
if (subType !== "h1") {
turnIntoSubmenu.push(this.turnsInto({
icon: "iconH1",
@@ -1065,6 +1073,14 @@ export class Gutter {
id,
type: "CancelList"
}));
+ turnIntoSubmenu.push(this.turnsIntoOne({
+ icon: "iconQuote",
+ accelerator: window.siyuan.config.keymap.editor.insert.quote.custom,
+ label: window.siyuan.languages.quote,
+ protyle,
+ selectsElement: [nodeElement],
+ type: "Blocks2Blockquote"
+ }));
if (nodeElement.getAttribute("data-subtype") === "o") {
turnIntoSubmenu.push(this.turnsOneInto({
icon: "iconList",
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 300db6126b..ba646b6b4a 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -1387,45 +1387,58 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (isMatchList || isMatchOList || isMatchCheck || isMatchQuote) {
const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
if (selectsElement.length === 0) {
- protyle.hint.splitChar = "/";
- protyle.hint.lastIndex = -1;
- if (isMatchQuote) {
- protyle.hint.fill(">" + Lute.Caret, protyle);
- } else {
- protyle.hint.fill((isMatchCheck ? "* [ ] " : (isMatchList ? "* " : "1. ")) + Lute.Caret, protyle);
- }
- } else if (selectsElement.length === 1) {
+ selectsElement.push(nodeElement);
+ }
+ if (selectsElement.length === 1) {
const subType = selectsElement[0].dataset.subtype;
const type = selectsElement[0].dataset.type;
- if (type === "NodeParagraph") {
- turnsIntoOneTransaction({
- protyle,
- selectsElement,
- type: isMatchQuote ? "Blocks2Blockquote" : (isMatchCheck ? "Blocks2TLs" : (isMatchList ? "Blocks2ULs" : "Blocks2OLs"))
- });
- } else if (type === "NodeList") {
- const id = selectsElement[0].dataset.nodeId;
- if (subType === "o" && (isMatchList || isMatchCheck)) {
- turnsOneInto({
- protyle,
- nodeElement: selectsElement[0],
- id,
- type: isMatchCheck ? "UL2TL" : "OL2UL",
- });
- } else if (subType === "t" && (isMatchList || isMatchOList)) {
- turnsOneInto({
+ if (isMatchQuote) {
+ if (["NodeHeading", "NodeParagraph", "NodeList"].includes(type)) {
+ turnsIntoOneTransaction({
protyle,
- nodeElement: selectsElement[0],
- id,
- type: isMatchList ? "TL2UL" : "TL2OL",
+ selectsElement,
+ type: "Blocks2Blockquote"
});
- } else if (isMatchCheck || isMatchOList) {
- turnsOneInto({
+ } else {
+ protyle.hint.splitChar = "/";
+ protyle.hint.lastIndex = -1;
+ protyle.hint.fill(">" + Lute.Caret, protyle);
+ }
+ } else {
+ if (type === "NodeParagraph") {
+ turnsIntoOneTransaction({
protyle,
- nodeElement: selectsElement[0],
- id,
- type: isMatchCheck ? "OL2TL" : "UL2OL",
+ selectsElement,
+ type: isMatchCheck ? "Blocks2TLs" : (isMatchList ? "Blocks2ULs" : "Blocks2OLs")
});
+ } else if (type === "NodeList") {
+ const id = selectsElement[0].dataset.nodeId;
+ if (subType === "o" && (isMatchList || isMatchCheck)) {
+ turnsOneInto({
+ protyle,
+ nodeElement: selectsElement[0],
+ id,
+ type: isMatchCheck ? "UL2TL" : "OL2UL",
+ });
+ } else if (subType === "t" && (isMatchList || isMatchOList)) {
+ turnsOneInto({
+ protyle,
+ nodeElement: selectsElement[0],
+ id,
+ type: isMatchList ? "TL2UL" : "TL2OL",
+ });
+ } else if (isMatchCheck || isMatchOList) {
+ turnsOneInto({
+ protyle,
+ nodeElement: selectsElement[0],
+ id,
+ type: isMatchCheck ? "OL2TL" : "UL2OL",
+ });
+ }
+ } else {
+ protyle.hint.splitChar = "/";
+ protyle.hint.lastIndex = -1;
+ protyle.hint.fill((isMatchCheck ? "* [ ] " : (isMatchList ? "* " : "1. ")) + Lute.Caret, protyle);
}
}
} else {