Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added settings to direct exports from papi, stopped trying to edit readonly projects #950

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading