Skip to content

feat(editor): add image support to scripts (paste, drop, file picker) - #5

Open
Builder106 wants to merge 2 commits into
ArunNGun:mainfrom
SankofaForge:pr/4-react-script-images
Open

Builder106 wants to merge 2 commits into
ArunNGun:mainfrom
SankofaForge:pr/4-react-script-images

Conversation

@Builder106

Copy link
Copy Markdown
Contributor

Summary

Brings the script-image workflow to the v3.0.0 React/Tiptap editor. This supersedes #4, which was written against the pre-v3.0.0 vanilla-JS frontend/renderer editor that no longer exists. Reimplemented as a first-class Tiptap image node rather than the old base64-in-textarea [[image:…]] marker hack.

Changes

  • Dependency: add @tiptap/extension-image, pinned to 3.22.3 so it resolves the same @tiptap/core as the rest of the Tiptap stack (a floating ^3.22.3 pulls core@3.26, which breaks @tiptap/react@3.22.3). The lockfile also picks up the stale version field fix (2.2.13.0.0) since npm install regenerates it.
  • EditView: insert images via paste, drag-and-drop, and a 🖼 toolbar file picker; images are stored as base64 data-URLs in the doc. Image-only scripts now save/start (guards switched from getText().trim() to editor.isEmpty).
  • tokenizer: emit an image token for image nodes so the read view sees them.
  • ReadView: render image tokens as <img class="read-image"> in the scrolling teleprompter.
  • style: image sizing/centering in both the editor and the read view.

Testing

  • npm run build:frontend passes clean.
  • Logic reviewed end-to-end: edit (insert) → save (getJSON persists the image node) → read (tokenizer → <img>).

Runtime verification inside the Tauri shell is recommended before merge.

Bring back the script-image workflow on the v3.0.0 React/Tiptap editor,
reimplemented as a first-class Tiptap image node instead of the old
base64-in-textarea marker hack.

- add @tiptap/extension-image (pinned to 3.22.3 to match @tiptap/core)
- EditView: paste, drag-and-drop, and a toolbar file picker insert images
  as base64 data-URLs; allow image-only scripts via editor.isEmpty guards
- tokenizer: emit an `image` token for image nodes
- ReadView: render image tokens as <img> in the scrolling teleprompter
- style: image sizing in the editor and read view
@Builder106

Copy link
Copy Markdown
Contributor Author

@ArunNGun Bumping this one as well. Let me know if you need any changes or if there are any blockers.

@ArunNGun ArunNGun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good will merge after running an final build, thank you for your contribution

@Builder106

Copy link
Copy Markdown
Contributor Author

@ArunNGun

Thanks. I pushed 1b2febf to SankofaForge:pr/4-react-script-images. It fixes the order of multiple pasted or dropped images, replaces selected text when an image is pasted, and avoids updating an editor after it has been destroyed.

The combined PR #5 and PR #6 changes passed the tests, lint, frontend build, dependency audit, and full ARM64 Tauri build. The build produced .deb, .rpm, and AppImage bundles.

I recommend merging PR #6 first because both PRs touch the dependency files. After that, I can refresh PR #5 against main, regenerate its lockfile, and run the checks again.

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.

2 participants