diff --git a/UI/WebServerResources/js/Common/sgCkeditor.component.js b/UI/WebServerResources/js/Common/sgCkeditor.component.js index 590db54d3f..5c57bca77c 100644 --- a/UI/WebServerResources/js/Common/sgCkeditor.component.js +++ b/UI/WebServerResources/js/Common/sgCkeditor.component.js @@ -214,7 +214,6 @@ var editorChangedTimerValue = 2000; var editorChangedTimer = null; - this.$onInit = function () { vm.ngModelCtrl.$render = function () { content = vm.ngModelCtrl.$viewValue; @@ -280,18 +279,12 @@ // Add Emoticons editor.plugins.get('SpecialCharacters').addItems('Emoji', emojis, { label: 'Emoticons' }); - - // if (vm.ckMargin) { - // // Set the margin of the iframe editable content - // vm.editor.editing.view.domRoots.get("main").style.marginTop = vm.ckMargin; - // vm.editor.editing.view.domRoots.get("main").style.marginLeft = vm.ckMargin; - // vm.editor.editing.view.domRoots.get("main").style.marginRight = vm.ckMargin; - // } - vm.editor.model.document.on('pasteState', function () { onEditorChange(false); }); - vm.editor.model.document.on('change:data', function () { onEditorChange(false); }); - vm.editor.model.document.on('paste', function () { onEditorChange(false); }); - editor.editing.view.document.on('blur', function () { onEditorChange(true); }); + vm.editor.model.document.on('pasteState', function () { vm.onEditorChange(false); }); + vm.editor.model.document.on('change:data', function () { vm.onEditorChange(false); }); + vm.editor.model.document.on('paste', function () { vm.onEditorChange(false); }); + vm.editor.editing.view.document.on('blur', function () { vm.onEditorChange(true); }); + vm.editor.component = this; onInstanceReady(); @@ -341,7 +334,7 @@ vm.editor.destroy(noUpdate); } - function onEditorChange(force) { + this.onEditorChange = function(force) { if (editorChangedTimer) clearTimeout(editorChangedTimer); diff --git a/UI/WebServerResources/js/Mailer/MessageEditorController.js b/UI/WebServerResources/js/Mailer/MessageEditorController.js index 4d9e5d2ac7..a7daf907b9 100644 --- a/UI/WebServerResources/js/Mailer/MessageEditorController.js +++ b/UI/WebServerResources/js/Mailer/MessageEditorController.js @@ -27,6 +27,7 @@ this.sendState = false; this.toggleFullscreen = toggleFullscreen; this.firstFocus = true; + this.editor = null; _initFileUploader(); @@ -251,6 +252,9 @@ }; this.send = function () { + if (this.editor && this.editor.component) + this.editor.component.onEditorChange(true); // Call onEditorChange on sgCkEditor component + this.sendState = 'sending'; if (this.autosave) $timeout.cancel(this.autosave); @@ -527,6 +531,7 @@ this.onHTMLReady = function ($editor) { if (!this.isNew()) { + this.editor = $editor; onCompletePromise().then(function() { $editor.focus(); });