X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.multilingual.js;h=f3af7145d4046aded1ced7c9759da94eff61df24;hb=8d400c3f0c7f67da2b935d0f2542e3af5f2f2395;hp=4de9929f0e9f65c78664f40aa108b8f72d176c70;hpb=9c41996008a0cb938cd30d8996cdec462c6a61a7;p=civicrm-core.git diff --git a/js/crm.multilingual.js b/js/crm.multilingual.js index 4de9929f0e..f3af7145d4 100644 --- a/js/crm.multilingual.js +++ b/js/crm.multilingual.js @@ -1,21 +1,27 @@ // http://civicrm.org/licensing // JS needed for multilingual installations CRM.$(function($) { - // This is largely redundant with what the CRM.popup function would do, - // with the difference that this loads unconditionally regardless of ajaxPopupsEnabled setting + // This is partially redundant with what the CRM.popup function would do, + // with a small amount of added functionality, + // and the difference that this loads unconditionally regardless of ajaxPopupsEnabled setting $('body').on('click', 'a.crm-multilingual-edit-button', function(e) { var $el = $(this), $form = $el.closest('form'), - $field = $('#' + $el.data('field'), $form); + $field = $('#' + $el.data('field'), $form), + wysiwyg = $field.hasClass('crm-form-wysiwyg'); CRM.loadForm($el.attr('href'), { dialog: {width: '50%', height: '50%'} }) + // Sync the primary language field with what the user has entered on the main form .on('crmFormLoad', function() { - $('.default-lang', this).val($field.val()); + CRM.wysiwyg.setVal($('.default-lang', this), CRM.wysiwyg.getVal($field)); + $('.default-lang', this).triggerHandler('change'); }) .on('crmFormSubmit', function() { - $field.val($('.default-lang', this).val()); + // Sync the primary language field with what the user has entered in the popup + CRM.wysiwyg.setVal($field, CRM.wysiwyg.getVal($('.default-lang', this))); + $field.triggerHandler('change'); $el.trigger('crmPopupFormSuccess'); }); e.preventDefault();