mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
added relation name autocomplete to relation map connection creation
This commit is contained in:
@@ -236,7 +236,7 @@ async function showDialog() {
|
||||
$dialog.on('focus', '.attribute-name', function (e) {
|
||||
attributeAutocompleteService.initAttributeNameAutocomplete({
|
||||
$el: $(this),
|
||||
attrTypeFunc: () => {
|
||||
attributeType: () => {
|
||||
const attribute = attributesModel.getTargetAttribute(this);
|
||||
return (attribute().type === 'relation' || attribute().type === 'relation-definition') ? 'relation' : 'label';
|
||||
},
|
||||
|
||||
@@ -4,19 +4,28 @@ const $answer = $("#prompt-dialog-answer");
|
||||
const $form = $("#prompt-dialog-form");
|
||||
|
||||
let resolve;
|
||||
let shownCb;
|
||||
|
||||
function ask(message, defaultValue = '') {
|
||||
function ask({ message, defaultValue, shown }) {
|
||||
glob.activeDialog = $dialog;
|
||||
|
||||
shownCb = shown;
|
||||
|
||||
$question.text(message);
|
||||
$answer.val(defaultValue);
|
||||
$answer.val(defaultValue || "");
|
||||
|
||||
$dialog.modal();
|
||||
|
||||
return new Promise((res, rej) => { resolve = res; });
|
||||
}
|
||||
|
||||
$dialog.on('shown.bs.modal', () => $answer.focus().select());
|
||||
$dialog.on('shown.bs.modal', () => {
|
||||
if (shownCb) {
|
||||
shownCb({ $dialog, $question, $answer, $form });
|
||||
}
|
||||
|
||||
$answer.focus().select();
|
||||
});
|
||||
|
||||
$dialog.on("hidden.bs.modal", () => {
|
||||
if (resolve) {
|
||||
|
||||
Reference in New Issue
Block a user