Skip to content

Commit

Permalink
Making sure Hyperlambda files doesn't focus CodeMirror when created
Browse files Browse the repository at this point in the history
  • Loading branch information
polterguy committed Jan 12, 2024
1 parent 411fc0f commit 218808e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ export class IdeTreeComponent implements OnInit {

this.generalService.hideLoading();
this.generalService.showFeedback('File successfully created', 'successMessage');
this.sort({ dialogResult: result, objectPath: path });
this.sort({ dialogResult: result, objectPath: path, autoFocus: false });

// Checking if we should show "Create arguments collection" dialog for file.
if (path.endsWith('.hl')) {
Expand Down Expand Up @@ -899,7 +899,7 @@ export class IdeTreeComponent implements OnInit {
};
}

updateFileObject(fileObject: string) {
updateFileObject(fileObject: string, autoFocus: boolean = true) {

let folder = fileObject;
let isFile = false;
Expand Down Expand Up @@ -929,6 +929,9 @@ export class IdeTreeComponent implements OnInit {
this.generalService.hideLoading();

const cmOptions = this.getCodeMirrorOptions(fileObject);
if (autoFocus === false) {
cmOptions.autofocus = false;
}

if (cmOptions !== null) {

Expand Down Expand Up @@ -1124,7 +1127,7 @@ export class IdeTreeComponent implements OnInit {

sorter();
this.dataBindTree();
this.updateFileObject(event.objectPath);
this.updateFileObject(event.objectPath, event.autoFocus);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Component, Inject } from '@angular/core';

// Application specific imports.
import { FileService } from 'src/app/services/file.service';
import { GeneralService } from 'src/app/services/general.service';

/**
* Helper class for passing parameters in and out of modal dialog.
*/
Expand Down Expand Up @@ -67,11 +63,16 @@ export class NewFileFolderDialogComponent {
pathValid() {

if (!this.data.name || this.data.name.length === 0) {

return false;
}

if (this.data.isFolder) {

return this.data.folders.filter(x => x.toLowerCase() === this.data.path + this.data.name.toLowerCase() + '/').length === 0;

} else {

return this.data.files.filter(x => x.toLowerCase() === this.data.path + this.data.name.toLowerCase()).length === 0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ <h3 class="fw-bold">This endpoint cannot be executed here.</h3>

<ng-template #noEndpointSelected>
<div class="m-auto">
<h3>Try something!</h3>
<h3>Select an endpoint</h3>
</div>
</ng-template>

Expand Down

0 comments on commit 218808e

Please sign in to comment.