mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
added support for app_css attribute, which allows custom styling
This commit is contained in:
parent
c831221cc4
commit
b6277049f3
@ -5,13 +5,32 @@ const router = express.Router();
|
|||||||
const auth = require('../services/auth');
|
const auth = require('../services/auth');
|
||||||
const source_id = require('../services/source_id');
|
const source_id = require('../services/source_id');
|
||||||
const sql = require('../services/sql');
|
const sql = require('../services/sql');
|
||||||
|
const Repository = require('../services/repository');
|
||||||
|
const attributes = require('../services/attributes');
|
||||||
const wrap = require('express-promise-wrap').wrap;
|
const wrap = require('express-promise-wrap').wrap;
|
||||||
|
|
||||||
router.get('', auth.checkAuth, wrap(async (req, res, next) => {
|
router.get('', auth.checkAuth, wrap(async (req, res, next) => {
|
||||||
|
const repository = new Repository(req);
|
||||||
|
|
||||||
res.render('index', {
|
res.render('index', {
|
||||||
sourceId: await source_id.generateSourceId(),
|
sourceId: await source_id.generateSourceId(),
|
||||||
maxSyncIdAtLoad: await sql.getValue("SELECT MAX(id) FROM sync")
|
maxSyncIdAtLoad: await sql.getValue("SELECT MAX(id) FROM sync"),
|
||||||
|
appCss: await getAppCss(repository)
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
async function getAppCss(repository) {
|
||||||
|
let css = '';
|
||||||
|
const notes = attributes.getNotesWithAttribute(repository, 'app_css');
|
||||||
|
|
||||||
|
for (const note of await notes) {
|
||||||
|
css += `/* ${note.noteId} */
|
||||||
|
${note.content}
|
||||||
|
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return css;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
@ -13,7 +13,8 @@ const BUILTIN_ATTRIBUTES = [
|
|||||||
'exclude_from_export',
|
'exclude_from_export',
|
||||||
'run',
|
'run',
|
||||||
'manual_transaction_handling',
|
'manual_transaction_handling',
|
||||||
'disable_inclusion'
|
'disable_inclusion',
|
||||||
|
'app_css'
|
||||||
];
|
];
|
||||||
|
|
||||||
async function getNoteAttributeMap(noteId) {
|
async function getNoteAttributeMap(noteId) {
|
||||||
|
@ -529,5 +529,9 @@
|
|||||||
// final form which is pretty ugly.
|
// final form which is pretty ugly.
|
||||||
$("#container").show();
|
$("#container").show();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
<%= appCss %>
|
||||||
|
</style>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user