mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Merge pull request #4084 from AndrewPluzhnikov/fix-868
Implement saving of global search string.
This commit is contained in:
		
						commit
						6ec6d66f17
					
				@ -2,6 +2,7 @@ import AbstractSearchOption from "./abstract_search_option.js";
 | 
				
			|||||||
import SpacedUpdate from "../../services/spaced_update.js";
 | 
					import SpacedUpdate from "../../services/spaced_update.js";
 | 
				
			||||||
import server from "../../services/server.js";
 | 
					import server from "../../services/server.js";
 | 
				
			||||||
import shortcutService from "../../services/shortcuts.js";
 | 
					import shortcutService from "../../services/shortcuts.js";
 | 
				
			||||||
 | 
					import appContext from "../../components/app_context.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TPL = `
 | 
					const TPL = `
 | 
				
			||||||
<tr>
 | 
					<tr>
 | 
				
			||||||
@ -56,6 +57,7 @@ export default class SearchString extends AbstractSearchOption {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        this.spacedUpdate = new SpacedUpdate(async () => {
 | 
					        this.spacedUpdate = new SpacedUpdate(async () => {
 | 
				
			||||||
            const searchString = this.$searchString.val();
 | 
					            const searchString = this.$searchString.val();
 | 
				
			||||||
 | 
					            appContext.lastSearchString = searchString;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            await this.setAttribute('label', 'searchString', searchString);
 | 
					            await this.setAttribute('label', 'searchString', searchString);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -84,6 +86,7 @@ export default class SearchString extends AbstractSearchOption {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    focusOnSearchDefinitionEvent() {
 | 
					    focusOnSearchDefinitionEvent() {
 | 
				
			||||||
        this.$searchString.focus();
 | 
					        this.$searchString.val(appContext.lastSearchString).focus().select();
 | 
				
			||||||
 | 
					        this.spacedUpdate.scheduleUpdate();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user