From: Tyrell Cook Date: Sun, 26 Apr 2015 20:45:32 +0000 (-0400) Subject: CRM-16354 style fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c90cd6ed842aab6dcf0927ab1a52518f679eb54f;p=civicrm-core.git CRM-16354 style fixes --- diff --git a/js/Common.js b/js/Common.js index a8595fee49..1f0b3a1262 100644 --- a/js/Common.js +++ b/js/Common.js @@ -839,7 +839,7 @@ CRM.strings = CRM.strings || {}; CRM.wysiwyg.create(this); } }) - }) + }); .on('dialogopen', function(e) { var $el = $(e.target); // Modal dialogs should disable scrollbars diff --git a/js/wysiwyg/crm.ckeditor.js b/js/wysiwyg/crm.ckeditor.js index f7f86ad431..05a69d5097 100644 --- a/js/wysiwyg/crm.ckeditor.js +++ b/js/wysiwyg/crm.ckeditor.js @@ -5,7 +5,7 @@ return CKEDITOR.instances[name]; } - CRM.wysiwyg['supportsFileUploads'] = true; + CRM.wysiwyg.supportsFileUploads = true; CRM.wysiwyg.create = function(item) { //var browseUrl = CRM.config.userFrameworkResourceUrl + "packages/kcfinder/browse.php"; var browseUrl = CRM.config.userFrameworkResourceURL + "packages/kcfinder/browse.php"; diff --git a/js/wysiwyg/crm.textarea.js b/js/wysiwyg/crm.textarea.js new file mode 100644 index 0000000000..28102538a2 --- /dev/null +++ b/js/wysiwyg/crm.textarea.js @@ -0,0 +1,34 @@ +// https://civicrm.org/licensing +(function($, _) { + function openWysiwyg(item) { + $(item).show(); + $(item).next('.replace-plain').hide(); + CRM.wysiwyg.create(item); + $(item).on( 'blur', function( e ) { + CRM.wysiwyg.updateElement(item); + CRM.wysiwyg.destroy(item); + $(item).hide().next('.replace-plain').show().html($(item).val()); + }); + } + CRM.wysiwyg = {}; + CRM.wysiwyg.supportsFileUploads = false; + CRM.wysiwyg.create = _.noop; + CRM.wysiwyg.destroy = _.noop; + CRM.wysiwyg.updateElement = _.noop; + CRM.wysiwyg.val = function(item) { + return $(item).val(); + }; + CRM.wysiwyg.insertText = _.noop; + CRM.wysiwyg.insertHTML = _.noop; + CRM.wysiwyg.createPlain = function(item) { + $(item) + .hide() + .after('
'); + $(item).next('.replace-plain').click(function(){ + openWysiwyg(item); + }); + $(item).next('.replace-plain').keypress(function(){ + openWysiwyg(item); + }); + }; +})(CRM.$, CRM._);