[BUGFIX] Avoid RTE context menu collapse to arrows only 78/50778/2
authorClaus Due <claus@namelesscoder.net>
Fri, 25 Nov 2016 11:57:44 +0000 (12:57 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 1 Dec 2016 20:53:45 +0000 (21:53 +0100)
Solves an issue in Chrome where calculating the height of
the editor window returns zero. Solved by hardcoding a
minimum context menu height of 150 pixels; applied via
Math.max()'ing the resolved height and 150.

Change-Id: Ie79507d661128f6aff31c12573b9c020b913ec8a
Resolves: #78795
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/50778
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/ContextMenu.js

index 9d0ed13..dc28cc7 100644 (file)
@@ -67,7 +67,9 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/Plugin/Plugin',
                                cls: 'htmlarea-context-menu',
                                defaultType: 'menuitem',
                                shadow: false,
-                               maxHeight: this.editor.iframe.height - this.editor.document.documentElement.clientHeight,
+                               // maxHeight is guarded against becoming less than 150px tall by hardcoded boundary. Avoids case of
+                               // zero-pixel height when calculating the editor document height fails.
+                               maxHeight: Math.max(this.editor.iframe.height - this.editor.document.documentElement.clientHeight, 150),
                                listeners: {
                                        itemClick: {
                                                fn: this.onItemClick,