LatexIt icon indicating copy to clipboard operation
LatexIt copied to clipboard

LatexIt v.0.6.8 incompatible with Thunderbird 78.2.2

Open mwparis opened this issue 4 years ago • 53 comments

Thanks for your great contribution with LatexIt -- I use it frequently.

What's the expectation for Tbird 78.2.2 compatibility?

Thanks. -Mark

mwparis avatar Sep 16 '20 16:09 mwparis

@jobisoft offered to help with the transition to a mailextension. See #62. But he/we could need some help testing this first step. Any volunteers?

sphh avatar Oct 01 '20 19:10 sphh

@jobisoft offered to help with the transition to a mailextension. See #62. But he/we could need some help testing this first step. Any volunteers?

I can help for some testing on windows.

kiv57 avatar Nov 09 '20 08:11 kiv57

@jobisoft offered to help with the transition to a mailextension. See #62. But he/we could need some help testing this first step. Any volunteers?

I can test on linux.

FMuro avatar Jan 11 '21 12:01 FMuro

Thanks for the offers. Since I did the first conversions on a Linux machine, that is ok. We also have already proceeded to the next step in the conversion stage #62, so at the moment we are ok.

But we could need help with the conversion itself!

sphh avatar Jan 13 '21 10:01 sphh

I am using the fork made by @jobisoft and it seems to work in in thunderbird 78.6.1. Many thanks! I really find this extension useful and it saved me as I could no longer use it in the new thunderbird

t-morales avatar Jan 20 '21 15:01 t-morales

I think it would be a good idea to point to the unfinished fork in the readme

marmistrz avatar Jan 20 '21 17:01 marmistrz

@marmistrz I assume the mailextension branch of this repository is meant (https://github.com/protz/LatexIt/tree/mailextension). Downloaded and followed procedure in Makefile. Runs fine on Windows and Thunderbird 78.7.1 (64-bit). Thank you very much for this neat feature, missed it in the last months.

fwillo avatar Feb 18 '21 13:02 fwillo

@fwillo, you are right, the mailextension branch is that one with the most recent work to convert this add-on to MailExtension.

If I remember correctly, the basic features are there, but the configuration is not working (but I might be wrong here, it's already 3½ months I did it and then I was "sidetracked" by my breadwinning job (and Christmas!).

Anyone out there wanting to finish that job?

sphh avatar Feb 19 '21 20:02 sphh

A quick update …

Since I last tried the mailextension branch, the situation has miraculously improved. I am now on TB 78.7.1 and I noticed only the following problems:

  • ~~If you install LatexIt! for the first time, a configuration screen pops up. This has the button No, take me to the options screen. If you press this button, nothing happens. You have to press the Yes, don't bother me again button and then go to the option screen – see next item. (The error message in the console is JavaScript error: chrome://tblatex/content/firstrun.html, line 86: NS_ERROR_ILLEGAL_VALUE:, if someone who wants to figure out and solve the problem)~~ [This is sorted due to the great help by @jobisoft and his PR] #83
  • ~~The configuration screen can only be reached via the menubar Tools>Add-on Options>LatexIt!, but the menubar is disabled by default (switch it on by right-clicking anywhere on the toolbar and tick Menu Bar)~~ [The configuration screen can now be opened from the Add-on page by clicking on the menu for LatexIt! Thanks @jobisoft!] https://github.com/protz/LatexIt/issues/61#issuecomment-800656903
  • ~~If you select Open the autodetection dialog from the configuration screen, the dialog probably appears behind the configuration screen. Furthermore it has a black background which makes the text difficult to read (I would suggest to get rid of it and incorporate its functionality into the main configuration screen; this would also solve the first problem).~~ This is sorted due to the great help by @jobisoft and his PR] #83
  • The configuration screen is not a proper TB78 configuration page, but a separate dialog. (Any help is welcome to rewrite it to a TB78 configuration page!)
  • ~~If you use Windows, it does not work yet (the problem are spaces in file paths and difficult escaping of quotation marks #76). @sfrcorne has developed an ingenious hack (PR #81), but this needs a bit of polishing, because at the moment it breaks on Linux. Stay tuned.~~ [Merged into the mailextension branch, so it should now work for Windows and Linux/MacOS. @sfrcorne, you are as good as gold!🙇]
  • ~~If you have more than one space before \usepackage[…]{preview}, LatexIt! complains, that the preview-package is not included in the preamble. Remove all spaces.~~ [The latest version of the mailextension branch has this sorted.]

sphh avatar Mar 16 '21 21:03 sphh

Update the used WindowListener API and the options page moves into the add-on manager! https://thunderbird.topicbox.com/groups/addons/T02a09c034809ca6d/resolving-the-add-on-options-chaos-introduced-by-my-wrapper-apis-windowlistener-and-bootstraploader

That solves the issue with option only accessible if menu bar is shown.

jobisoft avatar Mar 16 '21 22:03 jobisoft

Excellent, thanks @jobisoft: I updated api/WindowListener/implementation.js and now a Preference menu item appeared in the menu on the add-ons page.

It still opens a separate window, but I think, that's ok for now … So the next step would be to (re)write the preferences page (#80?)?

sphh avatar Mar 16 '21 23:03 sphh

Working on the pure html webextension options screen seems a good next step (you can make it inline in the add-on manager or as a tab). To not have to change too much at the same time, you can use the LegacyPrefs API to access the legacy pref branch to actually access the old prefs storage, so the remaining code does not need to be changed. Only later, when the add-on has been updated to work without the WindowListener API, you can switch to the webextension local storage.

https://github.com/thundernest/addon-developer-support/tree/master/auxiliary-apis/LegacyPrefs

jobisoft avatar Mar 17 '21 06:03 jobisoft

The NS_ERROR_ILLEGAL_VALUE error is fixed by https://github.com/protz/LatexIt/pull/83

jobisoft avatar Mar 17 '21 10:03 jobisoft

Thank you so much for updating the code so it is compatible with TB 78+ I dearly missed it!

jlinkels avatar Mar 30 '21 01:03 jlinkels

For everybody coming here looking for LatexIt! for TB 78 and who cannot wait for the official release on TB's add-on page, you can use this file for the moment (mind you, there might be still some rough edges!): tblatex.xpi.zip

  • Download the file
  • Unzip it
  • Go to TB's preferences page
  • Click on the cog wheel
  • Select Install Add-on From File…
  • Select the unzipped tblatex.xpi file
  • Confirm installation

Please keep in mind, that this might break automatic updates and you have de-install the add-on and re-install it from the TB add-ons page as soon as the new version is made available!

sphh avatar Apr 01 '21 08:04 sphh

On Mac:

  • Download the file
  • Unzip it
  • Go to TB's preferences page
  • "Extensions & Themes" (bottom left panel)
  • Click on the cog wheel
  • Select Install Add-on From File…
  • Select the unzipped tblatex.xpi file
  • Confirm installation

mwparis avatar Apr 01 '21 14:04 mwparis

I tried this tblatex.xpi (thanks for the trick), but I can't find how to configure LatexIt. Notably, I have an issue with colors: I don't know if it's because I'm using a dark theme in KDE, but the text is white, which makes it unreadable on the final email since it's white text on white background. I tried to add advanced LaTeX and from there I can force the color using a \textcolor{black}{$...$} but I can't find how to configure it by default (I'm using thunderbird 78.5.1, I tried to find the options in Thunderbird options, in tools>Addon Options, and in Addon > Extensions > LatexIt (3 dots)> Manage).

tobiasBora avatar Apr 16 '21 16:04 tobiasBora

@tobiasBora: Go to the Add-ons Manger page, click on the LaTeX It! add-on, then on the ... and select Preferences.

Or go to the Add-ons Manager page, find the LaTeX It! tile and click on the ... and select Preferences.

What Latex It! does: It figures out the colour of the surrounding text and uses this as a foreground colour: The equations now has the same colour as the text. The background is transparent. E.g. if you write in blue text on yellow background, the equation will also be in blue (and not black, the standard colour) and the background colour is shown behind the equation (and not white). This makes for nicer emails.

I always thought of the HTML editor as a WYSIWYG editor. Why does the theme changes the colours of the final HTML email sent??

sphh avatar Apr 16 '21 19:04 sphh

@sphh Thanks for you answer, but I feel a bit stupid: here is what I get when I do that (I remember that on older version, we could directly modify the tex path, the default template...): image

Concerning the background, in KDE when I setup a dark theme, many things are dark, including the textarea... (however, the emails in my input box are rendered with a white background). image I think that the default background color and text color are inverted at writing time, but not when the email is sent. For that reason I'd say that LatexIt should provide a way to check if the text color is white for that reason or because the user actually changed the text color. Also, I don't want to force the text to be black, because then it displays poorly on dark themes (black on black is not very visible...).

tobiasBora avatar Apr 17 '21 14:04 tobiasBora

You found a bug, the options page does not exist for me as well. I will investigate.

jobisoft avatar Apr 17 '21 14:04 jobisoft

Now I feel stupid: Untitled But as @jobisoft said, this might be a bug. @jobisoft, I guess that's in the code of your "compatibility glue"? My TB is 78.7.1 (64-bit) on Linux Mint 20.1, just in case you need it.

sphh avatar Apr 17 '21 14:04 sphh

@tobiasBora: What happens, if you select a colour for the text, let's say some shade of light grey? What will happen with the email sent out? Which colour does the email have? (I would find it weird, if it then has light grey on the default white background.)

How could we predict the text colour after the email is sent? And if it is predicted as black, how would the equation be displayed in the editor having a dark background? Black (on black)?

Personally, I find it a bit strange, that the theme fiddles with the colours in an editor, which can set the colours. (Just think of a drawing program – gimp – which changes the fore- and background colour when saving the file, if the user has not overwritten the defaults. That would be weird! But that is the impression I get from TB editor in dark theme mode!) Obviously it gets it right, when displaying the email, because it knows, it would mess up too many things by changing the background and foreground colour, maybe even render the email unreadable. Honestly, I would expect the same sensible approach, when writing the mails …

sphh avatar Apr 17 '21 15:04 sphh

Now I feel stupid: Untitled But as @jobisoft said, this might be a bug. @jobisoft, I guess that's in the code of your "compatibility glue"? My TB is 78.7.1 (64-bit) on Linux Mint 20.1, just in case you need it.

@sphh, @tobiasBora I had the same problem when installing the latest commit of the mailextention branch on my windows machine. In the end I decided not to open a new issue because restarting TB after installing LatexIt, fixed the issue for me. I don't know if this will also work in your case but you can try.

sfrcorne avatar Apr 17 '21 16:04 sfrcorne

Hm, after a restart I am not able to reproduce this, even after removing and re-installing. Options are always there. Hm, strange.

jobisoft avatar Apr 17 '21 16:04 jobisoft

Oh, I can confirm that restarting Thunderbird gives me the options back, thanks a lot! (not sure why, maybe one should display a message to the user to explain that a restart is required).

Concerning the formating, since most of the time I need to write text without specific colors (no specific font color attached to the text), it is actually quite confortable: I can use my dark theme, and I know the users can read it on whichever theme they like. Now, it can be an issue indeed if I plan myself to use colors, or if the text I'm quoting has forced a black color (it becomes unreadible when I reply, some clients seem to force that behaviour). For that reason, it would be much better if I could choose myself to enable or not the dark theme whenever I want (like right click/disable dark theme).

Here is an example of the current behaviour:

While editing: image

Once received: image

Html of the email:

<p><font color="#cbcbcb">This is a grey test.<font color="#434343"> This
      is darker grey.</font><br>
  </font></p>
<p>This is default (uncolored).</p>
<p><font color="#000000">This is black</font></p>
<p><font color="#ffffff">This is white</font>.<br>
  <font color="#cbcbcb"></font></p>

-- EDIT -- Here is a demo with forcing a black color: indeed it solves the problem. But maybe it would make more sense to put it black by default if no colors are found? image

tobiasBora avatar Apr 17 '21 16:04 tobiasBora

That's what I feared!

Looks like however the colour of the equations is handled, there will be someone who will not be happy.

Re your suggestion: The add-on looks for the colour of the element, where the equation is placed (most of the time that one of the surrounding text). It does it by DOM inspection, so it (currently) cannot detect, if that colour is set by the user or a theme. But if there is a way to figure out, where the colour of the text originates from (theme or custom setting), a fallback of black could be used, if the colour is set by the theme (and not the user). But I would need help, how this detection might work!

I more believe, that this is bug in TB's message composer window itself, as you have proven with your little white/grey/black example!

sphh avatar Apr 17 '21 17:04 sphh

Ahah, that's for sure a tricky problem, I also have sometimes similar issues with equations in Firefox with dark background (but at least I can disable my dark background there). But since I can customize the template to put this \textcolor, I guess people like me using theme and rarely changing the colors can use this trick. I have no idea how theming could be detected automatically. One may want to parse the generated html directly, but I guess it is not trivial to do. So for now I guess the current solution is good enough.

Another solution I can imagine maybe is to put an optionnal check box (visible via the settings and via right clicking for instance) saying "use black color/use current text color" to allow the user to quickly move between both behavior. But I guess 99% of people will just want to write the equation always using the same color, so modifying the template will be enough for most of us. However, I think that a Warning could definitely be useful to limit the impact of such problems: this could be easier to implement I guess: if any formula uses a very light color, then display a warning like "Warning: we detected that you use a white font, and the pictures are therefore white. If you prefer to have darker pictures, please update the default template using $\textcolor{black}{....}$".

Thanks for your work ;-)

tobiasBora avatar Apr 17 '21 18:04 tobiasBora

You know, what the best would be? TB reports not the current display colour, but the colour the element would have, when sending the email. We would then generate the equation in that colour. When displaying it in the composer window, there are two options: TB would display it as it is, if the user specified a colour of the surrounding element. If the element has the default foreground colour (managed by the theme), TB would adjust the foreground colour of the .png file to that one managed by the theme (which is technical possible). THAT would be the proper solution! The same technique could be used when displaying emails – and than you could read your emails in your beloved theme (even if is a HTML email).

@jobisoft: Would that be feasible at all? @tobiasBora: Do you want to open a bug in TB's own bug tracking system?

sphh avatar Apr 17 '21 19:04 sphh

IIRC we do not theme the message window exactly for this reason (checkout the standard black theme). What add-on is forcing the black background color? I think that should not do that OR that theme add-on must do the color adjustment.

jobisoft avatar Apr 17 '21 19:04 jobisoft

I'm back again about the theme color issues, sorry for the delay:

  • @sphh : I made one report here https://bugzilla.mozilla.org/show_bug.cgi?id=1708974
  • @jobisoft : I'm using just the KDE dark breeze theme (see in the above bug report how to setup it properly, basically you need to change the global theme, the plasma theme, the colors and the icons)

Also, to mitigate this problem, I wanted today to setup the \textcolor{red}{__REPLACE_ME__} code globally, but I realized that __REPLACE_ME__ already adds the dollar $. So it means that the text will be replaced by something like \textcolor{red}{$\Delta$} and it turns out that this does not set the color properly: you need instead to put the $ outside, like in $\textcolor{red}{\Delta}$. Would it be possible to specify the $ in the templace and not in __REPLACE_ME directly?

tobiasBora avatar May 02 '21 13:05 tobiasBora