Take a guess at the number of rows in the note and pass it to the editor.
authorChuck Hagenbuch <chuck@bluestatedigital.com>
Sat, 24 Jul 2010 20:34:23 +0000 (16:34 -0400)
committerChuck Hagenbuch <chuck@bluestatedigital.com>
Sat, 24 Jul 2010 20:34:23 +0000 (16:34 -0400)
mnemo/lib/Ajax/Imple/EditNote.php
mnemo/lib/Block/note.php

index bf15431..81ba3e1 100644 (file)
@@ -33,18 +33,19 @@ class Mnemo_Ajax_Imple_EditNote extends Horde_Core_Ajax_Imple
         $loadTextUrl = $this->_getUrl('EditNote', 'mnemo', array_merge($params, array('action' => 'load')));
         $js = array();
 
-        $js[] = "new InPlaceEditor('" . $this->_params['domid'] . "', '" . $url . "', {"
-                . "   callback: function(form, value) {"
-                . "       return 'value=' + encodeURIComponent(value);},"
-                . "   loadTextURL: '". $loadTextUrl . "',"
-                . "   rows: 4, "
-                . "   autoWidth: true,"
-                . "   emptyText: '" . _("Click to add text...") . "',"
-                . "   onComplete: function(ipe, opts) { ipe.checkEmpty() },"
-                . "   cancelText: '" . _("Cancel") . "',"
-                . "   okText: '" . _("Ok") . "',"
-                . "   cancelClassName: ''"
-                . "  });";
+        $js[] =
+            "new InPlaceEditor('" . $this->_params['domid'] . "', '" . $url . "', {"
+            . "   callback: function(form, value) {"
+            . "       return 'value=' + encodeURIComponent(value);},"
+            . "   loadTextURL: '". $loadTextUrl . "',"
+            . "   rows: " . (int)$this->_params['rows'] . ", "
+            . "   autoWidth: true,"
+            . "   emptyText: '" . _("Click to add text...") . "',"
+            . "   onComplete: function(ipe, opts) { ipe.checkEmpty() },"
+            . "   cancelText: '" . _("Cancel") . "',"
+            . "   okText: '" . _("Ok") . "',"
+            . "   cancelClassName: ''"
+            . "  });";
 
         Horde::addInlineScript($js, 'dom');
     }
@@ -80,5 +81,4 @@ class Mnemo_Ajax_Imple_EditNote extends Horde_Core_Ajax_Imple
                 array('parselevel' => Horde_Text_Filter_Text2html::MICRO));
         }
     }
-
 }
index 7ce08ae..baf0451 100644 (file)
@@ -46,8 +46,9 @@ class Horde_Block_Mnemo_note extends Horde_Block
         } catch (Horde_Exception_HookNotSet $e) {}
         $html .= $body . '</div>';
         $GLOBALS['injector']->getInstance('Horde_Ajax_Imple')->getImple(array('mnemo', 'EditNote'), array(
-            'domid' => "noteBody" . $memo['memo_id'],
-            'id' => $this->_params['note_uid']
+            'domid' => 'noteBody' . $memo['memo_id'],
+            'id' => $this->_params['note_uid'],
+            'rows' => substr_count($memo['body'], "\n"),
         ));
         return $html;
     }