moved pad size calculation to Pad method, and moved pad parsing to own function
added beforeChange event to text editor