From 7ee6990982a392bf4fd5b96915916904bcebda1b Mon Sep 17 00:00:00 2001 From: tjcouch-sil Date: Thu, 20 Jun 2024 17:00:57 -0500 Subject: [PATCH] Added settings direct export from papi --- .../src/platform-scripture-editor.web-view.tsx | 6 +++--- lib/papi-dts/papi.d.ts | 2 ++ src/extension-host/services/papi-backend.service.ts | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/extensions/src/platform-scripture-editor/src/platform-scripture-editor.web-view.tsx b/extensions/src/platform-scripture-editor/src/platform-scripture-editor.web-view.tsx index 95e48ae1a6..e1355256c1 100644 --- a/extensions/src/platform-scripture-editor/src/platform-scripture-editor.web-view.tsx +++ b/extensions/src/platform-scripture-editor/src/platform-scripture-editor.web-view.tsx @@ -88,10 +88,10 @@ globalThis.webViewComponent = function PlatformScriptureEditor({ usjDocumentDefault, ); - const debouncedSetUsx = useMemo(() => debounce((newUsj: Usj) => setUsj?.(newUsj), 300), [setUsj]); + const debouncedSetUsj = useMemo(() => debounce((newUsj: Usj) => setUsj?.(newUsj), 300), [setUsj]); // TODO: remove debounce when issue #826 is done. - const onChange = useCallback(debouncedSetUsx, [debouncedSetUsx]); + const onChange = useCallback(debouncedSetUsj, [debouncedSetUsj]); useEffect(() => { if (usj) editorRef.current?.setUsj(usj); @@ -151,7 +151,7 @@ globalThis.webViewComponent = function PlatformScriptureEditor({ scrRef={scrRef} setScrRef={setScrRef} options={options} - onChange={onChange} + onChange={isReadOnly ? undefined : onChange} logger={logger} /> ); diff --git a/lib/papi-dts/papi.d.ts b/lib/papi-dts/papi.d.ts index dc69aebd6b..347ce4016f 100644 --- a/lib/papi-dts/papi.d.ts +++ b/lib/papi-dts/papi.d.ts @@ -5719,6 +5719,8 @@ declare module '@papi/backend' { * within the renderer. */ export const storage: ExtensionStorageService; + /** */ + export const settings: ISettingsService; /** * * Service that allows to get and store menu data diff --git a/src/extension-host/services/papi-backend.service.ts b/src/extension-host/services/papi-backend.service.ts index ab637037c4..28c52cf698 100644 --- a/src/extension-host/services/papi-backend.service.ts +++ b/src/extension-host/services/papi-backend.service.ts @@ -155,6 +155,9 @@ Object.freeze(papi.projectSettings); /** JSDOC DESTINATION extensionStorageService */ export const { storage } = papi; Object.freeze(papi.storage); +/** JSDOC DESTINATION settingsService */ +export const { settings } = papi; +Object.freeze(papi.settings); /** JSDOC DESTINATION menuDataService */ export const { menuData } = papi; Object.freeze(papi.menuData);