From bf6654074ee1d4ed2464b625684496aac479f4d4 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 21 Nov 2013 16:16:22 +0100 Subject: Ported THtmlArea --- .../Javascripts/source/prado/controls/htmlarea.js | 32 ++++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'framework/Web/Javascripts/source') 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