Skip to content
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

[Chrome] Copy And Paste Text From Word Becomes Image #220

Open
dnguyen2111 opened this issue Jun 29, 2020 · 11 comments
Open

[Chrome] Copy And Paste Text From Word Becomes Image #220

dnguyen2111 opened this issue Jun 29, 2020 · 11 comments

Comments

@dnguyen2111
Copy link

Hello,

I notice something weird today. If you copy and paste text from a word document to the composer (not sure if that's the name) instead of pasting the text. It will get converted to an image.

Problem is reproducible on both Mac and Windows. Control/Cmd + Shift + V will fix the issue though

@clarkwinkelmann
Copy link
Member

I believe that's intended behavior. The current logic of Upload is that if the content of the clipboard can be pasted as image, it will be used as image.

When copying from a rich text software, the clipboard will actually contain multiple variations of the copied content and the webpage is able to choose between them. Here we loop through each entry of the clipboard and if any is an image, we use that:

if (items[i].type.indexOf('image') !== -1) {

We might be able to add an extra check so that if one of the entries is plain text, then we don't try to use the image. But this might actually be a behavior some people are using.

Potentially we could make this a setting in Upload "prefer pasting clipboard as image" vs "prefer pasting clipboard as text".

This option being the default probably makes more sense given we can always "paste as plain text" as you point out. If we make text the default, then there would be no way of pasting as image without going through another software.

I'm not sure what other FriendsOfFlarum members think of this potential change.

@dnguyen2111
Copy link
Author

dnguyen2111 commented Jun 29, 2020

But it's a word document with only text (and some bullet point formatting), so the fact that it became image is weird

@matteocontrini
Copy link

@clarkwinkelmann the way Telegram desktop does it is that when you paste something from an Office application it asks you the confirmation to send the image (as it always does), and if you press ESC or dismiss the modal it will paste the text instead.

Maybe it's not applicable in the context of this extension, but I wanted to give some additional perspective.

@clarkwinkelmann
Copy link
Member

@dnguyen2111 yes it's a text document but I believe it's a Word feature to copy the formatted text as image. The software in which you paste gets to choose which format they want. In this extension we assumed that if an image format is available we always want to use that, but I do realize this could be an issue with situations like these.

@matteocontrini good to know, thanks!

Unfortunately we don't have a confirmation modal at this point so this would need to be added to accommodate both options without forcing text or image.

@dnguyen2111
Copy link
Author

@clarkwinkelmann then how come it only happens in Chrome?

@clarkwinkelmann
Copy link
Member

It must have something to do with how Chrome implements the clipboard.

I won't be able to investigate this immediately because I need to spin up a VM for Office. If there's a way to replicate on Linux I'm happy to take a look in a less distant future.

@dnguyen2111
Copy link
Author

It must have something to do with how Chrome implements the clipboard.

I won't be able to investigate this immediately because I need to spin up a VM for Office. If there's a way to replicate on Linux I'm happy to take a look in a less distant future.

Maybe try using Wine?

@clarkwinkelmann
Copy link
Member

I'm unable to reproduce using the latest Office 365 and latest Chrome on a Windows 10 virtual machine.

Which Office version are you using? Does the Word document needs to contain some special kind of data?

Maybe someone else from the FoF team is able to reproduce?

@Ralkage
Copy link

Ralkage commented Jul 23, 2020

Hi @dnguyen2111, can you please verify which version of Chrome you are currently using? Luckily for you, I have an O365 account and can double down on trying to replicate this issue 👍 It would also be helpful to know if you have any Chrome extensions installed and of so, please list them if possible.

And just to verify, when you mean “copy and paste”, do you mean copy and pasting from the context menu?

It would also be helpful to know if you’re having this issue with the Word desktop application or web version so we can test more accurately 😄

@dnguyen2111
Copy link
Author

Hi @dnguyen2111, can you please verify which version of Chrome you are currently using? Luckily for you, I have an O365 account and can double down on trying to replicate this issue 👍 It would also be helpful to know if you have any Chrome extensions installed and of so, please list them if possible.

And just to verify, when you mean “copy and paste”, do you mean copy and pasting from the context menu?

It would also be helpful to know if you’re having this issue with the Word desktop application or web version so we can test more accurately 😄

Hello,
I'm using Chrome Version 84.0.4147.89. It happens both when you use Control + C , Control + V and right click -> copy -> right click -> paste. This happens to me on Word O365 Version 2006 (Build 13001.20384). I know other people ran into the same issue as well and chances are that they run a different Word version, at least one of them use Mac too.

I noticed that StackOverflow has this problem too. So maybe it's something with Chrome?

@jancha
Copy link

jancha commented Sep 18, 2023

Any update? This is very annoying. Copying to safari results in proper result.

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

No branches or pull requests

5 participants