ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Typings to be optimized for Autosave (save requires DataApi/DataApiMixin) / editor.getData on the Editor type

Open mmichaelis opened this issue 3 years ago • 4 comments

📝 Provide detailed reproduction steps (if any)

  1. Configuring Autosave following the documentation:

    https://github.com/ckeditor/ckeditor5/blob/3dc1e52036bc89d488db92d3d440bb360ec1aa69/packages/ckeditor5-autosave/src/autosave.ts#L43-L48

    or:

    https://github.com/ckeditor/ckeditor5/blob/3dc1e52036bc89d488db92d3d440bb360ec1aa69/packages/ckeditor5-autosave/src/autosave.ts#L385-L403

✔️ Expected result

The example compiles successfully.

❌ Actual result

The example fails to compile editor.getData(), as Editor does not implement the required DataApi/DataApiMixin.

❓ Possible solution

Possibly extend typing of save:

https://github.com/ckeditor/ckeditor5/blob/3dc1e52036bc89d488db92d3d440bb360ec1aa69/packages/ckeditor5-autosave/src/autosave.ts#L385-L403

to, for example:

save?: ( editor: Editor & DataApi ) => Promise<unknown>;

📃 Other details

  • Browser: Chrome
  • OS: Windows
  • First affected CKEditor version: 37.0.1
  • Installed CKEditor plugins: Autosave

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

mmichaelis avatar Apr 18 '23 11:04 mmichaelis

Thanks for the report. We were just discussing this but we are still unsure of how to approach the fix. The quick workaround could be directly accessing the data controller with the editor.data.get() API.

Witoso avatar Apr 18 '23 11:04 Witoso

Thanks for the report. We were just discussing this but we are still unsure of how to approach the fix. The quick workaround could be directly accessing the data controller with the editor.data.get() API.

Would be fine for us. We just need to ensure, that we can pass the options (here: trim) - and this is part of the DataController API.

mmichaelis avatar Apr 18 '23 11:04 mmichaelis

Scope:

  • add getData and setData to the Editor class.
  • deprecate DataApiMixin.
  • create an issue to follow up with the removal of DataApiMixin.

Witoso avatar Apr 26 '23 09:04 Witoso

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

CKEditorBot avatar Aug 17 '24 01:08 CKEditorBot

We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).

CKEditorBot avatar Oct 01 '24 23:10 CKEditorBot