Vanessa 2023-02-27 09:54:36 +08:00
parent 990b31dc00
commit 1f98334c60
2 changed files with 34 additions and 25 deletions

View File

@ -673,11 +673,6 @@ app.whenReady().then(() => {
}
});
});
ipcMain.on("siyuan-closetab", (event, data) => {
BrowserWindow.getAllWindows().forEach(item => {
item.webContents.send("siyuan-closetab", data);
});
});
ipcMain.on("siyuan-export-pdf", (event, data) => {
BrowserWindow.fromId(data.id).webContents.send("siyuan-export-pdf", data);
});
@ -851,6 +846,11 @@ app.whenReady().then(() => {
item.webContents.send("siyuan-lock-screen");
});
});
ipcMain.on("siyuan-closetab", (event, data) => {
BrowserWindow.getAllWindows().forEach(item => {
item.webContents.send("siyuan-closetab", data);
});
});
if (firstOpen) {
const firstOpenWindow = new BrowserWindow({

View File

@ -79,7 +79,6 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
name,
type: "notebook"
}));
}
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.config,
icon: "iconSettings",
@ -91,7 +90,6 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
});
}
}).element);
if (!window.siyuan.config.readonly) {
sortMenu("notebook", parseInt(liElement.parentElement.getAttribute("data-sortmode")), (sort) => {
fetchPost("/api/notebook/setNotebookConf", {
notebook: notebookId,
@ -116,6 +114,15 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
return true;
});
}
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.riffCard,
iconHTML: '<svg class="b3-menu__icon" style="color: var(--b3-theme-secondary)"><use xlink:href="#iconRiffCard"></use></svg>',
click: () => {
fetchPost("/api/riff/getNotebookRiffDueCards", {notebook: notebookId}, (response) => {
openCardByData(response.data, `<span data-id="${notebookId}" class="fn__flex-center">${escapeHtml(name)}</span>`);
});
}
}).element);
/// #if !MOBILE
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.search,
@ -125,6 +132,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
openSearch(window.siyuan.config.keymap.general.search.custom, undefined, notebookId);
}
}).element);
if (!window.siyuan.config.readonly) {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.replace,
accelerator: window.siyuan.config.keymap.general.replace.custom,
@ -132,6 +140,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
openSearch(window.siyuan.config.keymap.general.replace.custom, undefined, notebookId);
}
}).element);
}
/// #endif
if (!window.siyuan.config.readonly) {
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);