diff --git a/public/js/components/Messages/Details/NewMessage/Modal.js b/public/js/components/Messages/Details/NewMessage/Modal.js index ed013b0d3..eeda421e6 100644 --- a/public/js/components/Messages/Details/NewMessage/Modal.js +++ b/public/js/components/Messages/Details/NewMessage/Modal.js @@ -214,6 +214,7 @@ export default { this.replyData = result.data; if (this.replyData.length > 0) { + this.editor.setContent(this.replyData[0].replyBody); this.formData.subject = this.replyData[0].replySubject; this.formData.body = this.replyData[0].replyBody; this.formData.relationmessage_id = newMessageId; @@ -273,19 +274,6 @@ export default { }) .catch(this.$fhcAlert.handleSystemError); - - //case of reply - if(this.messageId) { - this.$api - .call(ApiMessages.getReplyData(this.messageId)) - .then(result => { - this.replyData = result.data; - this.formData.subject = this.replyData[0].replySubject; - this.formData.body = this.replyData[0].replyBody; - this.formData.relationmessage_id = this.messageId; - }) - .catch(this.$fhcAlert.handleSystemError); - } }, async mounted() { this.initTinyMCE(); diff --git a/public/js/components/Messages/Details/NewMessage/NewDiv.js b/public/js/components/Messages/Details/NewMessage/NewDiv.js index 51da7bf94..2e6ef30c5 100644 --- a/public/js/components/Messages/Details/NewMessage/NewDiv.js +++ b/public/js/components/Messages/Details/NewMessage/NewDiv.js @@ -198,6 +198,18 @@ export default { this.previewBody = this.previewText; }); }, + loadReplyData(messageId){ + this.$api + .call(ApiMessages.getReplyData(messageId)) + .then(result => { + this.replyData = result.data; + this.editor.setContent(this.replyData[0].replyBody); + this.formData.subject = this.replyData[0].replySubject; + this.formData.body = this.replyData[0].replyBody; + this.formData.relationmessage_id = messageId; + }) + .catch(this.$fhcAlert.handleSystemError); + } }, created(){ const missingparamsmsgs = []; @@ -268,15 +280,7 @@ export default { //case of reply if(this.messageId) { - this.$api - .call(ApiMessages.getReplyData(this.messageId)) - .then(result => { - this.replyData = result.data; - this.formData.subject = this.replyData[0].replySubject; - this.formData.body = this.replyData[0].replyBody; - this.formData.relationmessage_id = this.messageId; - }) - .catch(this.$fhcAlert.handleSystemError); + this.loadReplyData(this.messageId); } }, diff --git a/public/js/components/Messages/Messages.js b/public/js/components/Messages/Messages.js index e1fb69dc3..3b02c4af6 100644 --- a/public/js/components/Messages/Messages.js +++ b/public/js/components/Messages/Messages.js @@ -82,8 +82,8 @@ export default { this.$refs.modalMsg.show(); } else if (this.openMode == "inSamePage"){ - console.log("in same Page"); this.isVisibleDiv = true; + if(messageId) this.$refs.templateNewDivMessage.loadReplyData(messageId); else @@ -170,7 +170,7 @@ export default { -
+