mathquill / mathquill

Easily type math in your webapp
http://mathquill.com
Mozilla Public License 2.0
2.66k stars 703 forks source link

Copy-paste not works after mathquill mode changed #215

Open BrtSmpsn opened 10 years ago

BrtSmpsn commented 10 years ago

Hi!

I'm have got this bug in my code but this can be reproduced on http://mathquill.com/demo.html in FF 25.0 with firebug installed.

Please open firebug console and execute next commands: var m = $.find('#editable-math'); $(m).mathquill(); $(m).mathquill('editable'); $(m).mathquill('latex', '\frac{d}{dx}\sqrt{x}=');

After this copy-paste not works in mathquill editor.

laughinghan commented 10 years ago

Yeah, doing .mathquill() on an already MathQuill-ified thing gets you into a bad state; doing .mathquill('editable') afterwards just adds insult to injury.

BrtSmpsn commented 10 years ago

Can you fix this soon or recommend way around it?

laughinghan commented 10 years ago

Yeah, do .mathquill('revert') to already MathQuill-ified things before MathQuill-ifying them again.

BrtSmpsn commented 10 years ago

Hi,

Thank you, next workaround works on demo page:

var m = $.find('#editable-math');
$(m).mathquill('revert');
$(m).mathquill('editable');
$(m).mathquill('latex', '\\frac{d}{dx}\\sqrt{x}=');

But this doesn't:

var m = $.find('#editable-math');
$(m).mathquill('');
$(m).mathquill('revert');
$(m).mathquill('editable');
$(m).mathquill('latex', '\\frac{d}{dx}\\sqrt{x}=');

I'm had some read only expressions on my page processed by $(m).mathquill('');. User can switch read only expression to edit mode and I can't find workaround for editable expression with success working copy-paste.

laughinghan commented 10 years ago

Yeah, sorry, the current API is terrible and $(m).mathquill('') breaks things.

Han

On Sun, Nov 24, 2013 at 10:33 PM, rkonshin-sa notifications@github.comwrote:

Hi,

Thank you, next workaround works on demo page:

var m = $.find('#editable-math'); $(m).mathquill('revert'); $(m).mathquill('editable'); $(m).mathquill('latex', '\frac{d}{dx}\sqrt{x}=');

But this doesn't:

var m = $.find('#editable-math'); $(m).mathquill(''); $(m).mathquill('revert'); $(m).mathquill('editable'); $(m).mathquill('latex', '\frac{d}{dx}\sqrt{x}=');

I'm had some read only expressions on my page processed by $(m).mathquill('');. User can switch read only expression to edit mode and I can't find workaround for editable expression with success working copy-paste.

— Reply to this email directly or view it on GitHubhttps://github.com/mathquill/mathquill/issues/215#issuecomment-29180456 .

BrtSmpsn commented 10 years ago

Can you fix this soon or needed too much time for resolve this issue?

laughinghan commented 10 years ago

I don't think this is urgent, can't you just not call $(m).mathquill('')?

That problem will get fixed in the course of fixing the API to be less terrible.

Han

On Mon, Nov 25, 2013 at 12:57 AM, rkonshin-sa notifications@github.comwrote:

Can you fix this soon or needed too much time for resolve this issue?

— Reply to this email directly or view it on GitHubhttps://github.com/mathquill/mathquill/issues/215#issuecomment-29185802 .