refactor: consolidate CodeMirror editors into unified AE_Comp_Editor_CodeMirror component
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
import { ae_api } from '$lib/stores/ae_stores';
|
||||
import E_app_codemirror_v5 from '$lib/app_components/e_app_codemirror_v5.svelte';
|
||||
import AE_Comp_Editor_CodeMirror from '$lib/elements/AE_Comp_Editor_CodeMirror.svelte';
|
||||
import Ae_comp_event_settings_form from './ae_comp__event_settings_form.svelte';
|
||||
import Ae_comp_event_settings_pres_mgmt_form from './ae_comp__event_settings_pres_mgmt_form.svelte';
|
||||
import Ae_comp_event_settings_basic_form from './ae_comp__event_settings_basic_form.svelte';
|
||||
@@ -84,14 +84,13 @@
|
||||
onsave={(data: any) => handle_save('cfg_json', data)}
|
||||
/>
|
||||
{:else}
|
||||
<E_app_codemirror_v5
|
||||
editable={true}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
readonly={false}
|
||||
content={JSON.stringify(event_obj.cfg_json, null, 4)}
|
||||
bind:new_content={event_obj.cfg_json}
|
||||
show_line_numbers={true}
|
||||
placeholder="JSON config"
|
||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
class_li="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
@@ -120,14 +119,13 @@
|
||||
onsave={(data: any) => handle_save('mod_pres_mgmt_json', data)}
|
||||
/>
|
||||
{:else}
|
||||
<E_app_codemirror_v5
|
||||
editable={true}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
readonly={false}
|
||||
content={JSON.stringify(event_obj.mod_pres_mgmt_json, null, 4)}
|
||||
bind:new_content={event_obj.mod_pres_mgmt_json}
|
||||
show_line_numbers={true}
|
||||
placeholder="JSON config"
|
||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
class_li="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
@@ -157,14 +155,13 @@
|
||||
onsave={(data: any) => handle_save('mod_badges_json', data)}
|
||||
/>
|
||||
{:else}
|
||||
<E_app_codemirror_v5
|
||||
editable={true}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
readonly={false}
|
||||
content={JSON.stringify(event_obj.mod_badges_json, null, 4)}
|
||||
bind:new_content={event_obj.mod_badges_json}
|
||||
show_line_numbers={true}
|
||||
placeholder="JSON config"
|
||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
class_li="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
@@ -193,14 +190,13 @@
|
||||
onsave={(data: any) => handle_save('mod_abstracts_json', data)}
|
||||
/>
|
||||
{:else}
|
||||
<E_app_codemirror_v5
|
||||
editable={true}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
readonly={false}
|
||||
content={JSON.stringify(event_obj.mod_abstracts_json, null, 4)}
|
||||
bind:new_content={event_obj.mod_abstracts_json}
|
||||
show_line_numbers={true}
|
||||
placeholder="JSON config"
|
||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
class_li="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
@@ -216,14 +212,13 @@
|
||||
<details class="details">
|
||||
<summary class="summary">Exhibits (mod_exhibits_json)</summary>
|
||||
<div class="p-4">
|
||||
<E_app_codemirror_v5
|
||||
editable={true}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
readonly={false}
|
||||
content={JSON.stringify(event_obj.mod_exhibits_json, null, 4)}
|
||||
bind:new_content={event_obj.mod_exhibits_json}
|
||||
show_line_numbers={true}
|
||||
placeholder="JSON config"
|
||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
class_li="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
@@ -237,14 +232,13 @@
|
||||
<details class="details">
|
||||
<summary class="summary">Meetings (mod_meetings_json)</summary>
|
||||
<div class="p-4">
|
||||
<E_app_codemirror_v5
|
||||
editable={true}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
readonly={false}
|
||||
content={JSON.stringify(event_obj.mod_meetings_json, null, 4)}
|
||||
bind:new_content={event_obj.mod_meetings_json}
|
||||
show_line_numbers={true}
|
||||
placeholder="JSON config"
|
||||
class="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
class_li="p-1 preset-outlined-success-400-600 shadow-lg rounded-lg"
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { LockKeyhole, Save, RefreshCcw } from 'lucide-svelte';
|
||||
import { ae_loc } from '$lib/stores/ae_stores';
|
||||
import { journals_loc, journals_sess } from '$lib/ae_journals/ae_journals_stores';
|
||||
import E_app_codemirror_v5 from '$lib/app_components/e_app_codemirror_v5.svelte';
|
||||
import AE_Comp_Editor_CodeMirror from '$lib/elements/AE_Comp_Editor_CodeMirror.svelte';
|
||||
import type { ae_JournalEntry, ae_Journal } from '$lib/types/ae_types';
|
||||
|
||||
interface Props {
|
||||
@@ -73,13 +73,12 @@
|
||||
{:else}
|
||||
<!-- Actual Editor -->
|
||||
{#if journal?.cfg_json?.pref_editor == 'codemirror'}
|
||||
<E_app_codemirror_v5
|
||||
content={tmp_entry_obj?.content ?? ''}
|
||||
bind:new_content={tmp_entry_obj.content}
|
||||
bind:editorView={editor_view}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
bind:content={tmp_entry_obj.content}
|
||||
bind:editor_view={editor_view}
|
||||
theme_mode={$ae_loc.theme_mode}
|
||||
placeholder="Write using Markdown..."
|
||||
class="p-2 preset-outlined-warning-300-700 shadow-lg rounded-lg w-full max-w-6xl bg-surface-50 dark:bg-surface-800"
|
||||
class_li="p-2 preset-outlined-warning-300-700 shadow-lg rounded-lg w-full max-w-6xl bg-surface-50 dark:bg-surface-800"
|
||||
/>
|
||||
{:else}
|
||||
<textarea
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
journals_slct
|
||||
} 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_Comp_Editor_CodeMirror from '$lib/elements/AE_Comp_Editor_CodeMirror.svelte';
|
||||
|
||||
interface Props {
|
||||
log_lvl?: number;
|
||||
@@ -493,12 +493,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__journal_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}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
journals_loc,
|
||||
journals_sess
|
||||
} from '$lib/ae_journals/ae_journals_stores';
|
||||
import E_app_codemirror_v5 from '$lib/app_components/e_app_codemirror_v5.svelte';
|
||||
import AE_Comp_Editor_CodeMirror from '$lib/elements/AE_Comp_Editor_CodeMirror.svelte';
|
||||
|
||||
interface Props {
|
||||
log_lvl?: number;
|
||||
@@ -256,22 +256,20 @@
|
||||
</div>
|
||||
{:else if tab === 'local_json'}
|
||||
<div class="h-full min-h-[400px]">
|
||||
<E_app_codemirror_v5
|
||||
editable={false}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
readonly={true}
|
||||
content={JSON.stringify(tmp_config, 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>
|
||||
{:else if tab === 'session_json'}
|
||||
<div class="h-full min-h-[400px]">
|
||||
<E_app_codemirror_v5
|
||||
editable={false}
|
||||
<AE_Comp_Editor_CodeMirror
|
||||
readonly={true}
|
||||
content={JSON.stringify($journals_sess, 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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user