Closed
Bug 992127
Opened 11 years ago
Closed 11 years ago
Add a LaTeX-to-MathML dialog box to the mail composer
Categories
(Thunderbird :: Message Compose Window, defect)
Thunderbird
Message Compose Window
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 31.0
People
(Reporter: fredw, Assigned: fredw)
References
Details
(Keywords: user-doc-complete)
Attachments
(2 files, 3 obsolete files)
2.64 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
2.39 KB,
patch
|
Details | Diff | Splinter Review |
Follow-up of bug 986839. Per bug 986839 comment #9, this would only be porting the editorOverlay changes. So let's try it.
(In reply to neil@parkwaycc.co.uk from comment #9)
> It depends on what you mean by reusing the parser. Simply porting the
> editorOverlay changes should allow you to get the insert mathml dialog in
> Thunderbird compose for instance (it already seems to work in SeaMonkey
> message compose), so if somewhere under editor sounds reasonable, perhaps
> editor/texzilla/ or editor/ui/texzilla/content/ could work.
Assignee | ||
Comment 1•11 years ago
|
||
This patch applies on top of the one from bug 986839.
It seems that I have to explicitly mention TeXZilla.js in the jar.mn. I don't know if there is a better way to do that.
Note: as indicated on bug 986839, opening the math dialog might be very slow in debug mode.
Attachment #8401758 -
Flags: feedback?(mconley)
Comment 2•11 years ago
|
||
(In reply to Frédéric Wang from comment #1)
> It seems that I have to explicitly mention TeXZilla.js in the jar.mn. I
> don't know if there is a better way to do that.
You accidentally included TeXZilla.js in an #ifdef MOZ_SUITE block in editor/ui/jar.mn (sorry I didn't notice that before either).
Assignee | ||
Comment 3•11 years ago
|
||
(In reply to neil@parkwaycc.co.uk from comment #2)
> (In reply to Frédéric Wang from comment #1)
> > It seems that I have to explicitly mention TeXZilla.js in the jar.mn. I
> > don't know if there is a better way to do that.
>
> You accidentally included TeXZilla.js in an #ifdef MOZ_SUITE block in
> editor/ui/jar.mn (sorry I didn't notice that before either).
Ah, you're right. Good catch.
Attachment #8401758 -
Attachment is obsolete: true
Attachment #8401758 -
Flags: feedback?(mconley)
Attachment #8401786 -
Flags: review?(mconley)
Assignee | ||
Updated•11 years ago
|
Attachment #8401786 -
Flags: review?(mconley) → review?(mkmelin+mozilla)
Comment 4•11 years ago
|
||
I don't know what's wrong, but the dialog repeatedly takes about 15s (!!) to open on this machine, which is reasonably fast (builds tb in about 20-25min).
Assignee | ||
Comment 5•11 years ago
|
||
(In reply to Magnus Melin from comment #4)
> I don't know what's wrong, but the dialog repeatedly takes about 15s (!!) to
> open on this machine, which is reasonably fast (builds tb in about 20-25min).
Yes, I mentioned that in comment 1. That seems specific to debug mode (bug 986839 comment 12).
Comment 6•11 years ago
|
||
This isn't a debug build, but i do have --disable-optimize
Assignee | ||
Comment 7•11 years ago
|
||
(In reply to Magnus Melin from comment #6)
> This isn't a debug build, but i do have --disable-optimize
OK, that might be the reason. As I indicate on bug 986839, the TeXZilla.js parser is big and loading it from the XUL window seems to take a lot of time (I'm not sure why). The workaround I found was to create an <iframe> in the XUL window and to load TeXZilla.js from that iframe, then opening the window was fast. But I finally removed that iframe to address review comments and because it turned out to only happen in debug build for me.
Comment 8•11 years ago
|
||
I asked bz about that and he said that the difference might be that JavaScript in HTML is only initially parsed for syntax errors and not fully compiled until it is called.
Assignee | ||
Comment 9•11 years ago
|
||
(In reply to neil@parkwaycc.co.uk from comment #8)
> I asked bz about that and he said that the difference might be that
> JavaScript in HTML is only initially parsed for syntax errors and not fully
> compiled until it is called.
OK, thanks for the info. If that's a problem, we can probably keep an invisible iframe to just load TeXZilla.js and execute the TeXZilla code in that iframe document instead.
Assignee | ||
Comment 10•11 years ago
|
||
Here is a patch to load TeXZilla in an iframe, so that the window opens faster in non-optimized builds.
Assignee | ||
Comment 11•11 years ago
|
||
So what do you think? Should we take something like attachment 8405466 [details] [diff] [review] to speed up the opening of the math window in non-opt builds?
Comment 12•11 years ago
|
||
Comment on attachment 8405466 [details] [diff] [review]
Use an iframe
Review of attachment 8405466 [details] [diff] [review]:
-----------------------------------------------------------------
Yes, I think something like this is needed.
Even with an opt build opening the dialog was around 3-4 secs, which is too long
Attachment #8405466 -
Flags: feedback+
Comment 13•11 years ago
|
||
Comment on attachment 8401786 [details] [diff] [review]
Patch V2
Review of attachment 8401786 [details] [diff] [review]:
-----------------------------------------------------------------
This is fine by me, if the load time issue gets resolved.
Attachment #8401786 -
Flags: review?(mkmelin+mozilla) → review+
Assignee | ||
Updated•11 years ago
|
Attachment #8405466 -
Flags: review?(neil)
Comment 14•11 years ago
|
||
Comment on attachment 8405466 [details] [diff] [review]
Use an iframe
It's definitely much slower than I remember it being during testing, which is odd. According to a random break into the debugger it's spending lots of time cloning the function object which is saved between invocations of the dialog supposedly to improve performance.
However I think the subscript loader would be a better way to resolve the problem (normally I would suggest a module but there are some DOM accesses which would be harder to implement in a module).
(Also in testing it occurred to me that \frac {-b \pm \sqrt {b^2 - 4ac}} {2a} might have been a better example ;-)
Attachment #8405466 -
Flags: review?(neil) → review-
Assignee | ||
Comment 15•11 years ago
|
||
Note: you can find more examples at http://fred-wang.github.io/TeXZilla/
Attachment #8405466 -
Attachment is obsolete: true
Attachment #8408545 -
Flags: review?(neil)
Comment 16•11 years ago
|
||
Comment on attachment 8408545 [details] [diff] [review]
subscript-loader.patch
>+ Components.classes["@mozilla.org/moz/jssubscript-loader;1"].
>+ getService(Components.interfaces.mozIJSSubScriptLoader).
>+ loadSubScript("chrome://editor/content/TeXZilla.js");
Nit: looks slightly neater if you write it like this:
Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader)
.loadSubScript("chrome://editor/content/TeXZilla.js");
(It looked odd loading the script in the middle of Startup but I couldn't see an obviously better place to put it.)
Attachment #8408545 -
Flags: review?(neil) → review+
Assignee | ||
Comment 17•11 years ago
|
||
Address the review comment.
(In reply to neil@parkwaycc.co.uk from comment #14)
> (Also in testing it occurred to me that \frac {-b \pm \sqrt {b^2 - 4ac}}
> {2a} might have been a better example ;-)
OK, I just understood that you meant the LaTeX example at the bottom of the EdInsertMath.xul window, not the LaTeX examples you typeset for your own testing of that feature...
The rationale for that example was not to have something that has an actual mathematical meaning, but just a short text to show some basic constructions: subscript, superscript, fraction, square root, sum and greek letter. It was perhaps not clear, but it also shows that one can enter Unicode character directly instead of backslashed symbol names. And also, I think the quadratic example has already been overused :-)
Attachment #8408545 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 18•11 years ago
|
||
(In reply to Frédéric Wang from comment #17)
> I think the quadratic example has already been overused :-)
Very good points, especially that last one!
Comment 19•11 years ago
|
||
https://hg.mozilla.org/comm-central/rev/b1d860289be9
https://hg.mozilla.org/comm-central/rev/d619fe2d8921
Status: NEW → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 31.0
Assignee | ||
Comment 20•11 years ago
|
||
Change documented on MDN:
https://developer.mozilla.org/en-US/docs/Web/MathML/Authoring#MathML_in_email_and_instant_messaging_clients
https://developer.mozilla.org/en-US/docs/Web/MathML/Authoring#Input_Box
Keywords: user-doc-complete
Comment 21•11 years ago
|
||
Shouldn't this also be added to the dropdown on the "Insert" button in the Compose window?
Assignee | ||
Comment 22•11 years ago
|
||
(In reply to aleth from comment #21)
> Shouldn't this also be added to the dropdown on the "Insert" button in the
> Compose window?
I guess it depends whether we consider math important enough to be added there (not all the commands of the insert menu are available in the toolbar). If we do, then we can probably open a new bug for that.
You need to log in
before you can comment on or make changes to this bug.
Description
•