From bf6654074ee1d4ed2464b625684496aac479f4d4 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 21 Nov 2013 16:16:22 +0100 Subject: Ported THtmlArea --- framework/Web/Javascripts/packages.php | 2 +- .../Javascripts/source/prado/controls/htmlarea.js | 32 ++++++++++------------ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/framework/Web/Javascripts/packages.php b/framework/Web/Javascripts/packages.php index edd250f1..cc851b15 100644 --- a/framework/Web/Javascripts/packages.php +++ b/framework/Web/Javascripts/packages.php @@ -118,13 +118,13 @@ $dependencies = array( 'datepicker' => array('jquery', 'prado', 'datepicker'), 'activedatepicker' => array('jquery', 'prado', 'datepicker', 'ajax', 'activedatepicker'), 'colorpicker' => array('jquery', 'prado', 'colorpicker'), + 'htmlarea' => array('jquery', 'prado', 'htmlarea'), /* 'dragdrop' => array('prototype', 'prado', 'effects', 'ajax', 'dragdrop'), 'slider' => array('prototype', 'prado', 'slider'), 'keyboard' => array('prototype', 'prado', 'keyboard'), 'dragdropextra' => array('prototype', 'prado', 'effects', 'ajax', 'dragdrop','dragdropextra'), 'accordion' => array('prototype', 'prado', 'effects', 'accordion'), - 'htmlarea' => array('prototype', 'prado', 'htmlarea'), 'htmlarea4' => array('prototype', 'prado', 'htmlarea4'), 'ratings' => array('prototype', 'prado', 'effects', 'ajax', 'ratings'), 'inlineeditor' => array('prototype', 'prado', 'effects', 'ajax', 'inlineeditor'), diff --git a/framework/Web/Javascripts/source/prado/controls/htmlarea.js b/framework/Web/Javascripts/source/prado/controls/htmlarea.js index a425e697..819e853c 100644 --- a/framework/Web/Javascripts/source/prado/controls/htmlarea.js +++ b/framework/Web/Javascripts/source/prado/controls/htmlarea.js @@ -20,19 +20,13 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, { this.options = options; - var obj = this; - this.ajaxresponder = { - onComplete : function(request) - { - if(request && (request instanceof Prado.AjaxRequest)) - obj.checkInstance(); - } - }; this.registerAjaxHook(); this.registerInstance(); }, + + registerInstance: function() { if (typeof tinyMCE_GZ == 'undefined') @@ -74,7 +68,7 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, Prado.WebUI.THtmlArea.tinyMCELoadState = 255; var wrapper; while(Prado.WebUI.THtmlArea.pendingRegistrations.length>0) - if (wrapper = Prado.Registry.get(Prado.WebUI.THtmlArea.pendingRegistrations.pop())) + if (wrapper = Prado.Registry[Prado.WebUI.THtmlArea.pendingRegistrations.pop()]) wrapper.initInstance(); }, @@ -103,17 +97,19 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, registerAjaxHook: function() { - if (typeof(Ajax)!="undefined") - if (typeof(Ajax.Responders)!="undefined") - Ajax.Responders.register(this.ajaxresponder); + jQuery(document).on('ajaxComplete', this.ajaxresponder.bind(this)); }, deRegisterAjaxHook: function() { - if (typeof(Ajax)!="undefined") - if (typeof(Ajax.Responders)!="undefined") - Ajax.Responders.unregister(this.ajaxresponder); + jQuery(document).off('ajaxComplete', this.ajaxresponder.bind(this)); + }, + + ajaxresponder: function(request) + { + if(request && (request instanceof Prado.AjaxRequest)) + obj.checkInstance(); }, onDone: function() @@ -126,9 +122,9 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, tinyMCE.execCommand('mceFocus', false, this.ID); // when removed, tinyMCE restores its content to the textarea. If the textarea content has been // updated in this same callback, it will be overwritten with the old content. Workaround this. - var curtext = $(this.ID).value; + var curtext = $('#'+this.ID).get(0).value; tinyMCE.execCommand('mceRemoveControl', false, this.ID); - $(this.ID).value = curtext; + $('#'+this.ID).get(0).value = curtext; } catch (e) { @@ -143,7 +139,7 @@ Prado.WebUI.THtmlArea = jQuery.klass(Prado.WebUI.Control, } }); -Object.extend(Prado.WebUI.THtmlArea, +jQuery.extend(Prado.WebUI.THtmlArea, { pendingRegistrations : [], tinyMCELoadState : 0 -- cgit v1.2.3