Update editable components to trim whitespace when editing inline
This commit is contained in:
parent
df29ad1092
commit
90b3e2a16d
|
@ -25,7 +25,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateText = e => {
|
const updateText = e => {
|
||||||
builderStore.actions.updateProp("text", e.target.textContent)
|
builderStore.actions.updateProp("text", e.target.textContent.trim())
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
// Convert contenteditable HTML to text and save
|
// Convert contenteditable HTML to text and save
|
||||||
const updateText = e => {
|
const updateText = e => {
|
||||||
const sanitized = e.target.innerHTML.replace(/<br>/gi, "\n")
|
const sanitized = e.target.innerHTML.replace(/<br>/gi, "\n").trim()
|
||||||
builderStore.actions.updateProp("text", sanitized)
|
builderStore.actions.updateProp("text", sanitized)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateText = e => {
|
const updateText = e => {
|
||||||
builderStore.actions.updateProp("text", e.target.textContent)
|
builderStore.actions.updateProp("text", e.target.textContent.trim())
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
// Convert contenteditable HTML to text and save
|
// Convert contenteditable HTML to text and save
|
||||||
const updateText = e => {
|
const updateText = e => {
|
||||||
const sanitized = e.target.innerHTML.replace(/<br>/gi, "\n")
|
const sanitized = e.target.innerHTML.replace(/<br>/gi, "\n").trim()
|
||||||
builderStore.actions.updateProp("text", sanitized)
|
builderStore.actions.updateProp("text", sanitized)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
$: labelClass = labelPos === "above" ? "" : `spectrum-FieldLabel--${labelPos}`
|
$: labelClass = labelPos === "above" ? "" : `spectrum-FieldLabel--${labelPos}`
|
||||||
|
|
||||||
const updateLabel = e => {
|
const updateLabel = e => {
|
||||||
builderStore.actions.updateProp("label", e.target.textContent)
|
builderStore.actions.updateProp("label", e.target.textContent.trim())
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue