Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
autocompletes for attribute detail
zadama3a2f1a2b497
diff --git a/package-lock.json b/package-lock.jsonindex 8e777db8a5..2a23ed7f5e 100644--- a/package-lock.json+++ b/package-lock.json@@ -5366,9 +5366,9 @@}},"jasmine": {- "version": "3.6.0",- "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.6.0.tgz",- "integrity": "sha512-9PSggisk7ZKMGDBjky0wHq4vG7SdWWSBDKF2LkikG97mFgKjzPytl3jIZERsWRI8nuGZ5JCaQIEEVS0De61yGA==",+ "version": "3.6.1",+ "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.6.1.tgz",+ "integrity": "sha512-Jqp8P6ZWkTVFGmJwBK46p+kJNrZCdqkQ4GL+PGuBXZwK1fM4ST9BizkYgIwCFqYYqnTizAy6+XG2Ej5dFrej9Q==","dev": true,"requires": {"fast-glob": "^2.2.6",diff --git a/src/public/app/services/attribute_autocomplete.js b/src/public/app/services/attribute_autocomplete.jsindex 694c9e0c07..2f32577054 100644--- a/src/public/app/services/attribute_autocomplete.js+++ b/src/public/app/services/attribute_autocomplete.js@@ -33,9 +33,9 @@ function initAttributeNameAutocomplete({ $el, attributeType, open }) {}}-async function initLabelValueAutocomplete({ $el, open }) {+async function initLabelValueAutocomplete({ $el, open, nameCallback }) {if (!$el.hasClass("aa-input")) {- const attributeName = $el.parent().parent().find('.attribute-name').val();+ const attributeName = nameCallback();if (attributeName.trim() === "") {return;@@ -74,4 +74,4 @@ async function initLabelValueAutocomplete({ $el, open }) {export default {initAttributeNameAutocomplete,initLabelValueAutocomplete-}\ No newline at end of file+}diff --git a/src/public/app/widgets/attribute_detail.js b/src/public/app/widgets/attribute_detail.jsindex 054e68becf..697414d66e 100644--- a/src/public/app/widgets/attribute_detail.js+++ b/src/public/app/widgets/attribute_detail.js@@ -3,6 +3,7 @@ import treeCache from "../services/tree_cache.js";import treeService from "../services/tree.js";import linkService from "../services/link.js";import BasicWidget from "./basic_widget.js";+import attributeAutocompleteService from "../services/attribute_autocomplete.js";import noteAutocompleteService from "../services/note_autocomplete.js";import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js';@@ -157,9 +158,24 @@ export default class AttributeDetailWidget extends BasicWidget {this.$attrInputName = this.$widget.find('.attr-input-name');this.$attrInputName.on('keyup', () => this.updateAttributeInEditor());+ this.$attrInputName.on('focus', () => {+ attributeAutocompleteService.initAttributeNameAutocomplete({+ $el: this.$attrInputName,+ attributeType: () => ['relation', 'relation-definition'].includes(this.attrType) ? 'relation' : 'label',+ open: true+ });+ });+this.$attrRowValue = this.$widget.find('.attr-row-value');this.$attrInputValue = this.$widget.find('.attr-input-value');this.$attrInputValue.on('keyup', () => this.updateAttributeInEditor());+ this.$attrInputValue.on('focus', () => {+ attributeAutocompleteService.initLabelValueAutocomplete({+ $el: this.$attrInputValue,+ open: true,+ nameCallback: () => this.$attrInputName.val()+ });+ });this.$attrRowPromoted = this.$widget.find('.attr-row-promoted');this.$attrInputPromoted = this.$widget.find('.attr-input-promoted');