tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
324 stars 93 forks source link

Angular DomSanitizer: is it possible to have an output without "styles" attributes (but with css classes)? #219

Closed luca-sacco closed 3 years ago

luca-sacco commented 3 years ago

What is the current behavior? The output received from the Form Control inserted on the <editor> component gives me a value like this:

<p style="text-align: center;">hello</p>

but wanting to respect the Angular DomSanitizer, when we do [innerHTML] the style attributes are removed. Is it possible to have as output the html with css classes instead of styles attributes? Something like this:

<p class="tiny-text-center">hello</p> ?

Or do you have any ideas of how to resolve such problem?

Versions used: tinymce/tinymce-angular: ^4.2.0,
tinymce: ^5.6.2,

jscasca commented 3 years ago

Hi @luca-sacco

You can probably achieve that by specifying the formats you want to use as classes. You can see this example: https://www.tiny.cloud/docs/configure/content-formatting/#exampleofusageoftheformatsoption

Let me know if that helps.