mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
added shareCss relation and shareHiddenFromTree label
This commit is contained in:
parent
1180be75d1
commit
bcef8579ce
@ -52,6 +52,7 @@ const BUILTIN_ATTRIBUTES = [
|
|||||||
{ type: 'label', name: 'sorted' },
|
{ type: 'label', name: 'sorted' },
|
||||||
{ type: 'label', name: 'top' },
|
{ type: 'label', name: 'top' },
|
||||||
{ type: 'label', name: 'fullContentWidth' },
|
{ type: 'label', name: 'fullContentWidth' },
|
||||||
|
{ type: 'label', name: 'shareHiddenFromTree' },
|
||||||
|
|
||||||
// relation names
|
// relation names
|
||||||
{ type: 'relation', name: 'runOnNoteCreation', isDangerous: true },
|
{ type: 'relation', name: 'runOnNoteCreation', isDangerous: true },
|
||||||
@ -62,7 +63,8 @@ const BUILTIN_ATTRIBUTES = [
|
|||||||
{ type: 'relation', name: 'runOnAttributeChange', isDangerous: true },
|
{ type: 'relation', name: 'runOnAttributeChange', isDangerous: true },
|
||||||
{ type: 'relation', name: 'template' },
|
{ type: 'relation', name: 'template' },
|
||||||
{ type: 'relation', name: 'widget', isDangerous: true },
|
{ type: 'relation', name: 'widget', isDangerous: true },
|
||||||
{ type: 'relation', name: 'renderNote', isDangerous: true }
|
{ type: 'relation', name: 'renderNote', isDangerous: true },
|
||||||
|
{ type: 'relation', name: 'shareCss', isDangerous: false },
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @returns {Note[]} */
|
/** @returns {Note[]} */
|
||||||
|
@ -45,10 +45,10 @@ function register(router) {
|
|||||||
const image = shaca.getNote(req.params.noteId);
|
const image = shaca.getNote(req.params.noteId);
|
||||||
|
|
||||||
if (!image) {
|
if (!image) {
|
||||||
return res.sendStatus(404);
|
return res.status(404).send("Not found");
|
||||||
}
|
}
|
||||||
else if (image.type !== 'image') {
|
else if (image.type !== 'image') {
|
||||||
return res.sendStatus(400);
|
return res.status(400).send("Requested note is not an image");
|
||||||
}
|
}
|
||||||
|
|
||||||
res.set('Content-Type', image.mime);
|
res.set('Content-Type', image.mime);
|
||||||
@ -56,12 +56,12 @@ function register(router) {
|
|||||||
res.send(image.getContent());
|
res.send(image.getContent());
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/share/api/notes/:noteId/:download', (req, res, next) => {
|
router.get('/share/api/notes/:noteId/download', (req, res, next) => {
|
||||||
const {noteId} = req.params;
|
const {noteId} = req.params;
|
||||||
const note = shaca.getNote(noteId);
|
const note = shaca.getNote(noteId);
|
||||||
|
|
||||||
if (!note) {
|
if (!note) {
|
||||||
return res.status(404).send(`Note ${noteId} doesn't exist.`);
|
return res.status(404).send(`Not found`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const utils = require("../services/utils");
|
const utils = require("../services/utils");
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
<% if (note.type === 'text' || note.type === 'book') { %>
|
<% if (note.type === 'text' || note.type === 'book') { %>
|
||||||
<link href="../libraries/ckeditor/ckeditor-content.css" rel="stylesheet">
|
<link href="../libraries/ckeditor/ckeditor-content.css" rel="stylesheet">
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<% for (const cssRelation of note.getRelations("shareCss")) { %>
|
||||||
|
<link href="api/notes/<%= cssRelation.value %>/download" rel="stylesheet">
|
||||||
|
<% } %>
|
||||||
<title><%= note.title %></title>
|
<title><%= note.title %></title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -9,9 +9,11 @@
|
|||||||
<% if (note.hasChildren()) { %>
|
<% if (note.hasChildren()) { %>
|
||||||
<ul>
|
<ul>
|
||||||
<% note.getChildNotes().forEach(function (childNote) { %>
|
<% note.getChildNotes().forEach(function (childNote) { %>
|
||||||
|
<% if (!childNote.hasLabel("shareHiddenFromTree")) { %>
|
||||||
<li>
|
<li>
|
||||||
<%- include('tree_item', {note: childNote}) %>
|
<%- include('tree_item', {note: childNote}) %>
|
||||||
</li>
|
</li>
|
||||||
|
<% } %>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</ul>
|
</ul>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user