-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] Clipboard: support images in the clipboard #5098
base: master
Are you sure you want to change the base?
Conversation
9695adc
to
ad869b0
Compare
13e3841
to
405eb7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boup boup
405eb7c
to
4a8361d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm submitting my pending un-finished review now because apparently, I'm off this afternoon and I didn't know.
I must admit I was originally skeptical on the usefulness/cost ratio of this feature. But having tried it, I now find it really cool 😊
const file = await this.getImageFromUser(); | ||
const file = await this.userImageUpload(); | ||
if (file.size > MAX_FILE_SIZE) { | ||
throw new ImageImportError(_t("The file you are trying to upload is too large (> 5 mB)")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, IMO this kind of limitation is the worst possible user experience. Whenever I'm faced with this I rage-quit half of the time, rather than finding a shitty tool to reduce the image size.
I prefer if it works but it's slow rather than not working at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, it might not be useful at upload. The filestore implementation might reject files too big but it can be taken care of at that moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=> removed the upload limitation
image.src = imageUrl; | ||
image.addEventListener("load", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably doesn't matter in practice, but should the event listener be attached before setting src
? If somehow image.src = imageUrl;
is instant and synchronous, the event handler would never be called
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just couldn't make it work without that, i might have missed something...
f3e07a4
to
22ca025
Compare
d53c87b
to
2c70940
Compare
This commit adds the support of images in the clipboard. This allows the user to insert images from their OS faster than going through the "insert" menu and also to extract charts/images from the spreadsheet to use it in other applications (word, powerpoint, discuss apps, ...). Features: - Png images will be pasted to the clipboard instantly on "copy" - Charts can be added to the clipboard via a menu button "copy as image" - Pasting an image from the OS will add it to the spreadsheet as an image and place it in the current sheet. - Both images and charts can be downloaded as images by the user via the figure menu Limitations: - Charts will not be added to the clipboard directly as it can mislead users when using cross-sheet copy/paste. Namely, it would add the chart as an image on paste and not as a chart. - non-png images need to be converted as png to be added in the clipboard and this operation can be quite slow. We add a limit of 5mb image. Past that point, the image is not copied to the clipboard in order to avoid slowing down the user experience. Task: 4235104
8cd390d
to
b377210
Compare
Description:
This commit adds the support of images in the clipboard. Namely,
the filestore and dispatch a CREATE_IMAGE accordingly.
oOS clipboard. It can then be pasted somewhere else, like a discuss
app, a text editor maybe?.
TODO
because we never check agains the actual type of the file we upload
but it's wrong. Maybe use a generic
image/*
mimetype instead of usingpng. We still need to purge out dangerous mimetypes like image/svg(+xml)
we are copy pasting from the same spreadsheet clipboard (potential
useless upload)
clipboard has some text/* types along the image/* so it ignores the
later. for a fully integrated feature, we should probably decorrelate it
from the standard copy paste and make a menu "copy image to os
clipboard" ? tbd
Task: 4235104
review checklist