sachinchoolur / angular-trix

A rich WYSIWYG text editor directive for angularjs.
http://sachinchoolur.github.io/angular-trix/
MIT License
328 stars 62 forks source link

Prevent model update when there is no change by user #2

Closed qqilihq closed 5 years ago

qqilihq commented 8 years ago

Currently, the model might get updated and the form set to dirty, as soon the content is loaded. This seems to happen, b/c Trix automatically inserts HTML comments <!--block-->. The issue can be seen here:

http://plnkr.co/edit/XQsKXpsH7LZ4m0XBkaR2

Click inside the Trix editor, click outside Trix editor, pristine becomes false. (when removing ng-model-options="{ updateOn: 'blur' }", the form even becomes dirty immediately after load).

This change only updates the model, once the editor has ganined user focus (the Trix modifications have already happened before that point). Result: Forms are not set dirty when there are no actual changes.