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

Copying PTE field includes "normal" #7786

Open
ninaandal opened this issue Nov 11, 2024 · 4 comments
Open

Copying PTE field includes "normal" #7786

ninaandal opened this issue Nov 11, 2024 · 4 comments

Comments

@ninaandal
Copy link
Contributor

ninaandal commented Nov 11, 2024

When using the "Copy field" option on a PTE field in the studio, it copies the text, but includes a "normal" in the copied text.

Skjermopptak.2024-11-11.kl.10.26.55.mov

To Reproduce

Steps to reproduce the behavior:

  1. Go to a PTE field
  2. Click on 'Copy field'
  3. Paste it somewhere
  4. See that ', normal' has been included

Expected behavior

Just the text being copied in the field, and not a text representation of what I assume is the text size

Which versions of Sanity are you using?

3.63.0

Which versions of Node.js / npm are you running?

10.8.2
v20.17.0
@ninaandal ninaandal changed the title Copying PTE field includes "normal" at the end Copying PTE field includes "normal" Nov 11, 2024
@christianhg
Copy link
Member

Hi @ninaandal 👋 😃

Let me look into this.

@christianhg
Copy link
Member

christianhg commented Nov 18, 2024

I don't think there's much the @portabletext/editor can do to remedy this behaviour.

If you copy a field like this:

Screenshot 2024-11-18 at 09 09 45

Then (unless I'm mistaken) all that is stored on the clipboard is:

text/plain: h1, heading 1, normal, list, 1, bullet
text/html: <meta charset="utf-8">h1, heading 1, normal, list, 1, bullet

I think, "Copy field" needs to:

  1. Clean up the data it serialises as text/plain and text/html
  2. Store application/x-portable-text as well

What do you think @sgulseth ?

@ninaandal
Copy link
Contributor Author

Hm, have I maybe misinterpreted the intention of this button? Is it not supposed to copy the content of the field, but the field data itself?

@christianhg
Copy link
Member

I think it's meant to be used in combination with "Paste field", but I also think, just copying the text into the RTE should work as well. It's probably just not a scenario that was thought of during development.

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

2 participants