replace carriage returns client side

master
bel 2020-05-30 08:58:44 -06:00
parent 9bd9c47895
commit e9c09f13d1
2 changed files with 16 additions and 2 deletions

View File

@ -17,6 +17,9 @@ tbody tr:nth-child(2n+1) {
#upsert > textarea {
width: 100%;
resize: vertical;
font-family: monospace;
font-family: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace;
white-space: pre-wrap;
}
#jobs > tbody > tr > td {
@ -43,6 +46,10 @@ tbody tr:nth-child(2n+1) {
background: inherit;
min-width: 40%;
display: inline-block;
white-space: pre;
white-space: pre-wrap;
}
::selection,
::-moz-selection {
background-color: #565f67;
}

View File

@ -27,7 +27,14 @@ function upsert() {
function jsonifyForm(id) {
var form = document.getElementById(id)
var entries = new FormData(form).entries();
var json = Object.assign(...Array.from(entries, ([x,y]) => ({[x]:y})));
var json = Object.assign(...Array.from(
entries,
([x,y]) => ({
[x]:y
.replace(/\r\n/g, '\n')
.replace(/\r/g, '\n')
})
))
json.disabled = json.disabled == "false"
var s = JSON.stringify(json)
return s