paste event

Hello Webix team!
How to cath paste event to textarea (mouse right click —> paste)?
I need disable enter ‘;’ symbol to textarea. I disable input ‘;’ and cut ‘;’ after ‘Ctrl+V’. But my solution isn’t work with mouse paste.

on:{
‘onKeyPress’: function (code, e) {
if (e.key==’;’)
return false;
},
‘onTimedKeyPress’: function () {
let newv=this.getValue();
if (newv.indexOf(";")!==-1){
let str=newv.replace(/;/g,’’);
this.setValue(str);
}
},
}

Thank you in advance.

textarea isn’t support OnPaste event.

Hey @valk20, you’re right, there is no such event as onPaste defined within a webix textarea. To do something akin to what you’d like to do you’d need to look towards native JavaScript events, for example paste, and work from there. Basically, since we have to use the default JS events, we have to get the HTML element to attach our event to, to do this, we are using getInputNode().
I’ve included an example of how you could achieve this: https://snippet.webix.com/e9lxro76.

you can use a bit more low level code ( which will not work in older IE )

https://snippet.webix.com/6i8a878q

    { view:"textarea", placeholder:"Try to paste anything", on:{
      onAfterRender:function(){
        webix.event(this.getInputNode(), "input", () => {
          webix.message(this.getValue())
        });
      }
    }}

webix.event adds an event handler to native HTML onInput event, which will fire for any kind of content modification.

Thanks a lot. It’s help me.