mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
This commit is contained in:
parent
ca1c8af16d
commit
74f5aa08ac
3 changed files with 11 additions and 2 deletions
|
|
@ -464,6 +464,7 @@ export abstract class Constants {
|
||||||
switchAdjust: {default: "", custom: ""},
|
switchAdjust: {default: "", custom: ""},
|
||||||
rtl: {default: "", custom: ""},
|
rtl: {default: "", custom: ""},
|
||||||
ltr: {default: "", custom: ""},
|
ltr: {default: "", custom: ""},
|
||||||
|
aiWriting: {default: "", custom: ""},
|
||||||
},
|
},
|
||||||
insert: {
|
insert: {
|
||||||
appearance: {default: "⌥⌘X", custom: "⌥⌘X"},
|
appearance: {default: "⌥⌘X", custom: "⌥⌘X"},
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import {avRender} from "../render/av/render";
|
||||||
const getHotkeyOrMarker = (hotkey: string, marker: string) => {
|
const getHotkeyOrMarker = (hotkey: string, marker: string) => {
|
||||||
if (hotkey) {
|
if (hotkey) {
|
||||||
return `<span class="b3-menu__accelerator">${updateHotkeyTip(hotkey)}</span>`;
|
return `<span class="b3-menu__accelerator">${updateHotkeyTip(hotkey)}</span>`;
|
||||||
} else {
|
} else if (marker) {
|
||||||
return `<span class="b3-list-item__meta">${marker}</span>`;
|
return `<span class="b3-list-item__meta">${marker}</span>`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -59,7 +59,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
|
||||||
filter: [window.siyuan.languages.aiWriting, "ai writing", "ai编写", "aibianxie", "aibx", "人工智能", "rengongzhineng", "rgzn"],
|
filter: [window.siyuan.languages.aiWriting, "ai writing", "ai编写", "aibianxie", "aibx", "人工智能", "rengongzhineng", "rgzn"],
|
||||||
id: "aiWriting",
|
id: "aiWriting",
|
||||||
value: Constants.ZWSP + 5,
|
value: Constants.ZWSP + 5,
|
||||||
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconSparkles"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.aiWriting}</span></div>`,
|
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconSparkles"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.aiWriting}</span>${getHotkeyOrMarker(window.siyuan.config.keymap.editor.general.aiWriting.custom, "")}</div>`,
|
||||||
}, {
|
}, {
|
||||||
filter: [window.siyuan.languages.database, "database", "db", "数据库", "shujuku", "sjk", "视图", "view"],
|
filter: [window.siyuan.languages.database, "database", "db", "数据库", "shujuku", "sjk", "视图", "view"],
|
||||||
id: "database",
|
id: "database",
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ import {checkFold} from "../../util/noRelyPCFunction";
|
||||||
import {AIActions} from "../../ai/actions";
|
import {AIActions} from "../../ai/actions";
|
||||||
import {openLink} from "../../editor/openLink";
|
import {openLink} from "../../editor/openLink";
|
||||||
import {onlyProtyleCommand} from "../../boot/globalEvent/command/protyle";
|
import {onlyProtyleCommand} from "../../boot/globalEvent/command/protyle";
|
||||||
|
import {AIChat} from "../../ai/chat";
|
||||||
|
|
||||||
export const getContentByInlineHTML = (range: Range, cb: (content: string) => void) => {
|
export const getContentByInlineHTML = (range: Range, cb: (content: string) => void) => {
|
||||||
let html = "";
|
let html = "";
|
||||||
|
|
@ -1704,6 +1705,13 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!event.repeat && matchHotKey(window.siyuan.config.keymap.editor.general.aiWriting.custom, event)) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
AIChat(protyle, nodeElement);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// tab 需等待 list 和 table 处理完成
|
// tab 需等待 list 和 table 处理完成
|
||||||
if (event.key === "Tab" && isNotCtrl(event) && !event.altKey) {
|
if (event.key === "Tab" && isNotCtrl(event) && !event.altKey) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue