laughinghan / tinymce_mathquill_plugin Goto Github PK
View Code? Open in Web Editor NEWA MathQuill plugin for TinyMCE
A MathQuill plugin for TinyMCE
Hi, ive just downloaded the code to try it and it seems (according to my Chrome browser) that two files are missing:
/vendor/tinymce/jscripts/tiny_mce/plugins/mathquill/vendor/mathquill.js
/vendor/tinymce/jscripts/tiny_mce/plugins/mathquill/vendor/mathquill.css
regards
Martin
which is currently being used for rendering
Hi, I was wondering if there are any plans into adapting the plugin to make it work in the new version of TinyMCE v4 released recently? Im struggling to make it work in it.
TIA
Martin
Currently, the duplication problem we were having with asciimath can still be triggered. I can be triggered for certain by left (or right) mousing over Multiple rendered-latex images in a row. If you hit enter, it duplicates the latex, and then opens a new window. If you hit X, it only duplicates the latex once.
Part of the problem is that instead of replacing what's in the node that triggered the onNodeChange, we only replace what is currently selected, which means if we have a rendered-latex node that triggers on node change without being selected, the dialog will be populated with it's latex, but won't replace anything since nothing is selected.
We also need to better handle on node change so that we actually know the user wants to edit the math, instead of just texting if our node is the 'changing' node.
We should TinyMCE's language pack system (e.g. so that @piacentini can plug in Portuguese), but it's terribly documented, this appears to be the best plugin-developer-oriented documentation they have: http://www.tinymce.com/wiki.php/Creating_a_plugin
When you get the tinymce.html() contents the plugin transforms the image (used for preview) into mathquill-rendered-math spans. However, the opposite does not happen. So when you store the text in a database or another place and then reload the equation in the plugin, you will not see the preview images and will not be able to edit the equations (they will be loaded as mathquill-rendered-math spans in tinymce).
ASCIIMath plugin apparently toggles between AM and AMEdit spans in the preProcess method of the plugin, for reference.
"I just committed a change to enable the standard TinyMCE preview plugin button, next to MathQuill's one. Notice that in the preview we see the LaTeX image rendered. It would be very nice to be able to see the MathQuill rendered version of the math equation there instead.
I realize that this probably requires a new plugin (matquill_preview?). Internally it will probably just use the same functions we had already talked about previously (the ones that transform to/from MathQuill spans into img ones). Are these already coded somewhere? If they are, I can maybe give it a shot at duplicating/forking the preview plugin. This could be cool so editors would be able to immediately preview the whole exercise with MathQuill rendered math, as the mathtex version will probably not be accurate in all cases (alignment and size issues)."
"One thing I noticed, related to this. If you click the View Source button in the demo page (to see the HTML) notice that you get something like:
<p>Include text along with math equations like <span class="AM">`x=(-b+-sqrt(b^2-4ac))/(2a)`</span> in your documents</p>
<p>Click on the math formula to edit the AsciiMath expression used to generate it. <img class="rendered-latex" style="vertical-align: middle;" src="http://www.tabuleiro.com/cgi-bin/mathtex.cgi ?\frac{22}{2}" alt="" /></p>
<p>To edit the graph, click on the graph, then click the Graph button in the toolbar to open the control panel.</p>
<p><embed type="image/svg+xml" src="http://www.imathas.com/editordemo/jscripts/tiny_mce/plugins/asciisvg/js/d.svg " style="width: 300px; height: 200px; vertical-align: middle; float: none;" sscr="-7.5,7.5,-5,5,1,1,1,1,1,300,200,func,x^2,null,0,0,,,black,1,none"" /></p>
Compare the ASCII math area to the MathQuill one. In other words: even if the editor is rendering the IMAGES in both cases, the html returned here is the "untransformed" one for ASCIIMath span, while the MathQuill span returns the one with the image. The same is true for the preview button."
For the plugin to work, one needs to include the bundled copy of mathquill.js in the page that hosts the TinyMCE editor. Not sure if it is better/possible to include it in mathField.html if not defined (watching out for possible conflicts if one is using MathQuill in other areas of the app, perhaps?)
Repro. steps:
I assume we're being too aggressive about popping up the MathQuill editor onNodeChange
or something.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.