Skip to content
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

Create initial implementation #4692

Closed
ma2ciek opened this issue Jun 18, 2019 · 4 comments · Fixed by ckeditor/ckeditor5-watchdog#2
Closed

Create initial implementation #4692

ma2ciek opened this issue Jun 18, 2019 · 4 comments · Fixed by ckeditor/ckeditor5-watchdog#2
Assignees
Milestone

Comments

@ma2ciek
Copy link
Contributor

ma2ciek commented Jun 18, 2019

Overview created by @pjasiun:

  • The editor created using watchdog will be automatically observed and restarted in case of a fatal error.
  • The watchdog will save the editor data in a similar way autosave plugin do. Then, when the editor is restarted these data will be used as new initial data. Note that if the user uses RTC it should not be an issue because the editor will use data from the collaboration server anyway.
  • When the CKEditorError will occur it might be tricky to guess which editor causes the issue, the error could be thrown on the model class which knows nothing about the editor instance. However, since watchdog keeps the instance of the editor, it can recursively iterate over its own properties and check if the error is thrown on any of it.

Full usage:

const watchdog = new Watchdog();
watchdog.setCreator( ( element, config ) => ClassicEditor.create( element, config ) );
watchdog.setDestructor( editor => editor.destroy() );
		
watchdog.create( element, config );

Shortcut:

const watchdog = Watchdog.for( ClassicEditor );
watchdog.create( element, config );

Additional API:

watchdog.editor;
		
watchdog.destroy();
watchdog.restart();
		
watchdog.on( 'restart', () => { console.log( 'restarted' ); } )
@ma2ciek ma2ciek self-assigned this Jun 18, 2019
@ma2ciek
Copy link
Contributor Author

ma2ciek commented Jun 25, 2019

Should we be aware of such usage?

watchdog.create( element, config );

// Immediately called (until the editor is fully initialized):
watchdog.destory();

IMO yes, we should stack actions so the editor will be destroyed once it's created.

cc @pjasiun.

@pjasiun
Copy link

pjasiun commented Jun 25, 2019

IMO yes, we should stack actions so the editor will be destroyed once it's created.

I think the editor could support it. If the editor does not support it, then watchdog should not add such functionally (as long as there is no special reason, valid for Watchdog, but not for the editor, why Watchdog should have such functionality).

@ma2ciek
Copy link
Contributor Author

ma2ciek commented Jun 25, 2019

The watchdog has a slightly different API. Using the editor you can't do the above because you don't have access to the editor before the initialization.

@pjasiun
Copy link

pjasiun commented Jun 26, 2019

Right. Then, I think we could add such protection, but we can do it in the follow-up.

pjasiun referenced this issue in ckeditor/ckeditor5-utils Jul 2, 2019
Other: Added context as second required argument to the `CKEditorError`'s constructor, changed `isCKEditorError()` method to `is()`. Introduced the `areConnectedThroughProperties()` utility Part of the ckeditor/ckeditor5-watchdog#1.
pjasiun referenced this issue in ckeditor/ckeditor5-watchdog Jul 2, 2019
Feature: Introduce Watchdog. Closes #1.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-watchdog Oct 9, 2019
@mlewand mlewand added this to the iteration 25 milestone Oct 9, 2019
zadam added a commit to zadam/trilium-ckeditor5 that referenced this issue Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants