canonicalize line breaks to \n (fixing incompatibility between textarea editor and JS editor)