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

Adding a math plugin results in duplicate CKEditor error. #185

Closed
tshmieldev opened this issue Nov 20, 2024 · 14 comments
Closed

Adding a math plugin results in duplicate CKEditor error. #185

tshmieldev opened this issue Nov 20, 2024 · 14 comments
Labels
issue: question Question about the plugin / Searching for help with the plugin

Comments

@tshmieldev
Copy link

// app.tsx
import '@wiris/mathtype-ckeditor5';

// ckeditor.ts

plugins: [
globalThis.Mathematics,
...

I know there are similar issues on github, I tried the advice but I still can't make it work.
I have tried this plugin, and ckeditor5-math

@nshenderov
Copy link
Owner

You encounter this error because this plugin uses a legacy import method
According to the ckeditor documentation: "This is a premium feature that is additionally payable on top of CKEditor 5 commercial license fee and delivered by our partner, Wiris."
By checking out Wiris's repo, you can find wiris/html-integrations#1041
Try the steps mentioned there or wait for them to resolve the issue.

@nshenderov nshenderov added the issue: question Question about the plugin / Searching for help with the plugin label Nov 20, 2024
@tshmieldev
Copy link
Author

I have changed the import, as suggested in the issue you referenced.
Now, I don't get that error, but when I add this to the ckeditor.ts config:
plugins: [
globalThis.MathType,
...

Strapi compiles the admin, but when I open the editor, it keeps loading indefinitely, and the console has some new errors:
image

image

@nshenderov
Copy link
Owner

Have you added it to the global object?

import MathType from '@wiris/mathtype-ckeditor5/dist/browser/index.js';
globalThis.MathType = MathType;

@tshmieldev
Copy link
Author

No, I think it is added to the globalThis just by importing (that's how I saw it being done in examples)
I have tried this approach, and:

  1. Typescript doesn't see MathType declaration (there is none I think)
  2. Now, the editor loads, but the plugin is not there. (Plugin not loaded)

@nshenderov
Copy link
Owner

I don’t see any types provided by the plugin, so of course ts doesn't see it.
What do you mean by "it's not there"? Naturally, you need to add buttons to the toolbar and address security policies since this plugin loads scripts, styles, and images.

image

@tshmieldev
Copy link
Author

I thought all I need to do is import it and pass it in plugins: []
What you have in the screenshot is exactly what I need, how did you accomplish it please

@nshenderov
Copy link
Owner

nshenderov commented Nov 20, 2024

app.tsx

import MathType from '@wiris/mathtype-ckeditor5/dist/browser/index.js';
globalThis.MathType = MathType;

ckeditor.ts

plugins: [
  globalThis.Mathematics,
  ...
],
toolbar: [
  'MathType',
  'ChemType',
  ...
]

p.s. I didn't deal with security policies, but they need to be set in order to use the plugin

@tshmieldev
Copy link
Author

Thank you so much, I get the buttons now, yet when I click them they don't do anything. I haven't added the security policies, I don't know what they should be, could you please send them here?

image

@tshmieldev
Copy link
Author

I added the correct security config. The plugin loads, the css is bugged (the popup is hidden behind sidebar etc). I think I can just handle that with some css.

I still get this error though

@tshmieldev
Copy link
Author

tshmieldev commented Nov 20, 2024

It is worse than that, the popup "works" - all the buttons in it work, you can input into it just fine, but the CKEditor field doesn't get what you input in the popup...
I also get a lot of such errors from the plugin
image

@nshenderov
Copy link
Owner

These errors aren’t related to this repository. It would be better to report them to the maintainers of the plugin.

@tshmieldev
Copy link
Author

Okay, I will, thanks

Can you confirm that it also doesn't work for you?

@nshenderov
Copy link
Owner

There is a comment in the related issue mentioning similar behavior, I just checked that plugin loads and that's it.

@tshmieldev
Copy link
Author

Okay thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: question Question about the plugin / Searching for help with the plugin
Projects
None yet
Development

No branches or pull requests

2 participants