Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste on Mobile #458

Closed
ghost opened this issue Jan 3, 2019 · 12 comments
Closed

Paste on Mobile #458

ghost opened this issue Jan 3, 2019 · 12 comments
Labels
feature resolved if issue is resolved, it will be open until merge with master

Comments

@ghost
Copy link

ghost commented Jan 3, 2019

Upfront: This is a fantastic piece of software... It is a lot of fun to work with and for the most part it has been working exceptionally well.

Although, there doesn't seem to be a way to paste text into a jQuery Terminal cursor line with a browser running on iOS (Firefox, Safari, or Chrome on iOS 12.1.2). Is this an erroneous assumption?

(An increasingly complicated route has begun in trying to circumvent this seeming limitation, though confirmation that this is actually an issue before going further down the road is probably wise, as a work-around might already be known.)

Loading jQuery Terminal without its CSS —thus exposing the raw inputs—allows an ability to paste and parse text in the expected ways, though it would be fantastic if the same affordances were offered in 'proper' emulation.

The primary use case is pasting complex passwords into jQuery Terminal's login feature.

@jcubic jcubic added the Bug label Jan 4, 2019
@jcubic
Copy link
Owner

jcubic commented Jan 4, 2019

How to you paste text on iOS, never did that before. Is this the same as on Android where you hold the finger and system popup with paste select all, came up? I believe this will be the same on Android.

@jcubic
Copy link
Owner

jcubic commented Jan 4, 2019

It will be problematic, but I think it will probably be possible to have paste and copy on mobile in same time. It will require completely new implementation though, using content editable + hiding the caret. This is how Codemirror make it work on mobile, but he don't use custom cursor on content editable. This will be challenging to match content editable cursor with terminal cursor. And copy or paste will only work for command line - you will be able to hold finger only on command line - cmd, plugin for both copy and paste - as for copy on terminal output, we will see, if that also will be possible on mobile.

NOTE to self: to hide the cursor: caret-color: transparent

@ghost
Copy link
Author

ghost commented Jan 5, 2019

Thank you for the acknowledgement of the issue. Yes, I believe that the mechanism for copy, paste, select all, etc. is the same on iOS and Android.

I have started experimenting with some workarounds using things like the Clipboard API, and keep seeing it mentioned that iOS makes it difficult to programatically access the clipboard for security reasons, though other than things like that it would seem that support for paste in Android should theoretically translate to support in iOS.

Being able to paste into the command line would be wonderful. If anything comes from my fiddling with workarounds, I'll report back.

jcubic added a commit that referenced this issue Jan 13, 2019
jcubic added a commit that referenced this issue Jan 13, 2019
@jcubic
Copy link
Owner

jcubic commented Jan 19, 2019

I've forget to write, the code is working on Desktop (with contentedtiable) but still don't on Android. It's in new expermimental branch.

@jcubic jcubic changed the title Unable to paste into cursor line in iOS Paste on Mobile Feb 8, 2019
@jcubic jcubic added feature and removed Bug labels Feb 8, 2019
@Gummibeer
Copy link

A super ugly but 100% working idea would be to toggle a real input or open a browser prompt on mobile via a button.
The input would be nicer because it is stylable and could be fixed on the bottom.

JuiceSSH (a SSH App) dies this with the most used keys like tab, strg/cmd and so on.

@jcubic
Copy link
Owner

jcubic commented Mar 24, 2019

@Gummibeer this can be easily implementation outside of the library, but if you want something like this and terminal don't allow this I can add some option to make this easier. Still I will want content editable paste implemented, but I don't know if this will be usable if not I'll mark this issue as wont fix, but I will try to make it work.

@jcubic
Copy link
Owner

jcubic commented May 12, 2019

I think it's doable, I've created POC with input and dummy content editable on top of normal text and it seems to work. I only need to incorporate this into terminal will create new code that remove the old one since that one was using contenteditable on .cmd and you where able to delete prompt because you can't prevent default input event. But with dummy content editable that sit on top of terminal that is also invisible (opacity: 0.01) this will work the same as with textarea. There is only need to be different CSS applied to the dummy content editable div.

@jcubic
Copy link
Owner

jcubic commented May 12, 2019

The POC can be seen here https://jcubic.pl/x.html

@jcubic
Copy link
Owner

jcubic commented May 12, 2019

Forget to mention that version on experimental branch will never work on mobile because input event is not cancelable so it's possible to delete prompt with keyboard on Android.

@Gummibeer
Copy link

Screenshot_20190512_224500_com android chrome

It looks good so far. But the cursor is at the wrong position. Is this what you meant with the styling?

@jcubic
Copy link
Owner

jcubic commented May 13, 2019

It's only POC for paste, cursor is always at the end. It should work correctly when added to terminal. I hope the matching of terminal cursor and android cursor will be possible.

jcubic added a commit that referenced this issue Mar 14, 2020
@jcubic
Copy link
Owner

jcubic commented Mar 14, 2020

It's been a while (more then a year) but I finally added mobile paste, after adding touch scroll for less (so you can scroll wikipedia articles on 404 page on mobile).

@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label Mar 14, 2020
@jcubic jcubic closed this as completed Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature resolved if issue is resolved, it will be open until merge with master
Projects
None yet
Development

No branches or pull requests

2 participants