diff options
author | ctrlaltca <> | 2012-05-28 06:56:42 +0000 |
---|---|---|
committer | ctrlaltca <> | 2012-05-28 06:56:42 +0000 |
commit | aec092c914fb4a78fbc46361839822928694aca4 (patch) | |
tree | f887b447119b9783e19cb2f157612536d1743bd1 /framework/Web/UI/WebControls/THtmlArea.php | |
parent | ac8908ea795f22e4bcf8726971919d6413a0b9e6 (diff) |
Patch for #404
Diffstat (limited to 'framework/Web/UI/WebControls/THtmlArea.php')
-rw-r--r-- | framework/Web/UI/WebControls/THtmlArea.php | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php index 22f8e5f5..b73e03d7 100644 --- a/framework/Web/UI/WebControls/THtmlArea.php +++ b/framework/Web/UI/WebControls/THtmlArea.php @@ -349,9 +349,6 @@ class THtmlArea extends TTextBox public function onPreRender($param)
{
parent::onPreRender($param);
- $this->loadJavascriptLibrary();
- if($this->getEnableCompression())
- $this->preLoadCompressedScript();
}
/**
@@ -389,31 +386,22 @@ class THtmlArea extends TTextBox return self::$_themes;
}
- protected function preLoadCompressedScript()
+ protected function getCompressionOptions()
{
- $scripts = $this->getPage()->getClientScript();
- $key = 'prado:THtmlArea:compressed';
- if(!$scripts->isBeginScriptRegistered($key))
- {
- $options['plugins'] = implode(',', $this->getAvailablePlugins());
- $options['themes'] = implode(',', $this->getAvailableThemes());
- $options['languages'] = $this->getLanguageSuffix($this->getCulture());
- $options['disk_cache'] = true;
- $options['debug'] = false;
- $js = TJavaScript::encode($options,true,true);
- $script = "if(typeof(tinyMCE_GZ)!='undefined'){ tinyMCE_GZ.init({$js}); }";
- if ($this->getPage()->getIsCallback())
- $script.= 'tinymce.dom.Event._pageInit();';
- $scripts->registerEndScript($key, $script);
- }
+ return array(
+ 'plugins' => implode(',', $this->getAvailablePlugins()),
+ 'themes' => implode(',', $this->getAvailableThemes()),
+ 'languages' => $this->getLanguageSuffix($this->getCulture()),
+ 'disk_cache' => true,
+ 'debug' => false
+ );
}
protected function loadJavascriptLibrary()
{
$scripts = $this->getPage()->getClientScript();
- if(!$scripts->isScriptFileRegistered('prado:THtmlArea'))
- $scripts->registerScriptFile('prado:THtmlArea', $this->getScriptUrl());
$scripts->registerPradoScript('htmlarea');
+ $scripts->registerScriptFile('prado:THtmlArea', $this->getScriptUrl());
}
/**
@@ -421,8 +409,15 @@ class THtmlArea extends TTextBox */
protected function registerEditorClientScript($writer)
{
+ $this->loadJavascriptLibrary();
$scripts = $this->getPage()->getClientScript();
- $options = TJavaScript::encode($this->getEditorOptions(),true,true); // Force encoding of empty strings
+ $options = array(
+ 'EditorOptions' => $this->getEditorOptions()
+ );
+ if($this->getEnableCompression())
+ $options['CompressionOptions'] = $this->getCompressionOptions();
+
+ $options = TJavaScript::encode($options,true,true);
$script = "new Prado.WebUI.THtmlArea($options)";
$scripts->registerEndScript('prado:THtmlArea'.$this->ClientID,$script);
}
|