Fixing undo issue; cleaning up keybindings; removed diplicate focus event

This commit is contained in:
itdominator 2025-06-24 01:07:30 -05:00
parent 9915b98700
commit d7c8ea1902
6 changed files with 200 additions and 23 deletions

View File

@ -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;
}
});
})();

View File

@ -7,7 +7,7 @@ export const EditorSettings: any = {
CONFIG: { CONFIG: {
behavioursEnabled: true, behavioursEnabled: true,
fontSize: "12px", fontSize: "12px",
theme: "ace/theme/one_dark", theme: "ace/theme/gruvbox",
mode: "ace/mode/text", mode: "ace/mode/text",
printMarginColumn: 80, printMarginColumn: 80,
enableBasicAutocompletion: true, enableBasicAutocompletion: true,

View File

@ -8,11 +8,7 @@ export const Keybindings: Array<{}> = [
bindKey: {win: "F11", mac: "F11"}, bindKey: {win: "F11", mac: "F11"},
readOnly: false readOnly: false
}, { }, {
name: "showSettingsMenu", name: "showKeyShortcuts",
bindKey: {win: "ctrl-shift-m", mac: "ctrl-shift-m"},
readOnly: false
}, {
name: "showKeyboardShortcuts",
bindKey: {win: "ctrl-shift-k", mac: "command-shift-k"}, bindKey: {win: "ctrl-shift-k", mac: "command-shift-k"},
readOnly: false readOnly: false
}, { }, {

View File

@ -1,7 +1,7 @@
import { Injectable, inject } from '@angular/core'; import { Injectable, inject } from '@angular/core';
import { ReplaySubject, Observable } from 'rxjs'; 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 { getModeForPath } from 'ace-builds/src-noconflict/ext-modelist';
import { TabsService } from './tabs/tabs.service'; import { TabsService } from './tabs/tabs.service';
@ -93,7 +93,8 @@ export class FilesService {
file.session.setMode( file.session.setMode(
getModeForPath( file.path ).mode getModeForPath( file.path ).mode
); );
file.session.setUndoManager( new UndoManager() );
this.files.set(file.path, file); this.files.set(file.path, file);
} catch (error) { } catch (error) {
console.log( console.log(

View File

@ -85,11 +85,7 @@ export class NewtonEditorBase {
this.editor.execCommand("openCommandPalette"); this.editor.execCommand("openCommandPalette");
} }
public showSettingsMenu() { public showKeyShortcuts() {
this.editor.showSettingsMenu();
}
public showKeyboardShortcuts() {
this.editor.showKeyboardShortcuts(); this.editor.showKeyboardShortcuts();
} }

View File

@ -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-command_bar";
import "ace-builds/src-noconflict/ext-prompt"; import "ace-builds/src-noconflict/ext-prompt";
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";
import "ace-builds/src-noconflict/theme-dracula"; //import "ace-builds/src-noconflict/theme-penguins_in_space";
import "ace-builds/src-noconflict/theme-gruvbox";
import { NewtonEditorBase } from './newton-editor.base'; 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 // Note: https://ajaxorg.github.io/ace-api-docs/interfaces/ace.Ace.EditorEvents.html
this.editor.on("focus", (e) => { this.editor.on("focus", (e) => {
let message = new ServiceMessage();
message.action = "set-active-editor";
message.editorUUID = this.uuid;
this.editorsService.sendMessage(message);
this.updateInfoBar(); 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", () => { this.editor.on("change", () => {
if (!this.activeFile) return; if (!this.activeFile) return;