From: Chuck Hagenbuch Date: Sat, 24 Jul 2010 20:34:23 +0000 (-0400) Subject: Take a guess at the number of rows in the note and pass it to the editor. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7937f7d0b8c560e7a297cf8c5ca8de06e3b895e1;p=horde.git Take a guess at the number of rows in the note and pass it to the editor. --- diff --git a/mnemo/lib/Ajax/Imple/EditNote.php b/mnemo/lib/Ajax/Imple/EditNote.php index bf15431e7..81ba3e1ea 100644 --- a/mnemo/lib/Ajax/Imple/EditNote.php +++ b/mnemo/lib/Ajax/Imple/EditNote.php @@ -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)); } } - } diff --git a/mnemo/lib/Block/note.php b/mnemo/lib/Block/note.php index 7ce08ae2a..baf04518e 100644 --- a/mnemo/lib/Block/note.php +++ b/mnemo/lib/Block/note.php @@ -46,8 +46,9 @@ class Horde_Block_Mnemo_note extends Horde_Block } catch (Horde_Exception_HookNotSet $e) {} $html .= $body . ''; $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; }