jquery.terminal icon indicating copy to clipboard operation
jquery.terminal copied to clipboard

Set terminal readonly with keyboard present in Virtual Keyboard demo on Mobile

Open kuzmanzs opened this issue 5 years ago • 12 comments

Keyboard is very cool 3rd party lib. If I use together with terminal on Android smartphone when I press a key default input keyboard pops up. Therefore keyboard is not really usable for inputting. How can I disable input from keyboard/Android input keyboard and only accept input via keyboard event? I tried

if (Modernizr.touch) {
 			  $('#term').attr('readonly', 'readonly');
			}

but it does not make what I want.

kuzmanzs avatar Dec 01 '18 13:12 kuzmanzs

I think that freeze() method should do just that but it seems that not all keys work if you freeze because terminal is disabled. Also on my Android phone when you click on keyboard key, terminal unfreezes.

Keyboard was created just to make it work better on mobile but now native keyboard works just fine on a phone, It was not a good example, but still I'll try to fix the issue.

jcubic avatar Dec 01 '18 16:12 jcubic

It seems this is works you only need to use term.freeze(true); or $('#term').terminal().freeze(true)

I'll add option that calling freeze(); will be the same as freeze(true);

jcubic avatar Jan 19 '19 11:01 jcubic

My mistake it don't work, it freezes terminal and click don't work but invoking key event enable terminal.

jcubic avatar Jan 19 '19 11:01 jcubic

Found the issue with the jQuery keyboard the problem is that the plugin focus his textarea on click. To fix this you just need to add this css:

.ui-keyboard-input {
   display: none;
}

plus adding term.freeze(true); to disable enabling terminal on click/touch. One issue is that backspace don't work. Will need to add a way to enable passing keyboard events when terminal is disabled. So probably will add readonly option or method. this readonly feature probably will need cursor enabled or disabled depending on option.

jcubic avatar Jan 19 '19 12:01 jcubic

I'm closing this now, I've updated the jquery keyboard plugin (not minified version from Mottie/Keyboard) and it works fine, it don't open keyboard when you click on keys and you also have blinking cursor. Note to self always use latest version, that plugin was not updated for ages.

The keyboard is not centered but this is probably because of missing extension.

jcubic avatar Feb 16 '19 20:02 jcubic

Hi, I little bit do not understand how will it work. You have updated (Mottie/Keyboard](https://github.com/Mottie/Keyboard) project?? I have long time ago didn't worked with jquery terminal.. I lost little context Could you write some simple example for this issue?

kuzmanzs avatar Feb 28 '19 15:02 kuzmanzs

No I've didn't updated the project, I've updated the version I was using in a demo and it work with latest one.

jcubic avatar Feb 28 '19 16:02 jcubic

Does it work for testing mobile https://terminal.jcubic.pl/virtualKeyboard.html ?

If I open it from my Androud phone the enter key does not work (backspace but you know) and if I click on the black area my Android keyboard pops up.

kuzmanzs avatar Feb 28 '19 16:02 kuzmanzs

Native keyboard pops because terminal is enabled. You need to freeze it (call freeze(true) - will need to set true as default, freeze() don't work) Backspace and enter are still a problem, will need to update. Only tested if press key on VKeyboard don't trigger opening the native keyboard, since that was major issue.

jcubic avatar Feb 28 '19 17:02 jcubic

marking this as low because that demo was created when there where issues with native keyboard that work with no problems right now.

jcubic avatar Feb 28 '19 17:02 jcubic

thanks, it isn't high prio.

I am using freeze following way, looks does not work: scripts/css I am using from https://terminal.jcubic.pl/virtualKeyboard.html local css: .ui-keyboard-input { display: none; }

kuzmanzs avatar Feb 28 '19 17:02 kuzmanzs

you need to call freeze on terminal object:

term.freeze(true);

or

$('#term').terminal().freeze(true);

and this do nothing:

$('#term').attr('readonly', 'readonly'); 

jcubic avatar Feb 28 '19 18:02 jcubic