diff --git a/src/lib/elements/element_data_store_form.svelte b/src/lib/elements/element_data_store_form.svelte new file mode 100644 index 00000000..c927be62 --- /dev/null +++ b/src/lib/elements/element_data_store_form.svelte @@ -0,0 +1,320 @@ + + +
+ + +
+ + +
+ + +
+ + {#if show_account_field} + + {/if} +
+ + + {#if show_for_fields} +
+ +
+ + For ID + — random string ID of the parent object + + {#if is_new} + +

+ The backend resolves this string to an integer FK on create. + Once set, For ID cannot be changed via the UI. +

+ {:else} + +
+ {#if draft_for_id} + {draft_for_id} + {:else} + not set + {/if} +
+

+ For ID is fixed at creation time (DB stores an integer FK). To change it, update the record directly in phpMyAdmin. +

+ {/if} +
+
+ {/if} + + +
+
+ + Content + {#if draft_type === 'json'} + — parsed as JSON on save; invalid JSON is stored as-is + {:else if draft_type === 'sql'} + — stored as raw SQL string; not executed here + {:else if draft_type === 'md'} + — Markdown; rendered by the display component + {:else if draft_type === 'html'} + — HTML markup; rendered as raw HTML in display + {/if} + + {#if draft_type === 'html'} +
+ + +
+ {/if} +
+ + {#if draft_type === 'html'} + {#if html_edit_mode === 'source'} + + {:else} + + {/if} + {:else if draft_type === 'json' || draft_type === 'sql' || draft_type === 'md'} + + {:else} + + {/if} +
+ + +
+ + + {#if show_advanced} +
+ + +
+

Flags

+
+ + + +
+
+ + +
+ + +
+ + + + +
+ {/if} +
+ +
diff --git a/src/routes/core/data_stores/+page.svelte b/src/routes/core/data_stores/+page.svelte index 5a092016..c89344ec 100644 --- a/src/routes/core/data_stores/+page.svelte +++ b/src/routes/core/data_stores/+page.svelte @@ -11,9 +11,7 @@ import { ChevronLeft, ChevronRight, ChevronUp, - Code, Database, - Eye, Filter, LoaderCircle, Pencil, @@ -30,8 +28,7 @@ import { ae_loc, ae_api } from '$lib/stores/ae_stores'; import { db_core } from '$lib/ae_core/db_core'; import { ae_util } from '$lib/ae_utils/ae_utils'; import type { ae_DataStore } from '$lib/types/ae_types'; -import AE_Comp_Editor_CodeMirror from '$lib/elements/element_editor_codemirror.svelte'; -import AE_Comp_Editor_TipTap from '$lib/elements/element_editor_tiptap.svelte'; +import AE_DataStore_Form from '$lib/elements/element_data_store_form.svelte'; onMount(() => { if (!$ae_loc.manager_access) { @@ -73,7 +70,6 @@ let draft_priority = $state(false); let draft_sort = $state(''); let draft_group = $state(''); let draft_notes = $state(''); -let html_edit_mode = $state<'source' | 'visual'>('source'); let submit_status = $state<'idle' | 'processing' | 'saved' | 'error'>('idle'); // ── Bulk rename state ───────────────────────────────────────────────────────── @@ -170,7 +166,6 @@ function open_edit(obj: ae_DataStore) { ? obj.json : JSON.stringify(obj.json ?? '', null, 2) : (obj.text ?? obj.html ?? ''); - html_edit_mode = 'source'; submit_status = 'idle'; show_edit = true; } @@ -191,7 +186,6 @@ function open_new() { draft_sort = ''; draft_group = ''; draft_notes = ''; - html_edit_mode = 'source'; submit_status = 'idle'; show_edit = true; } @@ -748,174 +742,24 @@ function content_preview(ds: ae_DataStore): string { class="space-y-4" onsubmit={(e) => { e.preventDefault(); handle_save(); }}> - -
- - -
- - -
- - -
- - -
- -
- - For ID - — random string ID of parent - - {#if is_new} - - {:else} - -
- {#if editing_obj?.for_id} - {editing_obj.for_id} - {:else} - not set - {/if} -
-

- For ID is set at creation time. To change it, use phpMyAdmin (DB stores the integer FK). -

- {/if} -
-
- - -
- - - - - -
- - - - - -
-
- Content - {#if draft_type === 'html'} -
- - -
- {/if} -
- - {#if draft_type === 'html'} - {#if html_edit_mode === 'source'} - - {:else} - - {/if} - {:else if draft_type === 'json' || draft_type === 'sql' || draft_type === 'md'} - - {:else} - - {/if} -
+ + {#key editing_obj?.id ?? 'new'} + + {/key}