mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	fix attribute name autocomplete, no tooltip preview on path selection
This commit is contained in:
		| @@ -246,7 +246,7 @@ async function showDialog() { | |||||||
|     $dialog.dialog({ |     $dialog.dialog({ | ||||||
|         modal: true, |         modal: true, | ||||||
|         width: 950, |         width: 950, | ||||||
|         height: 500 |         height: 700 | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,10 +6,16 @@ function setupTooltip() { | |||||||
|     $(document).tooltip({ |     $(document).tooltip({ | ||||||
|         items: "body a", |         items: "body a", | ||||||
|         content: function (callback) { |         content: function (callback) { | ||||||
|             let notePath = linkService.getNotePathFromLink($(this).attr("href")); |             const $link = $(this); | ||||||
|  |  | ||||||
|  |             if ($link.hasClass("no-tooltip-preview")) { | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             let notePath = linkService.getNotePathFromLink($link.attr("href")); | ||||||
|  |  | ||||||
|             if (!notePath) { |             if (!notePath) { | ||||||
|                 notePath = $(this).attr("data-note-path"); |                 notePath = $link.attr("data-note-path"); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (notePath) { |             if (notePath) { | ||||||
|   | |||||||
| @@ -206,7 +206,11 @@ async function showPaths(noteId, node) { | |||||||
|         const notePath = parentNotePath ? (parentNotePath + '/' + noteId) : noteId; |         const notePath = parentNotePath ? (parentNotePath + '/' + noteId) : noteId; | ||||||
|         const title = await treeUtils.getNotePathTitle(notePath); |         const title = await treeUtils.getNotePathTitle(notePath); | ||||||
|  |  | ||||||
|         const item = $("<li/>").append(await linkService.createNoteLink(notePath, title)); |         const noteLink = await linkService.createNoteLink(notePath, title); | ||||||
|  |  | ||||||
|  |         noteLink.addClass("no-tooltip-preview"); | ||||||
|  |  | ||||||
|  |         const item = $("<li/>").append(noteLink); | ||||||
|  |  | ||||||
|         if (node.getParent().data.noteId === parentNote.noteId) { |         if (node.getParent().data.noteId === parentNote.noteId) { | ||||||
|             item.addClass("current"); |             item.addClass("current"); | ||||||
|   | |||||||
| @@ -59,17 +59,20 @@ async function createAttribute(attribute) { | |||||||
| } | } | ||||||
|  |  | ||||||
| async function getAttributeNames(type, nameLike) { | async function getAttributeNames(type, nameLike) { | ||||||
|     const names = await sql.getColumn( |     let names; | ||||||
|  |  | ||||||
|  |     if (!nameLike) { | ||||||
|  |         names = BUILTIN_ATTRIBUTES | ||||||
|  |             .filter(attribute => attribute.type === type) | ||||||
|  |             .map(attribute => attribute.name); | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         names = await sql.getColumn( | ||||||
|             `SELECT DISTINCT name  |             `SELECT DISTINCT name  | ||||||
|              FROM attributes  |              FROM attributes  | ||||||
|              WHERE isDeleted = 0 |              WHERE isDeleted = 0 | ||||||
|                AND type = ? |                AND type = ? | ||||||
|            AND name LIKE '%${utils.sanitizeSql(nameLike)}%'`, [ type ]); |                AND name LIKE '%${utils.sanitizeSql(nameLike)}%'`, [type]); | ||||||
|  |  | ||||||
|     for (const attribute of BUILTIN_ATTRIBUTES) { |  | ||||||
|         if (attribute.type === type && !names.includes(attribute.name)) { |  | ||||||
|             names.push(attribute.name); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     names.sort(); |     names.sort(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user