From 25cdf9d4a8a937a520e75cb310fb66f20872a2c7 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Fri, 18 Oct 2024 09:34:23 -0400 Subject: [PATCH] chore(edit-content): create components #29875 --- .../dot-form-file-editor.component.html | 2 +- .../dot-form-file-editor.component.ts | 29 +++++++++++++------ .../dot-form-file-editor.conts.ts | 4 +-- .../store/form-file-editor.store.ts | 10 +++---- .../dot-edit-content-file-field.component.ts | 10 ++----- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.component.html b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.component.html index f74a6f13fcba..5b60054d3540 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.component.html +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.component.html @@ -13,7 +13,7 @@ type="text" data-testId="editor-file-name" />
- @if(nameField) { + @if (nameField) { ({ alias: 'fileName' }); $fileContent = input.required({ alias: 'fileContent' }); $allowFileNameEdit = input(false, { alias: 'allowFileNameEdit' }); @@ -56,7 +68,6 @@ export class DotFormFileEditorComponent{ $editorRef = viewChild.required(MonacoEditorComponent); constructor() { - effect(() => { const name = this.$fileName(); const content = this.$fileContent(); @@ -104,12 +115,12 @@ export class DotFormFileEditorComponent{ #disableEditor() { this.form.disable(); const editor = this.$editorRef().editor; - editor.updateOptions({readOnly: true}); + editor.updateOptions({ readOnly: true }); } #enableEditor() { this.form.enable(); const editor = this.$editorRef().editor; - editor.updateOptions({readOnly: true}); + editor.updateOptions({ readOnly: true }); } } diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.conts.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.conts.ts index 1efa09fb9f27..7ed58154fabd 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.conts.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.conts.ts @@ -1,4 +1,4 @@ -import { MonacoEditorConstructionOptions } from "@materia-ui/ngx-monaco-editor"; +import { MonacoEditorConstructionOptions } from '@materia-ui/ngx-monaco-editor'; export const DEFAULT_FILE_TYPE = 'text'; @@ -16,4 +16,4 @@ export const DEFAULT_MONACO_CONFIG: MonacoEditorConstructionOptions = { fixedOverflowWidgets: true, language: 'text', fontSize: 14 -}; \ No newline at end of file +}; diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/store/form-file-editor.store.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/store/form-file-editor.store.ts index 40a7af1a0b3b..7613ddda2962 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/store/form-file-editor.store.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/store/form-file-editor.store.ts @@ -1,5 +1,5 @@ import { MonacoEditorConstructionOptions } from '@materia-ui/ngx-monaco-editor'; -import { patchState, signalStore, withComputed, withMethods, withState } from '@ngrx/signals'; +import { patchState, signalStore, withComputed, withMethods, withState } from '@ngrx/signals'; import { computed } from '@angular/core'; @@ -44,12 +44,12 @@ export const FormFileEditorStore = signalStore( ...monacoOptions, language: language }; - }), + }) })), withMethods((store) => { return { setFile(file: FileInfo) { - patchState(store, {file}) + patchState(store, { file }); }, setMonacoOptions(monacoOptions: Partial) { const prevState = store.monacoOptions(); @@ -76,6 +76,6 @@ export const FormFileEditorStore = signalStore( // implementation } - } + }; }) -); \ No newline at end of file +); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/dot-edit-content-file-field.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/dot-edit-content-file-field.component.ts index 7c99ff3b970d..7753f5f7217c 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/dot-edit-content-file-field.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/dot-edit-content-file-field.component.ts @@ -363,13 +363,9 @@ export class DotEditContentFileFieldComponent implements ControlValueAccessor, O style: { 'max-width': '1040px' } }); - this.#dialogRef.onClose - .pipe( - takeUntilDestroyed(this.#destroyRef) - ) - .subscribe((file) => { - console.log('file', file); - }); + this.#dialogRef.onClose.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((file) => { + console.log('file', file); + }); } /**