mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

unable to paste text nor latex

Open yakovyarmo opened this issue 3 years ago • 25 comments

unable to paste text nor latex

for example here: https://codepen.io/yakovyarmo/pen/gOmVpPR try to paste something

using chrome Version 91.0.4472.114 (Official Build) (64-bit)

yakovyarmo avatar Jun 24 '21 12:06 yakovyarmo

Seems to work for me. Could you provide more details? What are you trying to paste?

arnog avatar Jun 24 '21 13:06 arnog

Any thing. Tried latex and regular text. It only show "v". It seems that the paste event is not being triggered

yakovyarmo avatar Jun 24 '21 13:06 yakovyarmo

@yakovyarmo Which operating system? Which language? Which keyboard layout?

stefnotch avatar Jun 24 '21 13:06 stefnotch

Are you using command + V or control + V? What is your operating system? What happens if you select the Paste command from the Edit menu instead of the keyboard shortcut?

arnog avatar Jun 24 '21 16:06 arnog

I'm using English layout on windows 10.

On Thu, Jun 24, 2021, 16:33 stefnotch @.***> wrote:

@yakovyarmo https://github.com/yakovyarmo Which operating system? Which language? Which keyboard layout?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arnog/mathlive/issues/1047#issuecomment-867640628, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGYWBNJNB7VWVDSO45WPYTTUMX3BANCNFSM47HZYELA .

yakovyarmo avatar Jun 24 '21 17:06 yakovyarmo

The paste command doesn't appear when I right click on the math live input. image

Here is an example with a regular input: image

yakovyarmo avatar Jun 24 '21 18:06 yakovyarmo

@yakovyarmo That seems odd, I can't reproduce this. Could you try windows+v and try pasting something from the clipboard? This should work since you're on Windows.

Also, could you put this into your codepen, then hit ctrl+v and check the console?

document.addEventListener("keydown", (ev) => {
  console.log(ev.key, ev.code, ev.ctrlKey, ev.shiftKey, ev.altKey, ev.isComposing);
});

stefnotch avatar Jun 24 '21 19:06 stefnotch

Here is the result of the input: image

And here is the console: image

yakovyarmo avatar Jun 27 '21 11:06 yakovyarmo

That looks odd. Do you know if any software or hardware could be messing around with the keyboard/input?

At the beginning, it looks like the v key has been pressed while the control key has been pressed. After that, there are a few keyboard events with a missing code, which shouldn't happen according to MDN.

From the meta key, I'm assuming that you have some special keyboard (such as the apple keyboard)?

I don't really know what could be causing that, maybe arnog has an idea.

stefnotch avatar Jun 27 '21 11:06 stefnotch

I tried it on a different computer and the same result.

image

yakovyarmo avatar Jun 27 '21 12:06 yakovyarmo

Do you need more info from me?

yakovyarmo avatar Jun 28 '21 17:06 yakovyarmo

Let's try a few more things:

  • can you type regular text in the mathfield? What happens if you type "x"?
  • do other commands work? What happens if you type "ctrl+A"?
  • can you use arrow keys to navigate in the mathfield?
  • what happens if you press shift+left arrow key?
  • what about ctrl+left arrow key?

arnog avatar Jun 28 '21 18:06 arnog

All of these are working, I also wrote custom key binding which did work. I did notice that the (paste event)[https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event] doesn't get fired.

yakovyarmo avatar Jun 28 '21 18:06 yakovyarmo

All of these are working, I also wrote custom key binding which did work. I did notice that the (paste event)[https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event] doesn't get fired.

Just to clarify, does the MDN demo work? Or does the paste event also not get fired there?

If it's the latter, then I'd wonder if the issue could be caused by:

  • Using the same keyboard on both machines (to test: use the on-screen keyboard)
  • Using the same Chrome profile on both machines (to test: start Chrome in incognito)
  • Some browser setting (to test: try it with Microsoft Edge)

stefnotch avatar Jun 28 '21 18:06 stefnotch

And can you clarify: when you type ctrl+v, what appears in the mathfield: "v" (which you mention earlier) or "Controlv" (which shows up in a screenshot) or something else?

arnog avatar Jun 28 '21 20:06 arnog

I tried also with firefox and edge, same result. I tried different computers, same result. Just to clarify about the paste event, the MDN demo does work. I debugged mathlive and put breakpoint on the paste event and saw that it was never called while the other events (keyup, keydown etc') did.

yakovyarmo avatar Jun 29 '21 08:06 yakovyarmo

The paste event is triggered by the browser, so if it's not firing, something must be preventing it... I don't know why the MDN example would work, though. You tried earlier to paste using the contextual menu. But there is also an Edit menu in the menu bar at the top of the window. This menu should have a Paste command. Is the Paste command enabled? What happens when you select this command with your mouse?

arnog avatar Jun 29 '21 13:06 arnog

It is greyed out.

On Tue, Jun 29, 2021, 16:16 Arno Gourdol @.***> wrote:

The paste event is triggered by the browser, so if it's not firing, something must be preventing it... I don't know why the MDN example would work, though. You tried earlier to paste using the contextual menu. But there is also an Edit menu in the menu bar at the top of the window. This menu should have a Paste command. Is the Paste command enabled? What happens when you select this command with your mouse?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arnog/mathlive/issues/1047#issuecomment-870591117, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGYWBMKDAS7EMOCXJTZN73TVHBUNANCNFSM47HZYELA .

yakovyarmo avatar Jun 29 '21 15:06 yakovyarmo

So, the following is greyed out for you? image

In that case, I'd almost suspect some piece of software that is installed on both machines. Even though that'd be rather strange. If you do want to investigate that avenue further, you could try starting Windows in safe mode and report back.

stefnotch avatar Jun 29 '21 16:06 stefnotch

It does work with version 0.59.0. So can we inspect what changed in that version?

yakovyarmo avatar Jun 30 '21 08:06 yakovyarmo

Sure. There are 516 commits between 0.59 and the current version to go through, so that might take a while. And without a reproducible case, that's still going to be difficult to figure out a fix.

arnog avatar Jun 30 '21 09:06 arnog

It does work with version 0.59.0. So can we inspect what changed in that version?

Just to clarify again:

  • It worked in version 0.59.0
  • It does not work in the latest version, which is 0.69.4

Does it work in any of the versions inbetween? Which version broke it on your system? Which version still works on your system?

Also, feel free to go into the details, every bit of information helps! Especially when trying to hunt down a non-reproducible bug.

stefnotch avatar Jun 30 '21 09:06 stefnotch

It stopped working at version 0.60.0

On Wed, Jun 30, 2021, 12:40 stefnotch @.***> wrote:

It does work with version 0.59.0. So can we inspect what changed in that version?

Just to clarify again:

  • It worked in version 0.59.0
  • It does not work in the latest version, which is 0.69.4

Does it work in any of the versions inbetween https://www.npmjs.com/package/mathlive?activeTab=versions? Which version broke it on your system? Which version still works on your system?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arnog/mathlive/issues/1047#issuecomment-871251188, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGYWBO2MWYBQQIMVGQBDJLTVLRARANCNFSM47HZYELA .

yakovyarmo avatar Jun 30 '21 10:06 yakovyarmo

Okay, that narrows the range down a fair bit. It's still a lot to go through. https://github.com/arnog/mathlive/compare/v0.59.0...v0.60.1 https://github.com/arnog/mathlive/blob/master/CHANGELOG.md#0600-2021-04-12

If you want to test it locally, you could try checking out the v0.59.0 commit, building mathlive from source and testing it. And then adding commits until pasting breaks.

I'm sorry for not being able to help more, usually I'd do the 'bisecting' myself, but I still haven't figured out how to reproduce this issue. (I'm on a Windows 10 Home machine, version 20H2, have tried out a number of different keyboard layouts and keyboards, different browsers. No dice.)

stefnotch avatar Jun 30 '21 11:06 stefnotch

Where can I find the commit for: "

  • Fixed issues with copy/paste. Copying from a text zone will copy the text (and not a latex representation of it). Copy from a Latex zone now works."

On Wed, Jun 30, 2021, 14:35 stefnotch @.***> wrote:

Okay, that narrows the range down a fair bit. It's still a lot to go through. v0.59.0...v0.60.1 https://github.com/arnog/mathlive/compare/v0.59.0...v0.60.1 https://github.com/arnog/mathlive/blob/master/CHANGELOG.md#0600-2021-04-12

If you want to test it locally, you could try checking out the v0.59.0 commit, building mathlive from source and testing it. And then adding commits until pasting breaks.

I'm sorry for not being able to help more, usually I'd do the 'bisecting' myself, but I still haven't figured out how to reproduce this issue. (I'm on a Windows 10 Home machine, version 20H2, have tried out a number of different keyboard layouts and keyboards, different browsers. No dice.)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arnog/mathlive/issues/1047#issuecomment-871326524, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGYWBLBTUB4UIA4AVXE5XLTVL6RLANCNFSM47HZYELA .

yakovyarmo avatar Jun 30 '21 16:06 yakovyarmo

The Clipboard handling has been significantly rewritten and should now work in a wider set of environments.

arnog avatar May 19 '23 08:05 arnog