From 3b719ce53be0c17bf287346d8a077c01eafd0217 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 9 Jan 2019 17:33:52 +0000 Subject: [PATCH] Fixed keyword highlighting bug and other minor issues --- ElectronClient/app/gui/SideBar.jsx | 14 ++++++-------- ReactNativeClient/lib/MdToHtml.js | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ElectronClient/app/gui/SideBar.jsx b/ElectronClient/app/gui/SideBar.jsx index 0af9b8dc2a..27ed73b7fc 100644 --- a/ElectronClient/app/gui/SideBar.jsx +++ b/ElectronClient/app/gui/SideBar.jsx @@ -463,12 +463,12 @@ class SideBarComponent extends React.Component { marginRight: 12, marginLeft: 5, marginTop: style.fontSize * 0.125}}>; } return ( -
{ +
{ // if a custom click event is attached, trigger that. - if (headerClick) { - await headerClick(key, e); + if (headerClick) { + headerClick(key, event); } - await this.onHeaderClick_(key, e); + this.onHeaderClick_(key, event); }}> {icon} {label} @@ -477,15 +477,13 @@ class SideBarComponent extends React.Component { ); } - async onHeaderClick_(key, event) { + onHeaderClick_(key, event) { const currentHeader = event.currentTarget; const toggleBlock = +currentHeader.getAttribute('toggleblock'); if (toggleBlock) { const toggleKey = `${key}IsExpanded`; const isExpanded = this.state[toggleKey]; - this.setState({ - [toggleKey]: !isExpanded - }); + this.setState({ [toggleKey]: !isExpanded }); Setting.setValue(toggleKey, !isExpanded); } } diff --git a/ReactNativeClient/lib/MdToHtml.js b/ReactNativeClient/lib/MdToHtml.js index 11774ce886..3f9e11cf81 100644 --- a/ReactNativeClient/lib/MdToHtml.js +++ b/ReactNativeClient/lib/MdToHtml.js @@ -415,6 +415,7 @@ class MdToHtml { } applyHighlightedKeywords_(body, keywords) { + if (!keywords.length) return body; return StringUtils.surroundKeywords(keywords, body, '', ''); }