xpra-html5 icon indicating copy to clipboard operation
xpra-html5 copied to clipboard

v11 - pasting does not work correctly for non-plain text

Open Rush-iam opened this issue 1 year ago • 1 comments

When you copy text from a browser page into a buffer - it usually includes some kind of hidden formatting.

With v11 (I upgraded from v9.1), when you press Ctrl+V such text is pasted in an Xpra Client application with all formatting HTML tags.

E.g., I copy the word Assignees from the current issue page and paste it into any application in Xpra Client with Ctrl+V and get not the word Assignees but:

<span style="color: rgb(132, 141, 151); font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, &quot;Noto Sans&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 600; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(13, 17, 23); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">Assignees</span>

Rush-iam avatar Jan 31 '24 16:01 Rush-iam

Caused by #273

Unlike most real operating systems, we have no way of knowing what mimetype the application receiving the keyboard data actually wants. I don't think that we can set both text/html and text/plain either - but it's worth a try. The short term fix will be to add a configuration option on the connect page.

totaam avatar Feb 01 '24 08:02 totaam

We can set both text/html and text/plain by providing multiple ClipboardItems and the application can then choose what it wants to use.

This will only work for browsers that implement Clipboard.write, so this would work for chrome but not Firefox < 128 or Safari, see https://github.com/Xpra-org/xpra-html5/issues/301#issuecomment-2109269862 So we should probably still allow the html5 client to specify the preferred format - and default to text/plain?

This will require a server-side change too: https://github.com/Xpra-org/xpra/issues/4228

totaam avatar May 14 '24 09:05 totaam

Now working again for text/plain which is the default again. This can be changed using the advanced options: image

totaam avatar May 14 '24 10:05 totaam

@totaam I'm on the latest version of xpra and I don't see this option. I assume it hasn't been released yet?

I will have to set the format to text/plain by default. Could you please let me know how I can set this in xpra.conf?

heinosasshallik avatar May 16 '24 12:05 heinosasshallik

@heinosasshallik text/plain will be the new default.

totaam avatar May 16 '24 12:05 totaam

I had done it wrong: #316

totaam avatar Jul 31 '24 06:07 totaam