From: Tim Otten Date: Mon, 18 May 2015 21:28:56 +0000 (-0700) Subject: CRM-16445 - crmUiRichtext - Fix image insertion. Wait 50ms. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5ced105e4805cf2ff68c077e4ca7f2603c0c9799;p=civicrm-core.git CRM-16445 - crmUiRichtext - Fix image insertion. Wait 50ms. --- diff --git a/ang/crmUi.js b/ang/crmUi.js index 312e921cdd..0c571c691d 100644 --- a/ang/crmUi.js +++ b/ang/crmUi.js @@ -418,16 +418,14 @@ }); } - 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) {