christianp / writemaths

A jQuery plugin to give an instant preview of LaTeX in editing areas.
http://christianp.github.io/writemaths
27 stars 7 forks source link

Jquery 1.10.2 #2

Open magnetic-pi opened 10 years ago

magnetic-pi commented 10 years ago

HI Christian! Firstly, I'd like to start off by saying this is a kick as project! I love it and I am not sure why it doesn't have more traction. I'd like to report a bug. If using a newer version of jquery:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>                                          
<script type="text/javascript" src=" http://code.jquery.com/jquery-1.10.2.min.map"></script>  

The wm_preview does not display properly:

<div class="wm_preview" style="display: none;">$e^{\pi i} + 1 = 0$</div>

I am a bit confused as to how this is getting rendered. I think this functionality is being rendered by:

https://github.com/christianp/writemaths/blob/master/writemaths.js#L85

I tried changing the z-index as well as positioning to no avail. Do you have any thoughts?

Cheers, Jon

christianp commented 10 years ago

It looks like the problem is caused by the fact that $.browser was finally removed in jquery 1.9. jquery.caretposition uses $.browser all over the place, and it's not clear what features it's trying to detect so I don't know how to fix it. Using jQuery.migrate gives $.browser back and makes it all work again. I've opened issue beviz/jquery-caret-position-getter#5 to see if anyone knows how to go about updating it.

magnetic-pi commented 10 years ago

Hi Christian,

Thanks for getting back to me so quickly! I fixed the jquery-caret-position issue here:

https://github.com/jcostello84/jquery-caret-position-getter

Unfortunately, when I changed the caret-position file within the writemaths project, its still not working:

https://github.com/jcostello84/writemaths

Any thoughts?

The issue I am seeing has to do with the location of preview when hovering over $e^{\pi i} + 1 = 0$ in the div area.

Cheers, Jon

magnetic-pi commented 10 years ago

Perhaps something like this may work, but I am not 100% sure where to implement this in writemaths.js:

http://jsfiddle.net/fQ2zK/2/

Was this your submission? http://code.google.com/p/rangy/issues/detail?id=165

christianp commented 10 years ago

You can't just swap $.browser for $.support - the browser-detection features have been completely removed.

jpslav commented 10 years ago

Howdy - I was just able to replace jquery-caret-position-getter with https://github.com/Codecademy/textarea-helper. I just had to make a change to one line in writemaths. I don't know how great a solution this is, but it works for me in case you want to consider it.

With the current version of jQuery I also had to specify the preview's offset differently (appears "offset" is no longer the way to do it).

Here's the commit in case it helps: https://github.com/jpslav/exercises/commit/4110c2c205fc201fdefaca7cb1ef3a363564cdb5#diff-2c2cfebab607f776f64fff9a004b13e7