diff --git a/www/slide/main.js b/www/slide/main.js index 5e8a9f41a..28b6d93e1 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -134,7 +134,7 @@ define([ var $modal = $pad.contents().find('#modal'); var $content = $pad.contents().find('#content'); - Slide.setModal($modal, $content, $pad, ifrw); + Slide.setModal($modal, $content, $pad, ifrw, Messages.slideInitialState); var enterPresentationMode = function (shouldLog) { Slide.show(true, $textarea.val()); @@ -240,7 +240,7 @@ define([ var shjson = stringifyInner(textValue); module.patchText(shjson); - Slide.update(textValue || Messages.slideInitialState); + Slide.update(textValue); if (module.realtime.getUserDoc() !== shjson) { console.error("realtime.getUserDoc() !== shjson"); @@ -648,7 +648,7 @@ define([ updateMetadata(userDoc); editor.setValue(newDoc || ''); - Slide.update(newDoc || Messages.slideInitialState); + Slide.update(newDoc); if (Visible.isSupported()) { Visible.onChange(function (yes) { diff --git a/www/slide/slide.js b/www/slide/slide.js index 5fc279d59..292a45a8f 100644 --- a/www/slide/slide.js +++ b/www/slide/slide.js @@ -18,6 +18,7 @@ define([ var $modal; var $content; var $pad; + var placeholder; Slide.onChange = function (f) { if (typeof(f) === 'function') { @@ -160,6 +161,7 @@ define([ var update = Slide.update = function (content) { if (!Slide.shown) { return; } + if (!content) { content = placeholder; } var old = Slide.content[Slide.index]; Slide.content = content.split(/\n\s*\-\-\-\s*\n/).filter(truthy); 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; $content = Slide.$content = $c; $pad = Slide.$pad = $p; ifrw = Slide.ifrw = iframe; + placeholder = Slide.placeholder = ph; addEvent(); };