diff --git a/frappe/hooks.py b/frappe/hooks.py index d95e793f1a..9d7cd27c7a 100644 --- a/frappe/hooks.py +++ b/frappe/hooks.py @@ -12,7 +12,7 @@ source_link = "https://github.com/frappe/frappe" app_license = "MIT" develop_version = '12.x.x-develop' -staging_version = '11.0.3-beta.35' +staging_version = '11.0.3-beta.36' app_email = "info@frappe.io" diff --git a/frappe/patches/v11_0/delete_all_prepared_reports.py b/frappe/patches/v11_0/delete_all_prepared_reports.py index ee4b1dbd08..2204f90a8d 100644 --- a/frappe/patches/v11_0/delete_all_prepared_reports.py +++ b/frappe/patches/v11_0/delete_all_prepared_reports.py @@ -1,6 +1,7 @@ import frappe def execute(): - prepared_reports = frappe.get_all("Prepared Report") - for report in prepared_reports: - frappe.delete_doc("Prepared Report", report.name) + if frappe.db.table_exists('Prepared Report'): + prepared_reports = frappe.get_all("Prepared Report") + for report in prepared_reports: + frappe.delete_doc("Prepared Report", report.name) diff --git a/frappe/public/js/frappe/form/controls/text_editor.js b/frappe/public/js/frappe/form/controls/text_editor.js index 9e27dcf0f8..5203c57e7f 100644 --- a/frappe/public/js/frappe/form/controls/text_editor.js +++ b/frappe/public/js/frappe/form/controls/text_editor.js @@ -34,7 +34,7 @@ class HiddenBlock extends Block { } } HiddenBlock.blotName = 'hiddenblot'; -HiddenBlock.tagName = 'DIV'; +HiddenBlock.tagName = 'SPAN'; Quill.register(HiddenBlock, true); // image uploader diff --git a/frappe/public/js/frappe/form/footer/timeline.js b/frappe/public/js/frappe/form/footer/timeline.js index db1e04e5fb..da70f66016 100644 --- a/frappe/public/js/frappe/form/footer/timeline.js +++ b/frappe/public/js/frappe/form/footer/timeline.js @@ -78,10 +78,17 @@ frappe.ui.form.Timeline = class Timeline { var selector = this.frm.doctype === "Communication"? ".btn-reply-email": ".btn-new-email"; this.email_button = this.wrapper.find(selector) .on("click", function() { + const $btn = $(this); + let is_a_reply = true; + if ($btn.is('.btn-new-email')) { + is_a_reply = false; + } + var args = { doc: me.frm.doc, frm: me.frm, - recipients: me.get_recipient() + recipients: me.get_recipient(), + is_a_reply } if(me.frm.doctype === "Communication") { @@ -286,7 +293,8 @@ frappe.ui.form.Timeline = class Timeline { txt: "", title: __('Reply'), frm: me.frm, - last_email: last_email + last_email: last_email, + is_a_reply: true }); }); } @@ -336,7 +344,7 @@ frappe.ui.form.Timeline = class Timeline { }); } else { if(c.communication_type=="Communication" && c.communication_medium=="Email") { - c.content = c.content.split('
')[0]; + c.content = c.content.split('')[0]; c.content = frappe.utils.strip_original_content(c.content); c.original_content = c.content; diff --git a/frappe/public/js/frappe/views/communication.js b/frappe/public/js/frappe/views/communication.js index ec7db29b9d..46f25bc23b 100755 --- a/frappe/public/js/frappe/views/communication.js +++ b/frappe/public/js/frappe/views/communication.js @@ -498,7 +498,9 @@ frappe.views.CommunicationComposer = Class.extend({ save_as_draft: function() { if (this.dialog) { try { - localStorage.setItem(this.frm.doctype + this.frm.docname, this.dialog.get_value('content')); + let message = this.dialog.get_value('content'); + message = message.split('')[0]; + localStorage.setItem(this.frm.doctype + this.frm.docname, message); } catch (e) { // silently fail console.log(e); @@ -621,7 +623,7 @@ frappe.views.CommunicationComposer = Class.extend({ signature = signature.replace(/\n/g, "
"); } - if (this.txt) { + if(this.txt) { this.message = this.txt + (this.message ? ("

" + this.message) : ""); } else { // saved draft in localStorage @@ -636,8 +638,50 @@ frappe.views.CommunicationComposer = Class.extend({ + this.real_name + ",


" + (this.message || ""); } - var reply = (this.message || "") + (signature ? ("
" + signature) : ""); + let reply = (this.message || "") + (signature ? ("
" + signature) : ""); + let content = ''; - fields.content.set_value(reply); + if (this.is_a_reply === 'undefined') { + this.is_a_reply = true; + } + + if (this.is_a_reply) { + let last_email = this.last_email; + + if (!last_email) { + last_email = this.frm && this.frm.timeline.get_last_email(true); + } + + if (!last_email) return; + + let last_email_content = last_email.original_comment || last_email.content; + + last_email_content = last_email_content + .replace(/<meta[\s\S]*meta>/g, '') // remove tags + .replace(/<style[\s\S]*<\/style>/g, ''); // // remove