From ccf1e09a754f7eb33ea1cea783241536fbe1ff09 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 2 Aug 2019 22:41:39 +0200 Subject: [PATCH] Avoid using %tank %fats Because tank printing is a pain. Rely instead on %text, using %name to distinguish between intent. --- .../chat/src/js/components/lib/chat-input.js | 2 +- .../chat/src/js/components/lib/message.js | 22 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pkg/interface/chat/src/js/components/lib/chat-input.js b/pkg/interface/chat/src/js/components/lib/chat-input.js index b37477332..e8a8b7fc8 100644 --- a/pkg/interface/chat/src/js/components/lib/chat-input.js +++ b/pkg/interface/chat/src/js/components/lib/chat-input.js @@ -234,7 +234,7 @@ export class ChatInput extends Component { } }, tac: { name: { nom: 'long-form', - tac: { tank: lines.slice(1).map(l => { return {leaf: l }; }) } + tac: { text: lines.slice(1).join('\n') } } }, } }; } diff --git a/pkg/interface/chat/src/js/components/lib/message.js b/pkg/interface/chat/src/js/components/lib/message.js index 77f7d4a20..4f84aa741 100644 --- a/pkg/interface/chat/src/js/components/lib/message.js +++ b/pkg/interface/chat/src/js/components/lib/message.js @@ -112,14 +112,24 @@ export class Message extends Component { return (
{'Attached: ' + title} { _.has(content, 'text') - ?
{content.text}
+ ? (title === 'long-form') + ? this.renderParagraphs(content.text.split('\n')) + : this.renderPlaintext(content.text) : _.has(content, 'tank') - ?
- {content.tank.map(l =>

{l}

)} -
- : null + ? this.renderPlaintext(content.tank.join('\n')) + : null } - ); +
); + } + + renderParagraphs(paragraphs) { + return (
+ {paragraphs.map(p => (

{p}

))} +
); + } + + renderPlaintext(text) { + return (
{text}
); } renderContent() {