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

TinyMCE 6+7 attempts to upload mathml image

Open cdonnelly1992 opened this issue 1 year ago • 3 comments

Description

When running the integration: mathtype-tinymce6, using either tinyMCE 6 or 7: the tinyMCE editor attempts to upload the wiris formula image instead of ignoring the image.

Environment

Which version of MathType does this happen in? mathtype-tinymce6 (8.8.3 and 8.9.0)

What is the relevant software and their versions?

  • Editor (CKEditor, Froala, TinyMCE, etc.): Tinymce 6 and tinyMCE 7 (happens in both versions)

Steps to reproduce

What are the steps needed to reproduce the bug?

  • open up the mathtype editor within tinyMCE and type in whatever you want then submit the formula
  • The image is then added to tinyMCE and looks great and behaves as one would expect
  • Call tinyMCE's uploadImage and for some reason tinyMCE attempts to upload this image rather than ignore it

Expected result

What is the expected outcome of the steps above? The tinyMCE uploadImage attempts to upload nothing as there is no image that needs to be uploaded

Actual result

What is the actual outcome of the steps above? TinyMCE attempts to upload the formula image

Other details

Is there anything else to consider?

Based on reading through tinyMCE's scanForImages, it seems that you guys have a couple "easy" solutions:

  • scanForImages skips over any image that has an attribute "data-mce-bogus" or "data-mce-placeholder"
  • Another solution (my current workaround) is to add a filter to editorUpload for any image that contains the class "Wirisformula"
editor.on('init', () => {
      editor.editorUpload.addFilter((image) => {
        return image.classList.contains('Wirisformula');
      });
    });

cdonnelly1992 avatar Apr 25 '24 14:04 cdonnelly1992

Hello @cdonnelly1992, thank you for taking the time to report this!

We are currently preparing a new release and haven't had the time to look at your issue. We'll give you an answer shortly. Thank you for your understanding!

carla-at-wiris avatar May 06 '24 08:05 carla-at-wiris

Hi @cdonnelly1992, we wanted to let you know that we are still working on the issue you raised.

Additionally, we have another question: why don't you want TinyMCE to upload MathML images? The MathType editor plugin is designed to generate images corresponding to input formulas, so the behavior of the output formula is expected to be the same as regular images.

Is there any error or negative impact that leads you to not want to upload formula images?

xjiang-at-wiris avatar May 14 '24 13:05 xjiang-at-wiris

When I ask tinyMCE for the content editor.getContent(), wiris turns the image into a mathML string, which is the output I'm expecting. When I call uploadImage, tinyMCE finds the placeholder image, attempts to upload it and then adds the image ALONG with the mathML to the content. I would imagine that one of the settings given to wiris or the wiris plugin would tell it to choose between outputting the image into tinyMCE's getContent method or outputting the mathML (not both).

cdonnelly1992 avatar May 14 '24 14:05 cdonnelly1992

Hello, thank you for waiting.

After our investigation, we found that the function for uploading images, including Wiris formulas, is not a bug. As we mentioned before, they are treated as images, so we cannot rule out the possibility that other users may want to upload them.

Therefore, we currently do not plan to make changes. If you wish to skip Wiris formulas, you can add these filters to your project.

Thank you for using our service.

xjiang-at-wiris avatar May 21 '24 14:05 xjiang-at-wiris

This isn't considered a bug even though in tinyMCE 5, your plugin prevented uploading of the images using one of these same filters?

cdonnelly1992 avatar May 21 '24 14:05 cdonnelly1992

Hello, TinyMCE 5 has deprecated the images_dataimg_filter option, so we have removed this feature from the plugin in TinyMCE 6. As mentioned earlier, this change has significant implications, and we cannot guarantee that other users indeed need to upload Wiris formulas. Therefore, we currently do not plan to make changes in this regard.

We encourage you to continue customizing your upload filter in your workaround.

Thank you for your understanding.

xjiang-at-wiris avatar May 22 '24 12:05 xjiang-at-wiris