mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Merge pull request #534 from TriliumNext/AutomaticallyShowRecentNotes
Automatically trigger autocomplete on focus.
This commit is contained in:
		
						commit
						eb05c5b919
					
				@ -18,7 +18,6 @@ const TPL = `
 | 
				
			|||||||
            width: 130px;
 | 
					            width: 130px;
 | 
				
			||||||
            text-align: center;
 | 
					            text-align: center;
 | 
				
			||||||
            margin: 10px;
 | 
					            margin: 10px;
 | 
				
			||||||
            padding; 10px;
 | 
					 | 
				
			||||||
            border: 1px transparent solid;
 | 
					            border: 1px transparent solid;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -27,20 +26,35 @@ const TPL = `
 | 
				
			|||||||
            border: 1px solid var(--main-border-color);
 | 
					            border: 1px solid var(--main-border-color);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        .note-detail-empty-results .aa-dropdown-menu {
 | 
				
			||||||
 | 
					            max-height: 50vh;
 | 
				
			||||||
 | 
					            overflow: scroll;
 | 
				
			||||||
 | 
					            border: var(--bs-border-width) solid var(--bs-border-color);
 | 
				
			||||||
 | 
					            border-top: 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        .empty-tab-search .note-autocomplete-input {
 | 
				
			||||||
 | 
					            border-bottom-left-radius: 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        .empty-tab-search .input-clearer-button {
 | 
				
			||||||
 | 
					            border-bottom-right-radius: 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        .workspace-icon {
 | 
					        .workspace-icon {
 | 
				
			||||||
            text-align: center;
 | 
					            text-align: center;
 | 
				
			||||||
            font-size: 500%;
 | 
					            font-size: 500%;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </style>
 | 
					    </style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div class="form-group">
 | 
					    <div class="workspace-notes"></div>
 | 
				
			||||||
 | 
					    <div class="form-group empty-tab-search">
 | 
				
			||||||
        <label>${t('empty.open_note_instruction')}</label>
 | 
					        <label>${t('empty.open_note_instruction')}</label>
 | 
				
			||||||
        <div class="input-group">
 | 
					        <div class="input-group mt-1">
 | 
				
			||||||
            <input class="form-control note-autocomplete" placeholder="${t('empty.search_placeholder')}">
 | 
					            <input class="form-control note-autocomplete" placeholder="${t('empty.search_placeholder')}">
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    
 | 
					    <div class="note-detail-empty-results"></div>
 | 
				
			||||||
    <div class="workspace-notes"></div>
 | 
					 | 
				
			||||||
</div>`;
 | 
					</div>`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class EmptyTypeWidget extends TypeWidget {
 | 
					export default class EmptyTypeWidget extends TypeWidget {
 | 
				
			||||||
@ -51,10 +65,12 @@ export default class EmptyTypeWidget extends TypeWidget {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        this.$widget = $(TPL);
 | 
					        this.$widget = $(TPL);
 | 
				
			||||||
        this.$autoComplete = this.$widget.find(".note-autocomplete");
 | 
					        this.$autoComplete = this.$widget.find(".note-autocomplete");
 | 
				
			||||||
 | 
					        this.$results = this.$widget.find(".note-detail-empty-results");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
 | 
					        noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
 | 
				
			||||||
            hideGoToSelectedNoteButton: true,
 | 
					            hideGoToSelectedNoteButton: true,
 | 
				
			||||||
            allowCreatingNotes: true
 | 
					            allowCreatingNotes: true,
 | 
				
			||||||
 | 
					            container: this.$results
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
            .on('autocomplete:noteselected', function(event, suggestion, dataset) {
 | 
					            .on('autocomplete:noteselected', function(event, suggestion, dataset) {
 | 
				
			||||||
                if (!suggestion.notePath) {
 | 
					                if (!suggestion.notePath) {
 | 
				
			||||||
@ -66,6 +82,7 @@ export default class EmptyTypeWidget extends TypeWidget {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        this.$workspaceNotes = this.$widget.find('.workspace-notes');
 | 
					        this.$workspaceNotes = this.$widget.find('.workspace-notes');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        noteAutocompleteService.showRecentNotes(this.$autoComplete);
 | 
				
			||||||
        super.doRender();
 | 
					        super.doRender();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user