See https://www.woltlab.com/community/thread/295811-schriftfarbe-schriftart-oder-schriftgr%C3%B6%C3%9Fe-%C3%A4ndern-auf-ipad/
$.Redactor.prototype.WoltLabColor = function() {
"use strict";
+
+ let uiRedactorFormat;
// these are hex values, but the '#' was left out for convenience
var _defaultColors = [
});
$('<li class="dropdownDivider"></li>').insertBefore(dropdownMenu.children('li').last());
+
+ require(['WoltLabSuite/Core/Ui/Redactor/Format'], (UiRedactorFormat) => {
+ uiRedactorFormat = UiRedactorFormat;
+ });
},
- setColor: function(key) {
+ setColor(key) {
key = key.replace(/^color_/, '');
+
+ if ($.browser.iOS && !this.detect.isIpad()) {
+ this.selection.restore();
+ }
- this.selection.save();
-
- require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) {
- this.buffer.set();
-
- UiRedactorFormat.format(this.$editor[0], 'color', '#' + key);
-
- this.buffer.set();
- }).bind(this));
+ this.buffer.set();
- this.selection.restore();
+ uiRedactorFormat.format(this.$editor[0], 'color', '#' + key);
},
- removeColor: function() {
- this.selection.save();
-
- require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) {
- this.buffer.set();
-
- UiRedactorFormat.removeFormat(this.$editor[0], 'color');
-
- this.buffer.set();
- }).bind(this));
+ removeColor() {
+ this.buffer.set();
- this.selection.restore();
+ uiRedactorFormat.removeFormat(this.$editor[0], 'color');
}
};
};
$.Redactor.prototype.WoltLabFont = function() {
"use strict";
+
+ let uiRedactorFormat;
return {
_fonts: [
}).bind(this));
$('<li class="dropdownDivider"></li>').insertBefore(dropdownMenu.children('li').last());
+
+ require(["WoltLabSuite/Core/Ui/Redactor/Format"], (UiRedactorFormat) => {
+ uiRedactorFormat = UiRedactorFormat;
+ });
},
- setFont: function(key) {
+ setFont(key) {
key = key.replace(/^fontFamily_/, '');
-
- this.selection.save();
-
- require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) {
- this.buffer.set();
-
- UiRedactorFormat.format(this.$editor[0], 'font-family', this.WoltLabFont._fonts[key]);
-
- this.buffer.set();
- }).bind(this));
-
- this.selection.restore();
+
+ if ($.browser.iOS && !this.detect.isIpad()) {
+ this.selection.restore();
+ }
+
+ this.buffer.set();
+
+ uiRedactorFormat.format(this.$editor[0], 'font-family', this.WoltLabFont._fonts[key]);
},
- removeFont: function() {
- this.selection.save();
-
- require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) {
- this.buffer.set();
-
- UiRedactorFormat.removeFormat(this.$editor[0], 'font-family');
-
- this.buffer.set();
- }).bind(this));
+ removeFont() {
+ this.buffer.set();
- this.selection.restore();
+ uiRedactorFormat.removeFormat(this.$editor[0], 'font-family');
}
};
};
$.Redactor.prototype.WoltLabSize = function() {
"use strict";
+
+ let uiRedactorFormat;
return {
init: function() {
});
$('<li class="dropdownDivider"></li>').insertBefore(dropdownMenu.children('li').last());
+
+ require(['WoltLabSuite/Core/Ui/Redactor/Format'], (UiRedactorFormat) => {
+ uiRedactorFormat = UiRedactorFormat;
+ });
},
- setSize: function(key) {
- this.selection.save();
-
- require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) {
- this.buffer.set();
-
- UiRedactorFormat.format(this.$editor[0], 'font-size', key.replace(/^size_/, '') + 'pt');
-
- this.buffer.set();
- }).bind(this));
+ setSize(key) {
+ this.buffer.set();
+
+ if ($.browser.iOS && !this.detect.isIpad()) {
+ this.selection.restore();
+ }
- this.selection.restore();
+ uiRedactorFormat.format(this.$editor[0], 'font-size', key.replace(/^size_/, '') + 'pt');
},
- removeSize: function() {
- this.selection.save();
-
- require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) {
- this.buffer.set();
-
- UiRedactorFormat.removeFormat(this.$editor[0], 'font-size');
-
- this.buffer.set();
- }).bind(this));
+ removeSize() {
+ this.buffer.set();
- this.selection.restore();
+ uiRedactorFormat.removeFormat(this.$editor[0], 'font-size');
}
};
};