feat: Refactor Menu Navigation and Update Media Control Icons (#2783)
* chore: update media control icons Updated "next," "pause," "play," and "previous" icons in the media-icons-black folder. This improves visual consistency and ensures the latest icon designs are applied. * refactor(menu): migrate to `navigationHistory` API - Replaced deprecated `webContents` navigation methods (`canGoBack`, `goBack`, `canGoForward`, `goForward`) with `navigationHistory` API. - Updated `mainMenuTemplate` to use the new `navigationHistory` destructured from `win.webContents`.
|
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 13 KiB |
10
src/menu.ts
@ -68,7 +68,7 @@ export const mainMenuTemplate = async (
|
|||||||
win: BrowserWindow,
|
win: BrowserWindow,
|
||||||
): Promise<MenuTemplate> => {
|
): Promise<MenuTemplate> => {
|
||||||
const innerRefreshMenu = () => refreshMenu(win);
|
const innerRefreshMenu = () => refreshMenu(win);
|
||||||
|
const { navigationHistory } = win.webContents;
|
||||||
await loadAllMenuPlugins(win);
|
await loadAllMenuPlugins(win);
|
||||||
|
|
||||||
const menuResult = Object.entries(getAllMenuTemplate()).map(
|
const menuResult = Object.entries(getAllMenuTemplate()).map(
|
||||||
@ -610,16 +610,16 @@ export const mainMenuTemplate = async (
|
|||||||
{
|
{
|
||||||
label: t('main.menu.navigation.submenu.go-back'),
|
label: t('main.menu.navigation.submenu.go-back'),
|
||||||
click() {
|
click() {
|
||||||
if (win.webContents.canGoBack()) {
|
if (navigationHistory.canGoBack()) {
|
||||||
win.webContents.goBack();
|
navigationHistory.goBack();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('main.menu.navigation.submenu.go-forward'),
|
label: t('main.menu.navigation.submenu.go-forward'),
|
||||||
click() {
|
click() {
|
||||||
if (win.webContents.canGoForward()) {
|
if (navigationHistory.canGoForward()) {
|
||||||
win.webContents.goForward();
|
navigationHistory.goForward();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||