From 427234293e67351cfbb768d2e14dab36f5f15f5f Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 14 Nov 2018 08:36:19 +0100 Subject: [PATCH] tooltip for image note --- src/public/javascripts/services/tooltip.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/public/javascripts/services/tooltip.js b/src/public/javascripts/services/tooltip.js index 22480915e..863a87527 100644 --- a/src/public/javascripts/services/tooltip.js +++ b/src/public/javascripts/services/tooltip.js @@ -99,11 +99,21 @@ async function renderTooltip(note, attributes) { content += note.content; } else if (note.type === 'code') { - content += $("
").text(note.content).prop('outerHTML');
+        content += $("
")
+            .text(note.content)
+            .prop('outerHTML');
+    }
+    else if (note.type === 'image') {
+        content += $("")
+            .prop("src", `/api/images/${note.noteId}/${note.title}`)
+            .prop("style", "max-width: 300px; max-height: 300px;")
+            .prop('outerHTML');
+
+        console.log(content);
     }
     // other types of notes don't have tooltip preview
 
-    if (!$(content).text().trim()) {
+    if (!$(content).text().trim() && note.type !== 'image') {
         return "";
     }