mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
using ES6 modules for whole frontend SPA app
This commit is contained in:
parent
b3c32a39e9
commit
a699210a29
35
src/public/javascripts/bootstrap.js
vendored
35
src/public/javascripts/bootstrap.js
vendored
@ -1,9 +1,38 @@
|
|||||||
import searchTree from './search_tree.js';
|
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 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 cloning from './cloning.js';
|
||||||
|
import contextMenu from './context_menu.js';
|
||||||
|
import dragAndDropSetup from './drag_and_drop.js';
|
||||||
|
import exportService from './export.js';
|
||||||
|
import link from './link.js';
|
||||||
|
import messaging from './messaging.js';
|
||||||
|
import noteEditor from './note_editor.js';
|
||||||
|
import noteType from './note_type.js';
|
||||||
|
import protected_session from './protected_session.js';
|
||||||
|
import ScriptApi from './script_api.js';
|
||||||
|
import ScriptContext from './script_context.js';
|
||||||
|
import sync from './sync.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 './note_tree.js';
|
||||||
const $toggleSearchButton = $("#toggle-search-button");
|
const $toggleSearchButton = $("#toggle-search-button");
|
||||||
|
|
||||||
$toggleSearchButton.click(searchTree.toggleSearch);
|
$toggleSearchButton.click(searchTreeService.toggleSearch);
|
||||||
bindShortcut('ctrl+s', searchTree.toggleSearch);
|
bindShortcut('ctrl+s', searchTreeService.toggleSearch);
|
||||||
|
|
||||||
function bindShortcut(keyboardShortcut, handler) {
|
function bindShortcut(keyboardShortcut, handler) {
|
||||||
$(document).bind('keydown', keyboardShortcut, e => {
|
$(document).bind('keydown', keyboardShortcut, e => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const cloning = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
|
||||||
async function cloneNoteTo(childNoteId, parentNoteId, prefix) {
|
async function cloneNoteTo(childNoteId, parentNoteId, prefix) {
|
||||||
const resp = await server.put('notes/' + childNoteId + '/clone-to/' + parentNoteId, {
|
const resp = await server.put('notes/' + childNoteId + '/clone-to/' + parentNoteId, {
|
||||||
prefix: prefix
|
prefix: prefix
|
||||||
@ -26,8 +27,7 @@ const cloning = (function() {
|
|||||||
await treeService.reload();
|
await treeService.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
cloneNoteAfter,
|
cloneNoteAfter,
|
||||||
cloneNoteTo
|
cloneNoteTo
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,14 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const contextMenu = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
import cloning from './cloning.js';
|
||||||
|
import exportService from './export.js';
|
||||||
|
import messaging from './messaging.js';
|
||||||
|
import protected_session from './protected_session.js';
|
||||||
|
import treeChanges from './tree_changes.js';
|
||||||
|
import treeUtils from './tree_utils.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
|
||||||
const $tree = $("#tree");
|
const $tree = $("#tree");
|
||||||
|
|
||||||
let clipboardIds = [];
|
let clipboardIds = [];
|
||||||
@ -171,11 +179,10 @@ const contextMenu = (function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
pasteAfter,
|
pasteAfter,
|
||||||
pasteInto,
|
pasteInto,
|
||||||
cut,
|
cut,
|
||||||
copy,
|
copy,
|
||||||
contextMenuSettings
|
contextMenuSettings
|
||||||
}
|
};
|
||||||
})();
|
|
@ -1,6 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const addLink = (function() {
|
import treeService from '../note_tree.js';
|
||||||
|
import cloning from '../cloning.js';
|
||||||
|
import link from '../link.js';
|
||||||
|
import noteEditor from '../note_editor.js';
|
||||||
|
import treeUtils from '../tree_utils.js';
|
||||||
|
|
||||||
const $dialog = $("#add-link-dialog");
|
const $dialog = $("#add-link-dialog");
|
||||||
const $form = $("#add-link-form");
|
const $form = $("#add-link-form");
|
||||||
const $autoComplete = $("#note-autocomplete");
|
const $autoComplete = $("#note-autocomplete");
|
||||||
@ -131,7 +136,6 @@ const addLink = (function() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const editTreePrefix = (function() {
|
import treeService from '../note_tree.js';
|
||||||
|
|
||||||
const $dialog = $("#edit-tree-prefix-dialog");
|
const $dialog = $("#edit-tree-prefix-dialog");
|
||||||
const $form = $("#edit-tree-prefix-form");
|
const $form = $("#edit-tree-prefix-form");
|
||||||
const $treePrefixInput = $("#tree-prefix-input");
|
const $treePrefixInput = $("#tree-prefix-input");
|
||||||
@ -40,7 +41,6 @@ const editTreePrefix = (function() {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const eventLog = (function() {
|
import link from '../link.js';
|
||||||
|
import utils from '../utils.js';
|
||||||
|
|
||||||
const $dialog = $("#event-log-dialog");
|
const $dialog = $("#event-log-dialog");
|
||||||
const $list = $("#event-log-list");
|
const $list = $("#event-log-list");
|
||||||
|
|
||||||
@ -32,7 +34,6 @@ const eventLog = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const jumpToNote = (function() {
|
import treeService from '../note_tree.js';
|
||||||
|
import link from '../link.js';
|
||||||
|
import utils from '../utils.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#jump-to-note-button");
|
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");
|
||||||
@ -53,7 +56,6 @@ const jumpToNote = (function() {
|
|||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
$showDialogButton.click(showDialog);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const labelsDialog = (function() {
|
import noteEditor from '../note_editor.js';
|
||||||
|
import utils from '../utils.js';
|
||||||
|
|
||||||
const $showDialogButton = $(".show-labels-button");
|
const $showDialogButton = $(".show-labels-button");
|
||||||
const $dialog = $("#labels-dialog");
|
const $dialog = $("#labels-dialog");
|
||||||
const $saveLabelsButton = $("#save-labels-button");
|
const $saveLabelsButton = $("#save-labels-button");
|
||||||
@ -221,7 +223,6 @@ const labelsDialog = (function() {
|
|||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
$showDialogButton.click(showDialog);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const noteHistory = (function() {
|
import noteEditor from '../note_editor.js';
|
||||||
|
import utils from '../utils.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#show-history-button");
|
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");
|
||||||
@ -75,7 +77,6 @@ const noteHistory = (function() {
|
|||||||
|
|
||||||
$showDialogButton.click(showCurrentNoteHistory);
|
$showDialogButton.click(showCurrentNoteHistory);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showCurrentNoteHistory
|
showCurrentNoteHistory
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const noteSource = (function() {
|
import noteEditor from '../note_editor.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#show-source-button");
|
const $showDialogButton = $("#show-source-button");
|
||||||
const $dialog = $("#note-source-dialog");
|
const $dialog = $("#note-source-dialog");
|
||||||
const $noteSource = $("#note-source");
|
const $noteSource = $("#note-source");
|
||||||
@ -54,7 +55,6 @@ const noteSource = (function() {
|
|||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
$showDialogButton.click(showDialog);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const recentChanges = (function() {
|
import link from '../link.js';
|
||||||
|
import utils from '../utils.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#recent-changes-button");
|
const $showDialogButton = $("#recent-changes-button");
|
||||||
const $dialog = $("#recent-changes-dialog");
|
const $dialog = $("#recent-changes-dialog");
|
||||||
|
|
||||||
@ -86,7 +88,6 @@ const recentChanges = (function() {
|
|||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
$showDialogButton.click(showDialog);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const recentNotes = (function() {
|
import treeService from '../note_tree.js';
|
||||||
|
import server from '../server.js';
|
||||||
|
import messaging from '../messaging.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#recent-notes-button");
|
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');
|
||||||
@ -97,9 +100,8 @@ const recentNotes = (function() {
|
|||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
$showDialogButton.click(showDialog);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog,
|
showDialog,
|
||||||
addRecentNote,
|
addRecentNote,
|
||||||
reload
|
reload
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const settings = (function() {
|
import protected_session from '../protected_session.js';
|
||||||
|
import utils from '../utils.js';
|
||||||
|
import server from '../server.js';
|
||||||
|
|
||||||
const $showDialogButton = $("#settings-button");
|
const $showDialogButton = $("#settings-button");
|
||||||
const $dialog = $("#settings-dialog");
|
const $dialog = $("#settings-dialog");
|
||||||
const $tabs = $("#settings-tabs");
|
const $tabs = $("#settings-tabs");
|
||||||
@ -41,14 +44,13 @@ const settings = (function() {
|
|||||||
|
|
||||||
$showDialogButton.click(showDialog);
|
$showDialogButton.click(showDialog);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog,
|
showDialog,
|
||||||
saveSettings,
|
saveSettings,
|
||||||
addModule
|
addModule
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
|
||||||
settings.addModule((function() {
|
addModule((function() {
|
||||||
const $form = $("#change-password-form");
|
const $form = $("#change-password-form");
|
||||||
const $oldPassword = $("#old-password");
|
const $oldPassword = $("#old-password");
|
||||||
const $newPassword1 = $("#new-password1");
|
const $newPassword1 = $("#new-password1");
|
||||||
@ -94,7 +96,7 @@ settings.addModule((function() {
|
|||||||
};
|
};
|
||||||
})());
|
})());
|
||||||
|
|
||||||
settings.addModule((function() {
|
addModule((function() {
|
||||||
const $form = $("#protected-session-timeout-form");
|
const $form = $("#protected-session-timeout-form");
|
||||||
const $protectedSessionTimeout = $("#protected-session-timeout-in-seconds");
|
const $protectedSessionTimeout = $("#protected-session-timeout-in-seconds");
|
||||||
const settingName = 'protected_session_timeout';
|
const settingName = 'protected_session_timeout';
|
||||||
@ -118,7 +120,7 @@ settings.addModule((function() {
|
|||||||
};
|
};
|
||||||
})());
|
})());
|
||||||
|
|
||||||
settings.addModule((function () {
|
addModule((function () {
|
||||||
const $form = $("#history-snapshot-time-interval-form");
|
const $form = $("#history-snapshot-time-interval-form");
|
||||||
const $timeInterval = $("#history-snapshot-time-interval-in-seconds");
|
const $timeInterval = $("#history-snapshot-time-interval-in-seconds");
|
||||||
const settingName = 'history_snapshot_time_interval';
|
const settingName = 'history_snapshot_time_interval';
|
||||||
@ -138,7 +140,7 @@ settings.addModule((function () {
|
|||||||
};
|
};
|
||||||
})());
|
})());
|
||||||
|
|
||||||
settings.addModule((async function () {
|
addModule((async function () {
|
||||||
const $appVersion = $("#app-version");
|
const $appVersion = $("#app-version");
|
||||||
const $dbVersion = $("#db-version");
|
const $dbVersion = $("#db-version");
|
||||||
const $buildDate = $("#build-date");
|
const $buildDate = $("#build-date");
|
||||||
@ -155,7 +157,7 @@ settings.addModule((async function () {
|
|||||||
return {};
|
return {};
|
||||||
})());
|
})());
|
||||||
|
|
||||||
settings.addModule((async function () {
|
addModule((async function () {
|
||||||
const $forceFullSyncButton = $("#force-full-sync-button");
|
const $forceFullSyncButton = $("#force-full-sync-button");
|
||||||
const $fillSyncRowsButton = $("#fill-sync-rows-button");
|
const $fillSyncRowsButton = $("#fill-sync-rows-button");
|
||||||
const $anonymizeButton = $("#anonymize-button");
|
const $anonymizeButton = $("#anonymize-button");
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sqlConsole = (function() {
|
import utils from '../utils.js';
|
||||||
|
|
||||||
const $dialog = $("#sql-console-dialog");
|
const $dialog = $("#sql-console-dialog");
|
||||||
const $query = $('#sql-console-query');
|
const $query = $('#sql-console-query');
|
||||||
const $executeButton = $('#sql-console-execute');
|
const $executeButton = $('#sql-console-execute');
|
||||||
@ -100,7 +101,6 @@ const sqlConsole = (function() {
|
|||||||
|
|
||||||
$executeButton.click(execute);
|
$executeButton.click(execute);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
showDialog
|
showDialog
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,5 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import treeService from './note_tree.js';
|
||||||
|
import treeChanges from './tree_changes.js';
|
||||||
|
|
||||||
const dragAndDropSetup = {
|
const dragAndDropSetup = {
|
||||||
autoExpandMS: 600,
|
autoExpandMS: 600,
|
||||||
draggable: { // modify default jQuery draggable options
|
draggable: { // modify default jQuery draggable options
|
||||||
@ -65,3 +68,5 @@ const dragAndDropSetup = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default dragAndDropSetup;
|
@ -1,6 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const exportService = (function () {
|
import treeService from './note_tree.js';
|
||||||
|
import protected_session from './protected_session.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
|
||||||
function exportSubTree(noteId) {
|
function exportSubTree(noteId) {
|
||||||
const url = utils.getHost() + "/api/export/" + noteId + "?protectedSessionId="
|
const url = utils.getHost() + "/api/export/" + noteId + "?protectedSessionId="
|
||||||
+ encodeURIComponent(protected_session.getProtectedSessionId());
|
+ encodeURIComponent(protected_session.getProtectedSessionId());
|
||||||
@ -32,8 +35,7 @@ const exportService = (function () {
|
|||||||
await treeService.reload();
|
await treeService.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
exportSubTree,
|
exportSubTree,
|
||||||
importSubTree
|
importSubTree
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const initService = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
import link from './link.js';
|
||||||
|
import messaging from './messaging.js';
|
||||||
|
import noteEditor from './note_editor.js';
|
||||||
|
import treeUtils from './tree_utils.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
import server from './server.js';
|
||||||
|
|
||||||
// hot keys are active also inside inputs and content editables
|
// hot keys are active also inside inputs and content editables
|
||||||
jQuery.hotkeys.options.filterInputAcceptingElements = false;
|
jQuery.hotkeys.options.filterInputAcceptingElements = false;
|
||||||
jQuery.hotkeys.options.filterContentEditable = false;
|
jQuery.hotkeys.options.filterContentEditable = false;
|
||||||
@ -249,4 +256,3 @@ const initService = (function() {
|
|||||||
|
|
||||||
await treeService.activateNode(resp.noteId);
|
await treeService.activateNode(resp.noteId);
|
||||||
});
|
});
|
||||||
})();
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const link = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
import noteEditor from './note_editor.js';
|
||||||
|
import treeUtils from './tree_utils.js';
|
||||||
|
|
||||||
function getNotePathFromLink(url) {
|
function getNotePathFromLink(url) {
|
||||||
const notePathMatch = /#([A-Za-z0-9/]+)$/.exec(url);
|
const notePathMatch = /#([A-Za-z0-9/]+)$/.exec(url);
|
||||||
|
|
||||||
@ -93,11 +96,10 @@ const link = (function() {
|
|||||||
$(document).on('click', 'div.popover-content a, div.ui-tooltip-content a', goToLink);
|
$(document).on('click', 'div.popover-content a, div.ui-tooltip-content a', goToLink);
|
||||||
$(document).on('dblclick', '#note-detail a', goToLink);
|
$(document).on('dblclick', '#note-detail a', goToLink);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
getNodePathFromLabel,
|
getNodePathFromLabel,
|
||||||
getNotePathFromLink,
|
getNotePathFromLink,
|
||||||
createNoteLink,
|
createNoteLink,
|
||||||
addLinkToEditor,
|
addLinkToEditor,
|
||||||
addTextToEditor
|
addTextToEditor
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const messaging = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
import noteEditor from './note_editor.js';
|
||||||
|
import sync from './sync.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
|
||||||
const $changesToPushCount = $("#changes-to-push-count");
|
const $changesToPushCount = $("#changes-to-push-count");
|
||||||
|
|
||||||
function logError(message) {
|
function logError(message) {
|
||||||
@ -109,7 +113,6 @@ const messaging = (function() {
|
|||||||
}));
|
}));
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
logError
|
logError
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const noteEditor = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
import noteType from './note_type.js';
|
||||||
|
import protected_session from './protected_session.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
import server from './server.js';
|
||||||
|
|
||||||
const $noteTitle = $("#note-title");
|
const $noteTitle = $("#note-title");
|
||||||
|
|
||||||
const $noteDetail = $('#note-detail');
|
const $noteDetail = $('#note-detail');
|
||||||
@ -68,7 +73,7 @@ const noteEditor = (function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const note = noteEditor.getCurrentNote();
|
const note = getCurrentNote();
|
||||||
|
|
||||||
updateNoteFromInputs(note);
|
updateNoteFromInputs(note);
|
||||||
|
|
||||||
@ -379,7 +384,7 @@ const noteEditor = (function() {
|
|||||||
|
|
||||||
setInterval(saveNoteIfChanged, 5000);
|
setInterval(saveNoteIfChanged, 5000);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
reload,
|
reload,
|
||||||
switchToNote,
|
switchToNote,
|
||||||
saveNoteIfChanged,
|
saveNoteIfChanged,
|
||||||
@ -397,4 +402,3 @@ const noteEditor = (function() {
|
|||||||
loadLabelList,
|
loadLabelList,
|
||||||
setContent
|
setContent
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,5 +1,17 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import contextMenu from './context_menu.js';
|
||||||
|
import dragAndDropSetup from './drag_and_drop.js';
|
||||||
|
import link from './link.js';
|
||||||
|
import messaging from './messaging.js';
|
||||||
|
import noteEditor from './note_editor.js';
|
||||||
|
import protected_session from './protected_session.js';
|
||||||
|
import treeChanges from './tree_changes.js';
|
||||||
|
import treeUtils from './tree_utils.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
import server from './server.js';
|
||||||
|
import recentNotes from './dialogs/recent_notes.js';
|
||||||
|
|
||||||
class TreeCache {
|
class TreeCache {
|
||||||
constructor(noteRows, branchRows) {
|
constructor(noteRows, branchRows) {
|
||||||
this.parents = [];
|
this.parents = [];
|
||||||
@ -126,7 +138,6 @@ class Branch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const treeService = (function() {
|
|
||||||
let treeCache;
|
let treeCache;
|
||||||
|
|
||||||
const $tree = $("#tree");
|
const $tree = $("#tree");
|
||||||
@ -1020,7 +1031,7 @@ const treeService = (function() {
|
|||||||
$collapseTreeButton.click(collapseTree);
|
$collapseTreeButton.click(collapseTree);
|
||||||
$scrollToCurrentNoteButton.click(scrollToCurrentNote);
|
$scrollToCurrentNoteButton.click(scrollToCurrentNote);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
reload,
|
reload,
|
||||||
collapseTree,
|
collapseTree,
|
||||||
scrollToCurrentNote,
|
scrollToCurrentNote,
|
||||||
@ -1047,4 +1058,3 @@ const treeService = (function() {
|
|||||||
getBranch,
|
getBranch,
|
||||||
getNote
|
getNote
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const noteType = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
import noteEditor from './note_editor.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
|
||||||
const $executeScriptButton = $("#execute-script-button");
|
const $executeScriptButton = $("#execute-script-button");
|
||||||
const noteTypeModel = new NoteTypeModel();
|
const noteTypeModel = new NoteTypeModel();
|
||||||
|
|
||||||
@ -131,7 +134,7 @@ const noteType = (function() {
|
|||||||
|
|
||||||
ko.applyBindings(noteTypeModel, document.getElementById('note-type'));
|
ko.applyBindings(noteTypeModel, document.getElementById('note-type'));
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
getNoteType: () => noteTypeModel.type(),
|
getNoteType: () => noteTypeModel.type(),
|
||||||
setNoteType: type => noteTypeModel.type(type),
|
setNoteType: type => noteTypeModel.type(type),
|
||||||
|
|
||||||
@ -142,4 +145,3 @@ const noteType = (function() {
|
|||||||
noteTypeModel.updateExecuteScriptButtonVisibility();
|
noteTypeModel.updateExecuteScriptButtonVisibility();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const protected_session = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
import noteEditor from './note_editor.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
import server from './server.js';
|
||||||
|
|
||||||
const $dialog = $("#protected-session-password-dialog");
|
const $dialog = $("#protected-session-password-dialog");
|
||||||
const $passwordForm = $("#protected-session-password-form");
|
const $passwordForm = $("#protected-session-password-form");
|
||||||
const $password = $("#protected-session-password");
|
const $password = $("#protected-session-password");
|
||||||
@ -174,7 +178,7 @@ const protected_session = (function() {
|
|||||||
$protectButton.click(protectNoteAndSendToServer);
|
$protectButton.click(protectNoteAndSendToServer);
|
||||||
$unprotectButton.click(unprotectNoteAndSendToServer);
|
$unprotectButton.click(unprotectNoteAndSendToServer);
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
setProtectedSessionTimeout,
|
setProtectedSessionTimeout,
|
||||||
ensureProtectedSession,
|
ensureProtectedSession,
|
||||||
resetProtectedSession,
|
resetProtectedSession,
|
||||||
@ -186,4 +190,3 @@ const protected_session = (function() {
|
|||||||
protectSubTree,
|
protectSubTree,
|
||||||
ensureDialogIsClosed
|
ensureDialogIsClosed
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,3 +1,5 @@
|
|||||||
|
import treeService from './note_tree.js';
|
||||||
|
|
||||||
function ScriptApi(startNote, currentNote) {
|
function ScriptApi(startNote, currentNote) {
|
||||||
const $pluginButtons = $("#plugin-buttons");
|
const $pluginButtons = $("#plugin-buttons");
|
||||||
|
|
||||||
@ -52,3 +54,5 @@ function ScriptApi(startNote, currentNote) {
|
|||||||
runOnServer
|
runOnServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default ScriptApi;
|
@ -1,3 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
import ScriptApi from './script_api.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
|
||||||
function ScriptContext(startNote, allNotes) {
|
function ScriptContext(startNote, allNotes) {
|
||||||
const modules = {};
|
const modules = {};
|
||||||
|
|
||||||
@ -19,3 +24,5 @@ function ScriptContext(startNote, allNotes) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default ScriptContext;
|
@ -1,5 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import treeService from './note_tree.js';
|
||||||
|
|
||||||
const $tree = $("#tree");
|
const $tree = $("#tree");
|
||||||
const $searchInput = $("input[name='search-text']");
|
const $searchInput = $("input[name='search-text']");
|
||||||
const $resetSearchButton = $("#reset-search-button");
|
const $resetSearchButton = $("#reset-search-button");
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
const server = (function() {
|
"use strict";
|
||||||
|
|
||||||
|
import protected_session from './protected_session.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
|
||||||
function getHeaders() {
|
function getHeaders() {
|
||||||
let protectedSessionId = null;
|
let protectedSessionId = null;
|
||||||
|
|
||||||
@ -89,7 +93,7 @@ const server = (function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
get,
|
get,
|
||||||
post,
|
post,
|
||||||
put,
|
put,
|
||||||
@ -97,5 +101,4 @@ const server = (function() {
|
|||||||
ajax,
|
ajax,
|
||||||
// don't remove, used from CKEditor image upload!
|
// don't remove, used from CKEditor image upload!
|
||||||
getHeaders
|
getHeaders
|
||||||
}
|
};
|
||||||
})();
|
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const syncService = (function() {
|
import utils from './utils.js';
|
||||||
|
|
||||||
async function syncNow() {
|
async function syncNow() {
|
||||||
const result = await server.post('sync/now');
|
const result = await server.post('sync/now');
|
||||||
|
|
||||||
@ -24,8 +25,7 @@ const syncService = (function() {
|
|||||||
utils.showMessage("Note added to sync queue.");
|
utils.showMessage("Note added to sync queue.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
syncNow,
|
syncNow,
|
||||||
forceNoteSync
|
forceNoteSync
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const treeChanges = (function() {
|
import treeService from './note_tree.js';
|
||||||
|
import utils from './utils.js';
|
||||||
|
|
||||||
async function moveBeforeNode(nodesToMove, beforeNode) {
|
async function moveBeforeNode(nodesToMove, beforeNode) {
|
||||||
for (const nodeToMove of nodesToMove) {
|
for (const nodeToMove of nodesToMove) {
|
||||||
const resp = await server.put('tree/' + nodeToMove.data.branchId + '/move-before/' + beforeNode.data.branchId);
|
const resp = await server.put('tree/' + nodeToMove.data.branchId + '/move-before/' + beforeNode.data.branchId);
|
||||||
@ -122,11 +124,10 @@ const treeChanges = (function() {
|
|||||||
treeService.setCurrentNotePathToHash(node);
|
treeService.setCurrentNotePathToHash(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
moveBeforeNode,
|
moveBeforeNode,
|
||||||
moveAfterNode,
|
moveAfterNode,
|
||||||
moveToNode,
|
moveToNode,
|
||||||
deleteNodes,
|
deleteNodes,
|
||||||
moveNodeUpInHierarchy
|
moveNodeUpInHierarchy
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const treeUtils = (function() {
|
import utils from './utils.js';
|
||||||
|
|
||||||
const $tree = $("#tree");
|
const $tree = $("#tree");
|
||||||
|
|
||||||
function getParentProtectedStatus(node) {
|
function getParentProtectedStatus(node) {
|
||||||
@ -31,10 +32,9 @@ const treeUtils = (function() {
|
|||||||
return path.reverse().join("/");
|
return path.reverse().join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
getParentProtectedStatus,
|
getParentProtectedStatus,
|
||||||
getNodeByKey,
|
getNodeByKey,
|
||||||
getNotePath,
|
getNotePath,
|
||||||
getNoteIdFromNotePath,
|
getNoteIdFromNotePath,
|
||||||
};
|
};
|
||||||
})();
|
|
@ -1,6 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const utils = (function() {
|
import link from './link.js';
|
||||||
|
import messaging from './messaging.js';
|
||||||
|
import ScriptContext from './script_context.js';
|
||||||
|
|
||||||
function reloadApp() {
|
function reloadApp() {
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
@ -235,7 +238,7 @@ const utils = (function() {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
reloadApp,
|
reloadApp,
|
||||||
showMessage,
|
showMessage,
|
||||||
showError,
|
showError,
|
||||||
@ -267,4 +270,3 @@ const utils = (function() {
|
|||||||
toObject,
|
toObject,
|
||||||
randomString
|
randomString
|
||||||
};
|
};
|
||||||
})();
|
|
@ -521,43 +521,6 @@
|
|||||||
|
|
||||||
<script src="/javascripts/bootstrap.js" type="module"></script>
|
<script src="/javascripts/bootstrap.js" type="module"></script>
|
||||||
|
|
||||||
<script src="/javascripts/utils.js"></script>
|
|
||||||
<script src="/javascripts/init.js"></script>
|
|
||||||
<script src="/javascripts/server.js"></script>
|
|
||||||
|
|
||||||
<!-- Tree scripts -->
|
|
||||||
<script src="/javascripts/note_tree.js"></script>
|
|
||||||
<script src="/javascripts/tree_changes.js"></script>
|
|
||||||
<script src="/javascripts/cloning.js"></script>
|
|
||||||
<script src="/javascripts/tree_utils.js"></script>
|
|
||||||
<script src="/javascripts/drag_and_drop.js"></script>
|
|
||||||
<script src="/javascripts/context_menu.js"></script>
|
|
||||||
<script src="/javascripts/export.js"></script>
|
|
||||||
|
|
||||||
<!-- Note detail -->
|
|
||||||
<script src="/javascripts/note_editor.js"></script>
|
|
||||||
<script src="/javascripts/protected_session.js"></script>
|
|
||||||
<script src="/javascripts/note_type.js"></script>
|
|
||||||
|
|
||||||
<!-- dialogs -->
|
|
||||||
<script src="/javascripts/dialogs/recent_notes.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/add_link.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/jump_to_note.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/settings.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/note_history.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/recent_changes.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/event_log.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/edit_tree_prefix.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/sql_console.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/note_source.js"></script>
|
|
||||||
<script src="/javascripts/dialogs/labels.js"></script>
|
|
||||||
|
|
||||||
<script src="/javascripts/link.js"></script>
|
|
||||||
<script src="/javascripts/sync.js"></script>
|
|
||||||
<script src="/javascripts/messaging.js"></script>
|
|
||||||
<script src="/javascripts/script_context.js"></script>
|
|
||||||
<script src="/javascripts/script_api.js"></script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// we hide container initally because otherwise it is rendered first without CSS and then flickers into
|
// we hide container initally because otherwise it is rendered first without CSS and then flickers into
|
||||||
// final form which is pretty ugly.
|
// final form which is pretty ugly.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user