Skip to content

Commit

Permalink
update platform-editor (#869)
Browse files Browse the repository at this point in the history
- this disables spellchecking
- fix editor scripts after change to workspace
  • Loading branch information
irahopkinson authored Apr 23, 2024
1 parent f69539a commit 29941f9
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 303 deletions.
2 changes: 1 addition & 1 deletion extensions/src/resource-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"platform-bible-utils": "file:../../../lib/platform-bible-utils"
},
"devDependencies": {
"@biblionexus-foundation/platform-editor": "^0.1.0",
"@biblionexus-foundation/platform-editor": "^0.2.0",
"@swc/core": "^1.4.11",
"@types/node": "^20.12.2",
"@types/react": "^18.2.73",
Expand Down
25 changes: 25 additions & 0 deletions extensions/src/resource-viewer/src/_editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,31 @@
color: #dd4a68;
}

/* stylelint-disable-next-line selector-class-pattern */
.editor-mark {
background: rgba(255, 212, 0, 0.14);
border-bottom: 2px solid rgba(255, 212, 0, 0.3);
padding-bottom: 2px;
}

/* stylelint-disable-next-line selector-class-pattern */
.editor-mark.selected {
background: rgba(255, 212, 0, 0.5);
border-bottom: 2px solid rgba(255, 212, 0, 1);
}

/* stylelint-disable-next-line selector-class-pattern */
.editor-markOverlap {
background: rgba(255, 212, 0, 0.3);
border-bottom: 2px solid rgba(255, 212, 0, 0.7);
}

/* stylelint-disable-next-line selector-class-pattern */
.editor-markOverlap.selected {
background: rgba(255, 212, 0, 0.7);
border-bottom: 2px solid rgba(255, 212, 0, 0.7);
}

.editor-paragraph {
margin: 0;
margin-bottom: 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { JSX, useCallback, useEffect, useMemo, useRef } from 'react';
import type { WebViewProps } from '@papi/core';
import {
Editor,
EditorOptions,
EditorRef,
Usj,
getViewOptions,
usjToUsxString,
usxStringToUsj,
} from '@biblionexus-foundation/platform-editor';
Expand All @@ -28,6 +28,8 @@ const defaultScrRef: ScriptureReference = {
verseNum: 1,
};

const options: EditorOptions = { hasSpellCheck: false };

function scrollToScrRef(scrRef: ScriptureReference) {
const verseElement = document.querySelector<HTMLElement>(
`.editor-container span[data-marker="v"][data-number="${scrRef.verseNum}"]`,
Expand Down Expand Up @@ -105,8 +107,6 @@ globalThis.webViewComponent = function ResourceViewer({
}
}, [usx, scrRef]);

const viewOptions = useMemo(() => getViewOptions('formatted'), []);

// Scroll the selected verse into view
useEffect(() => {
// If we made this latest scrRef change, don't scroll
Expand Down Expand Up @@ -149,8 +149,8 @@ globalThis.webViewComponent = function ResourceViewer({
ref={editorRef}
scrRef={scrRef}
setScrRef={setScrRef}
options={options}
onChange={onChange}
viewOptions={viewOptions}
logger={logger}
/>
);
Expand Down
Loading

0 comments on commit 29941f9

Please sign in to comment.