Xpra-org / xpra-html5

HTML5 client for Xpra
Mozilla Public License 2.0
192 stars 53 forks source link

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

Closed Rush-iam closed 2 months ago

Rush-iam commented 5 months ago

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>
totaam commented 5 months ago

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 commented 2 months ago

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 commented 2 months ago

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

heinosasshallik commented 2 months ago

@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?

totaam commented 2 months ago

@heinosasshallik text/plain will be the new default.