[BUGFIX] Indent/outdent does not work if formatblock button is disabled
authorStanislas Rolland <typo3@sjbr.ca>
Sun, 14 Aug 2011 15:41:25 +0000 (11:41 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 16 Aug 2011 19:53:14 +0000 (21:53 +0200)
Problem: If the "formatblock" button is disabled, the current paragraph
gets a css class "indent" but a wrapping div is not created with that
css class.

Solution: When formatblock is not configured, allow all standard block
elements. When formatblock and indent are both configured, ensure div is
allowed.

Change-Id: Ib5d3087198904bb86a4901c57f5e0f2292f4b36e
Resolves: #28903
Releases: 4.5, 4.6
Reviewed-on: http://review.typo3.org/4321
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/extensions/BlockElements/class.tx_rtehtmlarea_blockelements.php
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js

index 3702c6c..121d1a6 100644 (file)
@@ -134,6 +134,14 @@ class tx_rtehtmlarea_blockelements extends tx_rtehtmlarea_api {
                        if (!in_array('*', $restrictTo)) {
                                $blockElementsOrder = array_intersect($blockElementsOrder, $restrictTo);
                        }
+                               // Add div element if indent is configured in the toolbar
+                       if (in_array('indent', $this->toolbar) || in_array('outdent', $this->toolbar)) {
+                               $blockElementsOrder = array_merge($blockElementsOrder, array('div'));
+                       }
+                               // Add blockquote element if blockquote is configured in the toolbar
+                       if (in_array('blockquote', $this->toolbar)) {
+                               $blockElementsOrder = array_merge($blockElementsOrder, array('blockquote'));
+                       }
                                // Localizing the options
                        $blockElementsOptions = array();
                        if ($this->htmlAreaRTE->cleanList($this->thisConfig['hidePStyleItems']) != '*') {
index a5f8b30..fae614f 100644 (file)
@@ -146,7 +146,11 @@ HTMLArea.BlockElements = HTMLArea.Plugin.extend({
                        }
                });
                this.allowedBlockElements = new RegExp( "^(" + blockElements.join("|") + ")$", "i");
-
+               if (blockElements.length) {
+                       this.allowedBlockElements = new RegExp( "^(" + blockElements.join("|") + ")$", "i");
+               } else {
+                       this.allowedBlockElements = this.standardBlockElements;
+               }
                /*
                 * Registering hot keys for the dropdown list items
                 */