mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 17:26:38 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad878c078e | ||
|
|
8a019d617f | ||
|
|
4a76b7a9a5 | ||
|
|
1ac1bf12a2 |
@@ -7,10 +7,6 @@ fi
|
|||||||
|
|
||||||
npm run webpack
|
npm run webpack
|
||||||
|
|
||||||
# problem with circular dependencies: https://github.com/webpack/webpack/issues/9173
|
|
||||||
# source issue: https://github.com/zadam/trilium/issues/1300
|
|
||||||
find ./src/public/app-dist -type f -exec sed -i 's/const /var /g' {} +
|
|
||||||
|
|
||||||
DIR=$1
|
DIR=$1
|
||||||
|
|
||||||
rm -rf $DIR
|
rm -rf $DIR
|
||||||
|
|||||||
4151
package-lock.json
generated
4151
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"productName": "Trilium Notes",
|
"productName": "Trilium Notes",
|
||||||
"description": "Trilium Notes",
|
"description": "Trilium Notes",
|
||||||
"version": "0.44.7",
|
"version": "0.44.8",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"main": "electron.js",
|
"main": "electron.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -86,8 +86,8 @@
|
|||||||
"jsdoc": "3.6.6",
|
"jsdoc": "3.6.6",
|
||||||
"lorem-ipsum": "2.0.3",
|
"lorem-ipsum": "2.0.3",
|
||||||
"rcedit": "2.2.0",
|
"rcedit": "2.2.0",
|
||||||
"webpack": "5.0.0-beta.32",
|
"webpack": "5.1.0",
|
||||||
"webpack-cli": "4.0.0-beta.8"
|
"webpack-cli": "4.0.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"electron-installer-debian": "2.0.1"
|
"electron-installer-debian": "2.0.1"
|
||||||
|
|||||||
@@ -5,6 +5,16 @@ import noteAttributeCache from "../services/note_attribute_cache.js";
|
|||||||
const LABEL = 'label';
|
const LABEL = 'label';
|
||||||
const RELATION = 'relation';
|
const RELATION = 'relation';
|
||||||
|
|
||||||
|
const NOTE_TYPE_ICONS = {
|
||||||
|
"file": "bx bx-file",
|
||||||
|
"image": "bx bx-image",
|
||||||
|
"code": "bx bx-code",
|
||||||
|
"render": "bx bx-extension",
|
||||||
|
"search": "bx bx-file-find",
|
||||||
|
"relation-map": "bx bx-map-alt",
|
||||||
|
"book": "bx bx-book"
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: since there's no "full note" anymore we can rename this to Note
|
* FIXME: since there's no "full note" anymore we can rename this to Note
|
||||||
*
|
*
|
||||||
@@ -254,6 +264,31 @@ class NoteShort {
|
|||||||
return this.getAttributes(LABEL, name);
|
return this.getAttributes(LABEL, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIcon(isFolder = false) {
|
||||||
|
const iconCassLabels = this.getLabels('iconClass');
|
||||||
|
|
||||||
|
if (iconCassLabels.length > 0) {
|
||||||
|
return iconCassLabels.map(l => l.value).join(' ');
|
||||||
|
}
|
||||||
|
else if (this.noteId === 'root') {
|
||||||
|
return "bx bx-chevrons-right";
|
||||||
|
}
|
||||||
|
else if (this.type === 'text') {
|
||||||
|
if (isFolder) {
|
||||||
|
return "bx bx-folder";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "bx bx-note";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.type === 'code' && this.mime.startsWith('text/x-sql')) {
|
||||||
|
return "bx bx-data";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NOTE_TYPE_ICONS[this.type];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} [name] - relation name to filter
|
* @param {string} [name] - relation name to filter
|
||||||
* @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones
|
* @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones
|
||||||
|
|||||||
@@ -63,6 +63,27 @@ export default class LinkMap {
|
|||||||
noteIds.add(this.note.noteId);
|
noteIds.add(this.note.noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await treeCache.getNotes(Array.from(noteIds));
|
||||||
|
|
||||||
|
// pre-fetch the link titles, it's important to have hte construction afterwards synchronous
|
||||||
|
// since jsPlumb caculates width of the element
|
||||||
|
const $linkTitles = {};
|
||||||
|
|
||||||
|
for (const noteId of noteIds) {
|
||||||
|
const note = await treeCache.getNote(noteId);
|
||||||
|
|
||||||
|
$linkTitles[noteId] = await linkService.createNoteLink(noteId, {title: note.title});
|
||||||
|
|
||||||
|
$linkTitles[noteId].on('click', e => {
|
||||||
|
try {
|
||||||
|
$linkTitles[noteId].tooltip('dispose');
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
|
|
||||||
|
linkService.goToLink(e);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// preload all notes
|
// preload all notes
|
||||||
const notes = await treeCache.getNotes(Array.from(noteIds), true);
|
const notes = await treeCache.getNotes(Array.from(noteIds), true);
|
||||||
|
|
||||||
@@ -98,18 +119,15 @@ export default class LinkMap {
|
|||||||
.addClass("note-box")
|
.addClass("note-box")
|
||||||
.prop("id", noteBoxId);
|
.prop("id", noteBoxId);
|
||||||
|
|
||||||
linkService.createNoteLink(noteId, {title: note.title}).then($link => {
|
const $link = $linkTitles[noteId];
|
||||||
$link.on('click', e => {
|
|
||||||
try {
|
|
||||||
$link.tooltip('dispose');
|
|
||||||
}
|
|
||||||
catch (e) {}
|
|
||||||
|
|
||||||
linkService.goToLink(e);
|
$noteBox.append(
|
||||||
});
|
$("<span>")
|
||||||
|
.addClass(note.getIcon()),
|
||||||
$noteBox.append($("<span>").addClass("title").append($link));
|
$("<span>")
|
||||||
});
|
.addClass("title")
|
||||||
|
.append($link)
|
||||||
|
);
|
||||||
|
|
||||||
if (noteId === this.note.noteId) {
|
if (noteId === this.note.noteId) {
|
||||||
$noteBox.addClass("link-map-active-note");
|
$noteBox.addClass("link-map-active-note");
|
||||||
@@ -273,4 +291,4 @@ export default class LinkMap {
|
|||||||
noteIdToId(noteId) {
|
noteIdToId(noteId) {
|
||||||
return this.linkMapContainerId + "-note-" + noteId;
|
return this.linkMapContainerId + "-note-" + noteId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,16 +159,6 @@ const TPL = `
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const NOTE_TYPE_ICONS = {
|
|
||||||
"file": "bx bx-file",
|
|
||||||
"image": "bx bx-image",
|
|
||||||
"code": "bx bx-code",
|
|
||||||
"render": "bx bx-extension",
|
|
||||||
"search": "bx bx-file-find",
|
|
||||||
"relation-map": "bx bx-map-alt",
|
|
||||||
"book": "bx bx-book"
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class NoteTreeWidget extends TabAwareWidget {
|
export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
constructor(treeName) {
|
constructor(treeName) {
|
||||||
super();
|
super();
|
||||||
@@ -562,40 +552,14 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
return noteList;
|
return noteList;
|
||||||
}
|
}
|
||||||
|
|
||||||
getIconClass(note) {
|
|
||||||
const labels = note.getLabels('iconClass');
|
|
||||||
|
|
||||||
return labels.map(l => l.value).join(' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
getIcon(note, isFolder) {
|
getIcon(note, isFolder) {
|
||||||
const hoistedNoteId = hoistedNoteService.getHoistedNoteId();
|
const hoistedNoteId = hoistedNoteService.getHoistedNoteId();
|
||||||
|
|
||||||
const iconClass = this.getIconClass(note);
|
if (note.noteId !== 'root' && note.noteId === hoistedNoteId) {
|
||||||
|
|
||||||
if (iconClass) {
|
|
||||||
return iconClass;
|
|
||||||
}
|
|
||||||
else if (note.noteId === 'root') {
|
|
||||||
return "bx bx-chevrons-right";
|
|
||||||
}
|
|
||||||
else if (note.noteId === hoistedNoteId) {
|
|
||||||
return "bx bxs-arrow-from-bottom";
|
return "bx bxs-arrow-from-bottom";
|
||||||
}
|
}
|
||||||
else if (note.type === 'text') {
|
|
||||||
if (isFolder) {
|
return note.getIcon(isFolder);
|
||||||
return "bx bx-folder";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "bx bx-note";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (note.type === 'code' && note.mime.startsWith('text/x-sql')) {
|
|
||||||
return "bx bx-data";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return NOTE_TYPE_ICONS[note.type];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNode(node) {
|
updateNode(node) {
|
||||||
|
|||||||
@@ -4,22 +4,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.link-map-container .note-box {
|
.link-map-container .note-box {
|
||||||
padding: 8px;
|
padding: 0px 8px 8px 8px;
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
background-color: var(--main-background-color);
|
background-color: var(--main-background-color);
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
border: 1px solid #666;
|
border: 1px solid #666;
|
||||||
box-shadow: 2px 2px 19px #999;
|
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
|
||||||
max-width: 200px;
|
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
max-height: 100px;
|
max-width: 250px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link-map-container .note-box:hover {
|
.link-map-container .note-box:hover {
|
||||||
@@ -47,4 +46,21 @@
|
|||||||
|
|
||||||
.link-map-widget .note-box .title {
|
.link-map-widget .note-box .title {
|
||||||
font-size: 19px !important;
|
font-size: 19px !important;
|
||||||
}
|
font-weight: 600
|
||||||
|
}
|
||||||
|
|
||||||
|
#link-map-dialog .note-box .bx {
|
||||||
|
font-size: 24px !important;
|
||||||
|
position: relative;
|
||||||
|
top: 6px;
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-map-widget .note-box .bx {
|
||||||
|
font-size: 30px !important;
|
||||||
|
position: relative;
|
||||||
|
top: 6px;
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
module.exports = { buildDate:"2020-10-13T23:45:39+02:00", buildRevision: "893b6053d22c159d6197900c988f0007eca4840d" };
|
module.exports = { buildDate:"2020-10-15T00:01:13+02:00", buildRevision: "8a019d617f1f1ecd1ef61812838bbe40532a0aa7" };
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
function getAppDataDir() {
|
function getAppDataDir() {
|
||||||
let appDataDir = os.homedir(); // fallback if OS is not recognized
|
let appDataDir = os.homedir(); // fallback if OS is not recognized
|
||||||
@@ -43,13 +44,13 @@ function getTriliumDataDir() {
|
|||||||
return process.env.TRILIUM_DATA_DIR;
|
return process.env.TRILIUM_DATA_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
const homePath = os.homedir() + "/" + DIR_NAME;
|
const homePath = os.homedir() + path.sep + DIR_NAME;
|
||||||
|
|
||||||
if (fs.existsSync(homePath)) {
|
if (fs.existsSync(homePath)) {
|
||||||
return homePath;
|
return homePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const appDataPath = getAppDataDir() + '/' + DIR_NAME;
|
const appDataPath = getAppDataDir() + path.sep + DIR_NAME;
|
||||||
|
|
||||||
if (!fs.existsSync(appDataPath)) {
|
if (!fs.existsSync(appDataPath)) {
|
||||||
fs.mkdirSync(appDataPath, 0o700);
|
fs.mkdirSync(appDataPath, 0o700);
|
||||||
@@ -59,10 +60,10 @@ function getTriliumDataDir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TRILIUM_DATA_DIR = getTriliumDataDir();
|
const TRILIUM_DATA_DIR = getTriliumDataDir();
|
||||||
const DOCUMENT_PATH = TRILIUM_DATA_DIR + "/document.db";
|
const DOCUMENT_PATH = TRILIUM_DATA_DIR + path.sep + "document.db";
|
||||||
const BACKUP_DIR = TRILIUM_DATA_DIR + "/backup";
|
const BACKUP_DIR = TRILIUM_DATA_DIR + path.sep + "backup";
|
||||||
const LOG_DIR = TRILIUM_DATA_DIR + "/log";
|
const LOG_DIR = TRILIUM_DATA_DIR + path.sep + "log";
|
||||||
const ANONYMIZED_DB_DIR = TRILIUM_DATA_DIR + "/anonymized-db";
|
const ANONYMIZED_DB_DIR = TRILIUM_DATA_DIR + path.sep + "anonymized-db";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
TRILIUM_DATA_DIR,
|
TRILIUM_DATA_DIR,
|
||||||
@@ -70,4 +71,4 @@ module.exports = {
|
|||||||
BACKUP_DIR,
|
BACKUP_DIR,
|
||||||
LOG_DIR,
|
LOG_DIR,
|
||||||
ANONYMIZED_DB_DIR
|
ANONYMIZED_DB_DIR
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user