mirror of https://github.com/status-im/codimd.git
Merge pull request #471 from butlerx/reveal/theme
add the ability to set slide theme in slide options
This commit is contained in:
commit
38cf2f7535
|
@ -13,6 +13,7 @@ var moment = require('moment')
|
||||||
var config = require('./config')
|
var config = require('./config')
|
||||||
var logger = require('./logger')
|
var logger = require('./logger')
|
||||||
var models = require('./models')
|
var models = require('./models')
|
||||||
|
var utils = require('./utils')
|
||||||
|
|
||||||
// public
|
// public
|
||||||
var response = {
|
var response = {
|
||||||
|
@ -574,6 +575,7 @@ function showPublishSlide (req, res, next) {
|
||||||
updatetime: updatetime,
|
updatetime: updatetime,
|
||||||
url: origin,
|
url: origin,
|
||||||
body: markdown,
|
body: markdown,
|
||||||
|
theme: utils.isRevealTheme(meta.slideOptions.theme),
|
||||||
meta: JSON.stringify(extracted.meta),
|
meta: JSON.stringify(extracted.meta),
|
||||||
useCDN: config.usecdn,
|
useCDN: config.usecdn,
|
||||||
owner: note.owner ? note.owner.id : null,
|
owner: note.owner ? note.owner.id : null,
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
exports.isSQLite = function isSQLite (sequelize) {
|
exports.isSQLite = function isSQLite (sequelize) {
|
||||||
return sequelize.options.dialect === 'sqlite'
|
return sequelize.options.dialect === 'sqlite'
|
||||||
|
@ -23,3 +25,10 @@ exports.getImageMimeType = function getImageMimeType (imagePath) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.isRevealTheme = function isRevealTheme (theme) {
|
||||||
|
if (fs.existsSync(path.join(__dirname, '..', 'public', 'build', 'reveal.js', 'css', 'theme', theme + '.css'))) {
|
||||||
|
return theme
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
|
@ -30,7 +30,11 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<!-- For reveal.js theme -->
|
<!-- For reveal.js theme -->
|
||||||
|
<% if(typeof theme !== 'undefined' && theme) { %>
|
||||||
|
<link rel="stylesheet" href="<%- url %>/build/reveal.js/css/theme/<%= theme %>.css" id="theme">
|
||||||
|
<% } else { %>
|
||||||
<link rel="stylesheet" href="<%- url %>/build/reveal.js/css/theme/black.css" id="theme">
|
<link rel="stylesheet" href="<%- url %>/build/reveal.js/css/theme/black.css" id="theme">
|
||||||
|
<% } %>
|
||||||
<!-- For syntax highlighting -->
|
<!-- For syntax highlighting -->
|
||||||
<link rel="stylesheet" href="<%- url %>/build/reveal.js/lib/css/zenburn.css">
|
<link rel="stylesheet" href="<%- url %>/build/reveal.js/lib/css/zenburn.css">
|
||||||
<!-- For overwrite reveal.js -->
|
<!-- For overwrite reveal.js -->
|
||||||
|
|
Loading…
Reference in New Issue