Show hint to re-index vault if wonky results in Obsidian search modal

Remove spurious indentation in Obsidian styles.css

Resolves #207
This commit is contained in:
Debanjum Singh Solanky 2023-06-18 04:51:25 -07:00
parent 595cc5b0f5
commit a44cde2865
2 changed files with 26 additions and 9 deletions

View file

@ -127,6 +127,15 @@ export class KhojSearchModal extends SuggestModal<SearchResult> {
let entry_snipped_indicator = result.entry.split('\n').length > lines_to_render ? ' **...**' : '';
let snipped_entry = result.entry.split('\n').slice(0, lines_to_render).join('\n');
// Show reindex hint on first search result
if (this.resultContainerEl.children.length == 1) {
let infoHintEl = createEl("div",{ cls: 'khoj-info-hint' });
el.insertAdjacentElement("beforebegin", infoHintEl);
setTimeout(() => {
infoHintEl.setText('Unexpected results? Try re-index your vault from the Khoj plugin settings to fix it.');
}, 3000);
}
// Show filename of each search result for context
el.createEl("div",{ cls: 'khoj-result-file' }).setText(filename ?? "");
let result_el = el.createEl("div", { cls: 'khoj-result-entry' })

View file

@ -148,9 +148,9 @@ If your plugin does not need CSS, delete this file.
.khoj-result-file {
font-weight: 600;
}
}
.khoj-result-entry {
.khoj-result-entry {
color: var(--text-muted);
margin-left: 2em;
padding-left: 0.5em;
@ -160,17 +160,25 @@ If your plugin does not need CSS, delete this file.
border-left-style: solid;
border-left-color: var(--color-accent-2);
white-space: normal;
}
}
.khoj-result-entry > * {
.khoj-result-entry > * {
font-size: var(--font-ui-medium);
}
}
.khoj-result-entry > p {
.khoj-result-entry > p {
margin-top: 0.2em;
margin-bottom: 0.2em;
}
}
.khoj-result-entry p br {
.khoj-result-entry p br {
display: none;
}
}
.khoj-info-hint {
color: var(--text-muted);
font-size: var(--font-ui-small);
font-style: italic;
text-align: center;
margin-bottom: 0.5em;
}