import { Component, computed, input, output } from '@angular/core'; import { RichTextBlock } from '@shared/kernel/rich-text'; import { RichTextEditorComponent, PlaceholderOption } from '@shared/ui/rich-text-editor/rich-text-editor.component'; import { ButtonComponent } from '@shared/ui/button/button.component'; import { LetterBlock } from '@brief/domain/brief'; /** Molecule: one block in a section — its editor plus provenance + block controls. Presentational: emits content/remove/move events; the section maps them to messages. */ @Component({ selector: 'app-letter-block', imports: [RichTextEditorComponent, ButtonComponent], styles: [` :host{display:block} .block{border-inline-start:var(--rhc-border-width-lg) solid var(--rhc-color-border-subtle);padding-inline-start:var(--rhc-space-max-md)} .meta{display:flex;justify-content:space-between;align-items:center;gap:var(--rhc-space-max-md);margin-block-end:var(--rhc-space-max-sm)} .controls{display:flex;gap:var(--rhc-space-max-sm)} `], template: `
{{ provenance() }} @if (editable()) { Omhoog Omlaag Verwijderen }
`, }) export class LetterBlockComponent { block = input.required(); placeholders = input([]); editable = input(false); contentChanged = output(); removed = output(); moved = output<-1 | 1>(); protected provenance = computed(() => { const b = this.block(); if (b.type === 'freeText') return $localize`:@@brief.provenance.free:Vrije tekst`; return b.edited ? $localize`:@@brief.provenance.edited:Aangepaste standaardtekst` : $localize`:@@brief.provenance.standard:Standaardtekst`; }); }