mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5646218be8 | ||
|
|
c2ebd4b308 | ||
|
|
d58e98e361 | ||
|
|
05547845cb | ||
|
|
9b905563c3 |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "trilium",
|
||||
"version": "0.36.2",
|
||||
"version": "0.36.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.36.3",
|
||||
"version": "0.36.4",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
|
||||
@@ -16,9 +16,9 @@ function getNotePathFromUrl(url) {
|
||||
|
||||
async function createNoteLink(notePath, noteTitle = null, tooltip = true) {
|
||||
if (!noteTitle) {
|
||||
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
|
||||
const {noteId, parentNoteId} = treeUtils.getNoteIdAndParentIdFromNotePath(notePath);
|
||||
|
||||
noteTitle = await treeUtils.getNoteTitle(noteId);
|
||||
noteTitle = await treeUtils.getNoteTitle(noteId, parentNoteId);
|
||||
}
|
||||
|
||||
const $noteLink = $("<a>", {
|
||||
|
||||
@@ -131,11 +131,13 @@ class NoteDetailBook {
|
||||
for (const childNote of await note.getChildNotes()) {
|
||||
const type = this.getRenderingType(childNote);
|
||||
|
||||
const childNotePath = this.ctx.notePath + '/' + childNote.noteId;
|
||||
|
||||
const $card = $('<div class="note-book-card">')
|
||||
.attr('data-note-id', childNote.noteId)
|
||||
.css("flex-basis", ZOOMS[this.zoomLevel].width)
|
||||
.addClass("type-" + type)
|
||||
.append($('<h5 class="note-book-title">').append(await linkService.createNoteLink(childNote.noteId, null, false)))
|
||||
.append($('<h5 class="note-book-title">').append(await linkService.createNoteLink(childNotePath, null, false)))
|
||||
.append($('<div class="note-book-content">')
|
||||
.css("max-height", ZOOMS[this.zoomLevel].height)
|
||||
.append(await this.getNoteContent(type, childNote)));
|
||||
@@ -270,7 +272,10 @@ class NoteDetailBook {
|
||||
return type;
|
||||
}
|
||||
|
||||
getContent() {}
|
||||
getContent() {
|
||||
// for auto-book cases when renaming title there should be content
|
||||
return "";
|
||||
}
|
||||
|
||||
show() {
|
||||
this.$component.show();
|
||||
|
||||
@@ -25,6 +25,29 @@ function getNoteIdFromNotePath(notePath) {
|
||||
return lastSegment.split("-")[0];
|
||||
}
|
||||
|
||||
function getNoteIdAndParentIdFromNotePath(notePath) {
|
||||
let parentNoteId = 'root';
|
||||
let noteId = '';
|
||||
|
||||
if (notePath) {
|
||||
const path = notePath.split("/");
|
||||
|
||||
const lastSegment = path[path.length - 1];
|
||||
|
||||
// path could have also tabId suffix
|
||||
noteId = lastSegment.split("-")[0];
|
||||
|
||||
if (path.length > 1) {
|
||||
parentNoteId = path[path.length - 2];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
parentNoteId,
|
||||
noteId
|
||||
}
|
||||
}
|
||||
|
||||
async function getNotePath(node) {
|
||||
if (!node) {
|
||||
console.error("Node is null");
|
||||
@@ -103,6 +126,7 @@ export default {
|
||||
getNodeByKey,
|
||||
getNotePath,
|
||||
getNoteIdFromNotePath,
|
||||
getNoteIdAndParentIdFromNotePath,
|
||||
getNoteTitle,
|
||||
getNotePathTitle,
|
||||
};
|
||||
@@ -1 +1 @@
|
||||
module.exports = { buildDate:"2019-11-05T21:49:16+01:00", buildRevision: "72fda89360d924aedf7a26216fd387346254dfd3" };
|
||||
module.exports = { buildDate:"2019-11-09T21:19:34+01:00", buildRevision: "c2ebd4b308d712b3f4cff99019c559ccab0e49b7" };
|
||||
|
||||
@@ -6,6 +6,7 @@ const treeService = require('./tree');
|
||||
const noteService = require('./notes');
|
||||
const repository = require('./repository');
|
||||
const Branch = require('../entities/branch');
|
||||
const TaskContext = require("./task_context.js");
|
||||
|
||||
async function cloneNoteToParent(noteId, parentNoteId, prefix) {
|
||||
if (await isNoteDeleted(noteId) || await isNoteDeleted(parentNoteId)) {
|
||||
@@ -53,7 +54,7 @@ async function ensureNoteIsAbsentFromParent(noteId, parentNoteId) {
|
||||
const branch = await repository.getEntity(`SELECT * FROM branches WHERE noteId = ? AND parentNoteId = ? AND isDeleted = 0`, [noteId, parentNoteId]);
|
||||
|
||||
if (branch) {
|
||||
await noteService.deleteBranch(branch);
|
||||
await noteService.deleteBranch(branch, new TaskContext());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -370,6 +370,7 @@ async function updateNote(noteId, noteUpdates) {
|
||||
note.isProtected = noteUpdates.isProtected;
|
||||
await note.save();
|
||||
|
||||
// this might be simplified to just !== undefined
|
||||
if (!['file', 'image', 'render'].includes(note.type)) {
|
||||
noteUpdates.content = await saveLinks(note, noteUpdates.content);
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
</div>
|
||||
|
||||
<% include dialogs/protected_session_password.ejs %>
|
||||
<% include dialogs/confirm.ejs %>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container"></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user