microsoft / roosterjs

roosterjs is a framework-independent javascript rich text editor.
Other
1.19k stars 161 forks source link

Set segmentFormat text color to black when creating the model of the clipboard content and using Keep source formatting paste type #2773

Closed BryanValverdeU closed 2 months ago

BryanValverdeU commented 2 months ago

Right now, if we paste some content in the editor and we use the Keep source formatting or normal paste type. If the default format is different that black, that color will be set to the elements that do not have any text color in the HTML.

Which causes inconsistencies with the content. To fix, if the paste type is of type normal or keep source formatting. Set the text color in the default format that is going to be used to generate the model from the clipboard content to black. That way if the element does not have a text color set we just default to black.

If the paste type is different than Keep source format, there is no need to do this, as we will merge all the format anyway.

Source image

Before image

After image

https://outlookweb.visualstudio.com/Outlook%20Web/_workitems/edit/288926/