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

MathType causes view-position-after-root erro being thrown when setting editor data with HTML+MathML #5765

Closed
jswiderski opened this issue Nov 20, 2019 · 2 comments
Labels
package:mathtype type:bug This issue reports a buggy (incorrect) behavior.

Comments

@jswiderski
Copy link

jswiderski commented Nov 20, 2019

📝 Provide detailed reproduction steps (if any)

  1. Create Classic CKEditor 5 with MathType plugin
  2. In HTML page insert below code and run it in a browser:
ClassicEditor.create( document.querySelector( '#editor' ) )
	.then( editor => {
		window.editor = editor;
		window.editor.setData( 
			"<p style=\"margin-top:12pt; text-align:justify\"> <math xmlns=\"http://www.w3.org/1998/Math/MathML\">  <msub>   <mrow>    <mi mathcolor=\"000000\">     P    </mi>   </mrow>   <mrow>    <mi mathvariant=\"italic\" mathcolor=\"000000\">     fs    </mi>   </mrow>  </msub> </math></p> <p style=\"margin-top:12pt; text-align:justify\">  </p>"
		 );
	} ).catch( err => {
		console.error( err.stack );
	} );

NOTE: Please also read Other details section.

✔️ Expected result

Content should be set and no error should be thrown.

❌ Actual result

Content isn't set and there is error being thrown: CKEditorError: view-position-after-root: You cannot make position after root

obraz

📃 Other details

This error gets only thrown when MathType plugin is used. If you remove the MathType from your build, editor will process pasted content without any issues.

  • Browser: Any
  • OS: Any
  • CKEditor version: 15.0.0
  • Installed CKEditor plugins: MathType

NOTES:

In the attached zip file there are files to create sample project (package.json, ckeditor.js and index.html) which helps to reproduce the problem - files.zip.

The most important is index.html sample which tries to insert below code:

<p style=\"margin-top:12pt; text-align:justify\"> <math xmlns=\"http://www.w3.org/1998/Math/MathML\">  <msub>   <mrow>    <mi mathcolor=\"000000\">     P    </mi>   </mrow>   <mrow>    <mi mathvariant=\"italic\" mathcolor=\"000000\">     fs    </mi>   </mrow>  </msub> </math></p> <p style=\"margin-top:12pt; text-align:justify\">  </p>

What is weird is that error can be prevented by making different changes to above HTML. If you remove last paragraph or spaces between > P < and > fs <, everything will work as expected.

Inside the sample index.html below the setData method you will also find original HTML (with spaces and \n characters) and slightly reduced one with removed spaces and \n characters. Both were divided into 4 lines (for better readability) where each is a paragraph. That HTML (whichever of two) when used in full also causes error however if you use a single paragraph, even the longest one with all the spaces and new line characters between tags, everything will work as expected.


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@FilipTokarski
Copy link
Member

FilipTokarski commented Jan 23, 2020

I checked it with the new release candidate of MathType&CKE5 integration and this bug seems to be fixed.
When I open the editor with this data, I get a math formula rendered correctly and no errors.

@FilipTokarski
Copy link
Member

This issue is fixed in the new MathType version 7.19.0

@mlewand mlewand removed this from the backlog milestone Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:mathtype type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

No branches or pull requests

5 participants