From ede7390a732a61b0e7770ced7200e9a4fe0ce81d Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Wed, 12 Apr 2017 15:23:07 +0530 Subject: [PATCH] CRM-20418 - Not able to select Tokens from dropdown on Message Template --- js/wysiwyg/crm.wysiwyg.js | 15 ++++++++------- templates/CRM/Admin/Form/MessageTemplates.tpl | 8 ++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/js/wysiwyg/crm.wysiwyg.js b/js/wysiwyg/crm.wysiwyg.js index d61bcdea82..743fb5e363 100644 --- a/js/wysiwyg/crm.wysiwyg.js +++ b/js/wysiwyg/crm.wysiwyg.js @@ -34,14 +34,15 @@ }, // Fallback function to use when a wysiwyg has not been initialized _insertIntoTextarea: function(item, text) { - var origVal = $(item).val(); - var origPos = item[0].selectionStart; - var newVal = origVal + text; - $(item).val(newVal); + itemObj = $(item); + var origVal = itemObj.val(); + var origPos = itemObj[0].selectionStart; + var newVal = origVal.substring(0, origPos) + text + origVal.substring(origPos, origPos.length); + itemObj.val(newVal); var newPos = (origPos + text.length); - item[0].selectionStart = newPos; - item[0].selectionEnd = newPos; - $(item).triggerHandler('change'); + itemObj[0].selectionStart = newPos; + itemObj[0].selectionEnd = newPos; + itemObj.triggerHandler('change'); CRM.wysiwyg.focus(item); }, // Create a "collapsed" textarea that expands into a wysiwyg when clicked diff --git a/templates/CRM/Admin/Form/MessageTemplates.tpl b/templates/CRM/Admin/Form/MessageTemplates.tpl index 477b276f7f..2634ae8ced 100644 --- a/templates/CRM/Admin/Form/MessageTemplates.tpl +++ b/templates/CRM/Admin/Form/MessageTemplates.tpl @@ -84,7 +84,7 @@ -
+
{ts}HTML Format{/ts} {help id="id-message-text" file="CRM/Contact/Form/Task/Email.hlp"} @@ -102,7 +102,7 @@
-
+
{ts}Plain-Text Format{/ts}
@@ -165,8 +165,8 @@ }); function showHideUpload(type) { var show = (type == 1) ? false : true; - $("#msg_html").toggle(show); - $("#msg_text, #pdf_format").toggle(show); + $("#msg_html_section").toggle(show); + $("#msg_text_section, #pdf_format").toggle(show); $("#file_id").parent().parent().toggle(!show); // auto file type validation -- 2.25.1