wonglkd / mathflowy

Chrom{e,ium} extension to provide MathJax rendering for Workflowy
https://chrome.google.com/webstore/detail/mathflowy/enkondafgdaafikjlehpnjebnknfgfle
9 stars 5 forks source link

Error when entering list item by deleting the next one #3

Closed wmayner closed 8 years ago

wmayner commented 8 years ago

Thanks for this extension :)

I'm noticing that when I have two list items in sequence and the first one contains math, if I delete the second one by repeatedly pressing backspace (causing the cursor to go to the end of the first item), the math is un-rendered incorrectly, resulting in strange duplication of the LaTeX code.

ClaudiusL commented 8 years ago

I've observed the same behavior in Chrome 53.0.2785.116.

Starting from the following list

- $1+$
- second item

and the deleting the second item by repeatedly pressing backspace yields

- 1+11+11+1
wmayner commented 8 years ago

I've since noticed that this also occurs when pasting text into an item.

wmayner commented 8 years ago

Also, I'm using Chrome 52.0.2743.116.

wonglkd commented 8 years ago

Thanks for the reports! I was able to reproduce the issues.

The main difficulty is finding a suitable place to hook the de-renderer onto. So far, the hooks have been at a rather high-level (e.g. blur/focus handlers): they were easier to find and implement, but there are many ways of using Workflowy that don't trigger those paths.

I've found a deeper place to place the hook. In my own testing, this appears to fix the issue for both pasting and backspacing/merging items.

wonglkd commented 8 years ago

I've uploaded the latest version here: mathflowy-2016-09-22.zip Do you mind helping to test it and see if it solves the issues? Thanks for your help!

If this works for you as well, I plan to update the Chrome store version in a few days' time.

wmayner commented 8 years ago

Happy to test it out. How do I load the extension from those files?

ClaudiusL commented 8 years ago

@wonglkd Thank you for the fix, works for me. But by the way: I don't know too much about private/public keys (or Chrome extensions), but are you sure that this pem file should be in the zip archive you uploaded?

@wmayner What I did to load it (though I don't know if this is the "correct" way of doing this): Create a directory and copy mathflowy.crx into it. Then, download the js, json and png files from the repository in the same directory. In Chrome, go to Extensions, enable the "developer mode" (https://developer.chrome.com/extensions/faq#faq-dev-01). Then, you can load the extension from the directory. (I uninstalled the old version first.)

wmayner commented 8 years ago

@ClaudiusL, thanks, that worked!

@wonglkd, thank you, the fix is working for me too 😄

wonglkd commented 8 years ago

@ClaudiusL thanks for your concern! Yes, I guess I was a little careless about that - on the other hand, that key was auto-generated for that particular crx file and I wasn't planning to use it again, so no long-term impact there.

@wmayner @ClaudiusL: thanks for testing it out! Glad that it works. Let me know if you find any bugs!

wonglkd commented 8 years ago

Updated the Chrome store version and closing this issue. Thanks!

ClaudiusL commented 8 years ago

@wonglkd Thank you for the fix. Just one thing … the old version could be used in Firefox as well, via the extension "Chrome Store Foxified". Since the update, this doesn't work anymore (installing the extension has no effect whatsoever).

I'm aware that Mathflowy is a Chrome extension and that it is not your responsibility to maintain compatibility with another browser via a third-party extension – but if you could do anything about this, it would be great. (Actually, I think it was not the fix of this issue that broke Firefox support but the additional settings that were added in the subsequent commit.)

wonglkd commented 8 years ago

Thanks @ClaudiusL for the heads up! Yes, it's probably due to the new settings page added. I'm maintaining the extension in my very limited spare time but will try to look into it. I'm an active Firefox user myself and am sympathetic. In the meantime, maybe you could use the previous version first? Thanks! I've opened #4 to track this problem.

ClaudiusL commented 8 years ago

I'm maintaining the extension in my very limited spare time

I know, and I appreciate this a lot!

I'm not sure how to use the previous version in Firefox, but I will try it. I will report in #4 in case of any news.