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

Support MIME type text/html in the clipboard #3056

Open
vscfreire opened this issue May 3, 2024 · 4 comments
Open

Support MIME type text/html in the clipboard #3056

vscfreire opened this issue May 3, 2024 · 4 comments

Comments

@vscfreire
Copy link

xrdp version

0.9.25

Detailed xrdp version, build options

Paste the result between `~~~`.  Please DO NOT remove `~~~`!

Operating system & version

Rocky Linux 9

Installation method

dnf / apt / zypper / pkg / etc

Which backend do you use?

Xvnc

What desktop environment do you use?

Xfce

Environment xrdp running on

VM

What's your client?

No response

Area(s) with issue?

Clipboard

Steps to reproduce

  1. Open application in xrdp and copy formatted text (e.g. bold text, hyperlinks, font size, color/styling, etc.)
  2. Paste to local application that supports keeping source formatting (LibreOffice, Office applications, Google Docs, etc.)

And the other way around:

  1. Copy formatted text from local application;
  2. Paste to application in xrdp that should show original formatting (LibreOffice)

✔️ Expected Behavior

Text stays the same between copy and paste.

❌ Actual Behavior

Text loses all formatting when pasted.

Anything else?

No errors in the xrdp logs or the chansrv/Xvnc logs in the user home.

Included screenshot showing text copied from Firefox remotely and pasted to Word locally:
xrdp-clipboard-formatting

For what it's worth, I can copy/paste formated text if using xfreerdp connected to a Windows Server, so it seems that both X11 and the RDP protocol support storing formated text in the clipboard, it's just being lost somewhere in xrdp.

@vscfreire vscfreire added the bug label May 3, 2024
@vscfreire
Copy link
Author

Apologies if this is a known issue, couldn't find any mention of formatting when searching issues related to clipboard.

@matt335672
Copy link
Member

Welcome back @vscfreire

I imagine we don't support the particular format the text is being transferred in at the moment.

I'm on a Linux Mint machine. If I visit https://www.mozilla.org/en-US/privacy/firefox/ (as in your example above), select the first three paragraphs and copy them, I've got the following formats on the clipboard:-

$ xclip -selection clipboard -o -t TARGETS
TIMESTAMP
TARGETS
MULTIPLE
SAVE_TARGETS
text/html
text/_moz_htmlcontext
text/_moz_htmlinfo
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain
text/x-moz-url-priv

I'm guessing we need to support text/html here.

If I do the following:-

$ echo '<h1>This is a test</h1>' | xclip -selection clipboard -i -t text/html
$ xclip -selection clipboard -o -t TARGETS
TARGETS
text/html

and past into LibreOffice (same machine), I get a heading.

Can you try this on your Linux machine:-

echo '<h1>This is a test</h1>' | xclip -selection clipboard -i -t text/html

Than paste on the Windows side and see what happens?

@vscfreire
Copy link
Author

Welcome back @vscfreire

Thank you, and thanks to the entire xrdp team for your continuous hard work.

I'm guessing we need to support text/html here.

I had a cursory look at FreeRDP's clipboard code to compare, and I think it's exactly this that's missing.

Can you try this on your Linux machine:-

This is what I get when I run the commands in a Linux session in xrdp:

$ echo '<h1>This is a test</h1>' | xclip -selection clipboard -i -t text/html
$ xclip -selection clipboard -o -t TARGETS
TARGETS
TIMESTAMP
MULTIPLE
STRING
UTF8_STRING

When I paste it into LibreOffice (same machine) I get a heading.
When I paste into Office or Google Docs on Windows (client side) I get plain text "This is a test" (no headings, but the tags don't appear either).

If I try the same commands in a xfreerdp - Windows Server session, I get headings both in Linux and Windows apps.

@matt335672 matt335672 added enhancement and removed bug labels May 7, 2024
@matt335672 matt335672 changed the title Clipboard loses text formatting when copying from/to xrdp Support MIME type text/html in the clipboard May 7, 2024
@matt335672
Copy link
Member

Thanks for the confirmation @vscfreire

I've remarked this as an 'enhancement' now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants