Selaa lähdekoodia

ZF-10516: fix for FF >= 3.6 dijit.Editor submission

- Tests for <br> and strips

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23918 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 14 vuotta sitten
vanhempi
commit
b800c72cbe

+ 5 - 1
library/Zend/Dojo/View/Helper/Editor.php

@@ -185,7 +185,11 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
 function() {
     var form = zend.findParentForm(dojo.byId('$hiddenId'));
     dojo.connect(form, 'submit', function(e) {
-        dojo.byId('$hiddenId').value = dijit.byId('$editorId').getValue(false);
+        var value = dijit.byId('$editorId').getValue(false);
+        if(dojo.isFF) {
+            value = value.replace(/<br _moz_editor_bogus_node="TRUE" \/>/, '');
+        }
+        dojo.byId('$hiddenId').value = value;
     });
 }
 EOJ;

+ 1 - 1
tests/Zend/Dojo/View/Helper/EditorTest.php

@@ -147,7 +147,7 @@ class Zend_Dojo_View_Helper_EditorTest extends PHPUnit_Framework_TestCase
         $onLoadActions = $this->view->dojo()->getOnLoadActions();
         $found = false;
         foreach ($onLoadActions as $action) {
-            if (strstr($action, "dojo.byId('foo').value = dijit.byId('foo-Editor').getValue(false);")) {
+            if (strstr($action, "value = dijit.byId('foo-Editor').getValue(false);")) {
                 $found = true;
                 break;
             }