tinymce / tinymce-angular

Official TinyMCE Angular Component
MIT License
320 stars 92 forks source link

Set max character limit without including internal format #366

Closed jeeten-parmar closed 7 months ago

jeeten-parmar commented 8 months ago

We want to set validation of x number character while using Editor. We can count the characters directly but It also counts internal format. i.e. bold text also considers that bold tag count.

Is there anyway to set max character limit and It considers just added text?

Note: We can use Regex to remove all html tags but still we want to check if there is anyway to get it from editor.

Version TinyMCE: 6.6.2 TinyMCE-Angular 7.0.0

exalate-issue-sync[bot] commented 8 months ago

Internal Ref: INT-3248

danoaky-tiny commented 7 months ago

https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.editor/#examples-6 tinymce.activeEditor.getContent({ format: 'text' }) If you want a specific example with the Angular integration, let me know and I can make a code sandbox for you. But basically you just need to have a child reference to our Editor component, then you can use the editor getter to retrieve the underlying TinyMCE instance to then call the getContent method