From 14ff1246741c91895bfd0310fe5352108326f093 Mon Sep 17 00:00:00 2001 From: or-else Date: Sun, 11 Nov 2018 16:59:39 +0300 Subject: [PATCH] strip formatting from button text --- src/widgets/chat-message.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/widgets/chat-message.jsx b/src/widgets/chat-message.jsx index 965d28c9..bb46539c 100644 --- a/src/widgets/chat-message.jsx +++ b/src/widgets/chat-message.jsx @@ -163,8 +163,14 @@ function draftyFormatter(style, data, values, key) { case 'BN': // Button attr.onClick = this.handleFormButtonClick; + let inner = React.Children.map(values, (child) => { + return typeof child == 'string' ? child : undefined; + } + if (!inner || inner.length == 0) { + inner = [attr.name] + } // Get text which will be sent back when the button is clicked. - attr['data-title'] = (React.Children.map(values, (child) => {return child;}) || [attr.name]).join(''); + attr['data-title'] = inner.join(''); break; case 'FM': // Form