Wiring in majority of minimap-view Part 2; Fixing keybinding select and move of session; moved modals around
This commit is contained in:
parent
289c061ab6
commit
a6b0bda263
@ -44,8 +44,9 @@
|
|||||||
"@angular/core": "19.2.0",
|
"@angular/core": "19.2.0",
|
||||||
"@angular/forms": "19.2.0",
|
"@angular/forms": "19.2.0",
|
||||||
"@angular/platform-browser": "19.2.0",
|
"@angular/platform-browser": "19.2.0",
|
||||||
"ace-builds": "1.41.0",
|
"ace-builds": "1.43.0",
|
||||||
"ace-linters": "1.5.3",
|
"ace-diff": "3.0.3",
|
||||||
|
"ace-linters": "1.7.0",
|
||||||
"bootstrap": "5.3.6",
|
"bootstrap": "5.3.6",
|
||||||
"bootstrap-icons": "1.12.1",
|
"bootstrap-icons": "1.12.1",
|
||||||
"chokidar": "4.0.3",
|
"chokidar": "4.0.3",
|
||||||
@ -73,7 +74,7 @@
|
|||||||
"karma-coverage": "2.2.0",
|
"karma-coverage": "2.2.0",
|
||||||
"karma-jasmine": "5.1.0",
|
"karma-jasmine": "5.1.0",
|
||||||
"karma-jasmine-html-reporter": "2.1.0",
|
"karma-jasmine-html-reporter": "2.1.0",
|
||||||
"typescript": "5.7.2",
|
"tslib": "2.3.0",
|
||||||
"tslib": "2.3.0"
|
"typescript": "5.7.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ import { Component } from '@angular/core';
|
|||||||
import { InfoBarComponent } from './editor/info-bar/info-bar.component';
|
import { InfoBarComponent } from './editor/info-bar/info-bar.component';
|
||||||
import { TabsComponent } from './editor/tabs/tabs.component';
|
import { TabsComponent } from './editor/tabs/tabs.component';
|
||||||
import { EditorsComponent } from './editor/editors.component';
|
import { EditorsComponent } from './editor/editors.component';
|
||||||
import { FilesModalComponent } from "./common/components/modals/files-modal.component";
|
import { FilesModalComponent } from "./common/components/modals/files/files-modal.component";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
<div #diffModal
|
||||||
|
id="diffModal" class="modal fade" tabindex="-1" role="dialog"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Diff:</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
|
||||||
|
<div class="diff-view"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,69 @@
|
|||||||
|
import { Component, inject } from "@angular/core";
|
||||||
|
import { CommonModule } from "@angular/common";
|
||||||
|
|
||||||
|
import { Subject, takeUntil } from 'rxjs';
|
||||||
|
|
||||||
|
import * as bootstrap from "bootstrap";
|
||||||
|
|
||||||
|
import AceDiff from 'ace-diff';
|
||||||
|
|
||||||
|
import 'ace-diff/dist/ace-diff.min.css';
|
||||||
|
import 'ace-diff/dist/ace-diff-dark.min.css';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'diff-modal',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
CommonModule
|
||||||
|
],
|
||||||
|
templateUrl: './diff-modal.component.html',
|
||||||
|
styleUrl: './diff-modal.component.css',
|
||||||
|
host: {
|
||||||
|
'class': ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
export class DiffModalComponent {
|
||||||
|
|
||||||
|
diffModal!: bootstrap.Modal;
|
||||||
|
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ngAfterViewInit(): void {
|
||||||
|
this.loadDiffView();
|
||||||
|
this.loadSubscribers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadDiffView() {
|
||||||
|
// Notes: https://github.com/ace-diff/ace-diff
|
||||||
|
// https://ajaxorg.github.io/ace-api-docs/classes/src_ext_diff_diff_view.DiffView.html#scrollB
|
||||||
|
/*
|
||||||
|
const differ = new AceDiff({
|
||||||
|
ace: window.ace
|
||||||
|
element: '.diff-view',
|
||||||
|
left: {
|
||||||
|
content: 'your first file content here',
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
content: 'your second file content here',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadSubscribers() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private createModal() {
|
||||||
|
this.diffModal = new bootstrap.Modal("#diffModal", {});
|
||||||
|
}
|
||||||
|
|
||||||
|
public showModal() {
|
||||||
|
this.diffModal?.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
.modal-column {
|
||||||
|
min-height: 24em;
|
||||||
|
max-height: 24em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-button {
|
||||||
|
background: rgba(116, 0, 0, 0.64);
|
||||||
|
border-style: solid;
|
||||||
|
border-color: rgba(0, 0, 0, 0.64);
|
||||||
|
border-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-button:hover {
|
||||||
|
background: rgba(256, 0, 0, 0.64);
|
||||||
|
}
|
@ -5,10 +5,10 @@ import { Subject, takeUntil } from 'rxjs';
|
|||||||
|
|
||||||
import * as bootstrap from "bootstrap";
|
import * as bootstrap from "bootstrap";
|
||||||
|
|
||||||
import { FilesModalService } from "../../services/editor/modals/files-modal.service";
|
import { FilesModalService } from "../../../services/editor/modals/files-modal.service";
|
||||||
import { TabsService } from '../../services/editor/tabs/tabs.service';
|
import { TabsService } from '../../../services/editor/tabs/tabs.service';
|
||||||
|
|
||||||
import { ServiceMessage } from '../../types/service-message.type';
|
import { ServiceMessage } from '../../../types/service-message.type';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -6,10 +6,12 @@ export const EditorSettings: any = {
|
|||||||
KEYBINDINGS: Keybindings,
|
KEYBINDINGS: Keybindings,
|
||||||
CONFIG: {
|
CONFIG: {
|
||||||
behavioursEnabled: true,
|
behavioursEnabled: true,
|
||||||
|
wrapBehavioursEnabled: true,
|
||||||
fontSize: "12px",
|
fontSize: "12px",
|
||||||
theme: "ace/theme/gruvbox",
|
theme: "ace/theme/gruvbox",
|
||||||
mode: "ace/mode/text",
|
mode: "ace/mode/text",
|
||||||
printMarginColumn: 80,
|
printMarginColumn: 80,
|
||||||
|
enableCodeLens: true,
|
||||||
enableBasicAutocompletion: true,
|
enableBasicAutocompletion: true,
|
||||||
enableLiveAutocompletion: true,
|
enableLiveAutocompletion: true,
|
||||||
enableSnippets: true,
|
enableSnippets: true,
|
||||||
@ -19,11 +21,10 @@ export const EditorSettings: any = {
|
|||||||
tabSize: 4,
|
tabSize: 4,
|
||||||
navigateWithinSoftTabs: true,
|
navigateWithinSoftTabs: true,
|
||||||
tooltipFollowsMouse: true,
|
tooltipFollowsMouse: true,
|
||||||
wrapBehavioursEnabled: false,
|
|
||||||
scrollPastEnd: 0.5,
|
scrollPastEnd: 0.5,
|
||||||
mergeUndoDeltas: false,
|
mergeUndoDeltas: false,
|
||||||
showGutter: true,
|
showGutter: true,
|
||||||
customScrollbar: true,
|
// customScrollbar: true,
|
||||||
scrollSpeed: 5
|
scrollSpeed: 5
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -29,9 +29,13 @@ export const Keybindings: Array<{}> = [
|
|||||||
bindKey: {win: "ctrl-shift-l", mac: "ctrl-shift-l"},
|
bindKey: {win: "ctrl-shift-l", mac: "ctrl-shift-l"},
|
||||||
readOnly: false
|
readOnly: false
|
||||||
}, {
|
}, {
|
||||||
name: "search",
|
name: "searchPopup",
|
||||||
bindKey: {win: "ctrl-f", mac: "ctrl-f"},
|
bindKey: {win: "ctrl-f", mac: "ctrl-f"},
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
}, {
|
||||||
|
name: "replacePopup",
|
||||||
|
bindKey: {win: "ctrl-r", mac: "ctrl-r"},
|
||||||
|
readOnly: false
|
||||||
}, {
|
}, {
|
||||||
name: "newSession",
|
name: "newSession",
|
||||||
bindKey: {win: "ctrl-t", mac: "ctrl-t"},
|
bindKey: {win: "ctrl-t", mac: "ctrl-t"},
|
||||||
|
@ -45,11 +45,11 @@ export class EditorsService {
|
|||||||
|
|
||||||
this.editors.set(uuid, component);
|
this.editors.set(uuid, component);
|
||||||
|
|
||||||
if (Object.keys(this.editors).length < 1) return;
|
if (Array.from(this.editors.keys()).length <= 1) return;
|
||||||
|
|
||||||
|
let _editors = this.getEditorsAsArray();
|
||||||
let leftEditor = null;
|
let leftEditor = null;
|
||||||
let rightEditor = null;
|
let rightEditor = null;
|
||||||
let _editors = this.getEditorsAsArray();
|
|
||||||
|
|
||||||
for (let i = 0; i < _editors.length; i++) {
|
for (let i = 0; i < _editors.length; i++) {
|
||||||
if (_editors[i].uuid !== uuid) continue;
|
if (_editors[i].uuid !== uuid) continue;
|
||||||
@ -66,14 +66,9 @@ export class EditorsService {
|
|||||||
public async setSession(file: NewtonFile | undefined | null) {
|
public async setSession(file: NewtonFile | undefined | null) {
|
||||||
if ( !file ) return;
|
if ( !file ) return;
|
||||||
|
|
||||||
let editorComponent = this.getActiveEditorComponent();
|
let editorComponent = this.getActiveEditorComponent();
|
||||||
let editor = editorComponent.editor;
|
editorComponent.assignSession(file);
|
||||||
|
this.miniMapView.cloneSession(file);
|
||||||
editorComponent.activeFile = file;
|
|
||||||
this.miniMapView.activeFile = file;
|
|
||||||
|
|
||||||
editor.setSession(file.session);
|
|
||||||
this.miniMapView.editor.setSession(file.session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSession() {
|
public getSession() {
|
||||||
@ -89,19 +84,13 @@ export class EditorsService {
|
|||||||
|
|
||||||
if (!this.miniMapView) return;
|
if (!this.miniMapView) return;
|
||||||
|
|
||||||
this.miniMapView.activeFile = editorComponent.activeFile;
|
this.miniMapView.cloneSession(editorComponent.activeFile);
|
||||||
this.miniMapView.editor.setSession(editorComponent.editor.getSession());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getActiveEditorComponent(): any {
|
public getActiveEditorComponent(): any {
|
||||||
return this.get(this.activeEditor);
|
return this.get(this.activeEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public clearminiMapView() {
|
|
||||||
this.miniMapView.newSession();
|
|
||||||
this.miniMapView.activeFile = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected getActiveEditor(): any {
|
protected getActiveEditor(): any {
|
||||||
let editorComponent = this.get(this.activeEditor);
|
let editorComponent = this.get(this.activeEditor);
|
||||||
let editor = editorComponent.editor;
|
let editor = editorComponent.editor;
|
||||||
|
@ -90,8 +90,12 @@ export class CodeViewBase {
|
|||||||
this.editor.showKeyboardShortcuts();
|
this.editor.showKeyboardShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public search() {
|
public searchPopup() {
|
||||||
console.log(this.editor.session.getMode()["$id"]);
|
this.editor.execCommand("find");
|
||||||
|
}
|
||||||
|
|
||||||
|
public replacePopup() {
|
||||||
|
this.editor.execCommand("replace");
|
||||||
}
|
}
|
||||||
|
|
||||||
public showFilesList() {
|
public showFilesList() {
|
||||||
@ -161,8 +165,30 @@ export class CodeViewBase {
|
|||||||
this.editor.setHighlightGutterLine(false);
|
this.editor.setHighlightGutterLine(false);
|
||||||
this.editor.setShowFoldWidgets(false);
|
this.editor.setShowFoldWidgets(false);
|
||||||
this.editor.setShowPrintMargin(false);
|
this.editor.setShowPrintMargin(false);
|
||||||
|
|
||||||
|
this.editorElm.nativeElement.parentElement.classList.remove("scroller");
|
||||||
this.editorElm.nativeElement.parentElement.classList.add("col-1");
|
this.editorElm.nativeElement.parentElement.classList.add("col-1");
|
||||||
this.editorElm.nativeElement.parentElement.classList.add("zero-margin-padding");
|
this.editorElm.nativeElement.parentElement.classList.add("zero-margin-padding");
|
||||||
|
|
||||||
|
this.editor.on("click", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
let editorComponent = this.editorsService.getActiveEditorComponent();
|
||||||
|
let pos = this.editor.getCursorPosition();
|
||||||
|
|
||||||
|
editorComponent.editor.moveCursorToPosition(pos);
|
||||||
|
editorComponent.editor.clearSelection();
|
||||||
|
editorComponent.editor.renderer.scrollCursorIntoView();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.editor.on("mousewheel", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
let editorComponent = this.editorsService.getActiveEditorComponent();
|
||||||
|
editorComponent.editor.renderer.scrollBy(null, event.domEvent.deltaY);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public zoomIn() {
|
public zoomIn() {
|
||||||
@ -223,4 +249,4 @@ export class CodeViewBase {
|
|||||||
private quit() {
|
private quit() {
|
||||||
window.main.quit();
|
window.main.quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import "ace-builds/src-noconflict/ext-settings_menu";
|
|||||||
import "ace-builds/src-noconflict/ext-keybinding_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-prompt";
|
import "ace-builds/src-noconflict/ext-prompt";
|
||||||
|
import "ace-builds/src-noconflict/ext-code_lens";
|
||||||
|
import "ace-builds/src-noconflict/ext-searchbox";
|
||||||
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-penguins_in_space";
|
//import "ace-builds/src-noconflict/theme-penguins_in_space";
|
||||||
@ -26,7 +28,7 @@ import { ServiceMessage } from '../../common/types/service-message.type';
|
|||||||
templateUrl: './view.component.html',
|
templateUrl: './view.component.html',
|
||||||
styleUrl: './view.component.css',
|
styleUrl: './view.component.css',
|
||||||
host: {
|
host: {
|
||||||
'class': 'col zero-margin-padding'
|
'class': 'col zero-margin-padding scroller'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export class CodeViewComponent extends CodeViewBase {
|
export class CodeViewComponent extends CodeViewBase {
|
||||||
@ -157,6 +159,23 @@ export class CodeViewComponent extends CodeViewBase {
|
|||||||
this.editor.setSession(session);
|
this.editor.setSession(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public assignSession(file: NewtonFile) {
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
this.activeFile = file;
|
||||||
|
this.editor.setSession(file.session);
|
||||||
|
}
|
||||||
|
|
||||||
|
public cloneSession(file: NewtonFile) {
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
this.activeFile = file;
|
||||||
|
let session = ace.createEditSession(file.session.getValue());
|
||||||
|
|
||||||
|
session.setMode( file.session.getMode()["$id"] );
|
||||||
|
this.editor.setSession(session);
|
||||||
|
}
|
||||||
|
|
||||||
protected openFiles() {
|
protected openFiles() {
|
||||||
let startDir = "";
|
let startDir = "";
|
||||||
if (this.activeFile) {
|
if (this.activeFile) {
|
||||||
|
@ -75,8 +75,7 @@ export class EditorsComponent {
|
|||||||
|
|
||||||
if (session == siblingSession) return;
|
if (session == siblingSession) return;
|
||||||
|
|
||||||
siblingComponent.editor.setSession(session);
|
siblingComponent.assignSession(editorComponent.activeFile);
|
||||||
siblingComponent.activeFile = editorComponent.activeFile;
|
|
||||||
|
|
||||||
editorComponent.newSession();
|
editorComponent.newSession();
|
||||||
siblingComponent.editor.focus()
|
siblingComponent.editor.focus()
|
||||||
@ -90,8 +89,7 @@ export class EditorsComponent {
|
|||||||
|
|
||||||
if (session == siblingSession) return;
|
if (session == siblingSession) return;
|
||||||
|
|
||||||
siblingComponent.editor.setSession(session);
|
siblingComponent.assignSession(editorComponent.activeFile);
|
||||||
siblingComponent.activeFile = editorComponent.activeFile;
|
|
||||||
|
|
||||||
editorComponent.newSession();
|
editorComponent.newSession();
|
||||||
siblingComponent.editor.focus()
|
siblingComponent.editor.focus()
|
||||||
@ -104,10 +102,8 @@ export class EditorsComponent {
|
|||||||
let editorComponent = this.editorsService.getActiveEditorComponent();
|
let editorComponent = this.editorsService.getActiveEditorComponent();
|
||||||
let editor = editorComponent.editor;
|
let editor = editorComponent.editor;
|
||||||
|
|
||||||
editorComponent.activeFile = file;
|
editorComponent.assignSession(file);
|
||||||
editor.setSession(file.session);
|
this.editorsService.miniMapView.cloneSession(file);
|
||||||
this.editorsService.miniMapView.editor.setSession(file.session);
|
|
||||||
this.editorsService.miniMapView.activeFile = file;
|
|
||||||
} else if (message.action === "close-tab") {
|
} else if (message.action === "close-tab") {
|
||||||
let file = this.filesService.get(message.filePath);
|
let file = this.filesService.get(message.filePath);
|
||||||
let editors = this.editorsService.getEditorsAsArray();
|
let editors = this.editorsService.getEditorsAsArray();
|
||||||
|
@ -10,7 +10,8 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: rgba(64, 64, 64, 0.0)
|
background-color: rgba(64, 64, 64, 0.0);
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user