angular-ui / ui-tinymce

AngularUI wrapper for TinyMCE
MIT License
488 stars 371 forks source link

Doesn't work if ID exists in TEXTAREA tag #332

Open chrispcb opened 7 years ago

chrispcb commented 7 years ago

Ex:

<label for="text">Message</label>
<textarea ui-tinymce ng-model="mymodel" name="text" id="text"></textarea>

Fixe:

if (!attrs.id) {
    var uniqueId = uiTinymceService.getUniqueId();
    attrs.$set('id', uniqueId);
}
DarkIsDude commented 7 years ago

Hi,

I don't contribute to this project but in README: Be sure not to set an id attribute. This is because the directive needs to maintain selector knowledge in order to handle buggy behavior in TinyMCE when DOM manipulation is involved, such as in a reordering of HTML through ng-repeat or DOM destruction/recreation through ng-if. Maybe more complicated?