From daaac0c62b4c298437c7f952c98dbd9fe4ae9ef5 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 27 Jan 2025 13:42:45 +0700 Subject: [PATCH 1/6] add a writing system editor --- .../FwLite/MiniLcm/Models/WritingSystem.cs | 5 +- .../viewer/src/lib/layout/EntryList.svelte | 6 ++ .../src/lib/services/service-provider.ts | 4 ++ frontend/viewer/src/lib/utils.ts | 16 +++++- .../writing-system/WritingSystemDialog.svelte | 56 +++++++++++++++++++ .../writing-system/WritingSystemEditor.svelte | 42 ++++++++++++++ 6 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 frontend/viewer/src/lib/writing-system/WritingSystemDialog.svelte create mode 100644 frontend/viewer/src/lib/writing-system/WritingSystemEditor.svelte diff --git a/backend/FwLite/MiniLcm/Models/WritingSystem.cs b/backend/FwLite/MiniLcm/Models/WritingSystem.cs index e23627cd7..2684b1dc9 100644 --- a/backend/FwLite/MiniLcm/Models/WritingSystem.cs +++ b/backend/FwLite/MiniLcm/Models/WritingSystem.cs @@ -1,4 +1,6 @@ -namespace MiniLcm.Models; +using System.Text.Json.Serialization; + +namespace MiniLcm.Models; public record WritingSystem: IObjectWithId { @@ -49,6 +51,7 @@ public record WritingSystems public WritingSystem[] Vernacular { get; set; } = []; } +[JsonConverter(typeof(JsonStringEnumConverter))] public enum WritingSystemType { Vernacular = 0, diff --git a/frontend/viewer/src/lib/layout/EntryList.svelte b/frontend/viewer/src/lib/layout/EntryList.svelte index 360a7ca0b..0a46a09c7 100644 --- a/frontend/viewer/src/lib/layout/EntryList.svelte +++ b/frontend/viewer/src/lib/layout/EntryList.svelte @@ -9,6 +9,8 @@ import {useCurrentView} from '$lib/services/view-service'; import {fieldName} from '$lib/i18n'; import {useWritingSystemService} from '$lib/writing-system-service'; + import WritingSystemDialog from '$lib/writing-system/WritingSystemDialog.svelte'; + import DevContent from '$lib/layout/DevContent.svelte'; const dispatch = createEventDispatcher<{ entrySelected: IEntry; @@ -81,6 +83,10 @@ rounded on:click={() => dictionaryMode = !dictionaryMode}> + + + + {/if} + + wsEditDialogOpen = true}> + Edit WS + + @@ -50,11 +58,12 @@ {#if $features.history} {/if} - {#if about} {/if} + +