Skip to content

Conversation

carla-at-wiris
Copy link
Contributor

@carla-at-wiris carla-at-wiris commented Sep 15, 2025

Description

When MathType and TextPartLanguage plugins are included in the same build, the use of the MathType plugin will result in an error. There's a conflict on the Wiris end and regarding the getLanguage() method.

This PR fixes the conflict by returning the editor's UI language when faced with a language object without the ui property.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project ( Run yarn lint to check)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • New and existing unit tests pass locally with my changes

How should be tested?

  1. Add the TextPartLanguage plugin to the CKEditor5 HTML demo. Check the documentation for guidance.
  2. Insert or modify a formula via MathType

@carla-at-wiris carla-at-wiris self-assigned this Sep 15, 2025
@carla-at-wiris carla-at-wiris added type:bug Something isn't working package:ckeditor5 Issues involving the plugin for CKEditor 5 labels Sep 15, 2025
@xjiang-at-wiris
Copy link
Contributor

image Works perfectly!

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a compatibility issue between MathType and TextPartLanguage plugins in CKEditor5 by resolving a conflict in the getLanguage() method. When these plugins are used together, the MathType plugin encounters an error due to how language objects are handled.

Key changes:

  • Replaces direct property access with safer Object.prototype.hasOwnProperty.call() method
  • Returns editor's UI language when language object lacks the ui property instead of returning the entire object

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:ckeditor5 Issues involving the plugin for CKEditor 5 type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants