Fix missing placeholder in the Slide app

pull/1/head
yflory 8 years ago
parent 7d6e15e465
commit 6f0d33dc1d

@ -134,7 +134,7 @@ define([
var $modal = $pad.contents().find('#modal'); var $modal = $pad.contents().find('#modal');
var $content = $pad.contents().find('#content'); var $content = $pad.contents().find('#content');
Slide.setModal($modal, $content, $pad, ifrw); Slide.setModal($modal, $content, $pad, ifrw, Messages.slideInitialState);
var enterPresentationMode = function (shouldLog) { var enterPresentationMode = function (shouldLog) {
Slide.show(true, $textarea.val()); Slide.show(true, $textarea.val());
@ -240,7 +240,7 @@ define([
var shjson = stringifyInner(textValue); var shjson = stringifyInner(textValue);
module.patchText(shjson); module.patchText(shjson);
Slide.update(textValue || Messages.slideInitialState); Slide.update(textValue);
if (module.realtime.getUserDoc() !== shjson) { if (module.realtime.getUserDoc() !== shjson) {
console.error("realtime.getUserDoc() !== shjson"); console.error("realtime.getUserDoc() !== shjson");
@ -648,7 +648,7 @@ define([
updateMetadata(userDoc); updateMetadata(userDoc);
editor.setValue(newDoc || ''); editor.setValue(newDoc || '');
Slide.update(newDoc || Messages.slideInitialState); Slide.update(newDoc);
if (Visible.isSupported()) { if (Visible.isSupported()) {
Visible.onChange(function (yes) { Visible.onChange(function (yes) {

@ -18,6 +18,7 @@ define([
var $modal; var $modal;
var $content; var $content;
var $pad; var $pad;
var placeholder;
Slide.onChange = function (f) { Slide.onChange = function (f) {
if (typeof(f) === 'function') { if (typeof(f) === 'function') {
@ -160,6 +161,7 @@ define([
var update = Slide.update = function (content) { var update = Slide.update = function (content) {
if (!Slide.shown) { return; } if (!Slide.shown) { return; }
if (!content) { content = placeholder; }
var old = Slide.content[Slide.index]; var old = Slide.content[Slide.index];
Slide.content = content.split(/\n\s*\-\-\-\s*\n/).filter(truthy); Slide.content = content.split(/\n\s*\-\-\-\s*\n/).filter(truthy);
if (old !== Slide.content[Slide.index]) { if (old !== Slide.content[Slide.index]) {
@ -256,11 +258,12 @@ define([
}); });
}; };
Slide.setModal = function ($m, $c, $p, iframe) { Slide.setModal = function ($m, $c, $p, iframe, ph) {
$modal = Slide.$modal = $m; $modal = Slide.$modal = $m;
$content = Slide.$content = $c; $content = Slide.$content = $c;
$pad = Slide.$pad = $p; $pad = Slide.$pad = $p;
ifrw = Slide.ifrw = iframe; ifrw = Slide.ifrw = iframe;
placeholder = Slide.placeholder = ph;
addEvent(); addEvent();
}; };

Loading…
Cancel
Save