瀏覽代碼

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 年之前
父節點
當前提交
a4ac34d8aa
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      client/lib/inlinedform.js

+ 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() {