From 7eba6dd8505d625ba1ca68c416291d1906b652e9 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Thu, 28 Nov 2024 10:59:34 +0700 Subject: [PATCH 1/2] fix issue where `__key` is considered an invalid WsId --- backend/FwLite/MiniLcm/Models/WritingSystemId.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/FwLite/MiniLcm/Models/WritingSystemId.cs b/backend/FwLite/MiniLcm/Models/WritingSystemId.cs index 7441fb99d..c12509fbb 100644 --- a/backend/FwLite/MiniLcm/Models/WritingSystemId.cs +++ b/backend/FwLite/MiniLcm/Models/WritingSystemId.cs @@ -33,7 +33,8 @@ public override void WriteAsPropertyName(Utf8JsonWriter writer, WritingSystemId public WritingSystemId(string code) { - if (code == "default" || IetfLanguageTag.IsValid(code)) + //__key is used by the LfClassicMiniLcmApi to smuggle non guid ids with possibilitie lists + if (code == "default" || code == "__key" || IetfLanguageTag.IsValid(code)) { Code = code; } From ffb7b137fc901dac271daf60c753d6cdaafb5cb7 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Thu, 28 Nov 2024 11:03:42 +0700 Subject: [PATCH 2/2] don't attempt to change entries in readonly mode --- frontend/viewer/src/lib/Editor.svelte | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/viewer/src/lib/Editor.svelte b/frontend/viewer/src/lib/Editor.svelte index 71bf2492f..bb56788bc 100644 --- a/frontend/viewer/src/lib/Editor.svelte +++ b/frontend/viewer/src/lib/Editor.svelte @@ -26,12 +26,14 @@ const viewSettings = useViewSettings(); async function onChange(e: { entry: IEntry, sense?: ISense, example?: IExampleSentence }) { + if (readonly) return; await updateEntry(e.entry); dispatch('change', {entry: e.entry}); updateInitialEntry(); } async function onDelete(e: { entry: IEntry, sense?: ISense, example?: IExampleSentence }) { + if (readonly) return; if (e.example !== undefined && e.sense !== undefined) { await saveHandler(() => lexboxApi.DeleteExampleSentence(e.entry.id, e.sense!.id, e.example!.id)); } else if (e.sense !== undefined) {