[BUGFIX] RTE fields do not handle eval validation like required 10/44810/4
authorFrank Nägler <frank.naegler@typo3.org>
Fri, 20 Nov 2015 09:51:59 +0000 (10:51 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 20 Nov 2015 14:08:30 +0000 (15:08 +0100)
Resolves: #70246
Releases: master
Change-Id: I3e536ab85740b58e07f1b262692bf3a9773edd62
Reviewed-on: https://review.typo3.org/44810
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Build/Resources/Public/Less/TYPO3/_main_form.less
typo3/sysext/rtehtmlarea/Classes/Form/Element/RichTextElement.php
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/Editor/Editor.js
typo3/sysext/t3skin/Resources/Public/Css/backend.css

index 93cc5e2..1ecf899 100644 (file)
@@ -117,6 +117,18 @@ fieldset[disabled] .form-control {
                display: inline-block;
        }
 
+       .btn-toolbar {
+               label:before {
+                       font-family: inherit;
+                       font-size: inherit;
+                       margin-right: inherit;
+                       text-align: inherit;
+                       content: '';
+                       color: inherit;
+                       display: block;
+               }
+       }
+
        .input-group-btn {
                label {
                        border-color: @brand-danger;
@@ -421,4 +433,4 @@ textarea {
        &.formengine-textarea {
                resize: none;
        }
-}
\ No newline at end of file
+}
index f50f57a..fcb91e8 100644 (file)
@@ -344,7 +344,7 @@ class RichTextElement extends AbstractFormElement
         $result[] =    $this->getLanguageService()->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang.xlf:Please wait');
         $result[] = '</div>';
         $result[] = '<div id="editorWrap' . $this->domIdentifier . '" class="editorWrap" style="visibility: hidden; width:' . $editorWrapWidth . '; height:100%;">';
-        $result[] =    '<textarea id="RTEarea' . $this->domIdentifier . '" name="' . htmlspecialchars($itemFormElementName) . '" rows="0" cols="0" style="' . htmlspecialchars($rteDivStyle) . '">';
+        $result[] =    '<textarea ' . $this->getValidationDataAsDataAttribute($this->data['parameterArray']['fieldConf']['config']) . ' id="RTEarea' . $this->domIdentifier . '" name="' . htmlspecialchars($itemFormElementName) . '" rows="0" cols="0" style="' . htmlspecialchars($rteDivStyle) . '">';
         $result[] =        htmlspecialchars($value);
         $result[] =    '</textarea>';
         $result[] = '</div>';
index 57ac6b9..1acf5b8 100644 (file)
@@ -28,8 +28,9 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/UserAgent/UserAgent',
        'TYPO3/CMS/Rtehtmlarea/HTMLArea/Editor/Toolbar',
        'TYPO3/CMS/Rtehtmlarea/HTMLArea/Editor/Iframe',
        'TYPO3/CMS/Rtehtmlarea/HTMLArea/Editor/TextAreaContainer',
-       'TYPO3/CMS/Rtehtmlarea/HTMLArea/Editor/StatusBar'],
-       function (UserAgent, Util, Ajax, Dom, Event, Selection, BookMark, Node, Typo3, Framework, Toolbar, Iframe, TextAreaContainer, StatusBar) {
+       'TYPO3/CMS/Rtehtmlarea/HTMLArea/Editor/StatusBar',
+       'TYPO3/CMS/Backend/FormEngine'],
+       function (UserAgent, Util, Ajax, Dom, Event, Selection, BookMark, Node, Typo3, Framework, Toolbar, Iframe, TextAreaContainer, StatusBar, FormEngine) {
 
        /**
         * Editor constructor method
@@ -284,6 +285,7 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/UserAgent/UserAgent',
                 */
                Event.trigger(this, 'HtmlAreaEventEditorReady');
                this.appendToLog('HTMLArea.Editor', 'onFrameworkReady', 'Editor ready.', 'info');
+               this.onDOMSubtreeModified();
        };
 
        /**
@@ -545,6 +547,7 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/UserAgent/UserAgent',
                // Add unload handler
                var self = this;
                Event.one(this.iframe.getIframeWindow(), 'unload', function (event) { return self.onUnload(event); });
+               Event.on(this.iframe.getIframeWindow(), 'DOMSubtreeModified', function (event) { return self.onDOMSubtreeModified(event); });
        };
 
        /**
@@ -568,6 +571,16 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/UserAgent/UserAgent',
        };
 
        /**
+        *
+        * @param {Event} event
+        */
+       Editor.prototype.onDOMSubtreeModified = function(event) {
+               this.textArea.value = this.getHTML().trim();
+               FormEngine.Validation.validate();
+       };
+
+
+       /**
         * Iframe unload handler: Update the textarea for submission and cleanup
         */
        Editor.prototype.onUnload = function (event) {
index 555943b..6cfea70 100644 (file)
@@ -12219,6 +12219,15 @@ fieldset[disabled] .form-control {
   color: #c83c3c;
   display: inline-block;
 }
+.form-group.has-error .btn-toolbar label:before {
+  font-family: inherit;
+  font-size: inherit;
+  margin-right: inherit;
+  text-align: inherit;
+  content: '';
+  color: inherit;
+  display: block;
+}
 .form-group.has-error .input-group-btn label {
   border-color: #c83c3c;
 }