mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
Merge branch 'master' into next55
# Conflicts: # electron.js # package-lock.json # package.json # src/public/app/layouts/desktop_layout.js # src/public/app/widgets/note_tree.js # src/services/port.js
This commit is contained in:
@@ -13,6 +13,7 @@ import appContext from "../services/app_context.js";
|
||||
import keyboardActionsService from "../services/keyboard_actions.js";
|
||||
import clipboard from "../services/clipboard.js";
|
||||
import protectedSessionService from "../services/protected_session.js";
|
||||
import linkService from "../services/link.js";
|
||||
import syncService from "../services/sync.js";
|
||||
import options from "../services/options.js";
|
||||
import protectedSessionHolder from "../services/protected_session_holder.js";
|
||||
@@ -401,6 +402,18 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
title: node.title
|
||||
}));
|
||||
|
||||
if (notes.length === 1) {
|
||||
linkService.createNoteLink(notes[0].noteId, {referenceLink: true})
|
||||
.then($link => data.dataTransfer.setData("text/html", $link[0].outerHTML));
|
||||
}
|
||||
else {
|
||||
Promise.all(notes.map(note => linkService.createNoteLink(note.noteId, {referenceLink: true}))).then(links => {
|
||||
const $list = $("<ul>").append(...links.map($link => $("<li>").append($link)));
|
||||
|
||||
data.dataTransfer.setData("text/html", $list[0].outerHTML);
|
||||
});
|
||||
}
|
||||
|
||||
data.dataTransfer.setData("text", JSON.stringify(notes));
|
||||
return true; // allow dragging to start
|
||||
},
|
||||
@@ -521,8 +534,6 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
if (isHoistedNote) {
|
||||
const $unhoistButton = $('<span class="tree-item-button unhoist-button bx bx-door-open" title="Unhoist"></span>');
|
||||
|
||||
$unhoistButton.on('click', () => alert("bebe"));
|
||||
|
||||
$span.append($unhoistButton);
|
||||
}
|
||||
|
||||
@@ -670,7 +681,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
const note = branch.getNoteFromCache();
|
||||
|
||||
if (!note) {
|
||||
throw new Error(`Branch "${branch.branchId}" has no note "${branch.noteId}"`);
|
||||
throw new Error(`Branch "${branch.branchId}" has no child note "${branch.noteId}"`);
|
||||
}
|
||||
|
||||
const title = (branch.prefix ? (branch.prefix + " - ") : "") + note.title;
|
||||
@@ -739,6 +750,12 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
extraClasses.push("archived");
|
||||
}
|
||||
|
||||
const colorClass = note.getColorClass();
|
||||
|
||||
if (colorClass) {
|
||||
extraClasses.push(colorClass);
|
||||
}
|
||||
|
||||
return extraClasses.join(" ");
|
||||
}
|
||||
|
||||
@@ -946,7 +963,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
|
||||
if (this.noteContext
|
||||
&& this.noteContext.notePath
|
||||
&& !this.noteContext.note.isDeleted
|
||||
&& !this.noteContext.note?.isDeleted
|
||||
&& !this.noteContext.notePath.includes("root/hidden")
|
||||
) {
|
||||
const newActiveNode = await this.getNodeFromPath(this.noteContext.notePath);
|
||||
|
||||
@@ -1040,7 +1058,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
const noteIdsToReload = new Set();
|
||||
|
||||
for (const ecAttr of loadResults.getAttributes()) {
|
||||
if (ecAttr.type === 'label' && ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'archived'].includes(ecAttr.name)) {
|
||||
if (ecAttr.type === 'label' && ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'archived', 'color'].includes(ecAttr.name)) {
|
||||
if (ecAttr.isInheritable) {
|
||||
noteIdsToReload.add(ecAttr.noteId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user