From 5ced105e4805cf2ff68c077e4ca7f2603c0c9799 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 18 May 2015 14:28:56 -0700 Subject: [PATCH] CRM-16445 - crmUiRichtext - Fix image insertion. Wait 50ms. --- ang/crmUi.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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) { -- 2.25.1