2
0
Эх сурвалжийг харах

Fixed trim whitespace at multiline editor fields

- before whitespaces were only trimmed if 2 or more whitespaces were at
  the end of the line
- now every whitespace is trimmed at the end of each line
Martin Filser 3 жил өмнө
parent
commit
a4ac34d8aa

+ 2 - 1
client/lib/inlinedform.js

@@ -49,7 +49,8 @@ InlinedForm = BlazeComponent.extendComponent({
 
   getValue() {
     const input = this.find('textarea,input[type=text]');
-    return this.isOpen.get() && input && input.value.replaceAll(/\s +$/gm, '');
+    // \s without \n + unicode (https://developer.mozilla.org/de/docs/Web/JavaScript/Guide/Regular_Expressions#special-white-space)
+    return this.isOpen.get() && input && input.value.replaceAll(/[ \f\r\t\v]+$/gm, '');
   },
 
   events() {