refactor: consolidate CodeMirror editors into unified AE_Comp_Editor_CodeMirror component

This commit is contained in:
Scott Idem
2026-01-29 14:16:35 -05:00
parent 3d7b68e7ce
commit 363d94a36b
10 changed files with 323 additions and 92 deletions

View File

@@ -28,8 +28,8 @@
import { ae_loc, ae_api } from '$lib/stores/ae_stores';
import { journals_loc, journals_sess } from '$lib/ae_journals/ae_journals_stores';
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
import E_app_codemirror_v5 from '$lib/app_components/e_app_codemirror_v5.svelte';
import AE_ObjectFlags from '$lib/ae_elements/AE_ObjectFlags.svelte';
import AE_Comp_Editor_CodeMirror from '$lib/elements/AE_Comp_Editor_CodeMirror.svelte';
import AE_Object_Flags from '$lib/ae_elements/AE_Object_Flags.svelte';
interface Props {
log_lvl?: number;
@@ -156,7 +156,7 @@
<h4 class="text-xs font-bold uppercase opacity-50">Quick Category</h4>
<div class="flex flex-wrap gap-2">
{#each journal?.cfg_json?.category_li ?? [] as cat}
<button
<button
class="btn btn-sm {tmp_entry_obj.category_code === cat.code ? 'variant-filled-primary' : 'variant-soft-primary'}"
onclick={() => { tmp_entry_obj.category_code = cat.code; handle_update_entry(); on_save(); }}
>
@@ -248,15 +248,15 @@
<section class="space-y-4">
<h4 class="text-xs font-bold uppercase opacity-50">Privacy Flags</h4>
<AE_ObjectFlags
bind:obj={tmp_entry_obj}
onToggle={() => { handle_update_entry(); on_save(); }}
hideAlert={journal?.cfg_json?.hide_btn_alert}
hidePrivate={journal?.cfg_json?.hide_btn_private}
hidePublic={journal?.cfg_json?.hide_btn_public}
hidePersonal={journal?.cfg_json?.hide_btn_personal}
hideProfessional={journal?.cfg_json?.hide_btn_professional}
hideTemplate={journal?.cfg_json?.hide_btn_template}
<AE_Object_Flags
bind:obj={tmp_entry_obj}
on_toggle={() => { handle_update_entry(); on_save(); }}
hide_alert={journal?.cfg_json?.hide_btn_alert}
hide_private={journal?.cfg_json?.hide_btn_private}
hide_public={journal?.cfg_json?.hide_btn_public}
hide_personal={journal?.cfg_json?.hide_btn_personal}
hide_professional={journal?.cfg_json?.hide_btn_professional}
hide_template={journal?.cfg_json?.hide_btn_template}
/>
</section>
@@ -283,12 +283,11 @@
{:else if tab === 'json'}
<div class="h-full min-h-[400px]">
<E_app_codemirror_v5
editable={false}
<AE_Comp_Editor_CodeMirror
readonly={true}
content={JSON.stringify(tmp_entry_obj, null, 2)}
theme_mode={$ae_loc.theme_mode}
class="rounded-lg border border-surface-500/30"
class_li="rounded-lg border border-surface-500/30"
/>
</div>
{/if}