mirror of https://github.com/laurent22/joplin.git
Desktop: Resolves #11664: Reorganised note list context menu
parent
6a1b498e96
commit
f602ad8a63
|
@ -7,7 +7,7 @@ import Setting from '@joplin/lib/models/Setting';
|
|||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'openNoteInNewWindow',
|
||||
label: () => _('Edit in new window'),
|
||||
label: () => _('Open in new window'),
|
||||
iconName: 'icon-share',
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ const bridge = require('@electron/remote').require('./bridge').default;
|
|||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'startExternalEditing',
|
||||
label: () => _('Edit in external editor'),
|
||||
label: () => _('Open in external editor'),
|
||||
iconName: 'icon-share',
|
||||
};
|
||||
|
||||
|
|
|
@ -42,34 +42,24 @@ export default class NoteListUtils {
|
|||
const menu = new Menu();
|
||||
|
||||
if (!includeEncryptedNotes && !includeDeletedNotes) {
|
||||
if (singleNoteId) {
|
||||
menu.append(
|
||||
new MenuItem(menuUtils.commandToStatefulMenuItem('openNoteInNewWindow', singleNoteId)),
|
||||
);
|
||||
|
||||
const cmd = props.watchedNoteFiles.includes(singleNoteId) ? 'stopExternalEditing' : 'startExternalEditing';
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
menu.append(new MenuItem(menuUtils.commandToStatefulMenuItem(cmd, singleNoteId) as any));
|
||||
|
||||
menu.append(new MenuItem({ type: 'separator' }));
|
||||
}
|
||||
|
||||
menu.append(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
new MenuItem(menuUtils.commandToStatefulMenuItem('setTags', noteIds) as any),
|
||||
);
|
||||
|
||||
menu.append(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
new MenuItem(menuUtils.commandToStatefulMenuItem('moveToFolder', noteIds) as any),
|
||||
);
|
||||
|
||||
menu.append(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
new MenuItem(menuUtils.commandToStatefulMenuItem('duplicateNote', noteIds) as any),
|
||||
);
|
||||
|
||||
if (singleNoteId) {
|
||||
const editInMenu = new Menu();
|
||||
|
||||
const cmd = props.watchedNoteFiles.includes(singleNoteId) ? 'stopExternalEditing' : 'startExternalEditing';
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
editInMenu.append(new MenuItem(menuUtils.commandToStatefulMenuItem(cmd, singleNoteId) as any));
|
||||
editInMenu.append(
|
||||
new MenuItem(menuUtils.commandToStatefulMenuItem('openNoteInNewWindow', singleNoteId)),
|
||||
);
|
||||
|
||||
menu.append(new MenuItem({ label: _('Edit in...'), submenu: editInMenu }));
|
||||
}
|
||||
|
||||
menu.append(new MenuItem({ type: 'separator' }));
|
||||
|
||||
if (noteIds.length <= 1) {
|
||||
menu.append(
|
||||
|
@ -107,6 +97,41 @@ export default class NoteListUtils {
|
|||
);
|
||||
}
|
||||
|
||||
menu.append(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
new MenuItem(menuUtils.commandToStatefulMenuItem('moveToFolder', noteIds) as any),
|
||||
);
|
||||
|
||||
menu.append(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
new MenuItem(menuUtils.commandToStatefulMenuItem('duplicateNote', noteIds) as any),
|
||||
);
|
||||
|
||||
if (includeDeletedNotes) {
|
||||
menu.append(
|
||||
new MenuItem(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
menuUtils.commandToStatefulMenuItem('restoreNote', noteIds) as any,
|
||||
),
|
||||
);
|
||||
|
||||
menu.append(
|
||||
new MenuItem(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
menuUtils.commandToStatefulMenuItem('permanentlyDeleteNote', noteIds) as any,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
menu.append(
|
||||
new MenuItem(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
menuUtils.commandToStatefulMenuItem('deleteNote', noteIds) as any,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
menu.append(new MenuItem({ type: 'separator' }));
|
||||
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: _('Copy Markdown link'),
|
||||
|
@ -132,6 +157,8 @@ export default class NoteListUtils {
|
|||
);
|
||||
}
|
||||
|
||||
menu.append(new MenuItem({ type: 'separator' }));
|
||||
|
||||
if ([9, 10].includes(Setting.value('sync.target'))) {
|
||||
menu.append(
|
||||
new MenuItem(
|
||||
|
@ -177,29 +204,6 @@ export default class NoteListUtils {
|
|||
menu.append(exportMenuItem);
|
||||
}
|
||||
|
||||
if (includeDeletedNotes) {
|
||||
menu.append(
|
||||
new MenuItem(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
menuUtils.commandToStatefulMenuItem('restoreNote', noteIds) as any,
|
||||
),
|
||||
);
|
||||
|
||||
menu.append(
|
||||
new MenuItem(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
menuUtils.commandToStatefulMenuItem('permanentlyDeleteNote', noteIds) as any,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
menu.append(
|
||||
new MenuItem(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||
menuUtils.commandToStatefulMenuItem('deleteNote', noteIds) as any,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
const pluginViewInfos = pluginUtils.viewInfosByType(props.plugins, 'menuItem');
|
||||
|
||||
for (const info of pluginViewInfos) {
|
||||
|
|
Loading…
Reference in New Issue