froala / wysiwyg-editor

The next generation Javascript WYSIWYG HTML Editor.
https://www.froala.com/wysiwyg-editor
Other
5.28k stars 672 forks source link

Clear Formatting doesn't clear paragraph styles #3285

Closed bholtbholt closed 5 years ago

bholtbholt commented 5 years ago

Expected behavior.

When using the clear formatting tool, all inline styles are removed.

// Pasted Content from Microsoft Word
<p style="color: rgb(0, 0, 0);font-family: Helvetica;font-size: 14px;margin-bottom: 3.2pt;">
  <strong>
    <span style='font-size:14px;font-family: "Comic Sans MS";'>
      January
    </span>
  </strong>
  <span style='font-size:14px;font-family: "Comic Sans MS";'>
   &nbsp;is the first month of the year&nbsp;
  </span>
</p>
// Content after using Clear Formatting Tool
<p>
  January&nbsp;is the first month of the year&nbsp;
</p>

Actual behavior.

When inline styles are applied to a paragraph, using clear formatting doesn't remove the inline styles from the paragraph.

This commonly happens when pasting in content from Microsoft Word.

// Pasted Content
<p style="color: rgb(0, 0, 0);font-family: Helvetica;font-size: 14px;margin-bottom: 3.2pt;">
  <strong>
    <span style='font-size:14px;font-family: "Comic Sans MS";'>
      January
    </span>
  </strong>
  <span style='font-size:14px;font-family: "Comic Sans MS";'>
   &nbsp;is the first month of the year&nbsp;
  </span>
</p>
// Content after using Clear Formatting Tool
<p style="color: rgb(0, 0, 0);font-family: Helvetica;font-size: 14px;margin-bottom: 3.2pt;">
  January&nbsp;is the first month of the year&nbsp;
</p>

Steps to reproduce the problem.

OS.

Reproducible on Mac and Windows (reported from our customers). I've specifically tested on Mac OSX 10.14.3

Browser.

Chrome, Safari, Firefox, IE11, Edge

Recording.

inline-styles-in-word

gothate commented 4 years ago

This is definitely counter-intuitive behavior, was this closed accidentally the same day it was updated to be a bug?

Foozor commented 4 years ago

This bug is still present. I don't understand why it was closed.

rahul-katikineni commented 2 years ago

This seems to be working on the latest version (4.0.5). Can anyone confirm if this has been fixed?

lukaszahorec commented 2 years ago

This seems to be working on the latest version (4.0.5). Can anyone confirm if this has been fixed?

not for me :(

rahul-katikineni commented 2 years ago

This seems to be working on the latest version (4.0.5). Can anyone confirm if this has been fixed?

not for me :(

I tried it here and the inline styles are getting cleared on the <p> tag

X-Tream commented 1 year ago

This issue has reappeared when upgrading from 4.0.5 to 4.0.15

You can try it here With the following paragraph: <p style="background: rgba(178, 222, 39, 1);">background green</p>

froalaParagraphStyleClearIssue