diff --git a/public/theme-penguins_in_space.js b/public/theme-penguins_in_space.js new file mode 100644 index 0000000..2ba992f --- /dev/null +++ b/public/theme-penguins_in_space.js @@ -0,0 +1,185 @@ +ace.define("ace/theme/penguins_in_space-css", ["require", "exports", "module"], function(require, exports, module) { + module.exports = """ +.penguins-in-space .ace_gutter { + background: #282c34; + color: #6a6f7a; +} + +.penguins-in-space .ace_print-margin { + width: 1px; + background: #e8e8e8; +} + +.penguins-in-space { + background-color: #282c34; + color: #abb2bf; +} + +.penguins-in-space .ace_cursor { + color: #528bff; +} + +.penguins-in-space .ace_marker-layer .ace_selection { + background: #3d4350; +} + +.penguins-in-space.ace_multiselect .ace_selection.ace_start { + box-shadow: 0 0 3px 0 #282c34; + border-radius: 2px; +} + +.penguins-in-space .ace_marker-layer .ace_step { + background: #c6dbae; +} + +.penguins-in-space .ace_marker-layer .ace_bracket { + margin: -1px 0 0 -1px; + border: 1px solid #747369; +} + +.penguins-in-space .ace_marker-layer .ace_active-line { + background: rgba(76,87,103,.19); +} + +.penguins-in-space .ace_gutter-active-line { + background-color: rgba(76,87,103,.19); +} + +.penguins-in-space .ace_marker-layer .ace_selected-word { + border: 1px solid #3d4350; +} + +.penguins-in-space .ace_fold { + background-color: #61afef; + border-color: #abb2bf; +} + +.penguins-in-space .ace_keyword { + color: #00a8c6; +} + +.penguins-in-space .ace_keyword.ace_operator { + color: #00a8c6; +} + +.penguins-in-space .ace_keyword.ace_other.ace_unit { + color: #d19a66; +} + +.penguins-in-space .ace_constant.ace_language { + color: #d19a66; +} + +.penguins-in-space .ace_constant.ace_numeric { + color: #d19a66; +} + +.penguins-in-space .ace_constant.ace_character { + color: #56b6c2; +} + +.penguins-in-space .ace_constant.ace_other { + color: #56b6c2; +} + +.penguins-in-space .ace_support.ace_function { + color: #61afef; +} + +.penguins-in-space .ace_support.ace_constant { + color: #d19a66; +} + +.penguins-in-space .ace_support.ace_class { + color: #ff5d38; +} + +.penguins-in-space .ace_support.ace_type { + color: #ff5d38; +} + +.penguins-in-space .ace_storage { + color: #c678dd; +} + +.penguins-in-space .ace_storage.ace_type { + color: #E6DB74; +} + +.penguins-in-space .ace_invalid { + color: #fff; + background-color: #f2777a; +} + +.penguins-in-space .ace_invalid.ace_deprecated { + color: #272b33; + background-color: #d27b53; +} + +.penguins-in-space .ace_string { + color: #e6db74; +} + +.penguins-in-space .ace_string.ace_regexp { + color: #e6db74; +} + +.penguins-in-space .ace_comment { + font-style: italic; + color: #454a54; +} + +.penguins-in-space .ace_variable { + color: #e06c75; +} + +.penguins-in-space .ace_variable.ace_parameter { + color: #d19a66; +} + +.penguins-in-space .ace_meta.ace_tag { + color: #e06c75; +} + +.penguins-in-space .ace_entity.ace_other.ace_attribute-name { + color: #e06c75; +} + +.penguins-in-space .ace_entity.ace_name.ace_function { + color: #61afef; +} + +.penguins-in-space .ace_entity.ace_name.ace_tag { + color: #e06c75; +} + +.penguins-in-space .ace_markup.ace_heading { + color: #98c379; +} + +.penguins-in-space .ace_indent-guide { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ09NrYAgMjP4PAAtGAwchHMyAAAAAAElFTkSuQmCC) right repeat-y; +} + +.penguins-in-space .ace_indent-guide-active { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y; +} + """; + +}); + +ace.define("ace/theme/penguins_in_space", ["require", "exports", "module", "ace/theme/penguins_in_space-css", "ace/lib/dom"], function(require, exports, module) { + exports.isDark = true; + exports.cssClass = "penguins-in-space"; + exports.cssText = require("./penguins_in_space-css"); + var dom = require("../lib/dom"); + dom.importCssString(exports.cssText, exports.cssClass, false); + +}); +(function() { + ace.require(["ace/theme/penguins_in_space"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); +})(); \ No newline at end of file diff --git a/src/app/common/configs/editor.config.ts b/src/app/common/configs/editor.config.ts index ecb629a..764686a 100644 --- a/src/app/common/configs/editor.config.ts +++ b/src/app/common/configs/editor.config.ts @@ -7,7 +7,7 @@ export const EditorSettings: any = { CONFIG: { behavioursEnabled: true, fontSize: "12px", - theme: "ace/theme/one_dark", + theme: "ace/theme/gruvbox", mode: "ace/mode/text", printMarginColumn: 80, enableBasicAutocompletion: true, diff --git a/src/app/common/configs/keybindings.config.ts b/src/app/common/configs/keybindings.config.ts index 8d19f51..f8bdf81 100644 --- a/src/app/common/configs/keybindings.config.ts +++ b/src/app/common/configs/keybindings.config.ts @@ -8,11 +8,7 @@ export const Keybindings: Array<{}> = [ bindKey: {win: "F11", mac: "F11"}, readOnly: false }, { - name: "showSettingsMenu", - bindKey: {win: "ctrl-shift-m", mac: "ctrl-shift-m"}, - readOnly: false - }, { - name: "showKeyboardShortcuts", + name: "showKeyShortcuts", bindKey: {win: "ctrl-shift-k", mac: "command-shift-k"}, readOnly: false }, { diff --git a/src/app/common/services/editor/files.service.ts b/src/app/common/services/editor/files.service.ts index 6af6630..f73f2e9 100644 --- a/src/app/common/services/editor/files.service.ts +++ b/src/app/common/services/editor/files.service.ts @@ -1,7 +1,7 @@ import { Injectable, inject } from '@angular/core'; import { ReplaySubject, Observable } from 'rxjs'; -import { EditSession } from 'ace-builds'; +import { EditSession, UndoManager } from 'ace-builds'; import { getModeForPath } from 'ace-builds/src-noconflict/ext-modelist'; import { TabsService } from './tabs/tabs.service'; @@ -93,7 +93,8 @@ export class FilesService { file.session.setMode( getModeForPath( file.path ).mode ); - + file.session.setUndoManager( new UndoManager() ); + this.files.set(file.path, file); } catch (error) { console.log( diff --git a/src/app/editor/newton-editor/newton-editor.base.ts b/src/app/editor/newton-editor/newton-editor.base.ts index e488c95..0f41a80 100644 --- a/src/app/editor/newton-editor/newton-editor.base.ts +++ b/src/app/editor/newton-editor/newton-editor.base.ts @@ -85,11 +85,7 @@ export class NewtonEditorBase { this.editor.execCommand("openCommandPalette"); } - public showSettingsMenu() { - this.editor.showSettingsMenu(); - } - - public showKeyboardShortcuts() { + public showKeyShortcuts() { this.editor.showKeyboardShortcuts(); } diff --git a/src/app/editor/newton-editor/newton-editor.component.ts b/src/app/editor/newton-editor/newton-editor.component.ts index 0b1d113..acff2cc 100644 --- a/src/app/editor/newton-editor/newton-editor.component.ts +++ b/src/app/editor/newton-editor/newton-editor.component.ts @@ -7,8 +7,9 @@ import "ace-builds/src-noconflict/ext-keybinding_menu"; import "ace-builds/src-noconflict/ext-command_bar"; import "ace-builds/src-noconflict/ext-prompt"; import "ace-builds/src-noconflict/ext-language_tools"; -import "ace-builds/src-noconflict/theme-one_dark"; -import "ace-builds/src-noconflict/theme-dracula"; +//import "ace-builds/src-noconflict/theme-one_dark"; +//import "ace-builds/src-noconflict/theme-penguins_in_space"; +import "ace-builds/src-noconflict/theme-gruvbox"; import { NewtonEditorBase } from './newton-editor.base'; @@ -90,6 +91,12 @@ export class NewtonEditorComponent extends NewtonEditorBase { // Note: https://ajaxorg.github.io/ace-api-docs/interfaces/ace.Ace.EditorEvents.html this.editor.on("focus", (e) => { + let message = new ServiceMessage(); + message.action = "set-active-editor"; + message.editorUUID = this.uuid; + + this.editorsService.sendMessage(message); + this.updateInfoBar(); }); @@ -116,14 +123,6 @@ export class NewtonEditorComponent extends NewtonEditorBase { } }); - this.editor.on("focus", () => { - let message = new ServiceMessage(); - message.action = "set-active-editor"; - message.editorUUID = this.uuid; - - this.editorsService.sendMessage(message); - }); - this.editor.on("change", () => { if (!this.activeFile) return;