Browse Source

Don't support multi-line markup (#165)

Solved markup issues with <br>. Now behaves like Android app.

Fixes #156
IndianaDschones 8 years ago
parent
commit
ec33ee1a11
3 changed files with 10 additions and 2 deletions
  1. 1 1
      src/directives/message_quote.ts
  2. 1 1
      src/directives/message_text.ts
  3. 8 0
      tests/filters.js

+ 1 - 1
src/directives/message_quote.ts

@@ -36,7 +36,7 @@ export default [
             template: `
                 <div class="message-quote-content" ng-style="{'border-color': ctrl.contact.color}">
                     <span class="message-name" ng-style="{'color': ctrl.contact.color}">{{ ctrl.contact.displayName }}</span>
-                    <span class="message-quote" ng-bind-html="ctrl.text | escapeHtml | nlToBr | emojify | linkify | markify"></span>
+                    <span class="message-quote" ng-bind-html="ctrl.text | escapeHtml | markify | emojify | linkify | nlToBr"></span>
                 </div>
             `,
         };

+ 1 - 1
src/directives/message_text.ts

@@ -48,7 +48,7 @@ export default [
                 }
             }],
             template: `
-                <span threema-action ng-bind-html="ctrl.text | escapeHtml | nlToBr: ctrl.multiLine | emojify | markify | linkify"></span>
+                <span threema-action ng-bind-html="ctrl.text | escapeHtml | markify | emojify | linkify | nlToBr: ctrl.multiLine"></span>
             `,
         };
     },

+ 8 - 0
tests/filters.js

@@ -96,6 +96,14 @@ describe('Filters', function() {
             ]);
         });
 
+        it('ignores markup with \\n (newline)', () => {
+            this.testPatterns([
+                ['*First line\n and a new one. (do not parse)*', '*First line\n and a new one. (do not parse)*'],
+                ['*\nbegins with linebreak. (do not parse)*', '*\nbegins with linebreak. (do not parse)*'],
+                ['*Just some text. But it ends with newline (do not parse)\n*', '*Just some text. But it ends with newline (do not parse)\n*'],
+            ]);
+        });
+
     });
 
     describe('escapeHtml', function() {