mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
smaller search improvements
This commit is contained in:
parent
526bd81b50
commit
b0e5ab7533
102
package-lock.json
generated
102
package-lock.json
generated
@ -610,9 +610,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/eslint": {
|
||||
"version": "7.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.5.tgz",
|
||||
"integrity": "sha512-Dc6ar9x16BdaR3NSxSF7T4IjL9gxxViJq8RmFd+2UAyA+K6ck2W+gUwfgpG/y9TPyUuBL35109bbULpEynvltA==",
|
||||
"version": "7.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.6.tgz",
|
||||
"integrity": "sha512-I+1sYH+NPQ3/tVqCeUSBwTE/0heyvtXqpIopUUArlBm0Kpocb8FbMa3AZ/ASKIFpN3rnEx932TTXDbt9OXsNDw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/estree": "*",
|
||||
@ -1585,16 +1585,16 @@
|
||||
"integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow=="
|
||||
},
|
||||
"browserslist": {
|
||||
"version": "4.14.7",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.7.tgz",
|
||||
"integrity": "sha512-BSVRLCeG3Xt/j/1cCGj1019Wbty0H+Yvu2AOuZSuoaUWn3RatbL33Cxk+Q4jRMRAbOm0p7SLravLjpnT6s0vzQ==",
|
||||
"version": "4.15.0",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.15.0.tgz",
|
||||
"integrity": "sha512-IJ1iysdMkGmjjYeRlDU8PQejVwxvVO5QOfXH7ylW31GO6LwNRSmm/SgRXtNsEXqMLl2e+2H5eEJ7sfynF8TCaQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caniuse-lite": "^1.0.30001157",
|
||||
"caniuse-lite": "^1.0.30001164",
|
||||
"colorette": "^1.2.1",
|
||||
"electron-to-chromium": "^1.3.591",
|
||||
"electron-to-chromium": "^1.3.612",
|
||||
"escalade": "^3.1.1",
|
||||
"node-releases": "^1.1.66"
|
||||
"node-releases": "^1.1.67"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
@ -1808,9 +1808,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001161",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001161.tgz",
|
||||
"integrity": "sha512-JharrCDxOqPLBULF9/SPa6yMcBRTjZARJ6sc3cuKrPfyIk64JN6kuMINWqA99Xc8uElMFcROliwtz0n9pYej+g==",
|
||||
"version": "1.0.30001165",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001165.tgz",
|
||||
"integrity": "sha512-8cEsSMwXfx7lWSUMA2s08z9dIgsnR5NAqjXP23stdsU3AUWkCr/rr4s4OFtHXn5XXr6+7kam3QFVoYyXNPdJPA==",
|
||||
"dev": true
|
||||
},
|
||||
"caseless": {
|
||||
@ -3206,9 +3206,9 @@
|
||||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.610",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.610.tgz",
|
||||
"integrity": "sha512-eFDC+yVQpEhtlapk4CYDPfV9ajF9cEof5TBcO49L1ETO+aYogrKWDmYpZyxBScMNe8Bo/gJamH4amQ4yyvXg4g==",
|
||||
"version": "1.3.616",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.616.tgz",
|
||||
"integrity": "sha512-CI8L38UN2BEnqXw3/oRIQTmde0LiSeqWSRlPA42ZTYgJQ8fYenzAM2Z3ni+jtILTcrs5aiXZCGJ96Pm+3/yGyQ==",
|
||||
"dev": true
|
||||
},
|
||||
"electron-window-state": {
|
||||
@ -3247,9 +3247,9 @@
|
||||
}
|
||||
},
|
||||
"enhanced-resolve": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.3.2.tgz",
|
||||
"integrity": "sha512-G28GCrglCAH6+EqMN2D+Q2wCUS1O1vVQJBn8ME2I/Api41YBe4vLWWRBOUbwDH7vwzSZdljxwTRVqnf+sm6XqQ==",
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.4.0.tgz",
|
||||
"integrity": "sha512-ZmqfWURB2lConOBM1JdCVfPyMRv5RdKWktLXO6123p97ovVm2CLBgw9t5MBj3jJWA6eHyOeIws9iJQoGFR4euQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
@ -7012,9 +7012,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"tapable": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.1.1.tgz",
|
||||
"integrity": "sha512-Wib1S8m2wdpLbmQz0RBEVosIyvb/ykfKXf3ZIDqvWoMg/zTNm6G/tDSuUM61J1kNCDXWJrLHGSFeMhAG+gAGpQ==",
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz",
|
||||
"integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==",
|
||||
"dev": true
|
||||
},
|
||||
"tar": {
|
||||
@ -7620,9 +7620,9 @@
|
||||
"integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w=="
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.9.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.9.0.tgz",
|
||||
"integrity": "sha512-YnnqIV/uAS5ZrNpctSv378qV7HmbJ74DL+XfvMxzbX1bV9e7eeT6eEWU4wuUw33CNr/HspBh7R/xQlVjTEyAeA==",
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.10.0.tgz",
|
||||
"integrity": "sha512-P0bHAXmIz0zsNcHNLqFmLY1ZtrT+jtBr7FqpuDtA2o7GiHC+zBsfhgK7SmJ1HG7BAEb3G9JoMdSVi7mEDvG3Zg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/eslint-scope": "^3.7.0",
|
||||
@ -7643,7 +7643,7 @@
|
||||
"loader-runner": "^4.1.0",
|
||||
"mime-types": "^2.1.27",
|
||||
"neo-async": "^2.6.2",
|
||||
"pkg-dir": "^4.2.0",
|
||||
"pkg-dir": "^5.0.0",
|
||||
"schema-utils": "^3.0.0",
|
||||
"tapable": "^2.1.1",
|
||||
"terser-webpack-plugin": "^5.0.3",
|
||||
@ -7657,11 +7657,63 @@
|
||||
"integrity": "sha512-XNP0PqF1XD19ZlLKvB7cMmnZswW4C/03pRHgirB30uSJTaS3A3V1/P4sS3HPvFmjoriPCJQs+JDSbm4bL1TxGQ==",
|
||||
"dev": true
|
||||
},
|
||||
"find-up": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
|
||||
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"locate-path": "^6.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
|
||||
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
|
||||
"dev": true
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
||||
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-locate": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"p-limit": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
|
||||
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"yocto-queue": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
|
||||
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-limit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"dev": true
|
||||
},
|
||||
"pkg-dir": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz",
|
||||
"integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"find-up": "^5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -86,7 +86,7 @@
|
||||
"jsdoc": "3.6.6",
|
||||
"lorem-ipsum": "2.0.3",
|
||||
"rcedit": "2.3.0",
|
||||
"webpack": "5.9.0",
|
||||
"webpack": "5.10.0",
|
||||
"webpack-cli": "4.2.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
@ -72,8 +72,7 @@ export default class DialogCommandExecutor extends Component {
|
||||
|
||||
const tabContext = await appContext.tabManager.openTabWithNote(searchNote.noteId, true);
|
||||
|
||||
appContext.triggerCommand('focusOnDetail', {tabId: tabContext.tabId});
|
||||
|
||||
appContext.triggerCommand('focusOnSearchDefinition', {tabId: tabContext.tabId});
|
||||
}
|
||||
|
||||
showBackendLogCommand() {
|
||||
|
@ -51,6 +51,7 @@ const TPL = `
|
||||
display: block;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.note-book-title {
|
||||
|
@ -94,6 +94,10 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
||||
// not updating the title specifically since the synced title might be older than what the user is currently typing
|
||||
this.setProtectedStatus(this.note);
|
||||
}
|
||||
|
||||
if (loadResults.isNoteReloaded(this.noteId, this.componentId)) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
beforeUnloadEvent() {
|
||||
|
@ -79,8 +79,6 @@ export default class SearchDefinitionWidget extends TabAwareWidget {
|
||||
|
||||
this.$component = this.$widget.find('.search-definition-widget');
|
||||
|
||||
this.$settingsArea = this.$widget.find('.search-settings');
|
||||
|
||||
this.spacedUpdate = new SpacedUpdate(() => this.updateSearch(), 2000);
|
||||
|
||||
this.$limitSearchToSubtree = this.$widget.find('.limit-search-to-subtree');
|
||||
@ -107,6 +105,16 @@ export default class SearchDefinitionWidget extends TabAwareWidget {
|
||||
subNoteId ? { type: 'label', name: 'subTreeNoteId', value: subNoteId } : undefined,
|
||||
].filter(it => !!it));
|
||||
|
||||
if (this.note.title.startsWith('Search: ')) {
|
||||
await server.put(`notes/${this.noteId}/change-title`, {
|
||||
title: 'Search: ' + (searchString.length < 30 ? searchString : `${searchString.substr(0, 30)}…`)
|
||||
});
|
||||
}
|
||||
|
||||
await this.refreshResults();
|
||||
}
|
||||
|
||||
async refreshResults() {
|
||||
await treeCache.reloadNotes([this.noteId]);
|
||||
}
|
||||
|
||||
@ -115,6 +123,12 @@ export default class SearchDefinitionWidget extends TabAwareWidget {
|
||||
this.$searchString.val(this.note.getLabelValue('searchString'));
|
||||
this.$searchWithinNoteContent.prop('checked', this.note.getLabelValue('includeNoteContent') === 'true');
|
||||
this.$limitSearchToSubtree.val(this.note.getLabelValue('subTreeNoteId'));
|
||||
|
||||
this.refreshResults(); // important specifically when this search note was not yet refreshed
|
||||
}
|
||||
|
||||
focusOnSearchDefinitionEvent() {
|
||||
this.$searchString.focus();
|
||||
}
|
||||
|
||||
getContent() {
|
||||
|
@ -60,11 +60,13 @@ function createSqlConsole() {
|
||||
function createSearchNote() {
|
||||
const today = dateUtils.localNowDate();
|
||||
|
||||
const todayNote = dateNoteService.getDateNote(today);
|
||||
const searchHome =
|
||||
attributeService.getNoteWithLabel('searchHome')
|
||||
|| dateNoteService.getDateNote(today);
|
||||
|
||||
const {note} = noteService.createNewNote({
|
||||
parentNoteId: todayNote.noteId,
|
||||
title: 'Search',
|
||||
parentNoteId: searchHome.noteId,
|
||||
title: 'Search: ',
|
||||
content: "",
|
||||
type: 'search',
|
||||
mime: 'application/json'
|
||||
|
@ -36,6 +36,7 @@ const BUILTIN_ATTRIBUTES = [
|
||||
{ type: 'label', name: 'workspace' },
|
||||
{ type: 'label', name: 'workspaceIconClass' },
|
||||
{ type: 'label', name: 'workspaceTabBackgroundColor' },
|
||||
{ type: 'label', name: 'searchHome' },
|
||||
|
||||
// relation names
|
||||
{ type: 'relation', name: 'runOnNoteCreation', isDangerous: true },
|
||||
|
Loading…
x
Reference in New Issue
Block a user