mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
reimplemented triggering search from URL, fixes #385
This commit is contained in:
parent
ac0d61e9b4
commit
b3381a3b53
@ -117,6 +117,10 @@ export default class TabManager extends Component {
|
|||||||
parsedFromUrl.viewScope,
|
parsedFromUrl.viewScope,
|
||||||
parsedFromUrl.hoistedNoteId
|
parsedFromUrl.hoistedNoteId
|
||||||
);
|
);
|
||||||
|
} else if (parsedFromUrl.searchString) {
|
||||||
|
await appContext.triggerCommand('searchNotes', {
|
||||||
|
searchString: parsedFromUrl.searchString
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
@ -153,6 +153,7 @@ function parseNavigationStateFromUrl(url) {
|
|||||||
};
|
};
|
||||||
let ntxId = null;
|
let ntxId = null;
|
||||||
let hoistedNoteId = null;
|
let hoistedNoteId = null;
|
||||||
|
let searchString = null;
|
||||||
|
|
||||||
if (paramString) {
|
if (paramString) {
|
||||||
for (const pair of paramString.split("&")) {
|
for (const pair of paramString.split("&")) {
|
||||||
@ -164,6 +165,8 @@ function parseNavigationStateFromUrl(url) {
|
|||||||
ntxId = value;
|
ntxId = value;
|
||||||
} else if (name === 'hoistedNoteId') {
|
} else if (name === 'hoistedNoteId') {
|
||||||
hoistedNoteId = value;
|
hoistedNoteId = value;
|
||||||
|
} else if (name === 'searchString') {
|
||||||
|
searchString = value; // supports triggering search from URL, e.g. #?searchString=blabla
|
||||||
} else if (['viewMode', 'attachmentId'].includes(name)) {
|
} else if (['viewMode', 'attachmentId'].includes(name)) {
|
||||||
viewScope[name] = value;
|
viewScope[name] = value;
|
||||||
} else {
|
} else {
|
||||||
@ -177,7 +180,8 @@ function parseNavigationStateFromUrl(url) {
|
|||||||
noteId: treeService.getNoteIdFromUrl(notePath),
|
noteId: treeService.getNoteIdFromUrl(notePath),
|
||||||
ntxId,
|
ntxId,
|
||||||
hoistedNoteId,
|
hoistedNoteId,
|
||||||
viewScope
|
viewScope,
|
||||||
|
searchString
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ export default class SearchString extends AbstractSearchOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
focusOnSearchDefinitionEvent() {
|
focusOnSearchDefinitionEvent() {
|
||||||
this.$searchString.val(appContext.lastSearchString).focus().select();
|
this.$searchString.val(this.$searchString.val().trim() || appContext.lastSearchString).focus().select();
|
||||||
this.spacedUpdate.scheduleUpdate();
|
this.spacedUpdate.scheduleUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user