add listener for buttons
listener edit and preview