Skip to content

feat(clipboard): support readImage & writeImage#845

Merged
lucasfernog merged 18 commits intotauri-apps:v2from
cijiugechu:feat/clipboard-image
Mar 19, 2024
Merged

feat(clipboard): support readImage & writeImage#845
lucasfernog merged 18 commits intotauri-apps:v2from
cijiugechu:feat/clipboard-image

Conversation

@cijiugechu
Copy link
Contributor

@cijiugechu cijiugechu requested a review from a team as a code owner December 21, 2023 10:52
@cijiugechu cijiugechu changed the title feat(clipboard): support read_image & write_image feat(clipboard): support readImage & writeImage Dec 21, 2023
@lucasfernog
Copy link
Member

I wish we had 1Password/arboard#103 :(

lucasfernog
lucasfernog previously approved these changes Mar 7, 2024
@socket-security
Copy link

socket-security bot commented Mar 9, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@tauri-apps/api@2.0.0-beta.6 None 0 542 kB tauri-apps-ci-user
npm/@tauri-apps/cli@2.0.0-beta.9 filesystem, shell 0 212 kB tauri-apps-ci-user

🚮 Removed packages: npm/@tauri-apps/api@2.0.0-beta.4, npm/@tauri-apps/cli@2.0.0-beta.7

View full report↗︎

* ```
* @since 2.0.0
*/
async function readImage(): Promise<ClipboardImage<Uint8Array>> {
Copy link
Member

Choose a reason for hiding this comment

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

this should return an instance of Image from @tauri-apps/image

Copy link
Member

Choose a reason for hiding this comment

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

in this case we already have the bytes/width/height and the Image class does note expose an API to directly create an image from those values.. doesn't make much sense to send them back to the rust side...

Copy link
Member

Choose a reason for hiding this comment

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

The Image class should be constructed on the Rust side then added to the resources_table, we only return an RresourceId to JS and construct the Js Image class with it.

@lucasfernog
Copy link
Member

Just waiting on the next tauri release to push the image changes :)

@lucasfernog lucasfernog merged commit 9dec960 into tauri-apps:v2 Mar 19, 2024
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.

5 participants