delete trailing whitespace on save
fixed error when there is no page breaks and navigation popup is used