From a87b7106264b9ed9a10d5041d1391f76e742d9c7 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 15 Aug 2020 21:24:17 +0200 Subject: [PATCH] attribute fixes --- package-lock.json | 20 ++++++++++---------- package.json | 2 +- src/public/app/services/note_tooltip.js | 8 +++++++- src/public/app/widgets/attribute_detail.js | 10 +++++++--- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index e2eaf216b..e0cc91b56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1882,7 +1882,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -2930,7 +2930,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", @@ -4789,9 +4789,9 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" }, "helmet": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/helmet/-/helmet-4.0.0.tgz", - "integrity": "sha512-HyoRKKHhWhO6+EBfgRLkuZR4/+NXc1nJB7x0bWwW89i9eoPciK0qUqyZNOA/zowpgrW9C4+J5toqMkZrpBOlkg==" + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-4.1.0.tgz", + "integrity": "sha512-KWy75fYN8hOG2Rhl8e5B3WhOzb0by1boQum85TiddIE9iu6gV+TXbUjVC17wfej0o/ZUpqB9kxM0NFCZRMzf+Q==" }, "hosted-git-info": { "version": "2.8.5", @@ -6028,7 +6028,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "minipass": { @@ -6149,7 +6149,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -6157,7 +6157,7 @@ "dependencies": { "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" } } @@ -7098,7 +7098,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "~1.0.0", @@ -8176,7 +8176,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" diff --git a/package.json b/package.json index 97ad90f6f..ae668b3ab 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "express-session": "1.17.1", "file-type": "14.7.1", "fs-extra": "9.0.1", - "helmet": "4.0.0", + "helmet": "4.1.0", "html": "1.0.0", "html2plaintext": "2.1.2", "http-proxy-agent": "4.0.1", diff --git a/src/public/app/services/note_tooltip.js b/src/public/app/services/note_tooltip.js index d9e6bd14f..59d09f4ff 100644 --- a/src/public/app/services/note_tooltip.js +++ b/src/public/app/services/note_tooltip.js @@ -45,7 +45,13 @@ async function mouseEnterHandler() { const note = await treeCache.getNote(noteId); const noteComplement = await treeCache.getNoteComplement(noteId); - const html = '
' + await renderTooltip(note, noteComplement) + '
'; + const content = await renderTooltip(note, noteComplement); + + if (utils.isHtmlEmpty(content)) { + return; + } + + const html = '
' + content + '
'; // we need to check if we're still hovering over the element // since the operation to get tooltip content was async, it is possible that diff --git a/src/public/app/widgets/attribute_detail.js b/src/public/app/widgets/attribute_detail.js index 248c11a5e..81a9dc0ab 100644 --- a/src/public/app/widgets/attribute_detail.js +++ b/src/public/app/widgets/attribute_detail.js @@ -159,6 +159,11 @@ const ATTR_TITLES = { }; export default class AttributeDetailWidget extends TabAwareWidget { + isEnabled() { + // this widget is not activated in a standard way + return false; + } + doRender() { this.relatedNotesSpacedUpdate = new SpacedUpdate(async () => this.updateRelatedNotes(), 1000); @@ -262,8 +267,6 @@ export default class AttributeDetailWidget extends TabAwareWidget { this.hide(); } }); - - this.toggleInt(false); // initial state is hidden } userEditedAttribute() { @@ -293,7 +296,8 @@ export default class AttributeDetailWidget extends TabAwareWidget { this.allAttributes = allAttributes; this.attribute = attribute; - await this.updateRelatedNotes(); + // can be slightly slower so just make it async + this.updateRelatedNotes(); this.$attrSaveDeleteButtonContainer.toggle(!!isOwned);