Skip to content

Lexical dual editor view with nav#111

Merged
vipinpaul merged 2 commits intodevelopmentfrom
lexical-dual-editor-view-with-nav
May 6, 2025
Merged

Lexical dual editor view with nav#111
vipinpaul merged 2 commits intodevelopmentfrom
lexical-dual-editor-view-with-nav

Conversation

@samueljd
Copy link
Copy Markdown
Contributor

@samueljd samueljd commented Apr 23, 2025

USFM Scripture Editor

Key Features

  • Dual-pane Interface: View source scripture and edit target scripture side-by-side
  • USJ Format Support: Works with USJ (Unified Scripture JSON) as the internal format
  • Verse Reference Navigation: Synchronized opening between source and target content
  • Book Selection: Easy switching between different books of the Bible
  • Automatic Content Creation: Creates default content for new books

Architecture

The editor consists of several key components:

  1. CustomFileWidget: The main editable editor for target scripture
  2. ReadOnlyEditorWidget: A read-only view for source scripture
  3. EditorStartupContribution: Handles initialization and book navigation
  4. LexicalEditor: The core editor component using the Lexical editor framework
  5. FileProcessorService: Backend service for USFM/USJ conversion

Data Flow

  1. USFM files are loaded from the filesystem
  2. The backend converts USFM to USJ format for editing
  3. The editor displays and allows manipulation of the USJ content
  4. On save, USJ is converted back to USFM and written to disk

Navigation

The editor supports navigation through:

  • Book selection from available books in the project
  • Chapter and verse navigation within a book

Configuration

The editor reads configuration from a scribe.json file, which specifies:

  • scope: List of books available in the project
  • sourceDir: Directory containing source scripture files
  • targetDir: Directory containing target scripture files

Usage

  1. Open the editor via the "View" menu → "Scripture Editor"
  2. Select a book to work on
  3. Navigate through chapters and verses
  4. Edit content in the target pane
  5. Save changes (Ctrl+S)

Other Changes

UI / Widgets

  • Added NavigationWidget under packages/UI/src/browser/widgets/.
  • Improved ChatWidget:
    • Reformatted and cleaned up JSX structure.
    • Standardized Tailwind class usaage.
    • Updated button layout for clarity (Discuss, Suggest, Checks).
    • Improved accessibility and structure of input area and scroll handling.

Backend (Project Management)

  • Extended ProjectServiceBackend functionality:
    • Introduced a scope array to track processed USJ identifiers.
    • saveToFile() now:
      • Organizes output into sources, textTranslation, and audioTranslation directories.
      • Writes parsed and cleaned USJ files to appropriate folders.
      • Records project metadata, including scope, to scribe.json.
  • Enhanced USFM parsing and validation:
    • Improved validateUSFM() with CDN-based tree-sitter grammar initialization.
    • Refined USFMtoUSJ() and cleanVerseText() to sanitize verse content.

Refactoring

Widget Cleanup

  • Removed unused widget components and bindings:
    • MainEditorLeftWidget, MainEditorRightWidget, AudioplayWidget removed from packages/UI/src/browser/widgets/.
    • Corresponding contributions and factory bindings removed from widgets/index.ts.

Code Style

  • Updated imports across multiple files to:
    • Use single quotes instead of double quotes.
    • Improve consistency and reduce visual clutter in import blocks.

Widget Contribution Behavior

  • Changed default widget options:
    • For ChatWidget, VideoWidget, and others:
      • activate: truefalse
      • reveal: truefalse
    • Prevents widgets from auto-opening on application start.

Fixes

BCV Navigator

  • Changed toggle command behavior:
    • Now uses { activate: true, reveal: true } to ensure the navigator opens reliably when triggered.

Dependency Updates

  • In applications/browser/package.json:
    • Removed: "project-manager": "0.0.0"
    • Added: "@biblionexus-foundation/scribe-editor": "0.1.2-scribe-v3-dev"

@samueljd samueljd force-pushed the lexical-dual-editor-view-with-nav branch 5 times, most recently from 375dc43 to 6507662 Compare April 23, 2025 11:11
- Added new package dependencies for scribe-editor and updated existing ones in package.json.
- Removed unused AudioPlayWidget and MainEditorLeft components to streamline the UI.
- Refactored ChatWidget and VideoWidget for improved functionality and consistency.
- Introduced new styles and components for better UI/UX in the usfm-editor.
- Updated global state management and added new utility functions for verse reference handling.
- Cleaned up code formatting across various files for better readability.
- Implemented dual pane editor for source and target.
- Added frontend contribution to open on load and also menu entries in File and View.
@samueljd samueljd force-pushed the lexical-dual-editor-view-with-nav branch from 6507662 to 1b10e6f Compare April 23, 2025 11:12
@Roslin22
Copy link
Copy Markdown

Roslin22 commented Apr 24, 2025

QA tested the Lexical dual editor view with nav.

Test Results

Functionality Overview:

  1. The scripture editor can be accessed via the "View" menu.
  2. The editor opens on the right side of the window, along with all the relevant editing controls.
  3. The user can navigate between books and chapters using the provided controls.
  4. Uploaded USFM books are correctly highlighted in the book dropdown.
  5. The selected book name is displayed inside the editor.
  6. The user is able to switch between different books within the editor.
  7. Upon selecting a book and chapter, the cursor correctly moves to the selected chapter.
  8. The user can edit the text within the target editor.
  9. Cut, copy, and paste functionalities are working as expected.
  10. Text can be deleted and copied as plain text multiple times without issue.
  11. Undo and redo operations function correctly within the editor.
  12. The "Insert" dropdown is visible and contains options such as Verse, Chapter, Footnote, and Cross Reference.
  13. The user can successfully insert chapters and verses into the editor.
  14. The editor can be toggled between "Editable" and "Read-Only" modes using the corresponding button.

Issues Noticed

  1. When the user uploads books like LUK and JON, the GEN book is also highlighted by default in the editor, even though it was not uploaded.

  2. Previously created books are also highlighted in the dropdown, even if they are not part of the current project.
    Previous books shown

  3. In the "Insert Chapter" and "Insert Verse" dropdowns, zero and negative numbers are displayed, which are not valid or applicable for this application.

  4. When the user attempts to add footnotes or cross-references, the application crashes, preventing further action.

QA Suggestions

  • In the book dropdown, the uploaded books are highlighted very lightly, making it difficult for the user to easily identify them. The book names shoud be highlighted and readable.
    Book dropdown

  • When a book and chapter are selected from the navigator, the selected chapter appears at the bottom of the editor instead of the beginning.
    Screen Recording:
    Lexical editor

  • There is no sync between the source and the target editors

Environment:
Tested on electron app

@vipinpaul vipinpaul merged commit 0be3fc2 into development May 6, 2025
34 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants