|
680 | 680 | // TODO: Move into fullscreen setup function (_setupFullscreen)
|
681 | 681 | _elementStates = {}
|
682 | 682 | self._goFullscreen = function (el) {
|
683 |
| - if (self.settings.autogrow) { |
684 |
| - self.getElement('editor').documentElement.style.overflow = "auto"; |
685 |
| - self.getElement('previewer').documentElement.style.overflow = "auto"; |
686 |
| - } |
| 683 | + this._fixScrollbars('auto'); |
687 | 684 |
|
688 | 685 | if (self.is('fullscreen')) {
|
689 | 686 | self._exitFullscreen(el);
|
|
783 | 780 | };
|
784 | 781 |
|
785 | 782 | self._exitFullscreen = function (el) {
|
786 |
| - if (self.settings.autogrow) { |
787 |
| - self.getElement('editor').documentElement.style.overflow = 'hidden'; |
788 |
| - self.getElement('previewer').documentElement.style.overflow = 'hidden'; |
789 |
| - } |
| 783 | + this._fixScrollbars(); |
790 | 784 |
|
791 | 785 | _saveStyleState(self.element, 'apply', _elementStates.element);
|
792 | 786 | _saveStyleState(self.iframeElement, 'apply', _elementStates.iframeElement);
|
|
1075 | 1069 | self._eeState.startup = false;
|
1076 | 1070 |
|
1077 | 1071 | if (self.settings.autogrow) {
|
1078 |
| - //prevent ugly temprorary scroll bars |
1079 |
| - self.getElement('editor').documentElement.style.overflow = 'hidden'; |
1080 |
| - self.getElement('previewer').documentElement.style.overflow = 'hidden'; |
| 1072 | + self._fixScrollbars(); |
1081 | 1073 |
|
1082 | 1074 | boundAutogrow = function () {
|
1083 | 1075 | setTimeout(function () {
|
|
1765 | 1757 | , minHeight
|
1766 | 1758 | , maxHeight
|
1767 | 1759 | , el
|
1768 |
| - , style; |
| 1760 | + , style |
| 1761 | + , maxedOut = false; |
1769 | 1762 |
|
1770 | 1763 | //autogrow in fullscreen is nonsensical
|
1771 | 1764 | if (!this.is('fullscreen')) {
|
1772 |
| - console.log('autogrow'); |
1773 | 1765 | if (this.is('edit')) {
|
1774 | 1766 | el = this.getElement('editor').documentElement;
|
1775 | 1767 | }
|
|
1798 | 1790 |
|
1799 | 1791 | if (maxHeight && newHeight > maxHeight) {
|
1800 | 1792 | newHeight = maxHeight;
|
| 1793 | + maxedOut = true; |
| 1794 | + } |
| 1795 | + |
| 1796 | + if (maxedOut) { |
| 1797 | + this._fixScrollbars('auto'); |
| 1798 | + } else { |
| 1799 | + this._fixScrollbars('hidden'); |
1801 | 1800 | }
|
1802 | 1801 |
|
1803 | 1802 | //actual resize
|
|
1812 | 1811 | }
|
1813 | 1812 | }
|
1814 | 1813 |
|
| 1814 | + /** |
| 1815 | + * Shows or hides scrollbars based on the autogrow setting |
| 1816 | + * @param {string} forceSetting a value to force the overflow to |
| 1817 | + */ |
| 1818 | + EpicEditor.prototype._fixScrollbars = function (forceSetting) { |
| 1819 | + var setting; |
| 1820 | + if (this.settings.autogrow) { |
| 1821 | + setting = 'hidden'; |
| 1822 | + } |
| 1823 | + else { |
| 1824 | + setting = 'auto'; |
| 1825 | + } |
| 1826 | + setting = forceSetting || setting; |
| 1827 | + this.getElement('editor').documentElement.style.overflow = setting; |
| 1828 | + this.getElement('previewer').documentElement.style.overflow = setting; |
| 1829 | + } |
| 1830 | + |
1815 | 1831 | EpicEditor.version = '0.2.1';
|
1816 | 1832 |
|
1817 | 1833 | // Used to store information to be shared across editors
|
|
0 commit comments