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

Support for Context and Watchdog features #118

Closed
guillegette opened this issue Nov 10, 2019 · 7 comments · Fixed by #178
Closed

Support for Context and Watchdog features #118

guillegette opened this issue Nov 10, 2019 · 7 comments · Fixed by #178
Assignees
Labels
bc:major squad:docs This issue should be handled by the docs squad. squad:integrations type:feature
Milestone

Comments

@guillegette
Copy link

Hi there, how do you recommend to add Watchdog to this ? Thanks!

@Mgsy
Copy link
Member

Mgsy commented Nov 12, 2019

Hello, unfortunately, Watchdog isn't supported in CKEditor 5 integrations. However, there is a feature request for it, feel free to add 👍 to the first post to bump its popularity and join the discussion.

@Mgsy Mgsy closed this as completed Nov 12, 2019
@Mgsy Mgsy added resolution:duplicate This issue is a duplicate of another issue and was merged into it. type:question labels Nov 12, 2019
@ma2ciek
Copy link
Contributor

ma2ciek commented Nov 12, 2019

Currently, there's no easy way to integrate it outside of the Angular integration, because the integration is responsible for creating and destroying the editor, so the feature must be implemented inside the integration.

@ma2ciek ma2ciek reopened this Aug 31, 2020
@ma2ciek
Copy link
Contributor

ma2ciek commented Aug 31, 2020

I'm reopening the issue to track it.

I'm trying to add support similarly to how it's done in the Angular integration:

  • Create a watchdog integration as a default option unless there're some issues with importing the Watchdog feature.
  • Add an option to pass the ContextWatchdog via the React props

@ma2ciek ma2ciek self-assigned this Aug 31, 2020
@ma2ciek ma2ciek added squad:platform Issue to be handled by the Platform team. type:feature and removed resolution:duplicate This issue is a duplicate of another issue and was merged into it. type:question labels Aug 31, 2020
@ma2ciek ma2ciek added this to the iteration 36 milestone Aug 31, 2020
@ma2ciek
Copy link
Contributor

ma2ciek commented Sep 1, 2020

I think that to not overcomplicate the implementation it'd be good to introduce some kind of adapters that could handle the <ckeditor> component <-> CKEditor5 feature glue code. I'll propose an API that should work for it.

We should handle such cases:
- EditorWatchdog
- ContextWatchdog
- Context (can be covered by the ContextWatchdog)
- Editor (can be covered by the EditorWatchdog)
 

If there will be no problem with bundling the watchdog feature to the integration I'd omit the 3rd and 4th cases.

@ma2ciek
Copy link
Contributor

ma2ciek commented Sep 1, 2020

Perhaps it could be also a good moment to address #168. I mean - we should probably restart the editor when the component's configuration changes and the watchdog feature provides a simple API to do it.

@ma2ciek ma2ciek changed the title Watchdog support Support for Context and Watchdog features Sep 17, 2020
@pomek pomek added the bc:major label Sep 18, 2020
pomek added a commit that referenced this issue Sep 18, 2020
Feature: The `<CKEditor>` component contains the built-in [watchdog](https://ckeditor.com/docs/ckeditor5/latest/features/watchdog.html) feature. Closes #118. 

Feature: Introduced the `<CKEditorContext>` component that supports the [context](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/context-and-collaboration-features.html) feature.

Feature: Added the `id` property which is used to distinguish different documents. When this property changes, the component restarts the underlying editor instead of setting data on it, which allows e.g. for switching between collaboration documents and fixes a couple of issues (e.g. the `onChange` event no longer fires during changing the document). Closes #168. Closes #169.

Feature: The `onError()` callback will be called with two arguments. The first one will be an error object (as it was before the release 3+). A second argument is an object that contains two properties:

  * `{String} phase`: `'initialization'|'runtime'` - Informs when the error has occurred (during the editor/context initialization or after the initialization).
  * `{Boolean} willEditorRestart` - When `true`, it means that the editor component will restart itself.
  * `{Boolean} willContextRestart`- When `true`, it means that the context component will restart itself.

    The `willEditorRestart` property will not appear when the error has occurred in the context feature. 
    The `willContextRestart` property will not appear when the error has occurred in the editor.

---

* _Add to the release summary:_ Both components (`<CKEditor>` and `<CKEditorContext>`) will internally use the [`Watchdog`](https://ckeditor.com/docs/ckeditor5/latest/api/module_watchdog_watchdog-Watchdog.html) class that restarts the [editor](https://ckeditor.com/docs/ckeditor5/latest/api/module_watchdog_editorwatchdog-EditorWatchdog.html) or [context](https://ckeditor.com/docs/ckeditor5/latest/api/module_watchdog_contextwatchdog-ContextWatchdog.html) when an error occurs.

* _Add to the release summary:_ The API of the entry point of the package has changed.

The previous way how the package was imported:

```js
import CKEditor from '@ckeditor/ckeditor5-react';
```

will not work with the release (3+). Use:

```js
import { CKEditor } from '@ckeditor/ckeditor5-react';
```

---

BREAKING CHANGE: The [entry point](https://github.com/ckeditor/ckeditor5-react/blob/master/src/index.js) of the package has changed. The default import was removed since the package provides more than a single component now. Use `import { CKEditor } from '@ckeditor/ckeditor5-react'` instead of `import CKEditor from '@ckeditor/ckeditor5-react';`.

BREAKING CHANGE: The `onInit` property was renamed to `onReady` and can be called multiple times (after the initialization and after the component is ready when an error occurred).
@AnnaTomanek AnnaTomanek added squad:docs This issue should be handled by the docs squad. squad:integrations and removed squad:platform Issue to be handled by the Platform team. labels Oct 27, 2020
pomek added a commit to ckeditor/ckeditor5 that referenced this issue Oct 28, 2020
Docs: Added sections about Context and Watchdog features to the React guide. Part of ckeditor/ckeditor5-react#118.
@LiamPham98
Copy link

Screen Shot 2020-12-27 at 15 55 56

Screen Shot 2020-12-27 at 15 47 44

Screen Shot 2020-12-27 at 15 47 24

Can anyone help me fix this? Thank you.

@ma2ciek
Copy link
Contributor

ma2ciek commented Dec 27, 2020

Hi @trungpham71198, could you report this bug in a separate issue? This one is already closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bc:major squad:docs This issue should be handled by the docs squad. squad:integrations type:feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants