renamed service variables to conform to new naming scheme

This commit is contained in:
azivner 2018-03-25 13:41:29 -04:00
parent d746d707b5
commit 297a2cd9da
31 changed files with 121 additions and 176 deletions

View file

@ -1,9 +1,7 @@
"use strict";
import treeService from '../services/tree_service.js';
import cloning from '../services/cloning.js';
import link from '../services/link.js';
import noteDetail from '../services/note_detail.js';
import treeService from '../services/tree.js';
import cloningService from '../services/cloning.js';
import linkService from '../services/link.js';
import noteDetailService from '../services/note_detail.js';
import treeUtils from '../services/tree_utils.js';
const $dialog = $("#add-link-dialog");
@ -27,7 +25,7 @@ function setLinkType(linkType) {
async function showDialog() {
glob.activeDialog = $dialog;
if (noteDetail.getCurrentNoteType() === 'text') {
if (noteDetailService.getCurrentNoteType() === 'text') {
$linkTypeHtml.prop('disabled', false);
setLinkType('html');
@ -58,7 +56,7 @@ async function showDialog() {
minLength: 0,
change: () => {
const val = $autoComplete.val();
const notePath = link.getNodePathFromLabel(val);
const notePath = linkService.getNodePathFromLabel(val);
if (!notePath) {
return;
}
@ -72,7 +70,7 @@ async function showDialog() {
// this is called when user goes through autocomplete list with keyboard
// at this point the item isn't selected yet so we use supplied ui.item to see WHERE the cursor is
focus: (event, ui) => {
const notePath = link.getNodePathFromLabel(ui.item.value);
const notePath = linkService.getNodePathFromLabel(ui.item.value);
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
setDefaultLinkTitle(noteId);
@ -83,7 +81,7 @@ async function showDialog() {
$form.submit(() => {
const value = $autoComplete.val();
const notePath = link.getNodePathFromLabel(value);
const notePath = linkService.getNodePathFromLabel(value);
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
if (notePath) {
@ -94,19 +92,19 @@ $form.submit(() => {
$dialog.dialog("close");
link.addLinkToEditor(linkTitle, '#' + notePath);
linkService.addLinkToEditor(linkTitle, '#' + notePath);
}
else if (linkType === 'selected-to-current') {
const prefix = $clonePrefix.val();
cloning.cloneNoteTo(noteId, noteDetail.getCurrentNoteId(), prefix);
cloningService.cloneNoteTo(noteId, noteDetailService.getCurrentNoteId(), prefix);
$dialog.dialog("close");
}
else if (linkType === 'current-to-selected') {
const prefix = $clonePrefix.val();
cloning.cloneNoteTo(noteDetail.getCurrentNoteId(), noteId, prefix);
cloningService.cloneNoteTo(noteDetailService.getCurrentNoteId(), noteId, prefix);
$dialog.dialog("close");
}

View file

@ -1,6 +1,4 @@
"use strict";
import treeService from '../services/tree_service.js';
import treeService from '../services/tree.js';
const $dialog = $("#edit-tree-prefix-dialog");
const $form = $("#edit-tree-prefix-form");

View file

@ -1,6 +1,4 @@
"use strict";
import link from '../services/link.js';
import linkService from '../services/link.js';
import utils from '../services/utils.js';
const $dialog = $("#event-log-dialog");
@ -23,7 +21,7 @@ async function showDialog() {
const dateTime = utils.formatDateTime(utils.parseDate(event.dateAdded));
if (event.noteId) {
const noteLink = link.createNoteLink(event.noteId).prop('outerHTML');
const noteLink = linkService.createNoteLink(event.noteId).prop('outerHTML');
event.comment = event.comment.replace('<note>', noteLink);
}

View file

@ -1,7 +1,5 @@
"use strict";
import treeService from '../services/tree_service.js';
import link from '../services/link.js';
import treeService from '../services/tree.js';
import linkService from '../services/link.js';
import utils from '../services/utils.js';
const $showDialogButton = $("#jump-to-note-button");
@ -27,7 +25,7 @@ async function showDialog() {
function getSelectedNotePath() {
const val = $autoComplete.val();
return link.getNodePathFromLabel(val);
return linkService.getNodePathFromLabel(val);
}
function goToNote() {

View file

@ -1,6 +1,4 @@
"use strict";
import noteDetail from '../services/note_detail.js';
import noteDetailService from '../services/note_detail.js';
import utils from '../services/utils.js';
const $showDialogButton = $(".show-labels-button");
@ -17,7 +15,7 @@ function LabelsModel() {
this.labels = ko.observableArray();
this.loadLabels = async function() {
const noteId = noteDetail.getCurrentNoteId();
const noteId = noteDetailService.getCurrentNoteId();
const labels = await server.get('notes/' + noteId + '/labels');
@ -81,7 +79,7 @@ function LabelsModel() {
return;
}
const noteId = noteDetail.getCurrentNoteId();
const noteId = noteDetailService.getCurrentNoteId();
const labelsToSave = self.labels()
.map(attr => attr())
@ -95,7 +93,7 @@ function LabelsModel() {
utils.showMessage("Labels have been saved.");
noteDetail.loadLabelList();
noteDetailService.loadLabelList();
};
function addLastEmptyRow() {

View file

@ -1,6 +1,4 @@
"use strict";
import noteDetail from '../services/note_detail.js';
import noteDetailService from '../services/note_detail.js';
import utils from '../services/utils.js';
const $showDialogButton = $("#show-history-button");
@ -12,7 +10,7 @@ const $title = $("#note-history-title");
let historyItems = [];
async function showCurrentNoteHistory() {
await showNoteHistoryDialog(noteDetail.getCurrentNoteId());
await showNoteHistoryDialog(noteDetailService.getCurrentNoteId());
}
async function showNoteHistoryDialog(noteId, noteRevisionId) {

View file

@ -1,6 +1,4 @@
"use strict";
import noteDetail from '../services/note_detail.js';
import noteDetailService from '../services/note_detail.js';
const $showDialogButton = $("#show-source-button");
const $dialog = $("#note-source-dialog");
@ -15,7 +13,7 @@ function showDialog() {
height: 500
});
const noteText = noteDetail.getCurrentNote().detail.content;
const noteText = noteDetailService.getCurrentNote().detail.content;
$noteSource.text(formatHtml(noteText));
}

View file

@ -1,6 +1,4 @@
"use strict";
import link from '../services/link.js';
import linkService from '../services/link.js';
import utils from '../services/utils.js';
const $showDialogButton = $("#recent-changes-button");
@ -42,7 +40,7 @@ async function showDialog() {
noteLink = change.current_title;
}
else {
noteLink = link.createNoteLink(change.noteId, change.title);
noteLink = linkService.createNoteLink(change.noteId, change.title);
}
changesListEl.append($('<li>')

View file

@ -1,8 +1,6 @@
"use strict";
import treeService from '../services/tree_service.js';
import treeService from '../services/tree.js';
import messagingService from '../services/messaging.js';
import server from '../services/server.js';
import messaging from '../services/messaging.js';
const $showDialogButton = $("#recent-notes-button");
const $dialog = $("#recent-notes-dialog");
@ -53,7 +51,7 @@ function showDialog() {
catch (e) {
noteTitle = "[error - can't find note title]";
messaging.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack);
messagingService.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack);
}
return {

View file

@ -1,6 +1,6 @@
"use strict";
import protected_session from '../services/protected_session.js';
import protectedSessionService from '../services/protected_session.js';
import utils from '../services/utils.js';
import server from '../services/server.js';
@ -81,7 +81,7 @@ addModule((function() {
alert("Password has been changed. Trilium will be reloaded after you press OK.");
// password changed so current protected session is invalid and needs to be cleared
protected_session.resetProtectedSession();
protectedSessionService.resetProtectedSession();
}
else {
utils.showError(result.message);
@ -109,7 +109,7 @@ addModule((function() {
const protectedSessionTimeout = $protectedSessionTimeout.val();
settings.saveSettings(settingName, protectedSessionTimeout).then(() => {
protected_session.setProtectedSessionTimeout(protectedSessionTimeout);
protectedSessionService.setProtectedSessionTimeout(protectedSessionTimeout);
});
return false;

View file

@ -1,5 +1,3 @@
"use strict";
import utils from '../services/utils.js';
const $dialog = $("#sql-console-dialog");

View file

@ -28,7 +28,7 @@ import utils from './utils.js';
import searchTreeService from './search_tree.js';
import './init.js';
import treeService from './tree_service.js';
import treeService from './tree.js';
const $toggleSearchButton = $("#toggle-search-button");
$toggleSearchButton.click(searchTreeService.toggleSearch);

View file

@ -1,6 +1,4 @@
"use strict";
import treeService from './tree_service.js';
import treeService from './tree.js';
async function cloneNoteTo(childNoteId, parentNoteId, prefix) {
const resp = await server.put('notes/' + childNoteId + '/clone-to/' + parentNoteId, {

View file

@ -1,11 +1,9 @@
"use strict";
import treeService from './tree_service.js';
import cloning from './cloning.js';
import treeService from './tree.js';
import cloningService 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 messagingService from './messaging.js';
import protectedSessionService from './protected_session.js';
import treeChangesService from './tree_changes.js';
import treeUtils from './tree_utils.js';
import utils from './utils.js';
@ -18,14 +16,14 @@ async function pasteAfter(node) {
if (clipboardMode === 'cut') {
const nodes = clipboardIds.map(nodeKey => treeUtils.getNodeByKey(nodeKey));
await treeChanges.moveAfterNode(nodes, node);
await treeChangesService.moveAfterNode(nodes, node);
clipboardIds = [];
clipboardMode = null;
}
else if (clipboardMode === 'copy') {
for (const noteId of clipboardIds) {
await cloning.cloneNoteAfter(noteId, node.data.branchId);
await cloningService.cloneNoteAfter(noteId, node.data.branchId);
}
// copy will keep clipboardIds and clipboardMode so it's possible to paste into multiple places
@ -42,14 +40,14 @@ async function pasteInto(node) {
if (clipboardMode === 'cut') {
const nodes = clipboardIds.map(nodeKey => treeUtils.getNodeByKey(nodeKey));
await treeChanges.moveToNode(nodes, node);
await treeChangesService.moveToNode(nodes, node);
clipboardIds = [];
clipboardMode = null;
}
else if (clipboardMode === 'copy') {
for (const noteId of clipboardIds) {
await cloning.cloneNoteTo(noteId, node.data.noteId);
await cloningService.cloneNoteTo(noteId, node.data.noteId);
}
// copy will keep clipboardIds and clipboardMode so it's possible to paste into multiple places
}
@ -138,10 +136,10 @@ const contextMenuSettings = {
editTreePrefix.showDialog(node);
}
else if (ui.cmd === "protectSubTree") {
protected_session.protectSubTree(node.data.noteId, true);
protectedSessionService.protectSubTree(node.data.noteId, true);
}
else if (ui.cmd === "unprotectSubTree") {
protected_session.protectSubTree(node.data.noteId, false);
protectedSessionService.protectSubTree(node.data.noteId, false);
}
else if (ui.cmd === "copy") {
copy(treeService.getSelectedNodes());
@ -156,7 +154,7 @@ const contextMenuSettings = {
pasteInto(node);
}
else if (ui.cmd === "delete") {
treeChanges.deleteNodes(treeService.getSelectedNodes(true));
treeChangesService.deleteNodes(treeService.getSelectedNodes(true));
}
else if (ui.cmd === "exportSubTree") {
exportService.exportSubTree(node.data.noteId);
@ -174,7 +172,7 @@ const contextMenuSettings = {
treeService.sortAlphabetically(node.data.noteId);
}
else {
messaging.logError("Unknown command: " + ui.cmd);
messagingService.logError("Unknown command: " + ui.cmd);
}
}
};

View file

@ -1,7 +1,5 @@
"use strict";
import treeService from './tree_service.js';
import treeChanges from './tree_changes.js';
import treeService from './tree.js';
import treeChangesService from './tree_changes.js';
const dragAndDropSetup = {
autoExpandMS: 600,
@ -55,13 +53,13 @@ const dragAndDropSetup = {
const selectedNodes = treeService.getSelectedNodes();
if (data.hitMode === "before") {
treeChanges.moveBeforeNode(selectedNodes, node);
treeChangesService.moveBeforeNode(selectedNodes, node);
}
else if (data.hitMode === "after") {
treeChanges.moveAfterNode(selectedNodes, node);
treeChangesService.moveAfterNode(selectedNodes, node);
}
else if (data.hitMode === "over") {
treeChanges.moveToNode(selectedNodes, node);
treeChangesService.moveToNode(selectedNodes, node);
}
else {
throw new Exception("Unknown hitMode=" + data.hitMode);

View file

@ -1,12 +1,10 @@
"use strict";
import treeService from './tree_service.js';
import protected_session from './protected_session.js';
import treeService from './tree.js';
import protectedSessionService from './protected_session.js';
import utils from './utils.js';
function exportSubTree(noteId) {
const url = utils.getHost() + "/api/export/" + noteId + "?protectedSessionId="
+ encodeURIComponent(protected_session.getProtectedSessionId());
+ encodeURIComponent(protectedSessionService.getProtectedSessionId());
utils.download(url);
}

View file

@ -1,9 +1,7 @@
"use strict";
import treeService from './tree_service.js';
import link from './link.js';
import messaging from './messaging.js';
import noteDetail from './note_detail.js';
import treeService from './tree.js';
import linkService from './link.js';
import messagingService from './messaging.js';
import noteDetailService from './note_detail.js';
import treeUtils from './tree_utils.js';
import utils from './utils.js';
import server from './server.js';
@ -24,7 +22,7 @@ $(document).bind('keydown', 'alt+t', e => {
const date = new Date();
const dateString = utils.formatDateTime(date);
link.addTextToEditor(dateString);
linkService.addTextToEditor(dateString);
e.preventDefault();
});
@ -107,7 +105,7 @@ $("#note-title").bind('keydown', 'return', () => $("#note-detail").focus());
$(window).on('beforeunload', () => {
// this makes sure that when user e.g. reloads the page or navigates away from the page, the note's content is saved
// this sends the request asynchronously and doesn't wait for result
noteDetail.saveNoteIfChanged();
noteDetailService.saveNoteIfChanged();
});
// Overrides the default autocomplete filter function to search for matched on atleast 1 word in each of the input term's words
@ -159,12 +157,12 @@ $.ui.autocomplete.filter = (array, terms) => {
$(document).tooltip({
items: "#note-detail a",
content: function(callback) {
const notePath = link.getNotePathFromLink($(this).attr("href"));
const notePath = linkService.getNotePathFromLink($(this).attr("href"));
if (notePath !== null) {
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
noteDetail.loadNote(noteId).then(note => callback(note.detail.content));
noteDetailService.loadNote(noteId).then(note => callback(note.detail.content));
}
},
close: function(event, ui)
@ -201,7 +199,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
].join(' - ');
}
messaging.logError(message);
messagingService.logError(message);
return false;
};
@ -244,7 +242,7 @@ $("#attachment-upload").change(async function() {
formData.append('upload', this.files[0]);
const resp = await $.ajax({
url: baseApiUrl + 'attachments/upload/' + noteDetail.getCurrentNoteId(),
url: baseApiUrl + 'attachments/upload/' + noteDetailService.getCurrentNoteId(),
headers: server.getHeaders(),
data: formData,
type: 'POST',

View file

@ -1,7 +1,5 @@
"use strict";
import treeService from './tree_service.js';
import noteDetail from './note_detail.js';
import treeService from './tree.js';
import noteDetailService from './note_detail.js';
import treeUtils from './tree_utils.js';
function getNotePathFromLink(url) {
@ -77,14 +75,14 @@ function goToLink(e) {
}
function addLinkToEditor(linkTitle, linkHref) {
const editor = noteDetail.getEditor();
const editor = noteDetailService.getEditor();
const doc = editor.document;
doc.enqueueChanges(() => editor.data.insertLink(linkTitle, linkHref), doc.selection);
}
function addTextToEditor(text) {
const editor = noteDetail.getEditor();
const editor = noteDetailService.getEditor();
const doc = editor.document;
doc.enqueueChanges(() => editor.data.insertText(text), doc.selection);

View file

@ -1,9 +1,7 @@
"use strict";
import treeService from './tree_service.js';
import treeService from './tree.js';
import noteDetailService from './note_detail.js';
import utils from './utils.js';
import recentNotes from '../dialogs/recent_notes.js';
import recentNotesDialog from '../dialogs/recent_notes.js';
const $changesToPushCount = $("#changes-to-push-count");
@ -54,7 +52,7 @@ function messageHandler(event) {
if (syncData.some(sync => sync.entityName === 'recent_notes')) {
console.log(utils.now(), "Reloading recent notes because of background changes");
recentNotes.reload();
recentNotesDialog.reload();
}
// we don't detect image changes here since images themselves are immutable and references should be

View file

@ -1,8 +1,6 @@
"use strict";
import treeService from './tree_service.js';
import noteType from './note_type.js';
import protected_session from './protected_session.js';
import treeService from './tree.js';
import noteTypeService from './note_type.js';
import protectedSessionService from './protected_session.js';
import utils from './utils.js';
import server from './server.js';
@ -80,7 +78,7 @@ async function saveNoteIfChanged() {
await saveNoteToServer(note);
if (note.detail.isProtected) {
protected_session.touchProtectedSession();
protectedSessionService.touchProtectedSession();
}
}
@ -221,15 +219,15 @@ async function loadNoteToEditor(noteId) {
$noteIdDisplay.html(noteId);
await protected_session.ensureProtectedSession(currentNote.detail.isProtected, false);
await protectedSessionService.ensureProtectedSession(currentNote.detail.isProtected, false);
if (currentNote.detail.isProtected) {
protected_session.touchProtectedSession();
protectedSessionService.touchProtectedSession();
}
// this might be important if we focused on protected note when not in protected note and we got a dialog
// to login, but we chose instead to come to another node - at that point the dialog is still visible and this will close it.
protected_session.ensureDialogIsClosed();
protectedSessionService.ensureDialogIsClosed();
$noteDetailWrapper.show();
@ -237,8 +235,8 @@ async function loadNoteToEditor(noteId) {
$noteTitle.val(currentNote.detail.title);
noteType.setNoteType(currentNote.detail.type);
noteType.setNoteMime(currentNote.detail.mime);
noteTypeService.setNoteType(currentNote.detail.type);
noteTypeService.setNoteMime(currentNote.detail.mime);
$noteDetail.hide();
$noteDetailSearch.hide();
@ -362,7 +360,7 @@ $attachmentOpen.click(() => {
function getAttachmentUrl() {
// electron needs absolute URL so we extract current host, port, protocol
return utils.getHost() + "/api/attachments/download/" + getCurrentNoteId()
+ "?protectedSessionId=" + encodeURIComponent(protected_session.getProtectedSessionId());
+ "?protectedSessionId=" + encodeURIComponent(protectedSessionService.getProtectedSessionId());
}
$(document).ready(() => {

View file

@ -1,6 +1,4 @@
"use strict";
import treeService from './tree_service.js';
import treeService from './tree.js';
import noteDetail from './note_detail.js';
import utils from './utils.js';

View file

@ -1,6 +1,4 @@
"use strict";
import treeService from './tree_service.js';
import treeService from './tree.js';
import noteDetail from './note_detail.js';
import utils from './utils.js';
import server from './server.js';

View file

@ -1,4 +1,4 @@
import treeService from './tree_service.js';
import treeService from './tree.js';
function ScriptApi(startNote, currentNote) {
const $pluginButtons = $("#plugin-buttons");

View file

@ -1,5 +1,3 @@
"use strict";
import ScriptApi from './script_api.js';
import utils from './utils.js';

View file

@ -1,6 +1,4 @@
"use strict";
import treeService from './tree_service.js';
import treeService from './tree.js';
const $tree = $("#tree");
const $searchInput = $("input[name='search-text']");

View file

@ -1,13 +1,11 @@
"use strict";
import protected_session from './protected_session.js';
import protectedSessionService from './protected_session.js';
import utils from './utils.js';
function getHeaders() {
let protectedSessionId = null;
try { // this is because protected session might not be declared in some cases - like when it's included in migration page
protectedSessionId = protected_session.getProtectedSessionId();
protectedSessionId = protectedSessionService.getProtectedSessionId();
}
catch(e) {}

View file

@ -1,5 +1,3 @@
"use strict";
import utils from './utils.js';
async function syncNow() {

View file

@ -1,16 +1,14 @@
"use strict";
import contextMenu from './context_menu.js';
import contextMenuService from './context_menu.js';
import dragAndDropSetup from './drag_and_drop.js';
import link from './link.js';
import messaging from './messaging.js';
import noteDetail from './note_detail.js';
import protected_session from './protected_session.js';
import treeChanges from './tree_changes.js';
import linkService from './link.js';
import messagingService from './messaging.js';
import noteDetailService from './note_detail.js';
import protectedSessionService from './protected_session.js';
import treeChangesService 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';
import recentNotesDialog from '../dialogs/recent_notes.js';
import treeCache from './tree_cache.js';
const $tree = $("#tree");
@ -146,7 +144,7 @@ async function prepareBranchInner(parentNote) {
const childBranches = await parentNote.getChildBranches();
if (!childBranches) {
messaging.logError(`No children for ${parentNote}. This shouldn't happen.`);
messagingService.logError(`No children for ${parentNote}. This shouldn't happen.`);
return;
}
@ -245,7 +243,7 @@ async function getRunPath(notePath) {
const parents = await child.getParentNotes();
if (!parents) {
messaging.logError("No parents found for " + childNoteId);
messagingService.logError("No parents found for " + childNoteId);
return;
}
@ -268,7 +266,7 @@ async function getRunPath(notePath) {
break;
}
else {
messaging.logError("No parents, can't activate node.");
messagingService.logError("No parents, can't activate node.");
return;
}
}
@ -315,7 +313,7 @@ async function showParentList(noteId, node) {
item = $("<span/>").attr("title", "Current note").append(title);
}
else {
item = link.createNoteLink(notePath, title);
item = linkService.createNoteLink(notePath, title);
}
$parentListList.append($("<li/>").append(item));
@ -377,7 +375,7 @@ function setCurrentNotePathToHash(node) {
document.location.hash = currentNotePath;
recentNotes.addRecentNote(currentBranchId, currentNotePath);
recentNotesDialog.addRecentNote(currentBranchId, currentNotePath);
}
function getSelectedNodes(stopOnParents = false) {
@ -401,13 +399,13 @@ function initFancyTree(branch) {
const keybindings = {
"del": node => {
treeChanges.deleteNodes(getSelectedNodes(true));
treeChangesService.deleteNodes(getSelectedNodes(true));
},
"ctrl+up": node => {
const beforeNode = node.getPrevSibling();
if (beforeNode !== null) {
treeChanges.moveBeforeNode([node], beforeNode);
treeChangesService.moveBeforeNode([node], beforeNode);
}
return false;
@ -415,13 +413,13 @@ function initFancyTree(branch) {
"ctrl+down": node => {
let afterNode = node.getNextSibling();
if (afterNode !== null) {
treeChanges.moveAfterNode([node], afterNode);
treeChangesService.moveAfterNode([node], afterNode);
}
return false;
},
"ctrl+left": node => {
treeChanges.moveNodeUpInHierarchy(node);
treeChangesService.moveNodeUpInHierarchy(node);
return false;
},
@ -429,7 +427,7 @@ function initFancyTree(branch) {
let toNode = node.getPrevSibling();
if (toNode !== null) {
treeChanges.moveToNode([node], toNode);
treeChangesService.moveToNode([node], toNode);
}
return false;
@ -479,22 +477,22 @@ function initFancyTree(branch) {
return false;
},
"ctrl+c": () => {
contextMenu.copy(getSelectedNodes());
contextMenuService.copy(getSelectedNodes());
return false;
},
"ctrl+x": () => {
contextMenu.cut(getSelectedNodes());
contextMenuService.cut(getSelectedNodes());
return false;
},
"ctrl+v": node => {
contextMenu.pasteInto(node);
contextMenuService.pasteInto(node);
return false;
},
"return": node => {
noteDetail.focus();
noteDetailService.focus();
return false;
},
@ -557,7 +555,7 @@ function initFancyTree(branch) {
setCurrentNotePathToHash(data.node);
noteDetail.switchToNote(node.noteId);
noteDetailService.switchToNote(node.noteId);
showParentList(node.noteId, data.node);
},
@ -615,7 +613,7 @@ function initFancyTree(branch) {
}
});
$tree.contextmenu(contextMenu.contextMenuSettings);
$tree.contextmenu(contextMenuService.contextMenuSettings);
}
async function loadSearchNote(searchNoteId) {
@ -768,7 +766,7 @@ async function createNote(node, parentNoteId, target, isProtected) {
// if isProtected isn't available (user didn't enter password yet), then note is created as unencrypted
// but this is quite weird since user doesn't see WHERE the note is being created so it shouldn't occur often
if (!isProtected || !protected_session.isProtectedSessionAvailable()) {
if (!isProtected || !protectedSessionService.isProtectedSessionAvailable()) {
isProtected = false;
}
@ -793,7 +791,7 @@ async function createNote(node, parentNoteId, target, isProtected) {
treeCache.add(note, branch);
noteDetail.newNoteCreated();
noteDetailService.newNoteCreated();
const newNode = {
title: newNoteName,
@ -869,7 +867,7 @@ $(document).bind('keydown', 'ctrl+p', e => {
$(document).bind('keydown', 'ctrl+del', e => {
const node = getCurrentNode();
treeChanges.deleteNodes([node]);
treeChangesService.deleteNodes([node]);
e.preventDefault();
});

View file

@ -1,7 +1,6 @@
"use strict";
import treeService from './tree_service.js';
import treeService from './tree.js';
import utils from './utils.js';
import server from './server.js';
async function moveBeforeNode(nodesToMove, beforeNode) {
for (const nodeToMove of nodesToMove) {

View file

@ -1,5 +1,3 @@
"use strict";
import utils from './utils.js';
const $tree = $("#tree");

View file

@ -1,7 +1,5 @@
"use strict";
import link from './link.js';
import messaging from './messaging.js';
import linkService from './link.js';
import messagingService from './messaging.js';
import ScriptContext from './script_context.js';
function reloadApp() {
@ -35,7 +33,7 @@ function showError(message, delay = 10000) {
}
function throwError(message) {
messaging.logError(message);
messagingService.logError(message);
throw new Error(message);
}
@ -191,7 +189,7 @@ async function requireScript(url) {
async function requireCss(url) {
const css = Array
.from(document.querySelectorAll('link'))
.from(document.querySelectorAll('linkService'))
.map(scr => scr.href);
if (!css.includes(url)) {