Skip to content

Commit

Permalink
Added settings to direct exports from papi, stopped trying to edit re…
Browse files Browse the repository at this point in the history
…adonly projects (#950)
  • Loading branch information
tjcouch-sil authored Jun 21, 2024
2 parents 37c0b3d + 7ee6990 commit da9d954
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -151,7 +151,7 @@ globalThis.webViewComponent = function PlatformScriptureEditor({
scrRef={scrRef}
setScrRef={setScrRef}
options={options}
onChange={onChange}
onChange={isReadOnly ? undefined : onChange}
logger={logger}
/>
);
Expand Down
2 changes: 2 additions & 0 deletions lib/papi-dts/papi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/extension-host/services/papi-backend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit da9d954

Please sign in to comment.