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