Skip to content

feat: add configuration for imageTool - #366

Open
7eliassen wants to merge 1 commit into
mainfrom
feat/add-image-tool
Open

feat: add configuration for imageTool#366
7eliassen wants to merge 1 commit into
mainfrom
feat/add-image-tool

Conversation

@7eliassen

Copy link
Copy Markdown
Contributor

Summary

Added Editor.js image tool (https://github.com/editor-js/image) configuration with a custom uploader that integrates with the existing authorized note attachment upload pipeline.

Details

  • useNoteEditor.ts — Added a noteId option to the composable. When the image tool is loaded and a noteId is available, the tool is configured with a custom uploadByFile uploader that calls noteSettingsService.uploadImage() (which uses the authorized noteAttachmentRepository), and an uploadByUrl handler that accepts pasted URLs as-is.

  • noteSettings.service.ts — Added uploadImage(id, data) method that uploads a image via the attachment repository and returns the file URL.

  • noteAttachmentUploader.repository.ts — Implemented getFileUrl(noteId, key) to build a direct URL to a stored attachment.

  • noteAttachmentUploader.repository.interface.ts — Added getFileUrl to the repository interface.

  • fetch.transport.ts — Added getBaseUrl() method to expose the transport's base URL.

  • EditorTool.ts — Extended EditorjsToolsConfig type to support an optional config field per tool.

  • Note.vue & HistoryVersion.vue — Pass noteId to the useNoteEditor composable.

Also check other related PR: Disabling authorization for GET image requests

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codex-ui Ready Ready Preview Aug 20, 2026 1:52pm

@codex-assistant

Copy link
Copy Markdown

Thanks for adding a description — the PR is now marked as Ready for Review.

@codex-assistant
codex-assistant Bot marked this pull request as ready for review August 20, 2026 13:53
@neSpecc
neSpecc requested a lite review from Copilot August 20, 2026 16:56
* @param url - image URL pasted by the user
*/
uploadByUrl: (url: string): Promise<{ success: 1; file: { url: string } }> => {
return Promise.resolve({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need to save file by url first, then substitute our own internal path to the file.url

if (toolClassAndInfo.tool.name === 'image') {
const noteId = toValue(options.noteId);

if (noteId !== null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what about images in new notes?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds Editor.js Image Tool configuration to the note editor, integrating image uploads with the existing authorized note-attachment upload flow and exposing attachment URLs for rendering.

Changes:

  • Extend useNoteEditor to accept noteId and configure the Editor.js image tool with custom uploadByFile/uploadByUrl handlers.
  • Add uploadImage() in NoteSettingsService, plus repository support for building direct attachment URLs (getFileUrl()).
  • Expose transport base URL (getBaseUrl()), and extend tool config typing to allow per-tool config.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/presentation/pages/Note.vue Passes noteId into useNoteEditor so image uploads can be note-scoped.
src/presentation/pages/HistoryVersion.vue Passes noteId into useNoteEditor for history viewer configuration parity.
src/infrastructure/transport/fetch.transport.ts Adds getBaseUrl() accessor used to build absolute attachment URLs.
src/infrastructure/noteAttachmentUploader.repository.ts Adds getFileUrl() to build a direct URL for an uploaded attachment key.
src/domain/noteSettings.service.ts Adds uploadImage() that uploads via attachment repository and returns the image URL.
src/domain/noteAttachmentUploader.repository.interface.ts Extends attachment repository interface with getFileUrl().
src/domain/entities/EditorTool.ts Extends EditorjsToolsConfig to support optional per-tool config.
src/application/services/useNoteEditor.ts Adds noteId option and configures the Editor.js image tool uploader integration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +150 to +154
if (toolClassAndInfo.tool.name === 'image') {
const noteId = toValue(options.noteId);

if (noteId !== null) {
toolConfig.config = {
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.

3 participants