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

[CKEditor5] New installation method can't be customized #1008

Open
mibs-pal opened this issue Sep 11, 2024 · 1 comment
Open

[CKEditor5] New installation method can't be customized #1008

mibs-pal opened this issue Sep 11, 2024 · 1 comment
Labels
type:bug Something isn't working

Comments

@mibs-pal
Copy link

mibs-pal commented Sep 11, 2024

Description

Previously it was possible to customize CKEditor5Integration since you could do something like

import MathTypePlugin from '@wiris/mathtype-ckeditor5';
import Integration from '@wiris/mathtype-ckeditor5/src/integration';

class MyIntegration extends Integration {
  insertMathml(mathml: string) {
    console.log("Custom insertMathml here")
  }
}

export default class MyPlugin extends MathTypePlugin {
  _addIntegration() {
    return new MyIntegration()
  }
}

This is not possible anymore with your new installation method (import MathType from '@wiris/mathtype-ckeditor5/dist/index.js';) because CKEditor5Integration (and other classes that are exported in the old installation method, but not in the new one) are not exported from that file.

And combining it with old installation methods doesn't work either, likely because of many reasons, one being that MathTypeCommand throws an error if CKEditor5Integration if the integration extends another class which it is, since the class in the dist version is not the same as the source version

import MathType from '@wiris/mathtype-ckeditor5/dist/index.js';
import Integration from '@wiris/mathtype-ckeditor5/src/integration';

class MyIntegration extends Integration {
  insertMathml(mathml: string) {
    // Custom handling here
  }
}

export default class MyPlugin extends CKEditor5Integration {
  _addIntegration() {
    return new MyIntegration()
  }
}

Environment

Using

"@wiris/mathtype-ckeditor5": "^8.11.0",
"@wiris/mathtype-html-integration-devkit": "^1.17.4",
"ckeditor5": "^43.1.0"

on Google Chrome, Version 128.0.6613.120 (Official Build) (arm64), MacOS 14.5

Steps to reproduce

Use the example above. In _addIntegration you can add the same code as in the original function but replace integration = new CKEditor5Integration(integrationProperties); with MyIntegration

Expected result

You should be able to use MathType and see Custom insertMathml here in the console when inserting

Actual result

Error in the console: 'Must pass a valid CKEditor5Integration instance as attribute "integration" of options'

Other details

Something like this will likely solve the issue?

export {default as CKEditor5Integration} from './integration'
// And why not export the rest too (since they are available using legacy install method and exported in the package.json file)?
export * from './commands'

in https://github.com/wiris/html-integrations/blob/4bc9bffd9a87ae2560621777f23e97994027d153/packages/ckeditor5/src/index.js

@mibs-pal mibs-pal added the type:bug Something isn't working label Sep 11, 2024
@mibs-pal mibs-pal changed the title New ckeditor5 installation method can't be customized [CKEditor5] New installation method can't be customized Sep 11, 2024
@carla-at-wiris
Copy link
Contributor

Hello @mibs-pal, thank you for writing us!

Your proposal seems possible. The team will conduct an investigation and let you know what the final solution is once it's released. Any further issues, please feel free to contact us or write an email to our support team at [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants