-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hotfix/issue1133 selection shortcut removed on editor destroy #1140
Changes from 1 commit
f780139
09973b6
a9a97cc
7d3a29f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import '@babel/register'; | |
|
||
import 'components/polyfills'; | ||
import Core from './components/core'; | ||
import * as _ from './components/utils'; | ||
|
||
declare const VERSION: string; | ||
|
||
|
@@ -81,9 +82,14 @@ export default class EditorJS { | |
public exportAPI(editor: Core): void { | ||
const fieldsToExport = [ 'configuration' ]; | ||
const destroy = (): void => { | ||
editor.moduleInstances.Listeners.removeAll(); | ||
editor.moduleInstances.UI.destroy(); | ||
editor.moduleInstances.ModificationsObserver.destroy(); | ||
for(const moduleName in editor.moduleInstances) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No specific reason. Object.values looks cleaner. Will change. |
||
if (Object.prototype.hasOwnProperty.call(editor.moduleInstances, moduleName)) { | ||
const moduleInstance = editor.moduleInstances[moduleName]; | ||
if(moduleInstance.destroy && _.isFunction(moduleInstance.destroy)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its better to add check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will remove the 'moduleInstance.destroy' check from the if condition. Is a separate check in isFunction required? I can leave the isFunction code as it is and the typeof check should take care even if I pass undefined? |
||
moduleInstance.destroy(); | ||
} | ||
} | ||
} | ||
editor = null; | ||
|
||
for (const field in this) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.18 is not released yet, so you can include patch to 2.18 instead of bumping patch version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok