mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
moved dialog entrypoints into bootstrap, fixes
This commit is contained in:
parent
19c605a9a8
commit
341f47f0f2
@ -128,12 +128,6 @@ function linkTypeChanged() {
|
|||||||
|
|
||||||
$linkTypes.change(linkTypeChanged);
|
$linkTypes.change(linkTypeChanged);
|
||||||
|
|
||||||
$(document).bind('keydown', 'ctrl+l', e => {
|
|
||||||
showDialog();
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
@ -2,7 +2,6 @@ import treeService from '../services/tree.js';
|
|||||||
import linkService from '../services/link.js';
|
import linkService from '../services/link.js';
|
||||||
import utils from '../services/utils.js';
|
import utils from '../services/utils.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#jump-to-note-button");
|
|
||||||
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 $form = $("#jump-to-note-form");
|
const $form = $("#jump-to-note-form");
|
||||||
@ -38,22 +37,12 @@ function goToNote() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).bind('keydown', 'ctrl+j', e => {
|
|
||||||
showDialog();
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
$form.submit(() => {
|
$form.submit(() => {
|
||||||
const action = $dialog.find("button:focus").val();
|
|
||||||
|
|
||||||
goToNote();
|
goToNote();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
@ -2,7 +2,6 @@ import noteDetailService from '../services/note_detail.js';
|
|||||||
import utils from '../services/utils.js';
|
import utils from '../services/utils.js';
|
||||||
import server from '../services/server.js';
|
import server from '../services/server.js';
|
||||||
|
|
||||||
const $showDialogButton = $(".show-labels-button");
|
|
||||||
const $dialog = $("#labels-dialog");
|
const $dialog = $("#labels-dialog");
|
||||||
const $saveLabelsButton = $("#save-labels-button");
|
const $saveLabelsButton = $("#save-labels-button");
|
||||||
const $labelsBody = $('#labels-table tbody');
|
const $labelsBody = $('#labels-table tbody');
|
||||||
@ -164,12 +163,6 @@ async function showDialog() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).bind('keydown', 'alt+l', e => {
|
|
||||||
showDialog();
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
ko.applyBindings(labelsModel, document.getElementById('labels-dialog'));
|
ko.applyBindings(labelsModel, document.getElementById('labels-dialog'));
|
||||||
|
|
||||||
$(document).on('focus', '.label-name', function (e) {
|
$(document).on('focus', '.label-name', function (e) {
|
||||||
@ -220,8 +213,6 @@ $(document).on('focus', '.label-value', async function (e) {
|
|||||||
$(this).autocomplete("search", $(this).val());
|
$(this).autocomplete("search", $(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
@ -2,7 +2,6 @@ import noteDetailService from '../services/note_detail.js';
|
|||||||
import utils from '../services/utils.js';
|
import utils from '../services/utils.js';
|
||||||
import server from '../services/server.js';
|
import server from '../services/server.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#show-history-button");
|
|
||||||
const $dialog = $("#note-history-dialog");
|
const $dialog = $("#note-history-dialog");
|
||||||
const $list = $("#note-history-list");
|
const $list = $("#note-history-list");
|
||||||
const $content = $("#note-history-content");
|
const $content = $("#note-history-content");
|
||||||
@ -49,12 +48,6 @@ async function showNoteHistoryDialog(noteId, noteRevisionId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).bind('keydown', 'alt+h', e => {
|
|
||||||
showCurrentNoteHistory();
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
$list.on('change', () => {
|
$list.on('change', () => {
|
||||||
const optVal = $list.find(":selected").val();
|
const optVal = $list.find(":selected").val();
|
||||||
|
|
||||||
@ -74,8 +67,6 @@ $(document).on('click', "a[action='note-history']", event => {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$showDialogButton.click(showCurrentNoteHistory);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
showCurrentNoteHistory
|
showCurrentNoteHistory
|
||||||
};
|
};
|
@ -1,6 +1,5 @@
|
|||||||
import noteDetailService from '../services/note_detail.js';
|
import noteDetailService from '../services/note_detail.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#show-source-button");
|
|
||||||
const $dialog = $("#note-source-dialog");
|
const $dialog = $("#note-source-dialog");
|
||||||
const $noteSource = $("#note-source");
|
const $noteSource = $("#note-source");
|
||||||
|
|
||||||
@ -45,14 +44,6 @@ function formatNode(node, level) {
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).bind('keydown', 'ctrl+u', e => {
|
|
||||||
showDialog();
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
@ -2,7 +2,6 @@ import linkService from '../services/link.js';
|
|||||||
import utils from '../services/utils.js';
|
import utils from '../services/utils.js';
|
||||||
import server from '../services/server.js';
|
import server from '../services/server.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#recent-changes-button");
|
|
||||||
const $dialog = $("#recent-changes-dialog");
|
const $dialog = $("#recent-changes-dialog");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
@ -83,10 +82,6 @@ function groupByDate(result) {
|
|||||||
return groupedByDate;
|
return groupedByDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).bind('keydown', 'alt+r', showDialog);
|
|
||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
@ -2,7 +2,6 @@ import treeService from '../services/tree.js';
|
|||||||
import messagingService from '../services/messaging.js';
|
import messagingService from '../services/messaging.js';
|
||||||
import server from '../services/server.js';
|
import server from '../services/server.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#recent-notes-button");
|
|
||||||
const $dialog = $("#recent-notes-dialog");
|
const $dialog = $("#recent-notes-dialog");
|
||||||
const $searchInput = $('#recent-notes-search-input');
|
const $searchInput = $('#recent-notes-search-input');
|
||||||
|
|
||||||
@ -93,14 +92,6 @@ async function showDialog() {
|
|||||||
|
|
||||||
setTimeout(reload, 100);
|
setTimeout(reload, 100);
|
||||||
|
|
||||||
$(document).bind('keydown', 'ctrl+e', e => {
|
|
||||||
showDialog();
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
showDialog,
|
showDialog,
|
||||||
addRecentNote,
|
addRecentNote,
|
||||||
|
@ -4,7 +4,6 @@ import protectedSessionService from '../services/protected_session.js';
|
|||||||
import utils from '../services/utils.js';
|
import utils from '../services/utils.js';
|
||||||
import server from '../services/server.js';
|
import server from '../services/server.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#settings-button");
|
|
||||||
const $dialog = $("#settings-dialog");
|
const $dialog = $("#settings-dialog");
|
||||||
const $tabs = $("#settings-tabs");
|
const $tabs = $("#settings-tabs");
|
||||||
|
|
||||||
@ -42,12 +41,9 @@ async function saveSettings(settingName, settingValue) {
|
|||||||
utils.showMessage("Settings change have been saved.");
|
utils.showMessage("Settings change have been saved.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
showDialog,
|
showDialog,
|
||||||
saveSettings,
|
saveSettings
|
||||||
addModule
|
|
||||||
};
|
};
|
||||||
|
|
||||||
addModule((function() {
|
addModule((function() {
|
||||||
|
@ -94,8 +94,6 @@ async function execute(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).bind('keydown', 'alt+o', showDialog);
|
|
||||||
|
|
||||||
$query.bind('keydown', 'ctrl+return', execute);
|
$query.bind('keydown', 'ctrl+return', execute);
|
||||||
|
|
||||||
$executeButton.click(execute);
|
$executeButton.click(execute);
|
||||||
|
53
src/public/javascripts/services/bootstrap.js
vendored
53
src/public/javascripts/services/bootstrap.js
vendored
@ -1,14 +1,12 @@
|
|||||||
import addLink from '../dialogs/add_link.js';
|
import addLinkDialog from '../dialogs/add_link.js';
|
||||||
import editTreePrefix from '../dialogs/edit_tree_prefix.js';
|
import jumpToNoteDialog from '../dialogs/jump_to_note.js';
|
||||||
import eventLog from '../dialogs/event_log.js';
|
|
||||||
import jumpToNote from '../dialogs/jump_to_note.js';
|
|
||||||
import labelsDialog from '../dialogs/labels.js';
|
import labelsDialog from '../dialogs/labels.js';
|
||||||
import noteHistory from '../dialogs/note_history.js';
|
import noteRevisionsDialog from '../dialogs/note_history.js';
|
||||||
import noteSource from '../dialogs/note_source.js';
|
import noteSourceDialog from '../dialogs/note_source.js';
|
||||||
import recentChanges from '../dialogs/recent_changes.js';
|
import recentChangesDialog from '../dialogs/recent_changes.js';
|
||||||
import recentNotes from '../dialogs/recent_notes.js';
|
import recentNotesDialog from '../dialogs/recent_notes.js';
|
||||||
import settings from '../dialogs/settings.js';
|
import settingsDialog from '../dialogs/settings.js';
|
||||||
import sqlConsole from '../dialogs/sql_console.js';
|
import sqlConsoleDialog from '../dialogs/sql_console.js';
|
||||||
|
|
||||||
import cloning from './cloning.js';
|
import cloning from './cloning.js';
|
||||||
import contextMenu from './context_menu.js';
|
import contextMenu from './context_menu.js';
|
||||||
@ -19,25 +17,38 @@ import messaging from './messaging.js';
|
|||||||
import noteDetail from './note_detail.js';
|
import noteDetail from './note_detail.js';
|
||||||
import noteType from './note_type.js';
|
import noteType from './note_type.js';
|
||||||
import protected_session from './protected_session.js';
|
import protected_session from './protected_session.js';
|
||||||
|
import searchTreeService from './search_tree.js';
|
||||||
import ScriptApi from './script_api.js';
|
import ScriptApi from './script_api.js';
|
||||||
import ScriptContext from './script_context.js';
|
import ScriptContext from './script_context.js';
|
||||||
import sync from './sync.js';
|
import sync from './sync.js';
|
||||||
|
import treeService from './tree.js';
|
||||||
import treeChanges from './tree_changes.js';
|
import treeChanges from './tree_changes.js';
|
||||||
import treeUtils from './tree_utils.js';
|
import treeUtils from './tree_utils.js';
|
||||||
import utils from './utils.js';
|
import utils from './utils.js';
|
||||||
|
|
||||||
import searchTreeService from './search_tree.js';
|
|
||||||
import './init.js';
|
import './init.js';
|
||||||
import treeService from './tree.js';
|
|
||||||
const $toggleSearchButton = $("#toggle-search-button");
|
|
||||||
|
|
||||||
$toggleSearchButton.click(searchTreeService.toggleSearch);
|
utils.bindShortcut('ctrl+l', addLinkDialog.showDialog);
|
||||||
bindShortcut('ctrl+s', searchTreeService.toggleSearch);
|
|
||||||
|
|
||||||
function bindShortcut(keyboardShortcut, handler) {
|
$("#jump-to-note-button").click(jumpToNoteDialog.showDialog);
|
||||||
$(document).bind('keydown', keyboardShortcut, e => {
|
utils.bindShortcut('ctrl+j', jumpToNoteDialog.showDialog);
|
||||||
handler();
|
|
||||||
|
|
||||||
e.preventDefault();
|
$("#show-history-button").click(noteRevisionsDialog.showCurrentNoteHistory);
|
||||||
});
|
|
||||||
}
|
$("#show-source-button").click(noteSourceDialog.showDialog);
|
||||||
|
utils.bindShortcut('ctrl+u', noteSourceDialog.showDialog);
|
||||||
|
|
||||||
|
$("#recent-changes-button").click(recentChangesDialog.showDialog);
|
||||||
|
|
||||||
|
$("#recent-notes-button").click(recentNotesDialog.showDialog);
|
||||||
|
utils.bindShortcut('ctrl+e', recentNotesDialog.showDialog);
|
||||||
|
|
||||||
|
$("#toggle-search-button").click(searchTreeService.toggleSearch);
|
||||||
|
utils.bindShortcut('ctrl+s', searchTreeService.toggleSearch);
|
||||||
|
|
||||||
|
$(".show-labels-button").click(labelsDialog.showDialog);
|
||||||
|
utils.bindShortcut('alt+l', labelsDialog.showDialog);
|
||||||
|
|
||||||
|
$("#settings-button").click(settingsDialog.showDialog);
|
||||||
|
|
||||||
|
utils.bindShortcut('alt+o', sqlConsoleDialog.showDialog);
|
@ -6,6 +6,7 @@ import protectedSessionService from './protected_session.js';
|
|||||||
import treeChangesService from './tree_changes.js';
|
import treeChangesService from './tree_changes.js';
|
||||||
import treeUtils from './tree_utils.js';
|
import treeUtils from './tree_utils.js';
|
||||||
import utils from './utils.js';
|
import utils from './utils.js';
|
||||||
|
import editTreePrefixDialog from '../dialogs/edit_tree_prefix.js';
|
||||||
|
|
||||||
const $tree = $("#tree");
|
const $tree = $("#tree");
|
||||||
|
|
||||||
@ -133,7 +134,7 @@ const contextMenuSettings = {
|
|||||||
treeService.createNote(node, node.data.noteId, 'into');
|
treeService.createNote(node, node.data.noteId, 'into');
|
||||||
}
|
}
|
||||||
else if (ui.cmd === "editTreePrefix") {
|
else if (ui.cmd === "editTreePrefix") {
|
||||||
editTreePrefix.showDialog(node);
|
editTreePrefixDialog.showDialog(node);
|
||||||
}
|
}
|
||||||
else if (ui.cmd === "protectSubTree") {
|
else if (ui.cmd === "protectSubTree") {
|
||||||
protectedSessionService.protectSubTree(node.data.noteId, true);
|
protectedSessionService.protectSubTree(node.data.noteId, true);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import treeService from './tree.js';
|
import treeService from './tree.js';
|
||||||
|
import server from './server.js';
|
||||||
|
|
||||||
function ScriptApi(startNote, currentNote) {
|
function ScriptApi(startNote, currentNote) {
|
||||||
const $pluginButtons = $("#plugin-buttons");
|
const $pluginButtons = $("#plugin-buttons");
|
||||||
|
@ -9,6 +9,7 @@ import treeUtils from './tree_utils.js';
|
|||||||
import utils from './utils.js';
|
import utils from './utils.js';
|
||||||
import server from './server.js';
|
import server from './server.js';
|
||||||
import recentNotesDialog from '../dialogs/recent_notes.js';
|
import recentNotesDialog from '../dialogs/recent_notes.js';
|
||||||
|
import editTreePrefixDialog from '../dialogs/edit_tree_prefix.js';
|
||||||
import treeCache from './tree_cache.js';
|
import treeCache from './tree_cache.js';
|
||||||
|
|
||||||
const $tree = $("#tree");
|
const $tree = $("#tree");
|
||||||
@ -480,7 +481,7 @@ function initFancyTree(branch) {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
"f2": node => {
|
"f2": node => {
|
||||||
editTreePrefix.showDialog(node);
|
editTreePrefixDialog.showDialog(node);
|
||||||
},
|
},
|
||||||
"alt+-": node => {
|
"alt+-": node => {
|
||||||
collapseTree(node);
|
collapseTree(node);
|
||||||
@ -605,16 +606,16 @@ function initFancyTree(branch) {
|
|||||||
mode: "hide" // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
|
mode: "hide" // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
|
||||||
},
|
},
|
||||||
dnd: dragAndDropSetup,
|
dnd: dragAndDropSetup,
|
||||||
lazyLoad: async function(event, data){
|
lazyLoad: function(event, data) {
|
||||||
const noteId = data.node.data.noteId;
|
const noteId = data.node.data.noteId;
|
||||||
const note = await getNote(noteId);
|
data.result = getNote(noteId).then(note => {
|
||||||
|
|
||||||
if (note.type === 'search') {
|
if (note.type === 'search') {
|
||||||
data.result = loadSearchNote(noteId);
|
return loadSearchNote(noteId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data.result = prepareBranchInner(note);
|
return prepareBranchInner(note);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
clones: {
|
clones: {
|
||||||
highlightActiveClones: true
|
highlightActiveClones: true
|
||||||
|
@ -236,6 +236,14 @@ function randomString(len) {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bindShortcut(keyboardShortcut, handler) {
|
||||||
|
$(document).bind('keydown', keyboardShortcut, e => {
|
||||||
|
handler();
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
reloadApp,
|
reloadApp,
|
||||||
showMessage,
|
showMessage,
|
||||||
@ -266,5 +274,6 @@ export default {
|
|||||||
getHost,
|
getHost,
|
||||||
download,
|
download,
|
||||||
toObject,
|
toObject,
|
||||||
randomString
|
randomString,
|
||||||
|
bindShortcut
|
||||||
};
|
};
|
@ -28,10 +28,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function validatorJavaScript(text, options) {
|
async function validatorJavaScript(text, options) {
|
||||||
if (noteEditor.getCurrentNote().detail.mime === 'application/json') {
|
// FIXME!!!
|
||||||
// eslint doesn't seem to validate pure JSON well
|
// if (noteEditor.getCurrentNote().detail.mime === 'application/json') {
|
||||||
return [];
|
// // eslint doesn't seem to validate pure JSON well
|
||||||
}
|
// return [];
|
||||||
|
// }
|
||||||
|
|
||||||
await requireLibrary(ESLINT);
|
await requireLibrary(ESLINT);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user