Skip to content

Commit

Permalink
No longer duplicate editor when error occurs in onReady callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed Nov 13, 2024
1 parent 94a9a43 commit 747ce3a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ckeditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,14 @@ export default class CKEditor<TEditor extends Editor> extends React.Component<Pr
afterMount: ( { mountResult } ) => {
const { onReady } = this.props;

if ( onReady && this.domContainer.current !== null ) {
if ( !onReady || this.domContainer.current === null ) {
return;
}

try {
onReady( mountResult.instance );
} catch ( err ) {
console.error( err );
}
},
unmount: async ( { element, mountResult } ) => {
Expand Down

0 comments on commit 747ce3a

Please sign in to comment.