Topic: Clipboard - new lines not working

meesha81 priority asked 10 months ago


Hi, you have updated clipboard since 6.3.0 to be able get new lines, but it is still not working.

\n nor br nor \r\n

I am not sure how there should be new line represented. All the time is one long line without new lines inserted to the clipboard.


Grzegorz Bujański staff answered 10 months ago


I'm not sure if I understand correctly. Check out this snippet: https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/5290048#js-tab-view. I added an event listener on copy.mdb.clipboard to display in the console what is being copied.

The first console.log shows what e returns. e.copyText holds the value that was copied. You can see there that /n has been added.

The second console log returns e.copyText. In my case it returns text correctly. The newlines are where they should be, it doesn't return it to me as one line of text.

When I paste the text that was copied to, for example, VSCode, it pastes correctly, as it was in textarea.

Have we missed something? Is it working incorrectly for you?


meesha81 priority commented 10 months ago

Hi, okey, so it is propably working only via textarea. I have some p /p

with text content and I thought that content with newlines will be copied from any element, not only from textarea. I have to create duplicate data in hidden textarea and use hidden textarea as a source for copy to clipboard...


meesha81 priority commented 10 months ago

Yes, with textarea it is working fine for me. Thank you.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.3.0
  • Device: PC
  • Browser: Chrome
  • OS: Win11
  • Provided sample code: No
  • Provided link: No