CKEditor 4 image preview: programmatically setting dimensions

98 Views Asked by At

I am adding plus / minus icon buttons to the CKEditor image properties preview for a user to click on them and increase / decrease the image width and height by a fixed number of pixels without having to type in the values.

I see that the keyup event updates the image preview as well as the lock ratio. How to correctly simulate the required keyup event in JavaScript / jQuery after the new pixel value has been set in the width / height input fields?

enter image description here

1

There are 1 best solutions below

1
nobody On

Something like the following works:

my_input.dispatchEvent(new KeyboardEvent('keyup', {
                'key': '1'
              }));