mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	moved services into the service directory
This commit is contained in:
		
							parent
							
								
									f52d7e3c28
								
							
						
					
					
						commit
						fddd1c278f
					
				@ -1,10 +1,10 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from '../note_tree.js';
 | 
					import treeService from '../services/tree_service.js';
 | 
				
			||||||
import cloning from '../cloning.js';
 | 
					import cloning from '../services/cloning.js';
 | 
				
			||||||
import link from '../link.js';
 | 
					import link from '../services/link.js';
 | 
				
			||||||
import noteEditor from '../note_editor.js';
 | 
					import noteDetail from '../services/note_detail.js';
 | 
				
			||||||
import treeUtils from '../tree_utils.js';
 | 
					import treeUtils from '../services/tree_utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $dialog = $("#add-link-dialog");
 | 
					const $dialog = $("#add-link-dialog");
 | 
				
			||||||
const $form = $("#add-link-form");
 | 
					const $form = $("#add-link-form");
 | 
				
			||||||
@ -27,7 +27,7 @@ function setLinkType(linkType) {
 | 
				
			|||||||
async function showDialog() {
 | 
					async function showDialog() {
 | 
				
			||||||
    glob.activeDialog = $dialog;
 | 
					    glob.activeDialog = $dialog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (noteEditor.getCurrentNoteType() === 'text') {
 | 
					    if (noteDetail.getCurrentNoteType() === 'text') {
 | 
				
			||||||
        $linkTypeHtml.prop('disabled', false);
 | 
					        $linkTypeHtml.prop('disabled', false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        setLinkType('html');
 | 
					        setLinkType('html');
 | 
				
			||||||
@ -99,14 +99,14 @@ $form.submit(() => {
 | 
				
			|||||||
        else if (linkType === 'selected-to-current') {
 | 
					        else if (linkType === 'selected-to-current') {
 | 
				
			||||||
            const prefix = $clonePrefix.val();
 | 
					            const prefix = $clonePrefix.val();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            cloning.cloneNoteTo(noteId, noteEditor.getCurrentNoteId(), prefix);
 | 
					            cloning.cloneNoteTo(noteId, noteDetail.getCurrentNoteId(), prefix);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $dialog.dialog("close");
 | 
					            $dialog.dialog("close");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if (linkType === 'current-to-selected') {
 | 
					        else if (linkType === 'current-to-selected') {
 | 
				
			||||||
            const prefix = $clonePrefix.val();
 | 
					            const prefix = $clonePrefix.val();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            cloning.cloneNoteTo(noteEditor.getCurrentNoteId(), noteId, prefix);
 | 
					            cloning.cloneNoteTo(noteDetail.getCurrentNoteId(), noteId, prefix);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $dialog.dialog("close");
 | 
					            $dialog.dialog("close");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from '../note_tree.js';
 | 
					import treeService from '../services/tree_service.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");
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import link from '../link.js';
 | 
					import link from '../services/link.js';
 | 
				
			||||||
import utils from '../utils.js';
 | 
					import utils from '../services/utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $dialog = $("#event-log-dialog");
 | 
					const $dialog = $("#event-log-dialog");
 | 
				
			||||||
const $list = $("#event-log-list");
 | 
					const $list = $("#event-log-list");
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from '../note_tree.js';
 | 
					import treeService from '../services/tree_service.js';
 | 
				
			||||||
import link from '../link.js';
 | 
					import link from '../services/link.js';
 | 
				
			||||||
import utils from '../utils.js';
 | 
					import utils from '../services/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");
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import noteEditor from '../note_editor.js';
 | 
					import noteDetail from '../services/note_detail.js';
 | 
				
			||||||
import utils from '../utils.js';
 | 
					import utils from '../services/utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $showDialogButton = $(".show-labels-button");
 | 
					const $showDialogButton = $(".show-labels-button");
 | 
				
			||||||
const $dialog = $("#labels-dialog");
 | 
					const $dialog = $("#labels-dialog");
 | 
				
			||||||
@ -17,7 +17,7 @@ function LabelsModel() {
 | 
				
			|||||||
    this.labels = ko.observableArray();
 | 
					    this.labels = ko.observableArray();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.loadLabels = async function() {
 | 
					    this.loadLabels = async function() {
 | 
				
			||||||
        const noteId = noteEditor.getCurrentNoteId();
 | 
					        const noteId = noteDetail.getCurrentNoteId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const labels = await server.get('notes/' + noteId + '/labels');
 | 
					        const labels = await server.get('notes/' + noteId + '/labels');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -81,7 +81,7 @@ function LabelsModel() {
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const noteId = noteEditor.getCurrentNoteId();
 | 
					        const noteId = noteDetail.getCurrentNoteId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const labelsToSave = self.labels()
 | 
					        const labelsToSave = self.labels()
 | 
				
			||||||
            .map(attr => attr())
 | 
					            .map(attr => attr())
 | 
				
			||||||
@ -95,7 +95,7 @@ function LabelsModel() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        utils.showMessage("Labels have been saved.");
 | 
					        utils.showMessage("Labels have been saved.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        noteEditor.loadLabelList();
 | 
					        noteDetail.loadLabelList();
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function addLastEmptyRow() {
 | 
					    function addLastEmptyRow() {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import noteEditor from '../note_editor.js';
 | 
					import noteDetail from '../services/note_detail.js';
 | 
				
			||||||
import utils from '../utils.js';
 | 
					import utils from '../services/utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $showDialogButton = $("#show-history-button");
 | 
					const $showDialogButton = $("#show-history-button");
 | 
				
			||||||
const $dialog = $("#note-history-dialog");
 | 
					const $dialog = $("#note-history-dialog");
 | 
				
			||||||
@ -12,7 +12,7 @@ const $title = $("#note-history-title");
 | 
				
			|||||||
let historyItems = [];
 | 
					let historyItems = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function showCurrentNoteHistory() {
 | 
					async function showCurrentNoteHistory() {
 | 
				
			||||||
    await showNoteHistoryDialog(noteEditor.getCurrentNoteId());
 | 
					    await showNoteHistoryDialog(noteDetail.getCurrentNoteId());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function showNoteHistoryDialog(noteId, noteRevisionId) {
 | 
					async function showNoteHistoryDialog(noteId, noteRevisionId) {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import noteEditor from '../note_editor.js';
 | 
					import noteDetail from '../services/note_detail.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $showDialogButton = $("#show-source-button");
 | 
					const $showDialogButton = $("#show-source-button");
 | 
				
			||||||
const $dialog = $("#note-source-dialog");
 | 
					const $dialog = $("#note-source-dialog");
 | 
				
			||||||
@ -15,7 +15,7 @@ function showDialog() {
 | 
				
			|||||||
        height: 500
 | 
					        height: 500
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const noteText = noteEditor.getCurrentNote().detail.content;
 | 
					    const noteText = noteDetail.getCurrentNote().detail.content;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $noteSource.text(formatHtml(noteText));
 | 
					    $noteSource.text(formatHtml(noteText));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import link from '../link.js';
 | 
					import link from '../services/link.js';
 | 
				
			||||||
import utils from '../utils.js';
 | 
					import utils from '../services/utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $showDialogButton = $("#recent-changes-button");
 | 
					const $showDialogButton = $("#recent-changes-button");
 | 
				
			||||||
const $dialog = $("#recent-changes-dialog");
 | 
					const $dialog = $("#recent-changes-dialog");
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from '../note_tree.js';
 | 
					import treeService from '../services/tree_service.js';
 | 
				
			||||||
import server from '../server.js';
 | 
					import server from '../services/server.js';
 | 
				
			||||||
import messaging from '../messaging.js';
 | 
					import messaging from '../services/messaging.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $showDialogButton = $("#recent-notes-button");
 | 
					const $showDialogButton = $("#recent-notes-button");
 | 
				
			||||||
const $dialog = $("#recent-notes-dialog");
 | 
					const $dialog = $("#recent-notes-dialog");
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import protected_session from '../protected_session.js';
 | 
					import protected_session from '../services/protected_session.js';
 | 
				
			||||||
import utils from '../utils.js';
 | 
					import utils from '../services/utils.js';
 | 
				
			||||||
import server from '../server.js';
 | 
					import server from '../services/server.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $showDialogButton = $("#settings-button");
 | 
					const $showDialogButton = $("#settings-button");
 | 
				
			||||||
const $dialog = $("#settings-dialog");
 | 
					const $dialog = $("#settings-dialog");
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import utils from '../utils.js';
 | 
					import utils from '../services/utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $dialog = $("#sql-console-dialog");
 | 
					const $dialog = $("#sql-console-dialog");
 | 
				
			||||||
const $query = $('#sql-console-query');
 | 
					const $query = $('#sql-console-query');
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,14 @@
 | 
				
			|||||||
import addLink from './dialogs/add_link.js';
 | 
					import addLink from '../dialogs/add_link.js';
 | 
				
			||||||
import editTreePrefix from './dialogs/edit_tree_prefix.js';
 | 
					import editTreePrefix from '../dialogs/edit_tree_prefix.js';
 | 
				
			||||||
import eventLog from './dialogs/event_log.js';
 | 
					import eventLog from '../dialogs/event_log.js';
 | 
				
			||||||
import jumpToNote from './dialogs/jump_to_note.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 noteHistory from '../dialogs/note_history.js';
 | 
				
			||||||
import noteSource from './dialogs/note_source.js';
 | 
					import noteSource from '../dialogs/note_source.js';
 | 
				
			||||||
import recentChanges from './dialogs/recent_changes.js';
 | 
					import recentChanges from '../dialogs/recent_changes.js';
 | 
				
			||||||
import recentNotes from './dialogs/recent_notes.js';
 | 
					import recentNotes from '../dialogs/recent_notes.js';
 | 
				
			||||||
import settings from './dialogs/settings.js';
 | 
					import settings from '../dialogs/settings.js';
 | 
				
			||||||
import sqlConsole from './dialogs/sql_console.js';
 | 
					import sqlConsole 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';
 | 
				
			||||||
@ -16,7 +16,7 @@ import dragAndDropSetup from './drag_and_drop.js';
 | 
				
			|||||||
import exportService from './export.js';
 | 
					import exportService from './export.js';
 | 
				
			||||||
import link from './link.js';
 | 
					import link from './link.js';
 | 
				
			||||||
import messaging from './messaging.js';
 | 
					import messaging from './messaging.js';
 | 
				
			||||||
import noteEditor from './note_editor.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 ScriptApi from './script_api.js';
 | 
					import ScriptApi from './script_api.js';
 | 
				
			||||||
@ -28,7 +28,7 @@ import utils from './utils.js';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import searchTreeService from './search_tree.js';
 | 
					import searchTreeService from './search_tree.js';
 | 
				
			||||||
import './init.js';
 | 
					import './init.js';
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
const $toggleSearchButton = $("#toggle-search-button");
 | 
					const $toggleSearchButton = $("#toggle-search-button");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$toggleSearchButton.click(searchTreeService.toggleSearch);
 | 
					$toggleSearchButton.click(searchTreeService.toggleSearch);
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.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, {
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import cloning from './cloning.js';
 | 
					import cloning from './cloning.js';
 | 
				
			||||||
import exportService from './export.js';
 | 
					import exportService from './export.js';
 | 
				
			||||||
import messaging from './messaging.js';
 | 
					import messaging from './messaging.js';
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import treeChanges from './tree_changes.js';
 | 
					import treeChanges from './tree_changes.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const dragAndDropSetup = {
 | 
					const dragAndDropSetup = {
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import protected_session from './protected_session.js';
 | 
					import protected_session from './protected_session.js';
 | 
				
			||||||
import utils from './utils.js';
 | 
					import utils from './utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,9 +1,9 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import link from './link.js';
 | 
					import link from './link.js';
 | 
				
			||||||
import messaging from './messaging.js';
 | 
					import messaging from './messaging.js';
 | 
				
			||||||
import noteEditor from './note_editor.js';
 | 
					import noteDetail from './note_detail.js';
 | 
				
			||||||
import treeUtils from './tree_utils.js';
 | 
					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';
 | 
				
			||||||
@ -107,7 +107,7 @@ $("#note-title").bind('keydown', 'return', () => $("#note-detail").focus());
 | 
				
			|||||||
$(window).on('beforeunload', () => {
 | 
					$(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 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
 | 
					    // this sends the request asynchronously and doesn't wait for result
 | 
				
			||||||
    noteEditor.saveNoteIfChanged();
 | 
					    noteDetail.saveNoteIfChanged();
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Overrides the default autocomplete filter function to search for matched on atleast 1 word in each of the input term's words
 | 
					// Overrides the default autocomplete filter function to search for matched on atleast 1 word in each of the input term's words
 | 
				
			||||||
@ -164,7 +164,7 @@ $(document).tooltip({
 | 
				
			|||||||
        if (notePath !== null) {
 | 
					        if (notePath !== null) {
 | 
				
			||||||
            const noteId = treeUtils.getNoteIdFromNotePath(notePath);
 | 
					            const noteId = treeUtils.getNoteIdFromNotePath(notePath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            noteEditor.loadNote(noteId).then(note => callback(note.detail.content));
 | 
					            noteDetail.loadNote(noteId).then(note => callback(note.detail.content));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    close: function(event, ui)
 | 
					    close: function(event, ui)
 | 
				
			||||||
@ -244,7 +244,7 @@ $("#attachment-upload").change(async function() {
 | 
				
			|||||||
    formData.append('upload', this.files[0]);
 | 
					    formData.append('upload', this.files[0]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const resp = await $.ajax({
 | 
					    const resp = await $.ajax({
 | 
				
			||||||
        url: baseApiUrl + 'attachments/upload/' + noteEditor.getCurrentNoteId(),
 | 
					        url: baseApiUrl + 'attachments/upload/' + noteDetail.getCurrentNoteId(),
 | 
				
			||||||
        headers: server.getHeaders(),
 | 
					        headers: server.getHeaders(),
 | 
				
			||||||
        data: formData,
 | 
					        data: formData,
 | 
				
			||||||
        type: 'POST',
 | 
					        type: 'POST',
 | 
				
			||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import noteEditor from './note_editor.js';
 | 
					import noteDetail from './note_detail.js';
 | 
				
			||||||
import treeUtils from './tree_utils.js';
 | 
					import treeUtils from './tree_utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getNotePathFromLink(url) {
 | 
					function getNotePathFromLink(url) {
 | 
				
			||||||
@ -77,14 +77,14 @@ function goToLink(e) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function addLinkToEditor(linkTitle, linkHref) {
 | 
					function addLinkToEditor(linkTitle, linkHref) {
 | 
				
			||||||
    const editor = noteEditor.getEditor();
 | 
					    const editor = noteDetail.getEditor();
 | 
				
			||||||
    const doc = editor.document;
 | 
					    const doc = editor.document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    doc.enqueueChanges(() => editor.data.insertLink(linkTitle, linkHref), doc.selection);
 | 
					    doc.enqueueChanges(() => editor.data.insertLink(linkTitle, linkHref), doc.selection);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function addTextToEditor(text) {
 | 
					function addTextToEditor(text) {
 | 
				
			||||||
    const editor = noteEditor.getEditor();
 | 
					    const editor = noteDetail.getEditor();
 | 
				
			||||||
    const doc = editor.document;
 | 
					    const doc = editor.document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    doc.enqueueChanges(() => editor.data.insertText(text), doc.selection);
 | 
					    doc.enqueueChanges(() => editor.data.insertText(text), doc.selection);
 | 
				
			||||||
@ -1,8 +1,7 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import noteEditor from './note_editor.js';
 | 
					import noteDetailService from './note_detail.js';
 | 
				
			||||||
import sync from './sync.js';
 | 
					 | 
				
			||||||
import utils from './utils.js';
 | 
					import utils from './utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $changesToPushCount = $("#changes-to-push-count");
 | 
					const $changesToPushCount = $("#changes-to-push-count");
 | 
				
			||||||
@ -41,10 +40,10 @@ function messageHandler(event) {
 | 
				
			|||||||
            treeService.reload();
 | 
					            treeService.reload();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (syncData.some(sync => sync.entityName === 'notes' && sync.entityId === noteEditor.getCurrentNoteId())) {
 | 
					        if (syncData.some(sync => sync.entityName === 'notes' && sync.entityId === noteDetailService.getCurrentNoteId())) {
 | 
				
			||||||
            utils.showMessage('Reloading note because of background changes');
 | 
					            utils.showMessage('Reloading note because of background changes');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            noteEditor.reload();
 | 
					            noteDetailService.reload();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (syncData.some(sync => sync.entityName === 'recent_notes')) {
 | 
					        if (syncData.some(sync => sync.entityName === 'recent_notes')) {
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.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 utils from './utils.js';
 | 
					import utils from './utils.js';
 | 
				
			||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import noteEditor from './note_editor.js';
 | 
					import noteDetail from './note_detail.js';
 | 
				
			||||||
import utils from './utils.js';
 | 
					import utils from './utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $executeScriptButton = $("#execute-script-button");
 | 
					const $executeScriptButton = $("#execute-script-button");
 | 
				
			||||||
@ -85,13 +85,13 @@ function NoteTypeModel() {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async function save() {
 | 
					    async function save() {
 | 
				
			||||||
        const note = noteEditor.getCurrentNote();
 | 
					        const note = noteDetail.getCurrentNote();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await server.put('notes/' + note.detail.noteId
 | 
					        await server.put('notes/' + note.detail.noteId
 | 
				
			||||||
            + '/type/' + encodeURIComponent(self.type())
 | 
					            + '/type/' + encodeURIComponent(self.type())
 | 
				
			||||||
            + '/mime/' + encodeURIComponent(self.mime()));
 | 
					            + '/mime/' + encodeURIComponent(self.mime()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await noteEditor.reload();
 | 
					        await noteDetail.reload();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // for the note icon to be updated in the tree
 | 
					        // for the note icon to be updated in the tree
 | 
				
			||||||
        await treeService.reload();
 | 
					        await treeService.reload();
 | 
				
			||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import noteEditor from './note_editor.js';
 | 
					import noteDetail from './note_detail.js';
 | 
				
			||||||
import utils from './utils.js';
 | 
					import utils from './utils.js';
 | 
				
			||||||
import server from './server.js';
 | 
					import server from './server.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -68,7 +68,7 @@ async function setupProtectedSession() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    $dialog.dialog("close");
 | 
					    $dialog.dialog("close");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteEditor.reload();
 | 
					    noteDetail.reload();
 | 
				
			||||||
    treeService.reload();
 | 
					    treeService.reload();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (protectedSessionDeferred !== null) {
 | 
					    if (protectedSessionDeferred !== null) {
 | 
				
			||||||
@ -117,33 +117,33 @@ function isProtectedSessionAvailable() {
 | 
				
			|||||||
async function protectNoteAndSendToServer() {
 | 
					async function protectNoteAndSendToServer() {
 | 
				
			||||||
    await ensureProtectedSession(true, true);
 | 
					    await ensureProtectedSession(true, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const note = noteEditor.getCurrentNote();
 | 
					    const note = noteDetail.getCurrentNote();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteEditor.updateNoteFromInputs(note);
 | 
					    noteDetail.updateNoteFromInputs(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    note.detail.isProtected = true;
 | 
					    note.detail.isProtected = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await noteEditor.saveNoteToServer(note);
 | 
					    await noteDetail.saveNoteToServer(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    treeService.setProtected(note.detail.noteId, note.detail.isProtected);
 | 
					    treeService.setProtected(note.detail.noteId, note.detail.isProtected);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteEditor.setNoteBackgroundIfProtected(note);
 | 
					    noteDetail.setNoteBackgroundIfProtected(note);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function unprotectNoteAndSendToServer() {
 | 
					async function unprotectNoteAndSendToServer() {
 | 
				
			||||||
    await ensureProtectedSession(true, true);
 | 
					    await ensureProtectedSession(true, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const note = noteEditor.getCurrentNote();
 | 
					    const note = noteDetail.getCurrentNote();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteEditor.updateNoteFromInputs(note);
 | 
					    noteDetail.updateNoteFromInputs(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    note.detail.isProtected = false;
 | 
					    note.detail.isProtected = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await noteEditor.saveNoteToServer(note);
 | 
					    await noteDetail.saveNoteToServer(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    treeService.setProtected(note.detail.noteId, note.detail.isProtected);
 | 
					    treeService.setProtected(note.detail.noteId, note.detail.isProtected);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteEditor.setNoteBackgroundIfProtected(note);
 | 
					    noteDetail.setNoteBackgroundIfProtected(note);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function touchProtectedSession() {
 | 
					function touchProtectedSession() {
 | 
				
			||||||
@ -160,7 +160,7 @@ async function protectSubTree(noteId, protect) {
 | 
				
			|||||||
    utils.showMessage("Request to un/protect sub tree has finished successfully");
 | 
					    utils.showMessage("Request to un/protect sub tree has finished successfully");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    treeService.reload();
 | 
					    treeService.reload();
 | 
				
			||||||
    noteEditor.reload();
 | 
					    noteDetail.reload();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$passwordForm.submit(() => {
 | 
					$passwordForm.submit(() => {
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function ScriptApi(startNote, currentNote) {
 | 
					function ScriptApi(startNote, currentNote) {
 | 
				
			||||||
    const $pluginButtons = $("#plugin-buttons");
 | 
					    const $pluginButtons = $("#plugin-buttons");
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $tree = $("#tree");
 | 
					const $tree = $("#tree");
 | 
				
			||||||
const $searchInput = $("input[name='search-text']");
 | 
					const $searchInput = $("input[name='search-text']");
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
import utils from "./utils.js";
 | 
					import utils from "./utils.js";
 | 
				
			||||||
import Branch from "./entities/branch.js";
 | 
					import Branch from "../entities/branch.js";
 | 
				
			||||||
import NoteShort from "./entities/note_short.js";
 | 
					import NoteShort from "../entities/note_short.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TreeCache {
 | 
					class TreeCache {
 | 
				
			||||||
    load(noteRows, branchRows) {
 | 
					    load(noteRows, branchRows) {
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import treeService from './note_tree.js';
 | 
					import treeService from './tree_service.js';
 | 
				
			||||||
import utils from './utils.js';
 | 
					import utils from './utils.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function moveBeforeNode(nodesToMove, beforeNode) {
 | 
					async function moveBeforeNode(nodesToMove, beforeNode) {
 | 
				
			||||||
@ -4,13 +4,13 @@ import contextMenu from './context_menu.js';
 | 
				
			|||||||
import dragAndDropSetup from './drag_and_drop.js';
 | 
					import dragAndDropSetup from './drag_and_drop.js';
 | 
				
			||||||
import link from './link.js';
 | 
					import link from './link.js';
 | 
				
			||||||
import messaging from './messaging.js';
 | 
					import messaging from './messaging.js';
 | 
				
			||||||
import noteEditor from './note_editor.js';
 | 
					import noteDetail from './note_detail.js';
 | 
				
			||||||
import protected_session from './protected_session.js';
 | 
					import protected_session from './protected_session.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 server from './server.js';
 | 
					import server from './server.js';
 | 
				
			||||||
import recentNotes from './dialogs/recent_notes.js';
 | 
					import recentNotes from '../dialogs/recent_notes.js';
 | 
				
			||||||
import treeCache from './tree_cache.js';
 | 
					import treeCache from './tree_cache.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const $tree = $("#tree");
 | 
					const $tree = $("#tree");
 | 
				
			||||||
@ -494,7 +494,7 @@ function initFancyTree(branch) {
 | 
				
			|||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        "return": node => {
 | 
					        "return": node => {
 | 
				
			||||||
            noteEditor.focus();
 | 
					            noteDetail.focus();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
@ -557,7 +557,7 @@ function initFancyTree(branch) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            setCurrentNotePathToHash(data.node);
 | 
					            setCurrentNotePathToHash(data.node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            noteEditor.switchToNote(node.noteId);
 | 
					            noteDetail.switchToNote(node.noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            showParentList(node.noteId, data.node);
 | 
					            showParentList(node.noteId, data.node);
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
@ -793,7 +793,7 @@ async function createNote(node, parentNoteId, target, isProtected) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    treeCache.add(note, branch);
 | 
					    treeCache.add(note, branch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteEditor.newNoteCreated();
 | 
					    noteDetail.newNoteCreated();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const newNode = {
 | 
					    const newNode = {
 | 
				
			||||||
        title: newNoteName,
 | 
					        title: newNoteName,
 | 
				
			||||||
@ -519,7 +519,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <link href="/stylesheets/style.css" rel="stylesheet">
 | 
					    <link href="/stylesheets/style.css" rel="stylesheet">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script src="/javascripts/bootstrap.js" type="module"></script>
 | 
					    <script src="/javascripts/services/bootstrap.js" type="module"></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
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user