// 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);
},
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);
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)
};
}
},
+ _replaceSize: function(stack, item, index) {
+ if (!item.attributes.length || ~~item.attributes[0] === 0) {
+ return [null, null];
+ }
+
+ return ['<span style="font-size: ' + ~~item.attributes[0] + 'pt">', '</span>'];
+ },
+
_replaceUrl: function(stack, item, index) {
// ignore url bbcode without arguments
if (!item.attributes.length) {
- stack[item.pair] = '';
-
- return '';
+ return [null, null];
}
return ['<a href="' + StringUtil.escapeHTML(item.attributes[0]) + '">', '</a>'];