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

Desktop: Regression: Restore "New sub-notebook" command

This commit is contained in:
Laurent Cozic 2020-10-25 17:29:52 +00:00
parent 52d5c32950
commit 9a6f6c8b39
7 changed files with 30 additions and 2 deletions

View File

@ -105,6 +105,7 @@ ElectronClient/gui/MainScreen/commands/hideModalMessage.js
ElectronClient/gui/MainScreen/commands/moveToFolder.js
ElectronClient/gui/MainScreen/commands/newFolder.js
ElectronClient/gui/MainScreen/commands/newNote.js
ElectronClient/gui/MainScreen/commands/newSubFolder.js
ElectronClient/gui/MainScreen/commands/newTodo.js
ElectronClient/gui/MainScreen/commands/openFolder.js
ElectronClient/gui/MainScreen/commands/openNote.js

1
.gitignore vendored
View File

@ -99,6 +99,7 @@ ElectronClient/gui/MainScreen/commands/hideModalMessage.js
ElectronClient/gui/MainScreen/commands/moveToFolder.js
ElectronClient/gui/MainScreen/commands/newFolder.js
ElectronClient/gui/MainScreen/commands/newNote.js
ElectronClient/gui/MainScreen/commands/newSubFolder.js
ElectronClient/gui/MainScreen/commands/newTodo.js
ElectronClient/gui/MainScreen/commands/openFolder.js
ElectronClient/gui/MainScreen/commands/openNote.js

View File

@ -48,6 +48,7 @@ ElectronClient/gui/MainScreen/commands/hideModalMessage.js
ElectronClient/gui/MainScreen/commands/moveToFolder.js
ElectronClient/gui/MainScreen/commands/newFolder.js
ElectronClient/gui/MainScreen/commands/newNote.js
ElectronClient/gui/MainScreen/commands/newSubFolder.js
ElectronClient/gui/MainScreen/commands/newTodo.js
ElectronClient/gui/MainScreen/commands/openFolder.js
ElectronClient/gui/MainScreen/commands/openNote.js

View File

@ -46,6 +46,7 @@ const commands = [
require('./gui/MainScreen/commands/moveToFolder'),
require('./gui/MainScreen/commands/newNote'),
require('./gui/MainScreen/commands/newFolder'),
require('./gui/MainScreen/commands/newSubFolder'),
require('./gui/MainScreen/commands/newTodo'),
require('./gui/MainScreen/commands/print'),
require('./gui/MainScreen/commands/renameFolder'),

View File

@ -48,6 +48,7 @@ const commands = [
require('./commands/moveToFolder'),
require('./commands/newNote'),
require('./commands/newFolder'),
require('./commands/newSubFolder'),
require('./commands/newTodo'),
require('./commands/print'),
require('./commands/renameFolder'),

View File

@ -0,0 +1,17 @@
import CommandService, { CommandContext, CommandDeclaration, CommandRuntime } from 'lib/services/CommandService';
import { _ } from 'lib/locale';
export const declaration:CommandDeclaration = {
name: 'newSubFolder',
label: () => _('New sub-notebook'),
iconName: 'fa-book',
};
export const runtime = ():CommandRuntime => {
return {
execute: async (context:CommandContext, parentId:string = null) => {
parentId = parentId || context.state.selectedFolderId;
return CommandService.instance().execute('newFolder', parentId);
},
};
};

View File

@ -95,6 +95,7 @@ const commandNames:string[] = [
'newNote',
'newTodo',
'newFolder',
'newSubFolder',
'print',
'synchronize',
'textCopy',
@ -301,6 +302,7 @@ function useMenu(props:Props) {
const newNoteItem = menuItemDic.newNote;
const newTodoItem = menuItemDic.newTodo;
const newFolderItem = menuItemDic.newFolder;
const newSubFolderItem = menuItemDic.newSubFolder;
const printItem = menuItemDic.print;
toolsItemsFirst.push(syncStatusItem, {
@ -423,7 +425,9 @@ function useMenu(props:Props) {
},
shim.isMac() ? noItem : newNoteItem,
shim.isMac() ? noItem : newTodoItem,
shim.isMac() ? noItem : newFolderItem, {
shim.isMac() ? noItem : newFolderItem,
shim.isMac() ? noItem : newSubFolderItem,
{
type: 'separator',
visible: shim.isMac() ? false : true,
}, {
@ -473,7 +477,9 @@ function useMenu(props:Props) {
submenu: [
newNoteItem,
newTodoItem,
newFolderItem, {
newFolderItem,
newSubFolderItem,
{
label: _('Close Window'),
platforms: ['darwin'],
accelerator: shim.isMac() && keymapService.getAccelerator('closeWindow'),