mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-27 01:51:34 +08:00 
			
		
		
		
	"go to selected note" button now has also note tooltip
This commit is contained in:
		
							parent
							
								
									19a07c699c
								
							
						
					
					
						commit
						8a3f508825
					
				| @ -2,7 +2,8 @@ import server from "./server.js"; | ||||
| import noteDetailService from "./note_detail.js"; | ||||
| import treeService from './tree.js'; | ||||
| 
 | ||||
| const SELECTED_PATH_KEY = "selected-path"; | ||||
| // this key needs to have this value so it's hit by the tooltip
 | ||||
| const SELECTED_PATH_KEY = "data-note-path"; | ||||
| 
 | ||||
| async function autocompleteSource(term, cb) { | ||||
|     const result = await server.get('autocomplete' | ||||
| @ -36,17 +37,16 @@ function initNoteAutocomplete($el, options) { | ||||
| 
 | ||||
|         $el.addClass("note-autocomplete-input"); | ||||
| 
 | ||||
|         const $clearTextButton = $("<span>") | ||||
|         const $clearTextButton = $("<a>") | ||||
|                 .addClass("input-group-text input-clearer-button jam jam-close") | ||||
|                 .prop("title", "Clear text field"); | ||||
| 
 | ||||
|         const $showRecentNotesButton = $("<span>") | ||||
|         const $showRecentNotesButton = $("<a>") | ||||
|                 .addClass("input-group-text show-recent-notes-button jam jam-clock") | ||||
|                 .prop("title", "Show recent notes"); | ||||
| 
 | ||||
|         const $goToSelectedNoteButton = $("<span>") | ||||
|             .addClass("input-group-text go-to-selected-note-button jam jam-arrow-right") | ||||
|             .prop("title", "Go to selected note"); | ||||
|         const $goToSelectedNoteButton = $("<a>") | ||||
|             .addClass("input-group-text go-to-selected-note-button jam jam-arrow-right"); | ||||
| 
 | ||||
|         const $sideButtons = $("<div>") | ||||
|             .addClass("input-group-append") | ||||
| @ -105,19 +105,20 @@ $.fn.getSelectedPath = function() { | ||||
|         return ""; | ||||
|     } | ||||
|     else { | ||||
|         return $(this).data(SELECTED_PATH_KEY); | ||||
|         return $(this).attr(SELECTED_PATH_KEY); | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| $.fn.setSelectedPath = function(path) { | ||||
|     path = path || ""; | ||||
| 
 | ||||
|     $(this).data(SELECTED_PATH_KEY, path); | ||||
|     $(this).attr(SELECTED_PATH_KEY, path); | ||||
| 
 | ||||
|     $(this) | ||||
|         .closest(".input-group") | ||||
|         .find(".go-to-selected-note-button") | ||||
|         .toggleClass("disabled", !path.trim()); | ||||
|         .toggleClass("disabled", !path.trim()) | ||||
|         .attr(SELECTED_PATH_KEY, path); // we also set attr here so tooltip can be displayed
 | ||||
| }; | ||||
| 
 | ||||
| ko.bindingHandlers.noteAutocomplete = { | ||||
|  | ||||
| @ -7,7 +7,7 @@ function setupTooltip() { | ||||
|     $(document).on("mouseenter", "a", async function() { | ||||
|         const $link = $(this); | ||||
| 
 | ||||
|         if ($link.hasClass("no-tooltip-preview")) { | ||||
|         if ($link.hasClass("no-tooltip-preview") || $link.hasClass("disabled")) { | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
| @ -54,7 +54,7 @@ function setupTooltip() { | ||||
|     }); | ||||
| 
 | ||||
|     // close any tooltip after click, this fixes the problem that sometimes tooltips remained on the screen
 | ||||
|     $(document).on("click", () => $('[rel=tooltip]').tooltip("hide")); | ||||
|     $(document).on("click", () => $('.tooltip').remove()); | ||||
| } | ||||
| 
 | ||||
| async function renderTooltip(note, attributes) { | ||||
|  | ||||
| @ -483,9 +483,9 @@ html.theme-dark body { | ||||
|     padding-right: 3px; | ||||
| } | ||||
| 
 | ||||
| .go-to-selected-note-button.disabled { | ||||
| .go-to-selected-note-button.disabled, .go-to-selected-note-button.disabled:hover { | ||||
|     cursor: inherit; | ||||
|     color: #ccc; | ||||
|     color: #ccc !important; | ||||
| } | ||||
| 
 | ||||
| .note-autocomplete-input { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner