Moved keybindings to mapping pattern
This commit is contained in:
parent
64a6e14840
commit
5c7dff5d2b
@ -1,142 +0,0 @@
|
|||||||
const editorCommands = [
|
|
||||||
{
|
|
||||||
name: "showSettingsMenu",
|
|
||||||
bindKey: {win: "Ctrl-Shift-m", mac: "Ctrl-Shift-m"},
|
|
||||||
exec: function(editor) {
|
|
||||||
ace.config.loadModule("ace/ext/settings_menu", function(module) {
|
|
||||||
module.init(editor);
|
|
||||||
editor.showSettingsMenu();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
name: "showKeyboardShortcuts",
|
|
||||||
bindKey: {win: "ctrl-shift-h", mac: "command-shift-h"},
|
|
||||||
exec: function(editor) {
|
|
||||||
ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
|
|
||||||
module.init(editor);
|
|
||||||
editor.showKeyboardShortcuts();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
name: "openCommandPalette2",
|
|
||||||
bindKey: {linux: "Command-Shift-/|F1", win: "Ctrl-Shift-/|F1"},
|
|
||||||
exec: function(editor) {
|
|
||||||
editor.execCommand("openCommandPalette");
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
name: "showLSPManager",
|
|
||||||
bindKey: {win: "ctrl-m", mac: "command-m"},
|
|
||||||
exec: function(editor) {
|
|
||||||
$('#lsp-modal').modal("toggle");
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
name: "search",
|
|
||||||
bindKey: {win: "ctrl-f", mac: "ctrl-f"},
|
|
||||||
exec: function(editor) {
|
|
||||||
blockHigherNewtonEvePropigation = true;
|
|
||||||
searchReplace.toggleShow();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "openFile",
|
|
||||||
bindKey: {win: "ctrl-o", mac: "ctrl-o"},
|
|
||||||
exec: function(editor) {
|
|
||||||
fpath = aceSessions[currentSession]["fpath"]
|
|
||||||
sendMessage("open_file", "", "", fpath, "");
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "saveSession",
|
|
||||||
bindKey: {win: "ctrl-s", mac: "ctrl-s"},
|
|
||||||
exec: function(editor) {
|
|
||||||
saveSession(currentSession);
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "newSession",
|
|
||||||
bindKey: {win: "ctrl-t", mac: "ctrl-t"},
|
|
||||||
exec: function(editor) {
|
|
||||||
newSession();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "closeSession",
|
|
||||||
bindKey: {win: "ctrl-w", mac: "ctrl-w"},
|
|
||||||
exec: function(editor) {
|
|
||||||
closeSession(currentSession);
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "toggleLineHighlight",
|
|
||||||
bindKey: {win: "ctrl-h", mac: "ctrl-h"},
|
|
||||||
exec: function(editor) {
|
|
||||||
toggleLineHighlight();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "gotoDefinition",
|
|
||||||
bindKey: {win: "ctrl-g", mac: "ctrl-g"},
|
|
||||||
exec: function(editor) {
|
|
||||||
console.log("Goto stub...");
|
|
||||||
// lspProvider.$messageController.postMessage(Message(), callback);
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "movelinesUp",
|
|
||||||
bindKey: {win: "ctrl-up", mac: "ctrl-up"},
|
|
||||||
exec: function(editor) {
|
|
||||||
editor.execCommand("movelinesup");
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "movelinesDown",
|
|
||||||
bindKey: {win: "ctrl-down", mac: "ctrl-down"},
|
|
||||||
exec: function(editor) {
|
|
||||||
editor.execCommand("movelinesdown");
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "tgglTopMainMenubar",
|
|
||||||
bindKey: {win: "ctrl-0", mac: "ctrl-0"},
|
|
||||||
exec: function(editor) {
|
|
||||||
sendMessage("tggl_top_main_menubar", "", "", "", "");
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "zoomIn",
|
|
||||||
bindKey: {win: "ctrl-=", mac: "ctrl-="},
|
|
||||||
exec: function(editor) {
|
|
||||||
zoomIn();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "zoomOut",
|
|
||||||
bindKey: {win: "ctrl--", mac: "ctrl--"},
|
|
||||||
exec: function(editor) {
|
|
||||||
zoomOut();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "scrollUp",
|
|
||||||
bindKey: {win: "alt-up", mac: "alt-up"},
|
|
||||||
exec: function(editor) {
|
|
||||||
editor.execCommand("scrollup");
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "scrollDown",
|
|
||||||
bindKey: {win: "alt-down", mac: "alt-down"},
|
|
||||||
exec: function(editor) {
|
|
||||||
editor.execCommand("scrolldown");
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "launhLSP",
|
|
||||||
bindKey: {win: "ctrl-l", mac: "ctrl-l"},
|
|
||||||
exec: function(editor) {
|
|
||||||
loadLSPManager();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}
|
|
||||||
|
|
||||||
];
|
|
@ -1,146 +1,100 @@
|
|||||||
export const Keybindings: Array<any> = [
|
export const Keybindings: Array<{}> = [
|
||||||
// export const Keybindings: any = [
|
|
||||||
// {
|
|
||||||
// name: "showSettingsMenu",
|
|
||||||
// bindKey: {win: "Ctrl-Shift-m", mac: "Ctrl-Shift-m"},
|
|
||||||
// exec: () => {
|
|
||||||
// ace.config.loadModule("ace/ext/settings_menu", function(module) {
|
|
||||||
// module.init(editor);
|
|
||||||
// editor.showSettingsMenu();
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// name: "showKeyboardShortcuts",
|
|
||||||
// bindKey: {win: "ctrl-shift-h", mac: "command-shift-h"},
|
|
||||||
// exec: () => {
|
|
||||||
// ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
|
|
||||||
// module.init(editor);
|
|
||||||
// editor.showKeyboardShortcuts();
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// name: "openCommandPalette2",
|
|
||||||
// bindKey: {linux: "Command-Shift-/|F1", win: "Ctrl-Shift-/|F1"},
|
|
||||||
// exec: () => {
|
|
||||||
// editor.execCommand("openCommandPalette");
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
// name: "showLSPManager",
|
|
||||||
// bindKey: {win: "ctrl-m", mac: "command-m"},
|
|
||||||
// exec: () => {
|
|
||||||
// $('//lsp-modal').modal("toggle");
|
|
||||||
// }
|
|
||||||
// }, {
|
|
||||||
{
|
{
|
||||||
|
name: "showSettingsMenu",
|
||||||
|
bindKey: {win: "Ctrl-Shift-m", mac: "Ctrl-Shift-m"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "showKeyboardShortcuts",
|
||||||
|
bindKey: {win: "ctrl-shift-k", mac: "command-shift-k"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "openCommandPalette",
|
||||||
|
bindKey: {linux: "Command-shift-/|F1", win: "ctrl-shift-/|F1"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "showFilesModal",
|
||||||
|
bindKey: {win: "ctrl-b", mac: "ctrl-b"},
|
||||||
|
service: "filesModalService",
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "showLSPModal",
|
||||||
|
bindKey: {win: "ctrl-shift-l", mac: "ctrl-shift-l"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
name: "search",
|
name: "search",
|
||||||
bindKey: {win: "ctrl-f", mac: "ctrl-f"},
|
bindKey: {win: "ctrl-f", mac: "ctrl-f"},
|
||||||
exec: () => {
|
readOnly: true
|
||||||
// blockHigherNewtonEvePropigation = true;
|
}, {
|
||||||
// searchReplace.toggleShow();
|
name: "newSession",
|
||||||
console.log("Search");
|
bindKey: {win: "ctrl-t", mac: "ctrl-t"},
|
||||||
},
|
readOnly: true
|
||||||
|
}, {
|
||||||
|
name: "destroySession",
|
||||||
|
bindKey: {win: "ctrl-w", mac: "ctrl-w"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "openFiles",
|
||||||
|
bindKey: {win: "ctrl-o", mac: "ctrl-o"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "saveFile",
|
||||||
|
bindKey: {win: "ctrl-s", mac: "ctrl-s"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "saveFileAs",
|
||||||
|
bindKey: {win: "ctrl-shift-s", mac: "ctrl-shift-s"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "selectSessionLeft",
|
||||||
|
bindKey: {win: "ctrl-pageup", mac: "ctrl-pageup"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "selectSessionRight",
|
||||||
|
bindKey: {win: "ctrl-pagedown", mac: "ctrl-pagedown"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "moveSessionLeft",
|
||||||
|
bindKey: {win: "ctrl-shift-up", mac: "ctrl-shift-up"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "moveSessionRight",
|
||||||
|
bindKey: {win: "ctrl-shift-down", mac: "ctrl-shift-down"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "cutToBuffer",
|
||||||
|
bindKey: {win: "ctrl-k", mac: "ctrl-k"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "pasteCutBuffer",
|
||||||
|
bindKey: {win: "ctrl-u", mac: "ctrl-u"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "movelinesUp",
|
||||||
|
bindKey: {win: "ctrl-up", mac: "ctrl-up"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "movelinesDown",
|
||||||
|
bindKey: {win: "ctrl-down", mac: "ctrl-down"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "duplicateLines",
|
||||||
|
bindKey: {win: "ctrl-d", mac: "ctrl-d"},
|
||||||
|
readOnly: false
|
||||||
|
}, {
|
||||||
|
name: "zoomIn",
|
||||||
|
bindKey: {win: "ctrl-=", mac: "ctrl-="},
|
||||||
|
readOnly: true
|
||||||
|
}, {
|
||||||
|
name: "zoomOut",
|
||||||
|
bindKey: {win: "ctrl--", mac: "ctrl--"},
|
||||||
|
readOnly: true
|
||||||
|
}, {
|
||||||
|
name: "toggleLineHighlight",
|
||||||
|
bindKey: {win: "ctrl-h", mac: "ctrl-h"},
|
||||||
|
readOnly: true
|
||||||
|
}, {
|
||||||
|
name: "gotoDefinition",
|
||||||
|
bindKey: {win: "ctrl-g", mac: "ctrl-g"},
|
||||||
readOnly: true
|
readOnly: true
|
||||||
}
|
}
|
||||||
// }, {
|
|
||||||
// name: "openFile",
|
|
||||||
// bindKey: {win: "ctrl-o", mac: "ctrl-o"},
|
|
||||||
// exec: () => {
|
|
||||||
// fpath = aceSessions[currentSession]["fpath"]
|
|
||||||
// sendMessage("open_file", "", "", fpath, "");
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "saveSession",
|
|
||||||
// bindKey: {win: "ctrl-s", mac: "ctrl-s"},
|
|
||||||
// exec: () => {
|
|
||||||
// saveSession(currentSession);
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "newSession",
|
|
||||||
// bindKey: {win: "ctrl-t", mac: "ctrl-t"},
|
|
||||||
// exec: () => {
|
|
||||||
// newSession();
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "closeSession",
|
|
||||||
// bindKey: {win: "ctrl-w", mac: "ctrl-w"},
|
|
||||||
// exec: () => {
|
|
||||||
// closeSession(currentSession);
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "toggleLineHighlight",
|
|
||||||
// bindKey: {win: "ctrl-h", mac: "ctrl-h"},
|
|
||||||
// exec: () => {
|
|
||||||
// toggleLineHighlight();
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "gotoDefinition",
|
|
||||||
// bindKey: {win: "ctrl-g", mac: "ctrl-g"},
|
|
||||||
// exec: () => {
|
|
||||||
// console.log("Goto stub...");
|
|
||||||
// lspProvider.$messageController.postMessage(Message(), callback);
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "movelinesUp",
|
|
||||||
// bindKey: {win: "ctrl-up", mac: "ctrl-up"},
|
|
||||||
// exec: () => {
|
|
||||||
// editor.execCommand("movelinesup");
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "movelinesDown",
|
|
||||||
// bindKey: {win: "ctrl-down", mac: "ctrl-down"},
|
|
||||||
// exec: () => {
|
|
||||||
// editor.execCommand("movelinesdown");
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "tgglTopMainMenubar",
|
|
||||||
// bindKey: {win: "ctrl-0", mac: "ctrl-0"},
|
|
||||||
// exec: () => {
|
|
||||||
// sendMessage("tggl_top_main_menubar", "", "", "", "");
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "zoomIn",
|
|
||||||
// bindKey: {win: "ctrl-=", mac: "ctrl-="},
|
|
||||||
// exec: () => {
|
|
||||||
// zoomIn();
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "zoomOut",
|
|
||||||
// bindKey: {win: "ctrl--", mac: "ctrl--"},
|
|
||||||
// exec: () => {
|
|
||||||
// zoomOut();
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "scrollUp",
|
|
||||||
// bindKey: {win: "alt-up", mac: "alt-up"},
|
|
||||||
// exec: () => {
|
|
||||||
// editor.execCommand("scrollup");
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "scrollDown",
|
|
||||||
// bindKey: {win: "alt-down", mac: "alt-down"},
|
|
||||||
// exec: () => {
|
|
||||||
// editor.execCommand("scrolldown");
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }, {
|
|
||||||
// name: "launhLSP",
|
|
||||||
// bindKey: {win: "ctrl-l", mac: "ctrl-l"},
|
|
||||||
// exec: () => {
|
|
||||||
// loadLSPManager();
|
|
||||||
// },
|
|
||||||
// readOnly: true
|
|
||||||
// }
|
|
||||||
|
|
||||||
];
|
];
|
@ -34,14 +34,26 @@ export class NewtonEditorBase {
|
|||||||
this.editorElm.nativeElement.classList.remove("active-editor")
|
this.editorElm.nativeElement.classList.remove("active-editor")
|
||||||
}
|
}
|
||||||
|
|
||||||
public commander() {
|
public openCommandPalette() {
|
||||||
this.editor.execCommand("openCommandPalette");
|
this.editor.execCommand("openCommandPalette");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public showSettingsMenu() {
|
||||||
|
this.editor.showSettingsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public showKeyboardShortcuts() {
|
||||||
|
this.editor.showKeyboardShortcuts();
|
||||||
|
}
|
||||||
|
|
||||||
protected search() {
|
protected search() {
|
||||||
console.log(this.editor.session.getMode()["$id"]);
|
console.log(this.editor.session.getMode()["$id"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected destroySession() {
|
||||||
|
this.editor.session.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
protected openFiles() {
|
protected openFiles() {
|
||||||
let startDir = "";
|
let startDir = "";
|
||||||
if (this.activeFile) {
|
if (this.activeFile) {
|
||||||
|
@ -3,6 +3,7 @@ import { Component } from "@angular/core";
|
|||||||
// Import Ace and its modes/themes so that `ace` global is defined
|
// Import Ace and its modes/themes so that `ace` global is defined
|
||||||
import * as ace from "ace-builds/src-noconflict/ace";
|
import * as ace from "ace-builds/src-noconflict/ace";
|
||||||
import "ace-builds/src-noconflict/ext-settings_menu";
|
import "ace-builds/src-noconflict/ext-settings_menu";
|
||||||
|
import "ace-builds/src-noconflict/ext-keybinding_menu";
|
||||||
import "ace-builds/src-noconflict/ext-command_bar";
|
import "ace-builds/src-noconflict/ext-command_bar";
|
||||||
import "ace-builds/src-noconflict/ext-language_tools";
|
import "ace-builds/src-noconflict/ext-language_tools";
|
||||||
import "ace-builds/src-noconflict/theme-one_dark";
|
import "ace-builds/src-noconflict/theme-one_dark";
|
||||||
@ -54,138 +55,36 @@ export class NewtonEditorComponent extends NewtonEditorBase {
|
|||||||
|
|
||||||
this.editor = ace.edit( this.editorElm.nativeElement );
|
this.editor = ace.edit( this.editorElm.nativeElement );
|
||||||
this.editor.setOptions( this.editorSettings.CONFIG );
|
this.editor.setOptions( this.editorSettings.CONFIG );
|
||||||
// this.editor.commands.addCommands( this.editorSettings.KEYBINDINGS );
|
|
||||||
this.editor.commands.addCommands([
|
|
||||||
{
|
|
||||||
name: "openCommandPalette2",
|
|
||||||
bindKey: {linux: "Command-shift-/|F1", win: "ctrl-shift-/|F1"},
|
|
||||||
exec: () => {
|
|
||||||
this.commander();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "search",
|
|
||||||
bindKey: {win: "ctrl-f", mac: "ctrl-f"},
|
|
||||||
exec: () => {
|
|
||||||
this.search();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "selectSessionLeft",
|
|
||||||
bindKey: {win: "ctrl-pageup", mac: "ctrl-pageup"},
|
|
||||||
exec: () => {
|
|
||||||
this.selectSessionLeft();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "selectSessionRight",
|
|
||||||
bindKey: {win: "ctrl-pagedown", mac: "ctrl-pagedown"},
|
|
||||||
exec: () => {
|
|
||||||
this.selectSessionRight();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "moveSessionLeft",
|
|
||||||
bindKey: {win: "ctrl-shift-up", mac: "ctrl-shift-up"},
|
|
||||||
exec: () => {
|
|
||||||
this.moveSessionLeft();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "moveSessionRight",
|
|
||||||
bindKey: {win: "ctrl-shift-down", mac: "ctrl-shift-down"},
|
|
||||||
exec: () => {
|
|
||||||
this.moveSessionRight();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "movelinesUp",
|
|
||||||
bindKey: {win: "ctrl-up", mac: "ctrl-up"},
|
|
||||||
exec: () => {
|
|
||||||
this.movelinesUp();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "movelinesDown",
|
|
||||||
bindKey: {win: "ctrl-down", mac: "ctrl-down"},
|
|
||||||
exec: () => {
|
|
||||||
this.movelinesDown();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "duplicateLines",
|
|
||||||
bindKey: {win: "ctrl-d", mac: "ctrl-d"},
|
|
||||||
exec: () => {
|
|
||||||
this.duplicateLines();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "zoomIn",
|
|
||||||
bindKey: {win: "ctrl-=", mac: "ctrl-="},
|
|
||||||
exec: () => {
|
|
||||||
this.zoomIn();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "zoomOut",
|
|
||||||
bindKey: {win: "ctrl--", mac: "ctrl--"},
|
|
||||||
exec: () => {
|
|
||||||
this.zoomOut();
|
|
||||||
},
|
|
||||||
readOnly: true
|
|
||||||
}, {
|
|
||||||
name: "cutToBuffer",
|
|
||||||
bindKey: {win: "ctrl-k", mac: "ctrl-k"},
|
|
||||||
exec: () => {
|
|
||||||
this.cutToBuffer();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "pasteCutBuffer",
|
|
||||||
bindKey: {win: "ctrl-u", mac: "ctrl-u"},
|
|
||||||
exec: () => {
|
|
||||||
this.pasteCutBuffer();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "destroySession",
|
|
||||||
bindKey: {win: "ctrl-w", mac: "ctrl-w"},
|
|
||||||
exec: () => {
|
|
||||||
this.editor.session.destroy();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "openFiles",
|
|
||||||
bindKey: {win: "ctrl-o", mac: "ctrl-o"},
|
|
||||||
exec: () => {
|
|
||||||
this.openFiles();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "saveFile",
|
|
||||||
bindKey: {win: "ctrl-s", mac: "ctrl-s"},
|
|
||||||
exec: () => {
|
|
||||||
this.saveFile();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "saveFileAs",
|
|
||||||
bindKey: {win: "ctrl-shift-s", mac: "ctrl-shift-s"},
|
|
||||||
exec: () => {
|
|
||||||
this.saveFileAs();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}, {
|
|
||||||
name: "showModal",
|
|
||||||
bindKey: {win: "ctrl-b", mac: "ctrl-b"},
|
|
||||||
exec: () => {
|
|
||||||
this.filesModalService.showFilesModal();
|
|
||||||
},
|
|
||||||
readOnly: false
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
let keyBindings = [];
|
||||||
|
for (let i = 0; i < this.editorSettings.KEYBINDINGS.length; i++) {
|
||||||
|
let keyBinding = this.editorSettings.KEYBINDINGS[i];
|
||||||
|
keyBindings.push(
|
||||||
|
{
|
||||||
|
name: keyBinding.name,
|
||||||
|
bindKey: keyBinding.bindKey,
|
||||||
|
exec: (keyBinding.name && keyBinding?.service) ?
|
||||||
|
() => (
|
||||||
|
this[keyBinding?.service][keyBinding.name]()
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(this[keyBinding.name]) ?
|
||||||
|
() => (
|
||||||
|
this[keyBinding.name]()
|
||||||
|
)
|
||||||
|
:
|
||||||
|
() => (
|
||||||
|
console.log(
|
||||||
|
`Name: ${keyBinding.name}, is not mapping to a method OR mapping to a Service: ${keyBinding?.service} and Name: ${keyBinding.name}.`
|
||||||
|
)
|
||||||
|
)
|
||||||
|
,
|
||||||
|
readOnly: keyBinding.readOnly
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.editor.commands.addCommands( keyBindings );
|
||||||
|
|
||||||
// Note: https://ajaxorg.github.io/ace-api-docs/interfaces/ace.Ace.EditorEvents.html
|
// Note: https://ajaxorg.github.io/ace-api-docs/interfaces/ace.Ace.EditorEvents.html
|
||||||
this.editor.on("focus", (e) => {
|
this.editor.on("focus", (e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user