Excessive nested span tags generated when repeatedly copy-pasting text with white background color

Open
#420 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
angular, html, typescript
Domain
frontend, web-dev

Research direction

Start by reproducing the issue in the linked TinyMCE Angular example and inspect the generated HTML after repeated copy-paste operations. Done means the pasted content no longer accumulates redundant nested span tags while retaining the white background color.

Written by the indexing model from the issue text.

Description

needs: more info

Bug Description

When using TinyMCE with Angular, repeatedly copy-pasting text segments with white background color results in excessive nested <span> tags being generated in the editor content.

Steps to Reproduce

  1. Initialize TinyMCE editor in Angular application
  2. Input a paragraph of text in the editor
  3. Select all text and set background color to white
  4. Randomly select a portion of text from the middle of the paragraph
  5. Copy the selected text (Ctrl+C)
  6. Position cursor at a fixed location in the editor
  7. Paste the copied text (Ctrl+V)
  8. repeat 5-7 more times

Image

Expected Behavior

The pasted text should maintain clean HTML structure with minimal nested tags, similar to:

<p><span style="background-color: white;">Your text content</span></p>

Actual Behavior

After multiple copy-paste operations, the HTML structure becomes heavily nested with multiple <span> tags:

<p>
  <span style="background-color: white;">
    <span style="background-color: white;">
      <span style="background-color: white;">
        <span style="background-color: white;">
          Your text content
        </span>
      </span>
    </span>
  </span>
</p>

This will reproduce in your example your example

Dominant language
TypeScript
Stars
346
Forks
94
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tinymce/tinymce-angular

All issues in tinymce/tinymce-angular

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.