mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Fixed keyword highlighting bug and other minor issues
This commit is contained in:
parent
83281197f1
commit
3b719ce53b
@ -463,12 +463,12 @@ class SideBarComponent extends React.Component {
|
|||||||
marginRight: 12, marginLeft: 5, marginTop: style.fontSize * 0.125}}></i>;
|
marginRight: 12, marginLeft: 5, marginTop: style.fontSize * 0.125}}></i>;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div style={style} key={key} {...extraProps} onClick={async (e) => {
|
<div style={style} key={key} {...extraProps} onClick={(event) => {
|
||||||
// if a custom click event is attached, trigger that.
|
// if a custom click event is attached, trigger that.
|
||||||
if (headerClick) {
|
if (headerClick) {
|
||||||
await headerClick(key, e);
|
headerClick(key, event);
|
||||||
}
|
}
|
||||||
await this.onHeaderClick_(key, e);
|
this.onHeaderClick_(key, event);
|
||||||
}}>
|
}}>
|
||||||
{icon}
|
{icon}
|
||||||
<span style={{flex: 1 }}>{label}</span>
|
<span style={{flex: 1 }}>{label}</span>
|
||||||
@ -477,15 +477,13 @@ class SideBarComponent extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async onHeaderClick_(key, event) {
|
onHeaderClick_(key, event) {
|
||||||
const currentHeader = event.currentTarget;
|
const currentHeader = event.currentTarget;
|
||||||
const toggleBlock = +currentHeader.getAttribute('toggleblock');
|
const toggleBlock = +currentHeader.getAttribute('toggleblock');
|
||||||
if (toggleBlock) {
|
if (toggleBlock) {
|
||||||
const toggleKey = `${key}IsExpanded`;
|
const toggleKey = `${key}IsExpanded`;
|
||||||
const isExpanded = this.state[toggleKey];
|
const isExpanded = this.state[toggleKey];
|
||||||
this.setState({
|
this.setState({ [toggleKey]: !isExpanded });
|
||||||
[toggleKey]: !isExpanded
|
|
||||||
});
|
|
||||||
Setting.setValue(toggleKey, !isExpanded);
|
Setting.setValue(toggleKey, !isExpanded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,6 +415,7 @@ class MdToHtml {
|
|||||||
}
|
}
|
||||||
|
|
||||||
applyHighlightedKeywords_(body, keywords) {
|
applyHighlightedKeywords_(body, keywords) {
|
||||||
|
if (!keywords.length) return body;
|
||||||
return StringUtils.surroundKeywords(keywords, body, '<span class="highlighted-keyword">', '</span>');
|
return StringUtils.surroundKeywords(keywords, body, '<span class="highlighted-keyword">', '</span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user