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

update platform-editor #869

Merged
merged 1 commit into from
Apr 23, 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
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
Loading