Panel image textarea drop jQuery trigger

Maybe this is more of a javascript question than a Kirby one.

I have a field with an extended textarea field. When I drag and drop an image into a textarea, I want to do something. I can’t make the event fire.

var field = $(this);
field.find('textarea').on('change keyup keydown paste', function() {
    console.log('changed');
});

Typing in the textarea works fine. Drag in an image does not.

Any ideas? Maybe there are more events needed?

I think that’s because the Panel uses a custom plugin for the drag and drop functionality:

From line 30, you can see what happens what happens when the user grabs a image and want to drop it on a textarea. I think you need to call a method from the drag and drop plugin instead of listening for the standard events.

I solved it! There is a drop event:

var field = $(this);
field.find('textarea').on('change keyup keydown paste drop', function() {
    console.log('changed');
});
1 Like