summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/response.js12
-rw-r--r--public/js/slide.js14
-rw-r--r--public/views/slide.ejs2
3 files changed, 12 insertions, 16 deletions
diff --git a/lib/response.js b/lib/response.js
index fa97f157..1a45d63a 100755
--- a/lib/response.js
+++ b/lib/response.js
@@ -16,15 +16,6 @@ var config = require("./config.js");
var logger = require("./logger.js");
var models = require("./models");
-//slides
-var md = require('reveal.js/plugin/markdown/markdown');
-
-//reveal.js
-var slideOptions = {
- separator: '^(\r\n?|\n)---(\r\n?|\n)$',
- verticalSeparator: '^(\r\n?|\n)----(\r\n?|\n)$'
-};
-
//public
var response = {
errorForbidden: function (res) {
@@ -584,7 +575,6 @@ function showPublishSlide(req, res, next) {
var text = S(body).escapeHTML().s;
var title = models.Note.decodeTitle(note.title);
title = models.Note.generateWebTitle(meta.title || title);
- var slides = md.slidify(text, slideOptions);
var origin = config.serverurl;
var data = {
title: title,
@@ -593,7 +583,7 @@ function showPublishSlide(req, res, next) {
createtime: createtime,
updatetime: updatetime,
url: origin,
- slides: slides,
+ body: text,
meta: JSON.stringify(obj.meta || {}),
useCDN: config.usecdn,
owner: note.owner ? note.owner.id : null,
diff --git a/public/js/slide.js b/public/js/slide.js
index b9521e64..a8411570 100644
--- a/public/js/slide.js
+++ b/public/js/slide.js
@@ -12,8 +12,7 @@ var finishView = extraModule.finishView;
var preventXSS = require('./render').preventXSS;
-var body = $(".slides").html();
-$(".slides").html(S(body).unescapeHTML().s);
+var body = $(".slides").text();
createtime = lastchangeui.time.attr('data-createtime');
lastchangetime = lastchangeui.time.attr('data-updatetime');
@@ -47,8 +46,15 @@ var deps = [{
}
}, {
src: serverurl + '/js/reveal-markdown.js',
- condition: function() {
- return !!document.querySelector('[data-markdown]');
+ callback: function () {
+ var slideOptions = {
+ separator: '^(\r\n?|\n)---(\r\n?|\n)$',
+ verticalSeparator: '^(\r\n?|\n)----(\r\n?|\n)$'
+ };
+ var slides = RevealMarkdown.slidify(body, slideOptions);
+ $(".slides").html(slides);
+ RevealMarkdown.initialize();
+ $(".slides").show();
}
}, {
src: serverurl + '/vendor/reveal.js/plugin/notes/notes.js',
diff --git a/public/views/slide.ejs b/public/views/slide.ejs
index 437f0c97..df23988d 100644
--- a/public/views/slide.ejs
+++ b/public/views/slide.ejs
@@ -55,7 +55,7 @@
<body>
<div class="container">
<div class="reveal">
- <div class="slides"><%- slides %></div>
+ <div class="slides" style="display: none;"><%- body %></div>
</div>
<div id="meta" style="display: none;"><%- meta %></div>