mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
* preview mode fix * preview-edit mode fixed * remove unecessary white space * improved logic and removed empty line * improved code and removed comment * improved code again * changed note type check logic * improved code
This commit is contained in:
parent
67e5451c7c
commit
0be982c798
@ -281,6 +281,8 @@ class Application extends BaseApplication {
|
||||
|
||||
if (['NOTE_VISIBLE_PANES_TOGGLE', 'NOTE_VISIBLE_PANES_SET'].indexOf(action.type) >= 0) {
|
||||
Setting.setValue('noteVisiblePanes', newState.noteVisiblePanes);
|
||||
const layout = newState.noteVisiblePanes[0];
|
||||
this.updateMenuItemStates(layout);
|
||||
}
|
||||
|
||||
if (['SIDEBAR_VISIBILITY_TOGGLE', 'SIDEBAR_VISIBILITY_SET'].indexOf(action.type) >= 0) {
|
||||
@ -292,7 +294,8 @@ class Application extends BaseApplication {
|
||||
}
|
||||
|
||||
if (action.type.indexOf('NOTE_SELECT') === 0 || action.type.indexOf('FOLDER_SELECT') === 0) {
|
||||
this.updateMenuItemStates(newState);
|
||||
const layout = newState.noteVisiblePanes[0];
|
||||
this.updateMenuItemStates(layout, newState);
|
||||
}
|
||||
|
||||
if (['NOTE_DEVTOOLS_TOGGLE', 'NOTE_DEVTOOLS_SET'].indexOf(action.type) >= 0) {
|
||||
@ -1166,7 +1169,7 @@ class Application extends BaseApplication {
|
||||
this.lastMenuScreen_ = screen;
|
||||
}
|
||||
|
||||
async updateMenuItemStates(state = null) {
|
||||
async updateMenuItemStates(layout, state = null) {
|
||||
if (!this.lastMenuScreen_) return;
|
||||
if (!this.store() && !state) return;
|
||||
|
||||
@ -1178,7 +1181,8 @@ class Application extends BaseApplication {
|
||||
for (const itemId of ['copy', 'paste', 'cut', 'selectAll', 'bold', 'italic', 'link', 'code', 'insertDateTime', 'commandStartExternalEditing', 'showLocalSearch']) {
|
||||
const menuItem = Menu.getApplicationMenu().getMenuItemById(`edit:${itemId}`);
|
||||
if (!menuItem) continue;
|
||||
menuItem.enabled = !!note && note.markup_language === MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN;
|
||||
const isHtmlNote = !!note && note.markup_language === MarkupToHtml.MARKUP_LANGUAGE_HTML;
|
||||
menuItem.enabled = !isHtmlNote && layout !== 'viewer' && !!note;
|
||||
}
|
||||
|
||||
const menuItem = Menu.getApplicationMenu().getMenuItemById('help:toggleDevTools');
|
||||
|
Loading…
Reference in New Issue
Block a user