Enable fullscreen mode while the editor source is active
authorAlexander Ebert <ebert@woltlab.com>
Wed, 3 Apr 2019 22:28:27 +0000 (00:28 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 3 Apr 2019 22:28:27 +0000 (00:28 +0200)
Closes #2877

wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabFullscreen.js
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabObserve.js
wcfsetup/install/files/js/3rdParty/redactor2/plugins/source.js
wcfsetup/install/files/js/3rdParty/redactor2/redactor.js
wcfsetup/install/files/style/ui/redactor.scss

index 7fe9aeaaecb5eda90cc8cf700f3e7075b69e7a30..150bfcd5ffdc6f3386684ca1f43f64b0f2801fae 100644 (file)
@@ -37,12 +37,10 @@ $.Redactor.prototype.WoltLabFullscreen = function() {
                        
                        if (this.core.box()[0].classList.toggle('redactorBoxFullscreen')) {
                                WCF.System.DisableScrolling.disable();
-                               this.core.editor()[0].style.setProperty('height', 'calc(100% - ' + ~~this.core.toolbar()[0].clientHeight + 'px)', '');
                                _active = true;
                        }
                        else {
                                WCF.System.DisableScrolling.enable();
-                               this.core.editor()[0].style.removeProperty('height');
                                _active = false;
                        }
                }
index 91d42f462e46b695b47919989ec8b8fe2197eb9f..50b4390d2fe72dd2e900a5e1a544c80a8fc50e37 100644 (file)
@@ -85,6 +85,10 @@ $.Redactor.prototype.WoltLabObserve = function() {
                                        this.button.setActive('html');
                                }
                                
+                               if (this.core.box()[0].classList.contains('redactorBoxFullscreen')) {
+                                       this.button.setActive('woltlabFullscreen');
+                               }
+                               
                                // WoltLab modification: we know that there will be quite a few
                                // active button states, so we'll simply check all ancestors one
                                // by one instead of searching the DOM over and over again
index 09496cc8796644de5fee38d46ee5c34e4d69dfb6..3b402017074c1aac1d6e1b906de4056842f841ea 100644 (file)
@@ -62,7 +62,7 @@
                                code = code.replace(/\n\n/g, '\n');
                                
                                this.core.editor().hide();
-                               this.button.disableAll('html');
+                               this.button.disableAll(['html', 'woltlabFullscreen']);
                                this.source.$textarea.val(code).height(height).addClass('open').show();
                                this.source.$textarea.on('keyup.redactor-source', $.proxy(function () {
                                        if (this.opts.type === 'textarea') {
index 74923a50f1415edce1a82d03223635247c8acd6a..a9f5d6e201ee1655d453fe7241729423445158d7 100644 (file)
                                disableAll: function (key) {
                                        var $btns = this.button.toolbar().find('a.re-button');
                                        if (typeof key !== 'undefined') {
-                                               $btns = $btns.not('.re-' + key);
+                                               if (!Array.isArray(key)) {
+                                                       key = [key];
+                                               }
+                                               
+                                               key = key.map(function(value) {
+                                                       return '.re-' + value
+                                               });
+                                               
+                                               $btns = $btns.not(key.join(','));
                                        }
                                        
                                        $btns.addClass('redactor-button-disabled').attr('aria-disabled', true);
index e83c33805f381d92be2e875fc04a946df45ff4dd..fe4add69c4bd1c839cadb4346c12659de614028e 100644 (file)
 
 .redactorBoxFullscreen {
        bottom: 0;
+       display: flex;
+       flex-direction: column;
        left: 0;
        position: fixed;
        right: 0;
        top: 0;
        z-index: 310;
        
-       .redactor-layer {
+       .redactor-toolbar-box {
+               flex: 0 auto;
+       }
+       
+       .redactor-layer,
+       .redactor-layer + textarea {
+               flex: 1 auto;
                max-height: none !important;
                min-height: 0 !important;
        }