Created @scriptural/react package#221
Conversation
# Conflicts: # pnpm-lock.yaml
- update lock file - fix USJ version from `usfm2Usj` - revert unintentional changes - move nodes menu CSS - fix menu closing when typing (improve selection change detection) - pass in `scrRef` to plugin - get `contextMarker` - add poetry quote marker overwrites
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders Open Preview |
- now at cursor rather than top-left
c9e7f5e to
ecc9a66
Compare
❌ Deploy Preview for quick-draft failed. Why did it fail? →
|
irahopkinson
left a comment
There was a problem hiding this comment.
I'm publishing this partial review for now since GH is acting weird.
There was a problem hiding this comment.
This file was out of date when I checked out the branch. Run pnpm i to update this file.
irahopkinson
left a comment
There was a problem hiding this comment.
Next partial review (GH still acting weird - perhaps its is the large number of files)
irahopkinson
left a comment
There was a problem hiding this comment.
Another partial review. I've run out of week now. I'll get back to this when I get back after next week. Sorry for the delay.
| content?: UsjParaContent[]; | ||
| "link-id"?: NonWhitespaceString; | ||
| "link-href"?: NonWhitespaceString; | ||
| [key: `x-${string}`]: string; |
There was a problem hiding this comment.
You should add [key: z-${string}]: string;. See https://docs.usfm.bible/usfm/3.1.1/char/attributes.html#_user_defined_attributes
There was a problem hiding this comment.
I thought x- prefix was for custom attributes and z prefix for custom markers, the link you provided doesn't provide an example for z- attributes. Could it be a mistake in the docs?
There was a problem hiding this comment.
I checked with the head of the USX/J/FM committee and it should be both x- and z- for properties. He helped me understand more about this if you want to chat in more detail.
irahopkinson
left a comment
There was a problem hiding this comment.
Finally getting back to this review. It would be good to talk about your USJ nodes and if we can combine our usage of nodes.
There was a problem hiding this comment.
If you delete this file I think we will have trouble publishing to NPM. Was this file causing some issue?
| }); | ||
| } | ||
|
|
||
| export type ScriptureReference = { |
There was a problem hiding this comment.
You should now import ScriptureReference from "shared/utils/get-marker-action.model" to keep consistent across the repo.
| root: ({ children }) => { | ||
| return { | ||
| type: "USJ", | ||
| version: "0.2.1", |
There was a problem hiding this comment.
The latest is v3.1. See main for this update.
| lastTextObject: null, | ||
| }; | ||
|
|
||
| function $isSerializedTextNode(node: SerializedLexicalNode): node is SerializedTextNode { |
There was a problem hiding this comment.
This function name doesn't strictly need to start with '$' and probably shouldn't since you are dealing with serialized data (rather than an instantiated Node).
| lastTextObject: null, | ||
| }; | ||
|
|
||
| function $isSerializedTextNode(node: SerializedLexicalNode): node is SerializedTextNode { |
There was a problem hiding this comment.
You should add | null | undefined to the node argument type. You could also simplify the last two checks to node?.type === "text".
| } from "lexical"; | ||
|
|
||
| export const createSerializedRootNode = (children: SerializedLexicalNode[]): SerializedRootNode => { | ||
| return { |
There was a problem hiding this comment.
For both these functions I would just use the simplified arrow function return format, i.e. ... => { ...<someObjectContent>... };
| export type SerializedBlockNode = SerializedScriptureElementNode; | ||
|
|
||
| export class BlockNode extends ScriptureElementNode { | ||
| constructor(attributes: Attributes = {}, props?: NodeProps, tag?: string, key?: NodeKey) { |
There was a problem hiding this comment.
You can remove this constructor since the super constructor does the same thing.
| export type SerializedInlineNode = SerializedScriptureElementNode; | ||
|
|
||
| export class InlineNode extends ScriptureElementNode { | ||
| constructor(attributes: Attributes = {}, props?: NodeProps, tag?: string, key?: NodeKey) { |
There was a problem hiding this comment.
You can also remove this constructor since the super constructor does the same thing.
| export type Attributes = { [key: string]: string }; | ||
|
|
||
| export type SerializedUsfmElementNode = Spread< | ||
| export type SerializedScriptureElementNode = Spread< |
There was a problem hiding this comment.
Are you sure this should be renamed? It now clashes with another type of that same name. I would revert the 2 changes to this file if its not intentional.
| } | ||
| }; | ||
|
|
||
| let nodeType: UsjNode["type"] | undefined = undefined; |
There was a problem hiding this comment.
NIT: assigning to undefined isn't needed since declaring it makes it undefined.
…al app - Introduced `AppReferenceHandler` to manage scripture references across editors. - Enhanced `Editor` and `AppBar` components to utilize the new reference handler. - Added `ScriptureNavigator` component for user-friendly navigation between scripture references. - Integrated `ScrollToReferencePlugin` to automatically scroll to the current reference in the editor. - Updated context and props to support scripture reference handling throughout the application.
…al editor lib and app (#301)
…erencePlugin` to clean up the code.
- Added `findVerseInChapterContext` function to locate verses considering their chapter context. - Implemented helper functions `isElementAfter` and `isElementBefore` to determine element positioning in the document. - Updated `scrollToReference` to utilize the new verse-finding logic.
- Added `FindReplacePlugin` to provide find and replace capabilities. - Introduced `FindReplaceDialog` component for user interface. - Integrated `SearchButton` in `CustomToolbar` to toggle the find and replace dialog. - Updated `Editor` and related components to support the new functionality. - Enhanced context management for search and replace operations.
…ality - Added `TriggerKeyButton` to `CustomToolbar` for setting trigger key combinations. - Integrated `TriggerKeyDialog` for user interaction with trigger keys. - Updated `CustomToolbar` to include `ScripturalNodesMenuPlugin` and `CustomMarkersToolbar`. - Wrapped `CustomToolbar` in `MarkersMenuProvider` within the `Editor` component for improved context management. - Refactored toolbar layout for better organization and usability.
…remove unused imports
…reamline functionality
…ine component functionality
…to improve code clarity
…ural editor - Introduced `CustomSaveButton` in `CustomToolbar` to replace the previous `SaveButton`, adding support for unsaved changes indication. - Implemented `useUnsavedChanges` hook in the `Editor` component to manage unsaved changes and integrate with the `HistoryPlugin`. - Updated `SaveButton` to include automatic change detection and visual feedback for unsaved changes. - Enhanced documentation to reflect new features and usage examples for tracking unsaved changes.
Created lexical editor package for supporting usj
This change is