Skip to content

Build your personal knowledge base with Trilium Notes

disable property widgets if not applicable

zadam17073096cfc2
diff --git a/src/public/app/widgets/type_property_widgets/file_properties.js b/src/public/app/widgets/type_property_widgets/file_properties.js
index 4bd58932a3..6af0816e1a 100644
--- a/src/public/app/widgets/type_property_widgets/file_properties.js
+++ b/src/public/app/widgets/type_property_widgets/file_properties.js
@@ -57,9 +57,13 @@ const TPL = `
export default class FilePropertiesWidget extends TabAwareWidget {
static getType() { return "file"; }
+ isEnabled() {
+ return this.note && this.note.type === 'file';
+ }
+
renderTitle(note) {
return {
- show: note.type === 'file',
+ show: this.isEnabled(),
activate: true,
$title: 'File'
};
diff --git a/src/public/app/widgets/type_property_widgets/image_properties.js b/src/public/app/widgets/type_property_widgets/image_properties.js
index d08cf6a142..0359d24ad5 100644
--- a/src/public/app/widgets/type_property_widgets/image_properties.js
+++ b/src/public/app/widgets/type_property_widgets/image_properties.js
@@ -37,9 +37,13 @@ const TPL = `
export default class ImagePropertiesWidget extends TabAwareWidget {
static getType() { return "image"; }
+ isEnabled() {
+ return this.note && this.note.type === 'image';
+ }
+
renderTitle(note) {
return {
- show: note.type === 'image',
+ show: this.isEnabled(),
activate: true,
$title: 'Image'
};
diff --git a/src/public/app/widgets/type_property_widgets/note_properties.js b/src/public/app/widgets/type_property_widgets/note_properties.js
index e5a9f11747..6049246cbd 100644
--- a/src/public/app/widgets/type_property_widgets/note_properties.js
+++ b/src/public/app/widgets/type_property_widgets/note_properties.js
@@ -15,9 +15,13 @@ const TPL = `
export default class NotePropertiesWidget extends TabAwareWidget {
static getType() { return "note-properties"; }
+ isEnabled() {
+ return this.note && !!this.note.getLabelValue('pageUrl');
+ }
+
renderTitle(note) {
return {
- show: !!note.getLabelValue('pageUrl'),
+ show: this.isEnabled(),
activate: true,
$title: 'Info'
};
diff --git a/src/public/app/widgets/type_property_widgets/search_definition.js b/src/public/app/widgets/type_property_widgets/search_definition.js
index ed15c4eda4..4df0cef686 100644
--- a/src/public/app/widgets/type_property_widgets/search_definition.js
+++ b/src/public/app/widgets/type_property_widgets/search_definition.js
@@ -184,9 +184,13 @@ for (const clazz of [
export default class SearchDefinitionWidget extends TabAwareWidget {
static getType() { return "search"; }
+ isEnabled() {
+ return this.note && this.note.type === 'search';
+ }
+
renderTitle(note) {
return {
- show: note.type === 'search',
+ show: this.isEnabled(),
activate: true,
$title: 'Search'
};