textAngular / textAngular

A radically powerful Text-Editor/Wysiwyg editor for Angular.js! Create multiple editor instances, two-way-bind HTML content, watch editors for changes and more!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to invoke "clear formatting" method grammatically?

AndrewEastwood opened this issue · comments

I want to invoke this methods when html is being paste to remove all unnecessary style attributes and have only paragraphs and breaks. Is that possible to achieve?

You can use ta-paste directive.
<text-angular ng-model="formatted_html" ta-paste="formatHtml($html)"></text-angular>finAnd in your controller you can define formatHtml function.

$scope.formatHtml = function(content){ return content.replace(/(style="([^"]*)")/gi, '') };