2020-11-07 17:59:37 +02:00
|
|
|
import CommandService, { CommandContext, CommandDeclaration, CommandRuntime } from '@joplin/lib/services/CommandService';
|
|
|
|
import { _ } from '@joplin/lib/locale';
|
2020-10-25 19:29:52 +02:00
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
export const declaration: CommandDeclaration = {
|
2020-10-25 19:29:52 +02:00
|
|
|
name: 'newSubFolder',
|
|
|
|
label: () => _('New sub-notebook'),
|
|
|
|
iconName: 'fa-book',
|
|
|
|
};
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
export const runtime = (): CommandRuntime => {
|
2020-10-25 19:29:52 +02:00
|
|
|
return {
|
2020-11-12 21:13:28 +02:00
|
|
|
execute: async (context: CommandContext, parentId: string = null) => {
|
2020-10-25 19:29:52 +02:00
|
|
|
parentId = parentId || context.state.selectedFolderId;
|
|
|
|
return CommandService.instance().execute('newFolder', parentId);
|
|
|
|
},
|
2024-03-02 16:25:27 +02:00
|
|
|
enabledCondition: '!folderIsReadOnly && !folderIsTrash',
|
2020-10-25 19:29:52 +02:00
|
|
|
};
|
|
|
|
};
|