Skip to content

add image paste support to chat input - #238

Merged
jgindin merged 3 commits into
a2ui-project:mainfrom
ddnn55:main
Oct 5, 2026
Merged

jgindin merged 3 commits into
a2ui-project:mainfrom
ddnn55:main

Conversation

@ddnn55

@ddnn55 ddnn55 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Description

Add image paste support to chat input. Shares existing file attachment mechanism. New test added covering image paste.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for pasting clipboard images directly into the chat panel prompt input. It adds a paste event handler, refactors file ingestion into a reusable ingestFiles method, and includes corresponding unit tests. Feedback is provided regarding the ensureFileName method, where file.name is typically always populated in modern browsers (e.g., as 'blob' or 'image.png'), rendering the current fallback check ineffective and potentially leading to duplicate filenames. A suggestion is made to detect these generic names and generate unique, timestamped filenames instead.

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

⚡ A2UI Composer PR Preview

Your automated preview is successfully live (commit 738291c):
👉 Launch PR Preview

Note: This environment will be wiped automatically when the PR is merged or closed.

}
}

if (imageFiles.length === 0 && clipboardData.files && clipboardData.files.length > 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we only do this if the loop above doesn't add anything to the imageFiles?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think in modern browsers, clipboardData.items is always a superset of clipboardData.files, in which case we don't want to add duplicates in the second loop, but in some legacy browsers, clipboardData.files may be the only way to get the data? I can either add a comment explaining, or remove the second loop.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added a comment explaining this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure what constitutes a "legacy" browser -- depending how old we're talking about, maybe just don't bother?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea i can remove it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done.

@jgindin
jgindin merged commit 94dc09e into a2ui-project:main Oct 5, 2026
11 of 13 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.

2 participants