Skip to content

Commit

Permalink
Replaced copy/pasted scripture utils with @biblionexus-foundation/scr…
Browse files Browse the repository at this point in the history
…ipture-utilities
  • Loading branch information
tjcouch-sil committed Jun 12, 2024
1 parent 63dac23 commit 084c31a
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 647 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import {
EditorRef,
Marginal,
MarginalRef,
Usj,
} from '@biblionexus-foundation/platform-editor';
import type { Usj } from '@biblionexus-foundation/scripture-utilities';
import { VerseRef } from '@sillsdev/scripture';
import { JSX, useCallback, useEffect, useMemo, useRef } from 'react';
import type { WebViewProps } from '@papi/core';
import { logger } from '@papi/frontend';
import { useProjectData, useSetting } from '@papi/frontend/react';
import { ScriptureReference, debounce } from 'platform-bible-utils';
import { USJDocument } from 'platform-scripture';

/** The offset in pixels from the top of the window to scroll to show the verse number */
const VERSE_NUMBER_SCROLL_OFFSET = 80;
Expand All @@ -29,7 +28,7 @@ const defaultScrRef: ScriptureReference = {
verseNum: 1,
};

const usjDocumentDefault: USJDocument = { type: 'USJ', version: '0.2.1', content: [] };
const usjDocumentDefault: Usj = { type: 'USJ', version: '0.2.1', content: [] };

function scrollToScrRef(scrRef: ScriptureReference) {
const verseElement = document.querySelector<HTMLElement>(
Expand Down
2 changes: 1 addition & 1 deletion extensions/src/platform-scripture/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
"platform-bible-utils": "file:../../../lib/platform-bible-utils"
},
"devDependencies": {
"@biblionexus-foundation/scripture-utilities": "^0.0.1",
"@swc/core": "^1.4.11",
"@types/node": "^20.12.2",
"@types/react": "^18.2.73",
"@types/react-dom": "^18.2.23",
"@types/webpack": "^5.28.5",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@xmldom/xmldom": "^0.8.10",
"concurrently": "^8.2.2",
"copy-webpack-plugin": "^12.0.2",
"cross-env": "^7.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { DataProviderUpdateInstructions, IProjectDataProviderEngine } from '@pap
import { VerseRef } from '@sillsdev/scripture';
import type { ProjectDataProviderInterfaces } from 'papi-shared-types';
import { UnsubscriberAsync, UnsubscriberAsyncList } from 'platform-bible-utils';
import { USJChapterProjectInterfaceDataTypes, USJDocument } from 'platform-scripture';
import { usjToUsxString } from './scripture-utils/usj-to-usx';
import { usxStringToUsj } from './scripture-utils/usx-to-usj';
import { USJChapterProjectInterfaceDataTypes } from 'platform-scripture';
import { Usj, usjToUsxString, usxStringToUsj } from '@biblionexus-foundation/scripture-utilities';

/** The `projectInterface`s the Scripture Extender PDPF serves */
// TypeScript is upset without `satisfies` here because `as const` makes the array readonly but it
Expand Down Expand Up @@ -74,7 +73,7 @@ class ScriptureExtenderProjectDataProviderEngine
@papi.dataProviders.decorators.doNotNotify
async setChapterUSJ(
verseRef: VerseRef,
chapterUsj: USJDocument,
chapterUsj: Usj,
): Promise<DataProviderUpdateInstructions<USJChapterProjectInterfaceDataTypes>> {
const didSucceed = await this.pdps['platformScripture.USX_Chapter'].setChapterUSX(
verseRef,
Expand All @@ -84,7 +83,7 @@ class ScriptureExtenderProjectDataProviderEngine
return false;
}

async getChapterUSJ(verseRef: VerseRef): Promise<USJDocument | undefined> {
async getChapterUSJ(verseRef: VerseRef): Promise<Usj | undefined> {
const usx = await this.pdps['platformScripture.USX_Chapter'].getChapterUSX(verseRef);
return usx ? usxStringToUsj(usx) : undefined;
}
Expand Down

This file was deleted.

Loading

0 comments on commit 084c31a

Please sign in to comment.