Abhishek Kumar
Abhishek Kumar

Reputation: 2539

Tinymce- Text format not transferred through copy and paste

While working on the project, i found an issue : "When texts with certain format is copied, it should be pasted to replace the formatting of whichever line of text it will be placed in"

Steps To Reproduce

Current behavior -Underlined UNBOLDED text is also bold when paste next to bolded text.

Expected behavior -Underlined UNBOLDED text should be underlined and unbolded after paste.

Used: Tinymce version : 4.6.6

Same Thing i have tested in MS Word or any other text editor, the expected output is not same as the tinymce. So i have reported this as an issue github link

Please help Thank you.

Upvotes: 0

Views: 975

Answers (1)

Michael Fromin
Michael Fromin

Reputation: 13744

This is working as expected. When you copy text with underline applied you are copying HTML like following:

<span style="text-decoration: underline;">fadsfasdfasd</span>

If you then paste that anywhere else in your document you have that HTML within the paragraph in question such as:

<p>
  <strong>fadsfasdfasdfa
    <span style="text-decoration:underline;">fadsfasdfasd</span>
  </strong>
</p>

So the net result is the outer strong tag also impacts the pasted text. This is simply how HTML works and is the expected behavior.

Upvotes: 1

Related Questions