diff --git a/packages/core/src/common/commands-common.ts b/packages/core/src/common/commands-common.ts index 706fdf436420f..3be226d8c751b 100644 --- a/packages/core/src/common/commands-common.ts +++ b/packages/core/src/common/commands-common.ts @@ -10,6 +10,7 @@ import { CommandContribution, CommandRegistry } from './command'; import { injectable } from "inversify"; export namespace CommonCommands { +<<<<<<< Upstream, based on branch 'GH-210' of https://github.com/theia-ide/theia.git export const EDIT_MENU = "2_edit"; export const EDIT_MENU_UNDO_GROUP = "1_undo/redo"; @@ -102,6 +103,63 @@ export class CommonCommandContribution implements CommandContribution { id: CommonCommands.EDIT_REPLACE, label: 'Replace' }); +======= + export const EDIT_MENU = "2_edit" + export const EDIT_MENU_UNDO_GROUP = "1_undo/redo" + export const EDIT_MENU_COPYPASTE_GROUP = "2_copy" + + export const EDIT_CUT = 'edit_cut'; + export const EDIT_COPY = 'edit_copy'; + export const EDIT_PASTE = 'edit_paste'; + + export const EDIT_UNDO = 'undo'; + export const EDIT_REDO = 'redo'; +} + +@injectable() +export class CommonMenuContribution implements MenuContribution { + + registerMenus(registry: MenuModelRegistry): void { + // Explicitly register the Edit Submenu + registry.registerSubmenu([MAIN_MENU_BAR], CommonCommands.EDIT_MENU, "Edit"); + registry.registerMenuAction([MAIN_MENU_BAR, CommonCommands.EDIT_MENU, CommonCommands.EDIT_MENU_UNDO_GROUP], { + commandId: CommonCommands.EDIT_UNDO + }); + registry.registerMenuAction([ + MAIN_MENU_BAR, + CommonCommands.EDIT_MENU, + CommonCommands.EDIT_MENU_UNDO_GROUP], { + commandId: CommonCommands.EDIT_REDO + }); + } + +} + +@injectable() +export class CommonCommandContribution implements CommandContribution { + + registerCommands(commandRegistry: CommandRegistry): void { + commandRegistry.registerCommand({ + id: CommonCommands.EDIT_CUT, + label: 'Cut' + }) + commandRegistry.registerCommand({ + id: CommonCommands.EDIT_COPY, + label: 'Copy', + }) + commandRegistry.registerCommand({ + id: CommonCommands.EDIT_PASTE, + label: 'Paste' + }) + commandRegistry.registerCommand({ + id: CommonCommands.EDIT_UNDO, + label: 'Undo' + }) + commandRegistry.registerCommand({ + id: CommonCommands.EDIT_REDO, + label: 'Redo' + }) +>>>>>>> 21b1906 GH-210: Restored undo/redo functionality. } } \ No newline at end of file diff --git a/packages/monaco/src/browser/monaco-command.ts b/packages/monaco/src/browser/monaco-command.ts index b56cbaf547703..4ca963680fb0a 100644 --- a/packages/monaco/src/browser/monaco-command.ts +++ b/packages/monaco/src/browser/monaco-command.ts @@ -95,7 +95,13 @@ export class MonacoEditorCommandHandlers implements CommandContribution { }); [CommonCommands.EDIT_UNDO, CommonCommands.EDIT_REDO].forEach(id => { +<<<<<<< Upstream, based on branch 'GH-210' of https://github.com/theia-ide/theia.git const doExecute = (editor: MonacoEditor, ...args: any[]): any => editor.getControl().cursor.trigger('keyboard', id, args); +======= + const doExecute = (editor: MonacoEditor, ...args: any[]): any => { + return editor.getControl().cursor.trigger('keyboard', id, args); + }; +>>>>>>> 21b1906 GH-210: Restored undo/redo functionality. const handler = this.newClipboardHandler(id, doExecute); commands.registerHandler(id, handler); });