Skip to content

Commit

Permalink
GH-210: Restored undo/redo functionality.
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <[email protected]>
  • Loading branch information
kittaakos authored and akosyakov committed Sep 5, 2017
1 parent 8ed0320 commit 4a348b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export namespace CommonCommands {
export const EDIT_COPY = 'edit_copy';
export const EDIT_PASTE = 'edit_paste';

export const EDIT_UNDO = 'edit_undo';
export const EDIT_REDO = 'edit_redo';
export const EDIT_UNDO = 'undo';
export const EDIT_REDO = 'redo';

export const TAB_NEXT: Command = {
id: 'tab:next',
Expand Down
2 changes: 1 addition & 1 deletion packages/monaco/src/browser/monaco-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class MonacoEditorCommandHandlers implements CommandContribution {

[CommonCommands.EDIT_UNDO, CommonCommands.EDIT_REDO].forEach(id => {
const doExecute = (editor: MonacoEditor, ...args: any[]): any => {
return editor.getControl().trigger('keyboard', id, args);
return editor.getControl().cursor.trigger('keyboard', id, args);
};
const handler = this.newClipboardHandler(id, doExecute);
commands.registerHandler(id, handler);
Expand Down
2 changes: 1 addition & 1 deletion packages/monaco/src/browser/monaco-context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class MonacoContextMenuService implements IContextMenuService {
showContextMenu(delegate: IContextMenuDelegate): void {
const anchor = toAnchor(delegate.getAnchor());
// If it is the general context menu, we want to delegate to our menu registry entirely and ignore the actually passed actions.
// Unfortunately checking the existence of certain properties seems to be the best way to tell, what kind of contect menu is requested.
// Unfortunately checking the existence of certain properties seems to be the best way to tell, what kind of context menu is requested.
if (delegate.hasOwnProperty("getKeyBinding")) {
this.contextMenuRenderer.render(EDITOR_CONTEXT_MENU_ID, anchor);
} else {
Expand Down
5 changes: 5 additions & 0 deletions packages/monaco/src/typings/monaco/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ declare module monaco.editor {
export interface ICommonCodeEditor {
readonly _commandService: monaco.commands.ICommandService;
readonly _instantiationService: monaco.instantiation.IInstantiationService;
readonly cursor: ICursor;
}

export interface ICursor {
trigger(source: string, handlerId: string, payload: any): void;
}

export interface IEditorOverrideServices {
Expand Down

0 comments on commit 4a348b5

Please sign in to comment.