1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Disable Markdown actions for HTML notes

This commit is contained in:
Laurent Cozic 2019-07-17 22:49:12 +01:00
parent feb5f17479
commit 490db0db62

View File

@ -954,16 +954,17 @@ class Application extends BaseApplication {
this.lastMenuScreen_ = screen; this.lastMenuScreen_ = screen;
} }
updateMenuItemStates() { async updateMenuItemStates() {
if (!this.lastMenuScreen_) return; if (!this.lastMenuScreen_) return;
if (!this.store()) return; if (!this.store()) return;
const selectedNoteIds = this.store().getState().selectedNoteIds; const selectedNoteIds = this.store().getState().selectedNoteIds;
const note = selectedNoteIds.length === 1 ? await Note.load(selectedNoteIds[0]) : null;
for (const itemId of ['copy', 'paste', 'cut', 'selectAll', 'bold', 'italic', 'link', 'code', 'insertDateTime', 'commandStartExternalEditing', 'setTags', 'showLocalSearch']) { for (const itemId of ['copy', 'paste', 'cut', 'selectAll', 'bold', 'italic', 'link', 'code', 'insertDateTime', 'commandStartExternalEditing', 'setTags', 'showLocalSearch']) {
const menuItem = Menu.getApplicationMenu().getMenuItemById('edit:' + itemId); const menuItem = Menu.getApplicationMenu().getMenuItemById('edit:' + itemId);
if (!menuItem) continue; if (!menuItem) continue;
menuItem.enabled = selectedNoteIds.length === 1; menuItem.enabled = !!note && note.markup_language === Note.MARKUP_LANGUAGE_MARKDOWN;
} }
} }