mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c496519095
13
db/migrations/0208__remove_archived_from_hidden.js
Normal file
13
db/migrations/0208__remove_archived_from_hidden.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module.exports = () => {
|
||||||
|
const cls = require("../../src/services/cls");
|
||||||
|
const beccaLoader = require("../../src/becca/becca_loader");
|
||||||
|
const becca = require("../../src/becca/becca");
|
||||||
|
|
||||||
|
cls.init(() => {
|
||||||
|
beccaLoader.load();
|
||||||
|
|
||||||
|
for (const label of becca.getNote('hidden').getLabels('archived')) {
|
||||||
|
label.markAsDeleted('0208__remove_archived_from_hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
@ -1,4 +1,4 @@
|
|||||||
const noteTypes = require("../services/note_types");
|
const noteTypeService = require("../services/note_types");
|
||||||
|
|
||||||
function mandatory(obj) {
|
function mandatory(obj) {
|
||||||
if (obj === undefined ) {
|
if (obj === undefined ) {
|
||||||
@ -63,6 +63,8 @@ function isNoteType(obj) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const noteTypes = noteTypeService.getNoteTypeNames();
|
||||||
|
|
||||||
if (!noteTypes.includes(obj)) {
|
if (!noteTypes.includes(obj)) {
|
||||||
return `'${obj}' is not a valid note type, allowed types are: ` + noteTypes.join(", ");
|
return `'${obj}' is not a valid note type, allowed types are: ` + noteTypes.join(", ");
|
||||||
}
|
}
|
||||||
|
@ -354,6 +354,8 @@ class NoteShort {
|
|||||||
return a.isSearch ? 1 : -1;
|
return a.isSearch ? 1 : -1;
|
||||||
} else if (a.isArchived !== b.isArchived) {
|
} else if (a.isArchived !== b.isArchived) {
|
||||||
return a.isArchived ? 1 : -1;
|
return a.isArchived ? 1 : -1;
|
||||||
|
} else if (a.isHidden !== b.isHidden) {
|
||||||
|
return a.isHidden ? 1 : -1;
|
||||||
} else {
|
} else {
|
||||||
return a.notePath.length - b.notePath.length;
|
return a.notePath.length - b.notePath.length;
|
||||||
}
|
}
|
||||||
|
@ -605,11 +605,12 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
this.$tree.on('contextmenu', '.fancytree-node', e => {
|
this.$tree.on('contextmenu', '.fancytree-node', e => {
|
||||||
const node = $.ui.fancytree.getNode(e);
|
const node = $.ui.fancytree.getNode(e);
|
||||||
|
const note = froca.getNoteFromCache(node.data.noteId);
|
||||||
|
|
||||||
if (hoistedNoteService.getHoistedNoteId() === 'lbRoot') {
|
if (note.isLaunchBarConfig()) {
|
||||||
import("../menus/launcher_context_menu.js").then(({LauncherContextMenu: ShortcutContextMenu}) => {
|
import("../menus/launcher_context_menu.js").then(({default: LauncherContextMenu}) => {
|
||||||
const shortcutContextMenu = new LauncherContextMenu(this, node);
|
const launcherContextMenu = new LauncherContextMenu(this, node);
|
||||||
shortcutContextMenu.show(e);
|
launcherContextMenu.show(e);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
import("../menus/tree_context_menu.js").then(({default: TreeContextMenu}) => {
|
import("../menus/tree_context_menu.js").then(({default: TreeContextMenu}) => {
|
||||||
|
@ -4,7 +4,7 @@ const build = require('./build');
|
|||||||
const packageJson = require('../../package');
|
const packageJson = require('../../package');
|
||||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
||||||
|
|
||||||
const APP_DB_VERSION = 207;
|
const APP_DB_VERSION = 208;
|
||||||
const SYNC_VERSION = 28;
|
const SYNC_VERSION = 28;
|
||||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ const attributeService = require('./attributes');
|
|||||||
const noteRevisionService = require('./note_revisions');
|
const noteRevisionService = require('./note_revisions');
|
||||||
const becca = require("../becca/becca");
|
const becca = require("../becca/becca");
|
||||||
const utils = require("../services/utils");
|
const utils = require("../services/utils");
|
||||||
const noteTypes = require("../services/note_types");
|
const noteTypes = require("../services/note_types").getNoteTypeNames();
|
||||||
|
|
||||||
class ConsistencyChecks {
|
class ConsistencyChecks {
|
||||||
constructor(autoFix) {
|
constructor(autoFix) {
|
||||||
|
@ -4,9 +4,9 @@ const log = require("./log");
|
|||||||
|
|
||||||
const LBTPL_ROOT = "lbTplRoot";
|
const LBTPL_ROOT = "lbTplRoot";
|
||||||
const LBTPL_BASE = "lbTplBase";
|
const LBTPL_BASE = "lbTplBase";
|
||||||
const LBTPL_COMMAND = "lbTplCommand";
|
const LBTPL_COMMAND = "lbTplCommandLauncher";
|
||||||
const LBTPL_NOTE_LAUNCHER = "lbTplNoteLauncher";
|
const LBTPL_NOTE_LAUNCHER = "lbTplNoteLauncher";
|
||||||
const LBTPL_SCRIPT = "lbTplScript";
|
const LBTPL_SCRIPT = "lbTplScriptLauncher";
|
||||||
const LBTPL_BUILTIN_WIDGET = "lbTplBuiltinWidget";
|
const LBTPL_BUILTIN_WIDGET = "lbTplBuiltinWidget";
|
||||||
const LBTPL_SPACER = "lbTplSpacer";
|
const LBTPL_SPACER = "lbTplSpacer";
|
||||||
const LBTPL_CUSTOM_WIDGET = "lbTplCustomWidget";
|
const LBTPL_CUSTOM_WIDGET = "lbTplCustomWidget";
|
||||||
@ -20,9 +20,6 @@ const HIDDEN_SUBTREE_DEFINITION = {
|
|||||||
// over tree when it's in the middle
|
// over tree when it's in the middle
|
||||||
notePosition: 999_999_999,
|
notePosition: 999_999_999,
|
||||||
attributes: [
|
attributes: [
|
||||||
// isInheritable: false means that this notePath is automatically not preffered but at the same time
|
|
||||||
// the flag is not inherited to the children
|
|
||||||
{ type: 'label', name: 'archived' },
|
|
||||||
{ type: 'label', name: 'excludeFromNoteMap', isInheritable: true }
|
{ type: 'label', name: 'excludeFromNoteMap', isInheritable: true }
|
||||||
],
|
],
|
||||||
children: [
|
children: [
|
||||||
@ -283,7 +280,7 @@ function checkHiddenSubtreeRecursively(parentNoteId, item) {
|
|||||||
|
|
||||||
if (!branch) {
|
if (!branch) {
|
||||||
// not sure if there's some better way to recover
|
// not sure if there's some better way to recover
|
||||||
log.error(`Cannot find branch id='${item.id}', ignoring...`);
|
log.error(`Cannot find launcher branch id='${item.id}', ignoring...`);
|
||||||
} else {
|
} else {
|
||||||
if (item.notePosition !== undefined && branch.notePosition !== item.notePosition) {
|
if (item.notePosition !== undefined && branch.notePosition !== item.notePosition) {
|
||||||
branch.notePosition = item.notePosition;
|
branch.notePosition = item.notePosition;
|
||||||
|
@ -10,6 +10,8 @@ function isHoistedInHiddenSubtree() {
|
|||||||
|
|
||||||
if (hoistedNoteId === 'root') {
|
if (hoistedNoteId === 'root') {
|
||||||
return false;
|
return false;
|
||||||
|
} else if (hoistedNoteId === 'hidden') {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hoistedNote = becca.getNote(hoistedNoteId);
|
const hoistedNote = becca.getNote(hoistedNoteId);
|
||||||
|
@ -1,17 +1,33 @@
|
|||||||
module.exports = [
|
const noteTypes = [
|
||||||
'text',
|
{ type: 'text', defaultMime: 'text/html' },
|
||||||
'code',
|
{ type: 'code', defaultMime: 'text/plain' },
|
||||||
'render',
|
{ type: 'render', defaultMime: '' },
|
||||||
'file',
|
{ type: 'file', defaultMime: 'application/octet-stream' },
|
||||||
'image',
|
{ type: 'image', defaultMime: '' },
|
||||||
'search',
|
{ type: 'search', defaultMime: '' },
|
||||||
'relationMap',
|
{ type: 'relationMap', defaultMime: 'application/json' },
|
||||||
'book',
|
{ type: 'book', defaultMime: '' },
|
||||||
'noteMap',
|
{ type: 'noteMap', defaultMime: '' },
|
||||||
'mermaid',
|
{ type: 'mermaid', defaultMime: 'text/plain' },
|
||||||
'canvas',
|
{ type: 'canvas', defaultMime: 'application/json' },
|
||||||
'webView',
|
{ type: 'webView', defaultMime: '' },
|
||||||
'launcher',
|
{ type: 'launcher', defaultMime: '' },
|
||||||
'doc',
|
{ type: 'doc', defaultMime: '' },
|
||||||
'contentWidget'
|
{ type: 'contentWidget', defaultMime: '' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function getDefaultMimeForNoteType(typeName) {
|
||||||
|
const typeRec = noteTypes.find(nt => nt.type === typeName);
|
||||||
|
|
||||||
|
if (!typeRec) {
|
||||||
|
throw new Error(`Cannot find note type '${typeName}'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return typeRec.defaultMime;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getNoteTypes: () => noteTypes,
|
||||||
|
getNoteTypeNames: () => noteTypes.map(nt => nt.type),
|
||||||
|
getDefaultMimeForNoteType
|
||||||
|
};
|
||||||
|
@ -20,6 +20,7 @@ const Attribute = require('../becca/entities/attribute');
|
|||||||
const dayjs = require("dayjs");
|
const dayjs = require("dayjs");
|
||||||
const htmlSanitizer = require("./html_sanitizer");
|
const htmlSanitizer = require("./html_sanitizer");
|
||||||
const ValidationError = require("../errors/validation_error");
|
const ValidationError = require("../errors/validation_error");
|
||||||
|
const noteTypesService = require("./note_types");
|
||||||
|
|
||||||
function getNewNotePosition(parentNoteId) {
|
function getNewNotePosition(parentNoteId) {
|
||||||
const note = becca.notes[parentNoteId];
|
const note = becca.notes[parentNoteId];
|
||||||
@ -47,19 +48,7 @@ function deriveMime(type, mime) {
|
|||||||
return mime;
|
return mime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'text') {
|
return noteTypesService.getDefaultMimeForNoteType(type);
|
||||||
mime = 'text/html';
|
|
||||||
} else if (type === 'code' || type === 'mermaid') {
|
|
||||||
mime = 'text/plain';
|
|
||||||
} else if (['relationMap', 'search', 'canvas'].includes(type)) {
|
|
||||||
mime = 'application/json';
|
|
||||||
} else if (['render', 'book', 'webView'].includes(type)) {
|
|
||||||
mime = '';
|
|
||||||
} else {
|
|
||||||
mime = 'application/octet-stream';
|
|
||||||
}
|
|
||||||
|
|
||||||
return mime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyChildAttributes(parentNote, childNote) {
|
function copyChildAttributes(parentNote, childNote) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user