Keyboard icon indicating copy to clipboard operation
Keyboard copied to clipboard

Rebuild for Angular 5, TypeScript, and npm

Open sProject opened this issue 8 years ago • 6 comments

@Mottie We all love your keyboard in my team. I personally have used it with Angular 1.x and it's performance is unbelievable - by far the most stable thing out there especially on touch screen devices.

However, since we upgraded our stack to ng5 and ts it has become more difficult to work with the keyboard. We are considering rebuilding to make it more user friendly to newer angular stacks and thus promote your work even more.

I'd like to ask for your general opinion on this topic, may be you know someone that is already doing this. Also I'm sure that we'll need some guidance here and there, do you mind if we trouble you from time to time when we get blocked by something.

Thanks

sProject avatar Jul 18 '18 13:07 sProject

Hi @sProject!

Sure, I wouldn't mind helping out if I can. Sadly, I haven't dove into learning angular so I may not be too helpful. If you need to chat, I am on slack, discord (Mottie#0026) and sometimes gitter.im.

Mottie avatar Jul 18 '18 14:07 Mottie

@sProject please keep us updated with you're progress regarding the Angular 2+ virtual keyboard. If you have a public repository for the keyboard project, I'm sure more people would be happy to contribute.

tudorciotlos avatar Sep 11 '18 09:09 tudorciotlos

I've been working with this great keyboard in an Angular 2+ (6.1.4) application recently.

@sProject What are some of the difficulties your team is experiencing? I don't quite follow why you feel it requires a rebuild. Or are you trying to avoid the jQuery dependency in your Angular app?

mattsmith-au avatar Sep 13 '18 00:09 mattsmith-au

Hello @mattsmith-au, I'm having an issue with the two-way binding. I type some text in an input, using the virtual-keyboard, but then I print the variable using console.log and the variable has not been updated. I'm using Angular 6.1.0. Thanks in advance!

joaquincrippa avatar Sep 17 '18 15:09 joaquincrippa

@joaquincrippa I had to work through the same issue. Angular's [(ngModel)] relies on an 'input' type Event being dispatched from the input element when its value is changed. When interacting with the virtual keyboard text is inserted into the input, but no event is fired. The keyboard will also capture certain interactions with the physical keyboard (meaning hitting backspace will update the text within the input but Angular is unaware of the change, hence the backing variable is not updated).

To work around this issue I hooked into the keyboards change callback and manually dispatched an 'input' event from the input element whenever a change occurs.

I'm not sure how you're wiring up the keyboard but our app does the following:

$(this._elementRef.nativeElement).keyboard({
  ...
  change: (event, keyboard, el) => {
    this._elementRef.nativeElement.dispatchEvent(new Event('input'));
  },
  ...
});

mattsmith-au avatar Sep 18 '18 07:09 mattsmith-au

Thanks a lot @mattsmith-au ! You saved my day. My final code:

$(".virtual-keyboard").keyboard({
  accepted: function(e, keyboard, el) {
    el.dispatchEvent(new Event("input"));
  }
});

joaquincrippa avatar Sep 18 '18 14:09 joaquincrippa