elData(_toggleButton, 'show-on-mobile', true);
var icon = _toggleButton.children[0].children[0];
-
- _toggleButton.children[0].addEventListener('mousedown', (function (event) {
- event.preventDefault();
+ var toggle = (function (event) {
+ if (event instanceof Event) {
+ event.preventDefault();
+ }
if (this.$toolbar[0].classList.toggle('redactorToolbarOverride')) {
// this prevents mobile browser from refocusing another element
icon.classList.toggle('fa-caret-down');
icon.classList.toggle('fa-caret-up');
- }).bind(this));
+ }).bind(this);
+
+ _toggleButton.children[0].addEventListener('mousedown', toggle);
this.$toolbar[0].appendChild(_toggleButton);
+
+ WCF.System.Event.addListener('com.woltlab.wcf.redactor2', 'reset_' + this.$element[0].id, (function () {
+ if (this.$toolbar[0].classList.contains('redactorToolbarOverride')) {
+ toggle();
+ }
+ }).bind(this));
}
};
};
if ($collapsible !== undefined) {
this.options.collapsible = $collapsible;
}
+
+ var wysiwygContainerId = elData(this.element[0], 'wysiwyg-container-id');
+ if (wysiwygContainerId) {
+ WCF.System.Event.addListener('com.woltlab.wcf.redactor2', 'reset_' + wysiwygContainerId, (function () {
+ for (var i = 0, length = this._tabs.length; i < length; i++) {
+ this._tabs[i].container.removeClass('active');
+ this._tabs[i].tab.removeClass('active');
+ }
+ }).bind(this));
+ }
},
/**