From: Alexander Ebert Date: Mon, 6 Jul 2015 10:54:00 +0000 (+0200) Subject: Fixed textarea height and added support for [size] X-Git-Tag: 3.0.0_Beta_1~2220 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eb6dd716cb9c139c7ec9d92e6e549172835576b3;p=GitHub%2FWoltLab%2FWCF.git Fixed textarea height and added support for [size] --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js index 7e5c6e2e7d..0f81bb4301 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js @@ -501,16 +501,19 @@ RedactorPlugins.wmonkeypatch = function() { // fixes an issue related to setSelectionRange on a hidden textarea in Firefox (NS_ERROR_FAILURE, #1984) var $mpShowCode = this.code.showCode; this.code.showCode = (function() { - var $hiddenParent = null; + var height = this.$editor.innerHeight(), hiddenParent = null; if (!this.$textarea.is(':visible')) { - $hiddenParent = this.$textarea.parentsUntil(':visible').last(); - $hiddenParent.show(); + hiddenParent = this.$textarea.parentsUntil(':visible').last(); + hiddenParent.show(); } $mpShowCode.call(this); - if ($hiddenParent !== null) { - $hiddenParent.hide(); + // jQuery's .height() seems to add the paddings + this.$textarea[0].style.setProperty('height', height + 'px'); + + if (hiddenParent !== null) { + hiddenParent.hide(); } }).bind(this); }, diff --git a/wcfsetup/install/files/js/3rdParty/redactor/redactor.js b/wcfsetup/install/files/js/3rdParty/redactor/redactor.js index 3aa3de51ea..4fccb0d3ec 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/redactor.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/redactor.js @@ -2976,6 +2976,8 @@ else { this.$textarea.height(height).show().focus(); + console.debug(height); + console.debug(this.$textarea[0].outerHTML); this.$textarea.on('keydown.redactor-textarea-indenting', this.code.textareaIndenting); $(window).scrollTop(scroll); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/BBCode/ToHtml.js b/wcfsetup/install/files/js/WoltLab/WCF/BBCode/ToHtml.js index 7d7d87af75..00f312e58b 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/BBCode/ToHtml.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/BBCode/ToHtml.js @@ -84,6 +84,7 @@ define(['Core', 'EventHandler', 'Language', 'StringUtil', 'WoltLab/WCF/BBCode/Pa email: this._replaceEmail.bind(this), list: this._replaceList.bind(this), quote: this._replaceQuote.bind(this), + size: this._replaceSize.bind(this), url: this._replaceUrl.bind(this), img: this._replaceImage.bind(this) }; @@ -439,12 +440,18 @@ define(['Core', 'EventHandler', 'Language', 'StringUtil', 'WoltLab/WCF/BBCode/Pa } }, + _replaceSize: function(stack, item, index) { + if (!item.attributes.length || ~~item.attributes[0] === 0) { + return [null, null]; + } + + return ['', '']; + }, + _replaceUrl: function(stack, item, index) { // ignore url bbcode without arguments if (!item.attributes.length) { - stack[item.pair] = ''; - - return ''; + return [null, null]; } return ['', ''];