mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
share functionality WIP
This commit is contained in:
parent
08e8047d8a
commit
ab550a1e8d
@ -58,7 +58,7 @@
|
||||
"joplin-turndown-plugin-gfm": "1.0.12",
|
||||
"jsdom": "19.0.0",
|
||||
"mime-types": "2.1.34",
|
||||
"multer": "1.4.3",
|
||||
"multer": "1.4.4",
|
||||
"node-abi": "3.5.0",
|
||||
"normalize-strings": "^1.1.1",
|
||||
"open": "8.4.0",
|
||||
@ -92,7 +92,7 @@
|
||||
"jsdoc": "3.6.7",
|
||||
"lorem-ipsum": "2.0.4",
|
||||
"rcedit": "3.0.1",
|
||||
"webpack": "5.64.4",
|
||||
"webpack": "5.65.0",
|
||||
"webpack-cli": "4.9.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
|
@ -9,7 +9,6 @@
|
||||
padding: 20px;
|
||||
flex-basis: 0;
|
||||
flex-grow: 1;
|
||||
background-color: #ccc;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
@ -17,6 +16,11 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#menu > p {
|
||||
font-weight: bold;
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
#menu ul {
|
||||
padding-left: 20px;
|
||||
}
|
||||
@ -24,12 +28,11 @@
|
||||
#main {
|
||||
flex-basis: 0;
|
||||
flex-grow: 3;
|
||||
background-color:#eee;
|
||||
}
|
||||
|
||||
#title {
|
||||
margin: 0;
|
||||
padding: 20px 20px 0 20px;
|
||||
padding: 10px 20px 0 20px;
|
||||
}
|
||||
|
||||
#content {
|
||||
|
@ -201,12 +201,29 @@ function getHoistedNote() {
|
||||
return becca.getNote(cls.getHoistedNoteId());
|
||||
}
|
||||
|
||||
function getShareRoot() {
|
||||
let shareRoot = becca.getNote('share');
|
||||
|
||||
if (!shareRoot) {
|
||||
shareRoot = noteService.createNewNote({
|
||||
noteId: 'share',
|
||||
title: 'share',
|
||||
type: 'text',
|
||||
content: '',
|
||||
parentNoteId: getHiddenRoot().noteId
|
||||
}).note;
|
||||
}
|
||||
|
||||
return shareRoot;
|
||||
}
|
||||
|
||||
function createMissingSpecialNotes() {
|
||||
getSinglesNoteRoot();
|
||||
getSqlConsoleRoot();
|
||||
getSinglesNoteRoot();
|
||||
getSinglesNoteRoot();
|
||||
getGlobalNoteMap();
|
||||
getShareRoot();
|
||||
|
||||
const hidden = getHiddenRoot();
|
||||
|
||||
|
@ -7,6 +7,7 @@ const Note = require('./entities/note');
|
||||
const Branch = require('./entities/branch');
|
||||
const Attribute = require('./entities/attribute');
|
||||
const shareRoot = require('../share_root');
|
||||
const eventService = require("../../services/events");
|
||||
|
||||
function load() {
|
||||
const start = Date.now();
|
||||
@ -41,8 +42,17 @@ function load() {
|
||||
new Branch(row);
|
||||
}
|
||||
|
||||
// TODO: add filter for allowed attributes
|
||||
for (const row of sql.getRawRows(`SELECT attributeId, noteId, type, name, value, isInheritable, position, utcDateModified FROM attributes WHERE isDeleted = 0 AND noteId IN (${noteIdStr})`, [])) {
|
||||
const attributes = sql.getRawRows(`
|
||||
SELECT attributeId, noteId, type, name, value, isInheritable, position, utcDateModified
|
||||
FROM attributes
|
||||
WHERE isDeleted = 0
|
||||
AND noteId IN (${noteIdStr})
|
||||
AND (
|
||||
(type = 'label' AND name IN ('archived'))
|
||||
OR (type = 'relation' AND name IN ('imageLink', 'template'))
|
||||
)`, []);
|
||||
|
||||
for (const row of attributes) {
|
||||
new Attribute(row);
|
||||
}
|
||||
|
||||
@ -57,6 +67,9 @@ function ensureLoad() {
|
||||
}
|
||||
}
|
||||
|
||||
eventService.subscribe([ eventService.ENTITY_CREATED, eventService.ENTITY_CHANGED, eventService.ENTITY_DELETED, eventService.ENTITY_CHANGE_SYNCED, eventService.ENTITY_DELETE_SYNCED ], ({ entityName, entity }) => {
|
||||
shaca.reset();
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
load,
|
||||
|
@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
SHARE_ROOT_NOTE_ID: 'root'
|
||||
SHARE_ROOT_NOTE_ID: 'share'
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user