mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
🐛 fix broken editor at mobile sizes (#790)
closes https://github.com/TryGhost/Ghost/issues/8657 - add checks for the toolbar being present before attempting to set classes on the buttons
This commit is contained in:
parent
84b2824f95
commit
09bc15e980
1 changed files with 20 additions and 10 deletions
|
@ -231,16 +231,20 @@ export default Component.extend(ShortcutsMixin, {
|
||||||
let sideBySideButton = this._editor.toolbarElements['side-by-side'];
|
let sideBySideButton = this._editor.toolbarElements['side-by-side'];
|
||||||
let spellcheckButton = this._editor.toolbarElements.spellcheck;
|
let spellcheckButton = this._editor.toolbarElements.spellcheck;
|
||||||
|
|
||||||
if (this.get('_isSplitScreen')) {
|
if (sideBySideButton) {
|
||||||
sideBySideButton.classList.add('active');
|
if (this.get('_isSplitScreen')) {
|
||||||
} else {
|
sideBySideButton.classList.add('active');
|
||||||
sideBySideButton.classList.remove('active');
|
} else {
|
||||||
|
sideBySideButton.classList.remove('active');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._editor.codemirror.getOption('mode') === 'spell-checker') {
|
if (spellcheckButton) {
|
||||||
spellcheckButton.classList.add('active');
|
if (this._editor.codemirror.getOption('mode') === 'spell-checker') {
|
||||||
} else {
|
spellcheckButton.classList.add('active');
|
||||||
spellcheckButton.classList.remove('active');
|
} else {
|
||||||
|
spellcheckButton.classList.remove('active');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -437,10 +441,16 @@ export default Component.extend(ShortcutsMixin, {
|
||||||
preview.action(this._editor);
|
preview.action(this._editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
previewButton.classList.add('disabled');
|
if (previewButton) {
|
||||||
|
previewButton.classList.add('disabled');
|
||||||
|
}
|
||||||
|
|
||||||
run.scheduleOnce('afterRender', this, this._connectSplitPreview);
|
run.scheduleOnce('afterRender', this, this._connectSplitPreview);
|
||||||
} else {
|
} else {
|
||||||
previewButton.classList.remove('disabled');
|
if (previewButton) {
|
||||||
|
previewButton.classList.remove('disabled');
|
||||||
|
}
|
||||||
|
|
||||||
run.scheduleOnce('afterRender', this, this._disconnectSplitPreview);
|
run.scheduleOnce('afterRender', this, this._disconnectSplitPreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue