fix(core): Notify sgCkeditor component when clicking the send button to update content. Fixes #5952.

This commit is contained in:
smizrahi
2024-04-29 22:21:33 +02:00
parent 9b5a8cb6fc
commit c2d9050539
2 changed files with 11 additions and 13 deletions
@@ -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);
@@ -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();
});