From ee0a68eddb3c63d072a1e9844522d58ea8b31757 Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Thu, 21 Jul 2011 17:22:36 +0000 Subject: added Gabor's HtmlArea registration patch (fixes #351) --- framework/Web/Javascripts/source/packages.php | 5 ++ .../Javascripts/source/prado/controls/htmlarea.js | 100 +++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 framework/Web/Javascripts/source/prado/controls/htmlarea.js (limited to 'framework/Web/Javascripts/source') diff --git a/framework/Web/Javascripts/source/packages.php b/framework/Web/Javascripts/source/packages.php index a8484820..cff913f8 100644 --- a/framework/Web/Javascripts/source/packages.php +++ b/framework/Web/Javascripts/source/packages.php @@ -78,6 +78,10 @@ $packages = array( 'prado/controls/accordion.js' ), + 'htmlarea'=>array( + 'prado/controls/htmlarea.js' + ), + ); @@ -98,6 +102,7 @@ $dependencies = array( 'activefileupload' => array('prado', 'effects', 'ajax', 'activefileupload'), 'dragdropextra' => array('prado', 'effects', 'ajax', 'dragdrop','dragdropextra'), 'accordion' => array('prado', 'effects', 'accordion'), + 'htmlarea' => array('prado', 'htmlarea'), ); return array($packages, $dependencies); diff --git a/framework/Web/Javascripts/source/prado/controls/htmlarea.js b/framework/Web/Javascripts/source/prado/controls/htmlarea.js new file mode 100644 index 00000000..5ee01c05 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/controls/htmlarea.js @@ -0,0 +1,100 @@ + +/* + * + * HtmlArea (tinyMCE) wrapper + * + * @author Gabor Berczi + * +*/ + + +Prado.WebUI.THtmlArea = Class.create(); +Prado.WebUI.THtmlArea.prototype = +{ + initialize : function(options) + { + this.onInit(options); + }, + + onInit : function(options) + { + if (typeof(tinyMCE)=='undefined') + throw "TinyMCE libraries must be loaded first"; + + this.options = options; + this.id = options.elements; + + var p = Prado.Registry.get(this.id); + if (p) p.deinitialize(); + + tinyMCE.init(options); + + Prado.Registry.set(this.id, this); + + var obj = this; + this.ajaxresponder = { + onComplete : function(request) + { + if(request && request instanceof Prado.AjaxRequest) + obj.checkInstance(); + } + }; + this.registerAjaxHook(); + }, + + checkInstance: function() + { + if (!document.getElementById(this.id)) + this.deinitialize(); + }, + + removePreviousInstance: function() + { + for(var i=0;i has been removed from DOM tree without deinitialzing the tinyMCE editor first) + } + + // doublecheck editor instance here and remove manually from tinyMCE-registry if neccessary + this.removePreviousInstance(); + + this.deRegisterAjaxHook(); + } +} + -- cgit v1.2.3