Skip to content

Commit

Permalink
fix(edit-content) fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oidacra committed Feb 1, 2024
1 parent 41779d8 commit d329d26
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
8 changes: 2 additions & 6 deletions core-web/apps/dotcms-binary-field-builder/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
]
},
"configurations": {
"localhost": {
"sourceMap": true,
"optimization": false,
"watch": true
},
"production": {
"budgets": [
{
Expand All @@ -67,7 +62,8 @@
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
"namedChunks": true,
"watch": true
},
"tomcat": {
"outputPath": "../../tomcat9/webapps/ROOT/dotcms-binary-field-builder",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ describe('DotBinaryFieldEditorComponent', () => {
content: 'test'
});

component.form.updateValueAndValidity();

spectator.detectComponentChanges();

tick(355); //due to debounceTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ const DEFAULT_FILE_TYPE = 'text';
export class DotBinaryFieldEditorComponent implements OnInit {
@Input() fileName = '';
@Input() fileContent = '';

private readonly languageType = signal(DEFAULT_FILE_TYPE);
@Output() readonly tempFileUploaded = new EventEmitter<DotCMSTempFile>();
@Output() readonly cancel = new EventEmitter<void>();
@ViewChild('editorRef', { static: true }) editorRef!: MonacoEditorComponent;
Expand All @@ -71,6 +69,7 @@ export class DotBinaryFieldEditorComponent implements OnInit {
content: new FormControl('')
});
mimeType = '';
private readonly languageType = signal(DEFAULT_FILE_TYPE);
private readonly cd: ChangeDetectorRef = inject(ChangeDetectorRef);
private readonly dotUploadService: DotUploadService = inject(DotUploadService);
private readonly dotMessageService: DotMessageService = inject(DotMessageService);
Expand All @@ -81,19 +80,19 @@ export class DotBinaryFieldEditorComponent implements OnInit {
private invalidFileMessage = '';
private editor: monaco.editor.IStandaloneCodeEditor;

private _customMonacoOptions = signal<MonacoEditorConstructionOptions>({});
private _userMonacoOptions = signal<MonacoEditorConstructionOptions>({});

monacoOptions = computed(() => {
return {
...DEFAULT_BINARY_FIELD_MONACO_CONFIG,
...this._customMonacoOptions(),
...this._userMonacoOptions(),
language: this.languageType()
};
});

@Input()
set customMonacoOptions(customMonacoOptions: MonacoEditorConstructionOptions) {
this._customMonacoOptions.set(customMonacoOptions);
set userMonacoOptions(customMonacoOptions: MonacoEditorConstructionOptions) {
this._userMonacoOptions.set(customMonacoOptions);
}

get name(): FormControl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
data-testId="url-mode"></dot-dot-binary-field-url-mode>
<dot-dot-binary-field-editor
*ngSwitchCase="BinaryFieldMode.EDITOR"
[customMonacoOptions]="customMonacoOptions()"
[fileContent]="vm.tempFile?.content || vm.contentlet?.content"
[fileName]="vm.tempFile?.fileName || vm.contentlet?.name"
[userMonacoOptions]="customMonacoOptions()"
(cancel)="closeDialog()"
(tempFileUploaded)="setTempFile($event)"
data-testId="editor-mode"></dot-dot-binary-field-editor>
Expand Down

0 comments on commit d329d26

Please sign in to comment.