mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
autocompletes for attribute detail
This commit is contained in:
parent
3261fea67f
commit
a3a2f1a2b4
6
package-lock.json
generated
6
package-lock.json
generated
@ -5366,9 +5366,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jasmine": {
|
"jasmine": {
|
||||||
"version": "3.6.0",
|
"version": "3.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.6.1.tgz",
|
||||||
"integrity": "sha512-9PSggisk7ZKMGDBjky0wHq4vG7SdWWSBDKF2LkikG97mFgKjzPytl3jIZERsWRI8nuGZ5JCaQIEEVS0De61yGA==",
|
"integrity": "sha512-Jqp8P6ZWkTVFGmJwBK46p+kJNrZCdqkQ4GL+PGuBXZwK1fM4ST9BizkYgIwCFqYYqnTizAy6+XG2Ej5dFrej9Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"fast-glob": "^2.2.6",
|
"fast-glob": "^2.2.6",
|
||||||
|
@ -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")) {
|
if (!$el.hasClass("aa-input")) {
|
||||||
const attributeName = $el.parent().parent().find('.attribute-name').val();
|
const attributeName = nameCallback();
|
||||||
|
|
||||||
if (attributeName.trim() === "") {
|
if (attributeName.trim() === "") {
|
||||||
return;
|
return;
|
||||||
@ -74,4 +74,4 @@ async function initLabelValueAutocomplete({ $el, open }) {
|
|||||||
export default {
|
export default {
|
||||||
initAttributeNameAutocomplete,
|
initAttributeNameAutocomplete,
|
||||||
initLabelValueAutocomplete
|
initLabelValueAutocomplete
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import treeCache from "../services/tree_cache.js";
|
|||||||
import treeService from "../services/tree.js";
|
import treeService from "../services/tree.js";
|
||||||
import linkService from "../services/link.js";
|
import linkService from "../services/link.js";
|
||||||
import BasicWidget from "./basic_widget.js";
|
import BasicWidget from "./basic_widget.js";
|
||||||
|
import attributeAutocompleteService from "../services/attribute_autocomplete.js";
|
||||||
import noteAutocompleteService from "../services/note_autocomplete.js";
|
import noteAutocompleteService from "../services/note_autocomplete.js";
|
||||||
import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.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 = this.$widget.find('.attr-input-name');
|
||||||
this.$attrInputName.on('keyup', () => this.updateAttributeInEditor());
|
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.$attrRowValue = this.$widget.find('.attr-row-value');
|
||||||
this.$attrInputValue = this.$widget.find('.attr-input-value');
|
this.$attrInputValue = this.$widget.find('.attr-input-value');
|
||||||
this.$attrInputValue.on('keyup', () => this.updateAttributeInEditor());
|
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.$attrRowPromoted = this.$widget.find('.attr-row-promoted');
|
||||||
this.$attrInputPromoted = this.$widget.find('.attr-input-promoted');
|
this.$attrInputPromoted = this.$widget.find('.attr-input-promoted');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user