Skip to content

Commit

Permalink
Merge 896b569 into cc88556
Browse files Browse the repository at this point in the history
  • Loading branch information
pomek committed Mar 8, 2021
2 parents cc88556 + 896b569 commit de2bed8
Show file tree
Hide file tree
Showing 4 changed files with 616 additions and 413 deletions.
15 changes: 12 additions & 3 deletions src/ckeditor.jsx
Expand Up @@ -74,7 +74,7 @@ export default class CKEditor extends React.Component {

// Destroy the editor before unmouting the component.
componentWillUnmount() {
this._destroyEditor();
return this._destroyEditor();
}

// Render a <div> element which will be replaced by CKEditor.
Expand Down Expand Up @@ -157,10 +157,19 @@ export default class CKEditor extends React.Component {

/**
* Destroys the editor by destroying the watchdog.
*
* @returns {Promise}
*/
_destroyEditor() {
this.watchdog.destroy();
this.watchdog = null;
// It may happen during the tests that the watchdog instance is not assigned before destroying itself. See: #197.
if ( !this.watchdog ) {
return Promise.resolve();
}

return this.watchdog.destroy()
.then( () => {
this.watchdog = null;
} );
}

/**
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion webpack.config.js
Expand Up @@ -64,7 +64,7 @@ module.exports = {
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
options: {
compact: false,
presets: [ '@babel/preset-react' ]
}
Expand Down

0 comments on commit de2bed8

Please sign in to comment.