wiris / moodle-atto_wiris

Moodle Atto's editor plugin for MathType, the leading formula editor and equation writer for the web by Wiris
https://www.wiris.com/moodle
GNU General Public License v3.0
11 stars 13 forks source link

Fix compatibility issue with the collapse plugin from Atto editor on Moodle 4 #89

Closed icaparros-at-wiris closed 2 years ago

icaparros-at-wiris commented 2 years ago

Description

When an Atto Editor is loaded, all the tool buttons that have to be hidden in the secondary toolbar are visible. The collapse button doesn't hide/unhidde the tool icons that must be collapsed, and the MathType and ChemType icon buttons doesn't open the wiris editor.

When the user clicks on MathType or ChemType tool icons, the error Uncaught ReferenceError: WirisPlugin is not defined is logged on the console.

On moodle-atto_wiris project, we call the function _setVisibility from collapse plugin. If we move this call before the wiris core is loaded, the null reference issue will be fixed.

Behat Test

Added a Behat test atto_collapseCompatibility.feature that check the compatibility with collapse plugin. The test click on the collapse icon button from the Atto editor, then click on the MathType icon button and inserts a formula. Finally, check if the formula exist.

I added the possibility to click the collapse button using the step And I press "Collapse" in "Page content" field in Atto editor, so I had to modify the function i_press_in_field_in_atto_editor($button, $field) from moodle-filter_wiris project.

How to reproduce:

  1. Open a Moodle 4.0 instance with wiris-moodle-docker
  2. Log as a Teacher
  3. Go to My courses > Test course
  4. Click on Edit Mode switch
  5. Click on Add activity or resource and add and Assignament
  6. On the Atto Editor from Description parameter click on the "Collapse" icon
  7. Click On the MathType icon
  8. On the MathType Editor add a formula and press Insert button
  9. Check if the formula is inserted on the Atto Editor.

#taskid 22246

mcagigas-at-wiris commented 2 years ago

OK! Good work