This commit is contained in:
Vanessa 2022-12-28 10:48:18 +08:00
parent c9a909d033
commit 545fc07314
3 changed files with 21 additions and 0 deletions

View file

@ -7,6 +7,15 @@ import {onGet} from "../protyle/util/onGet";
import {hasClosestByClassName} from "../protyle/util/hasClosest";
export const openCard = () => {
const exit = window.siyuan.dialogs.find(item => {
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.riffCard.custom) {
item.destroy();
return true
}
})
if (exit) {
return;
}
let decksHTML = '<option value="">All</option>';
fetchPost("/api/riff/getRiffDecks", {}, (response) => {
response.data.forEach((deck: { id: string, name: string }) => {

View file

@ -537,6 +537,7 @@ export const globalShortcut = () => {
if (matchHotKey(window.siyuan.config.keymap.general.riffCard.custom, event)) {
openCard();
if (target.classList.contains("protyle-wysiwyg") ||
target.tagName === "TABLE" ||
target.classList.contains("protyle-title__input") ||
target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
target.blur();
@ -547,6 +548,7 @@ export const globalShortcut = () => {
if (matchHotKey(window.siyuan.config.keymap.general.dailyNote.custom, event)) {
newDailyNote();
if (target.classList.contains("protyle-wysiwyg") ||
target.tagName === "TABLE" ||
target.classList.contains("protyle-title__input") ||
target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
target.blur();

View file

@ -7,6 +7,15 @@ import {getNotebookName, getOpenNotebookCount} from "./pathName";
import {validateName} from "../editor/rename";
export const newDailyNote = () => {
const exit = window.siyuan.dialogs.find(item => {
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.dailyNote.custom) {
item.destroy();
return true
}
})
if (exit) {
return;
}
const openCount = getOpenNotebookCount();
if (openCount === 0) {
showMessage(window.siyuan.languages.newFileTip);
@ -48,6 +57,7 @@ export const newDailyNote = () => {
</div>`,
width: isMobile() ? "80vw" : "520px",
});
dialog.element.setAttribute("data-key", window.siyuan.config.keymap.general.dailyNote.custom);
const btnsElement = dialog.element.querySelectorAll(".b3-button");
const selectElement = dialog.element.querySelector(".b3-select") as HTMLSelectElement;
selectElement.value = localNotebookId;