feat(document): drop the read-only Originaltext field from the edit form
The "Originaltext:" line in WhoWhenSection rendered the verbatim import cell (metaDateRaw) as static text plus a hidden input that re-submitted it on every save. Editors mistook it for an editable field. Remove the visible line, the hidden round-trip input, and the now-unused rawDate prop (here and at the DocumentEditLayout call site). The backend's partial update preserves the stored value, so no data is lost. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -209,7 +209,6 @@ async function handleReplaceFile(e: Event) {
|
|||||||
bind:dateIso={dateIso}
|
bind:dateIso={dateIso}
|
||||||
bind:precision={datePrecision}
|
bind:precision={datePrecision}
|
||||||
bind:endDateIso={dateEndIso}
|
bind:endDateIso={dateEndIso}
|
||||||
rawDate={doc.metaDateRaw ?? ''}
|
|
||||||
initialDateIso={doc.documentDate ?? ''}
|
initialDateIso={doc.documentDate ?? ''}
|
||||||
initialLocation={doc.location ?? ''}
|
initialLocation={doc.location ?? ''}
|
||||||
initialSenderName={doc.sender?.displayName ?? ''}
|
initialSenderName={doc.sender?.displayName ?? ''}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ let {
|
|||||||
dateIso = $bindable(''),
|
dateIso = $bindable(''),
|
||||||
precision = $bindable<DatePrecision>('DAY'),
|
precision = $bindable<DatePrecision>('DAY'),
|
||||||
endDateIso = $bindable(''),
|
endDateIso = $bindable(''),
|
||||||
rawDate = '',
|
|
||||||
initialDateIso = '',
|
initialDateIso = '',
|
||||||
initialLocation = '',
|
initialLocation = '',
|
||||||
initialSenderName = '',
|
initialSenderName = '',
|
||||||
@@ -30,7 +29,6 @@ let {
|
|||||||
dateIso?: string;
|
dateIso?: string;
|
||||||
precision?: DatePrecision;
|
precision?: DatePrecision;
|
||||||
endDateIso?: string;
|
endDateIso?: string;
|
||||||
rawDate?: string;
|
|
||||||
initialDateIso?: string;
|
initialDateIso?: string;
|
||||||
initialLocation?: string;
|
initialLocation?: string;
|
||||||
initialSenderName?: string;
|
initialSenderName?: string;
|
||||||
@@ -179,15 +177,6 @@ $effect(() => {
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="metaDateEnd" value={showEndDate ? endDateIso : ''} />
|
<input type="hidden" name="metaDateEnd" value={showEndDate ? endDateIso : ''} />
|
||||||
|
|
||||||
<!-- Originaltext (read-only raw cell): labelled static text, not a disabled input. -->
|
|
||||||
{#if rawDate && rawDate.trim().length > 0}
|
|
||||||
<div data-testid="who-when-raw">
|
|
||||||
<p class="mb-1 block text-sm font-medium text-ink-2">{m.date_original_label()}</p>
|
|
||||||
<p class="font-sans text-sm text-ink">{rawDate}</p>
|
|
||||||
<input type="hidden" name="metaDateRaw" value={rawDate} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!-- Absender (required in upload mode — row 1, col 2) -->
|
<!-- Absender (required in upload mode — row 1, col 2) -->
|
||||||
|
|||||||
@@ -93,13 +93,12 @@ describe('WhoWhenSection — precision controls', () => {
|
|||||||
expect(document.querySelector('input#metaDateEnd')).not.toBeNull();
|
expect(document.querySelector('input#metaDateEnd')).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders the raw cell as static text (not an editable input) and escapes it', async () => {
|
it('never renders the raw cell, and never re-submits it via a hidden input', async () => {
|
||||||
render(WhoWhenSection, { rawDate: '<b>Sommer</b> 1916' });
|
render(WhoWhenSection, {});
|
||||||
const raw = document.querySelector('[data-testid="who-when-raw"]');
|
// The confusing "Originaltext" line is gone …
|
||||||
expect(raw).not.toBeNull();
|
expect(document.querySelector('[data-testid="who-when-raw"]')).toBeNull();
|
||||||
// Verbatim shown as escaped text; no injected <b> element.
|
// … and editing no longer round-trips metaDateRaw to the backend.
|
||||||
expect(raw?.textContent).toContain('<b>Sommer</b> 1916');
|
expect(document.querySelector('input[name="metaDateRaw"]')).toBeNull();
|
||||||
expect(raw?.querySelector('b')).toBeNull();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user