html-integrations icon indicating copy to clipboard operation
html-integrations copied to clipboard

[CKEditor 5] `TypeError` thrown when using MathType in combination with TextPartLanguage

Open mabryl opened this issue 1 year ago • 1 comments

Description

What does the bug consist in?

When MathType and TextPartLanguage are included in the same build, using the MathType plugin will result in the following error being thrown:

editor?lang=[object%…ersion=8.8.2.1481:1 Uncaught TypeError: language.toLowerCase is not a function
    at com.wiris.editor.EditorModel.vm2.com.wiris.editor.EditorModel.normalizeLanguage

Removing either of the plugins resolves the issue, which seems to suggest that there is some conflict between these plugins.

Environment

Which version of MathType does this happen in?

wiris/mathtype-ckeditor5": "8.8.0

What is the relevant software and their versions?

  • Editor (CKEditor, Froala, TinyMCE, etc.): CKEditor 5 v41.1.0
  • Framework (Angular, React, etc.): none
  • Browser (Chrome, Firefox, etc.): cross-browser
  • Operating System (Windows, macOS, Ubuntu, etc.): macOS Sonoma 14.3.1 (23D60)

Steps to reproduce

What are the steps needed to reproduce the bug? Please be specific.

Download ckeditor5-math-lang-test.zip and run e.g. http-server in its root directory.

Then, access the index.html file contained in the sample directory via the server.

Finally, try to insert a formula via MathType.

Expected result

No errors should appear.

Actual result

Errors thrown in the console.

Other details

Is there anything else to consider?

mabryl avatar Mar 05 '24 14:03 mabryl

Hi @mabryl, thank you for reporting this!

We indeed have an issue in how we treat the language that is creating these conflicts. We sent the issue to the next step, and you'll be informed once we release a fix for it.

In the meantime, setting a language for the MathType Editor, provides a temporary fix, here's an example:

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        ...
        mathTypeParameters: {
            editorParameters: { language: 'en' }, // MathType configuration
        },
    } )
    .then( editor => {
        ...
        window.editor = editor;
    } )
    .catch( err => {
        ...
        console.error( err.stack );
    } );

We hope this can help while we work on a permanent fix. Any further issues, please feel free to contact us

carla-at-wiris avatar Mar 07 '24 14:03 carla-at-wiris