Ckeditor improvements.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 7 Jun 2010 17:50:46 +0000 (11:50 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 7 Jun 2010 19:25:02 +0000 (13:25 -0600)
Allow 'config' parameter to be a PHP array.
Disable spell check as you type.
Editor still requires Core - remove incorrect comment in package.xml.

framework/Editor/lib/Horde/Editor/Ckeditor.php
framework/Editor/package.xml

index 534fd8f..5974408 100644 (file)
@@ -21,7 +21,7 @@ class Horde_Editor_Ckeditor extends Horde_Editor
      * <pre>
      * 'basic' - (boolean) Load "basic" editor (a small javascript stub that
      *           will download the full code on demand)?
-     * 'config' - (string) The javascript config hash used to indiciate the
+     * 'config' - (array) The javascript config hash used to indiciate the
      *            config for this editor instance.
      * 'id' - (string) The ID of the text area to turn into an editor. If
      *        empty, won't automatically load the editor.
@@ -29,8 +29,12 @@ class Horde_Editor_Ckeditor extends Horde_Editor
      *               instead be stored for access via getJS().
      * </pre>
      */
-    public function __construct($params = array())
+    public function __construct(array $params = array())
     {
+        $params = array_merge(array(
+            'config' => array()
+        ), $params);
+
         parent::__construct($params);
 
         if (!$this->supportedByBrowser()) {
@@ -42,9 +46,10 @@ class Horde_Editor_Ckeditor extends Horde_Editor
             : 'ckeditor_basic.js';
         $ck_path = $GLOBALS['registry']->get('webroot', 'horde') . '/services/editor/ckeditor/';
 
-        if (empty($params['config'])) {
-            $params['config'] = '{}';
-        }
+        /* Globally disable spell check as you type. */
+        $params['config']['scayt_autoStartup'] = false;
+
+        $params['config'] = Horde_Serialize::serialize($params['config'], Horde_Serialize::JSON);
 
         if (empty($params['no_notify'])) {
             Horde::addScriptFile($ck_path . $ck_file, null, array('external' => true));
index a30503f..8e3e746 100644 (file)
@@ -30,8 +30,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <api>beta</api>
  </stability>
  <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Removed dependency on Horde_Core.
- * Removed Xinha driver.
+ <notes>* Removed Xinha driver.
  * Added CKEditor driver.
  * Initial Horde 4 package.
  </notes>
@@ -62,6 +61,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
     <channel>pear.horde.org</channel>
    </package>
    <package>
+    <name>Core</name>
+    <channel>pear.horde.org</channel>
+   </package>
+   <package>
     <name>Exception</name>
     <channel>pear.horde.org</channel>
    </package>