mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
🐛 Fixed editor crashing when leaving a markdown card's edit mode
no issue - a change in Ember 3.10's rendering has resulting in the component's element being removed before the `{{gh-markdown-editor}}`'s cleanup action is run which meant that we were trying to run `.querySelector` on `undefined` - removes the code which moved toolbar elements around because it hasn't been used since we moved to Koenig, this meant that the cleanup action could also be removed
This commit is contained in:
parent
af5aeaf444
commit
c722c83a6e
@ -45,8 +45,6 @@ export default Component.extend(ShortcutsMixin, {
|
||||
_isHemingwayMode: false,
|
||||
_isUploading: false,
|
||||
_showUnsplash: false,
|
||||
_statusbar: null,
|
||||
_toolbar: null,
|
||||
_uploadedImageUrls: null,
|
||||
|
||||
// Closure actions
|
||||
@ -293,17 +291,6 @@ export default Component.extend(ShortcutsMixin, {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
this._editor.codemirror.setOption('specialChars', /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\xa0]/g);
|
||||
|
||||
// HACK: move the toolbar & status bar elements outside of the
|
||||
// editor container so that they can be aligned in fixed positions
|
||||
let container = this.element.closest('.gh-editor');
|
||||
let footer = container && container.querySelector('.gh-editor-footer');
|
||||
if (footer) {
|
||||
this._toolbar = this.element.querySelector('.editor-toolbar');
|
||||
this._statusbar = this.element.querySelector('.editor-statusbar');
|
||||
footer.appendChild(this._toolbar);
|
||||
footer.appendChild(this._statusbar);
|
||||
}
|
||||
|
||||
this._updateButtonState();
|
||||
},
|
||||
|
||||
@ -437,17 +424,6 @@ export default Component.extend(ShortcutsMixin, {
|
||||
|
||||
toggleMarkdownHelp() {
|
||||
this.toggleProperty('showMarkdownHelp');
|
||||
},
|
||||
|
||||
// put the toolbar/statusbar elements back so that SimpleMDE doesn't throw
|
||||
// errors when it tries to remove them
|
||||
destroyEditor() {
|
||||
let container = this.element.querySelector('.gh-markdown-editor-pane');
|
||||
if (container) {
|
||||
container.appendChild(this._toolbar);
|
||||
container.appendChild(this._statusbar);
|
||||
}
|
||||
this._editor = null;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -67,7 +67,6 @@ export default TextArea.extend({
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.onEditorDestroy();
|
||||
this._editor.toTextArea();
|
||||
delete this._editor;
|
||||
this._super(...arguments);
|
||||
|
@ -7,7 +7,6 @@
|
||||
onFocus=(action "updateFocusState" true)
|
||||
onBlur=(action "updateFocusState" false)
|
||||
onEditorInit=(action "setEditor")
|
||||
onEditorDestroy=(action "destroyEditor")
|
||||
options=simpleMDEOptions)
|
||||
isFullScreen=_isFullScreen
|
||||
isSplitScreen=_isSplitScreen
|
||||
|
Loading…
Reference in New Issue
Block a user