});
}
- ck.on('pasteState', function () {
- scope.$apply(function () {
+ // CRM-16445 - When one inserts an image, none of these events seem to fire at the right time:
+ // afterCommandExec, afterInsertHtml, afterPaste, afterSetData, change, insertElement,
+ // insertHtml, insertText, pasteState. It seems that 'pasteState' is the general equivalent of
+ // what 'change' should be, except (in the case of image insertion) it fires too soon.
+ ck.on('pasteState', function(evt) {
+ $timeout(function() {
ngModel.$setViewValue(ck.getData());
- });
- });
-
- ck.on('insertText', function () {
- $timeout(function () {
- ngModel.$setViewValue(ck.getData());
- });
+ }, 50);
});
ngModel.$render = function (value) {