mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
close currently active dialog if a different one is activated
This commit is contained in:
parent
27659805f6
commit
4cde65d171
@ -1,4 +1,5 @@
|
|||||||
import server from "../services/server.js";
|
import server from "../services/server.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#about-dialog");
|
const $dialog = $("#about-dialog");
|
||||||
const $appVersion = $("#app-version");
|
const $appVersion = $("#app-version");
|
||||||
@ -9,6 +10,8 @@ const $buildRevision = $("#build-revision");
|
|||||||
const $dataDirectory = $("#data-directory");
|
const $dataDirectory = $("#data-directory");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
const appInfo = await server.get('app-info');
|
const appInfo = await server.get('app-info');
|
||||||
|
|
||||||
$appVersion.text(appInfo.appVersion);
|
$appVersion.text(appInfo.appVersion);
|
||||||
|
@ -3,6 +3,7 @@ import linkService from '../services/link.js';
|
|||||||
import noteDetailService from '../services/note_detail.js';
|
import noteDetailService from '../services/note_detail.js';
|
||||||
import treeUtils from '../services/tree_utils.js';
|
import treeUtils from '../services/tree_utils.js';
|
||||||
import noteAutocompleteService from "../services/note_autocomplete.js";
|
import noteAutocompleteService from "../services/note_autocomplete.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#add-link-dialog");
|
const $dialog = $("#add-link-dialog");
|
||||||
const $form = $("#add-link-form");
|
const $form = $("#add-link-form");
|
||||||
@ -28,6 +29,8 @@ async function showDialogForClone() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function showDialog(linkType) {
|
async function showDialog(linkType) {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
if (noteDetailService.getActiveNoteType() === 'text') {
|
if (noteDetailService.getActiveNoteType() === 'text') {
|
||||||
|
@ -3,6 +3,7 @@ import server from '../services/server.js';
|
|||||||
import infoService from "../services/info.js";
|
import infoService from "../services/info.js";
|
||||||
import treeUtils from "../services/tree_utils.js";
|
import treeUtils from "../services/tree_utils.js";
|
||||||
import attributeAutocompleteService from "../services/attribute_autocomplete.js";
|
import attributeAutocompleteService from "../services/attribute_autocomplete.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#attributes-dialog");
|
const $dialog = $("#attributes-dialog");
|
||||||
const $saveAttributesButton = $("#save-attributes-button");
|
const $saveAttributesButton = $("#save-attributes-button");
|
||||||
@ -254,6 +255,8 @@ function AttributesModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
// lazily apply bindings on first use
|
// lazily apply bindings on first use
|
||||||
if (!ko.dataFor($dialog[0])) {
|
if (!ko.dataFor($dialog[0])) {
|
||||||
ko.applyBindings(attributesModel, $dialog[0]);
|
ko.applyBindings(attributesModel, $dialog[0]);
|
||||||
|
@ -3,6 +3,7 @@ import server from '../services/server.js';
|
|||||||
import treeCache from "../services/tree_cache.js";
|
import treeCache from "../services/tree_cache.js";
|
||||||
import treeUtils from "../services/tree_utils.js";
|
import treeUtils from "../services/tree_utils.js";
|
||||||
import infoService from "../services/info.js";
|
import infoService from "../services/info.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#branch-prefix-dialog");
|
const $dialog = $("#branch-prefix-dialog");
|
||||||
const $form = $("#branch-prefix-form");
|
const $form = $("#branch-prefix-form");
|
||||||
@ -12,6 +13,8 @@ const $noteTitle = $('#branch-prefix-note-title');
|
|||||||
let branchId;
|
let branchId;
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$dialog.modal();
|
$dialog.modal();
|
||||||
|
@ -6,6 +6,8 @@ const $dialog = $("#event-log-dialog");
|
|||||||
const $list = $("#event-log-list");
|
const $list = $("#event-log-list");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$dialog.modal();
|
$dialog.modal();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import treeService from '../services/tree.js';
|
import treeService from '../services/tree.js';
|
||||||
import treeUtils from "../services/tree_utils.js";
|
import treeUtils from "../services/tree_utils.js";
|
||||||
import utils from "../services/utils.js";
|
import utils from "../services/utils.js";
|
||||||
import protectedSessionHolder from "../services/protected_session_holder.js";
|
|
||||||
import messagingService from "../services/messaging.js";
|
import messagingService from "../services/messaging.js";
|
||||||
import infoService from "../services/info.js";
|
import infoService from "../services/info.js";
|
||||||
|
|
||||||
@ -20,6 +19,8 @@ const $opmlVersions = $("#opml-versions");
|
|||||||
let exportId = '';
|
let exportId = '';
|
||||||
|
|
||||||
async function showDialog(defaultType) {
|
async function showDialog(defaultType) {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
// each opening of the dialog resets the exportId so we don't associate it with previous exports anymore
|
// each opening of the dialog resets the exportId so we don't associate it with previous exports anymore
|
||||||
exportId = '';
|
exportId = '';
|
||||||
$exportButton.removeAttr("disabled");
|
$exportButton.removeAttr("disabled");
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#help-dialog");
|
const $dialog = $("#help-dialog");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$dialog.modal();
|
$dialog.modal();
|
||||||
|
@ -21,6 +21,8 @@ const $explodeArchivesCheckbox = $("#explode-archives-checkbox");
|
|||||||
let importId;
|
let importId;
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
// each opening of the dialog resets the importId so we don't associate it with previous imports anymore
|
// each opening of the dialog resets the importId so we don't associate it with previous imports anymore
|
||||||
importId = '';
|
importId = '';
|
||||||
$importProgressCountWrapper.hide();
|
$importProgressCountWrapper.hide();
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#info-dialog");
|
const $dialog = $("#info-dialog");
|
||||||
const $infoContent = $("#info-dialog-content");
|
const $infoContent = $("#info-dialog-content");
|
||||||
const $okButton = $("#info-dialog-ok-button");
|
const $okButton = $("#info-dialog-ok-button");
|
||||||
@ -5,6 +7,8 @@ const $okButton = $("#info-dialog-ok-button");
|
|||||||
let resolve;
|
let resolve;
|
||||||
|
|
||||||
function info(message) {
|
function info(message) {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$infoContent.text(message);
|
$infoContent.text(message);
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
import treeService from '../services/tree.js';
|
import treeService from '../services/tree.js';
|
||||||
import searchNotesService from '../services/search_notes.js';
|
import searchNotesService from '../services/search_notes.js';
|
||||||
import noteAutocompleteService from '../services/note_autocomplete.js';
|
import noteAutocompleteService from '../services/note_autocomplete.js';
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#jump-to-note-dialog");
|
const $dialog = $("#jump-to-note-dialog");
|
||||||
const $autoComplete = $("#jump-to-note-autocomplete");
|
const $autoComplete = $("#jump-to-note-autocomplete");
|
||||||
const $showInFullTextButton = $("#show-in-full-text-button");
|
const $showInFullTextButton = $("#show-in-full-text-button");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$autoComplete.val('');
|
$autoComplete.val('');
|
||||||
|
@ -3,6 +3,7 @@ import noteDetailService from "../services/note_detail.js";
|
|||||||
import libraryLoader from "../services/library_loader.js";
|
import libraryLoader from "../services/library_loader.js";
|
||||||
import treeCache from "../services/tree_cache.js";
|
import treeCache from "../services/tree_cache.js";
|
||||||
import linkService from "../services/link.js";
|
import linkService from "../services/link.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $linkMapContainer = $("#link-map-container");
|
const $linkMapContainer = $("#link-map-container");
|
||||||
|
|
||||||
@ -26,6 +27,8 @@ let pzInstance = null;
|
|||||||
let renderer = null;
|
let renderer = null;
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
// set default settings
|
// set default settings
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import noteDetailService from '../services/note_detail.js';
|
import noteDetailService from '../services/note_detail.js';
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#note-info-dialog");
|
const $dialog = $("#note-info-dialog");
|
||||||
const $noteId = $("#note-info-note-id");
|
const $noteId = $("#note-info-note-id");
|
||||||
@ -9,6 +10,8 @@ const $mime = $("#note-info-mime");
|
|||||||
const $okButton = $("#note-info-ok-button");
|
const $okButton = $("#note-info-ok-button");
|
||||||
|
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$dialog.modal();
|
$dialog.modal();
|
||||||
|
@ -15,6 +15,8 @@ async function showCurrentNoteRevisions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function showNoteRevisionsDialog(noteId, noteRevisionId) {
|
async function showNoteRevisionsDialog(noteId, noteRevisionId) {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$dialog.modal();
|
$dialog.modal();
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import noteDetailService from '../services/note_detail.js';
|
import noteDetailService from '../services/note_detail.js';
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#note-source-dialog");
|
const $dialog = $("#note-source-dialog");
|
||||||
const $noteSource = $("#note-source");
|
const $noteSource = $("#note-source");
|
||||||
|
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$dialog.modal();
|
$dialog.modal();
|
||||||
|
@ -17,6 +17,8 @@ function addTabHandler(handler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
const options = await server.get('options');
|
const options = await server.get('options');
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#prompt-dialog");
|
const $dialog = $("#prompt-dialog");
|
||||||
const $dialogBody = $dialog.find(".modal-body");
|
const $dialogBody = $dialog.find(".modal-body");
|
||||||
|
|
||||||
@ -10,6 +12,8 @@ let resolve;
|
|||||||
let shownCb;
|
let shownCb;
|
||||||
|
|
||||||
function ask({ message, defaultValue, shown }) {
|
function ask({ message, defaultValue, shown }) {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
shownCb = shown;
|
shownCb = shown;
|
||||||
|
@ -6,6 +6,8 @@ const $dialog = $("#recent-changes-dialog");
|
|||||||
const $content = $("#recent-changes-content");
|
const $content = $("#recent-changes-content");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
$dialog.modal();
|
$dialog.modal();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import libraryLoader from '../services/library_loader.js';
|
import libraryLoader from '../services/library_loader.js';
|
||||||
import server from '../services/server.js';
|
import server from '../services/server.js';
|
||||||
import infoService from "../services/info.js";
|
import infoService from "../services/info.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const $dialog = $("#sql-console-dialog");
|
const $dialog = $("#sql-console-dialog");
|
||||||
const $query = $('#sql-console-query');
|
const $query = $('#sql-console-query');
|
||||||
@ -14,6 +15,8 @@ let codeEditor;
|
|||||||
$dialog.on("shown.bs.modal", e => initEditor());
|
$dialog.on("shown.bs.modal", e => initEditor());
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
glob.activeDialog = $dialog;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
await showTables();
|
await showTables();
|
||||||
|
@ -162,9 +162,7 @@ async function activateNote(notePath, noteLoadedListener) {
|
|||||||
await hoistedNoteService.unhoist();
|
await hoistedNoteService.unhoist();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glob.activeDialog) {
|
utils.closeActiveDialog();
|
||||||
glob.activeDialog.modal('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
const node = await expandToNote(notePath);
|
const node = await expandToNote(notePath);
|
||||||
|
|
||||||
|
@ -194,6 +194,12 @@ function getMimeTypeClass(mime) {
|
|||||||
return 'mime-' + mime.toLowerCase().replace(/[\W_]+/g,"-");
|
return 'mime-' + mime.toLowerCase().replace(/[\W_]+/g,"-");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeActiveDialog() {
|
||||||
|
if (glob.activeDialog) {
|
||||||
|
glob.activeDialog.modal('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
reloadApp,
|
reloadApp,
|
||||||
parseDate,
|
parseDate,
|
||||||
@ -223,5 +229,6 @@ export default {
|
|||||||
setSessionCookie,
|
setSessionCookie,
|
||||||
getCookie,
|
getCookie,
|
||||||
getNoteTypeClass,
|
getNoteTypeClass,
|
||||||
getMimeTypeClass
|
getMimeTypeClass,
|
||||||
|
closeActiveDialog
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user