diff --git a/www/code/main.js b/www/code/main.js index dff4be7dc..5ece7a208 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -52,6 +52,7 @@ define([ var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox'); var parsedHash = Cryptpad.parsePadUrl(window.location.href); var defaultName = Cryptpad.getDefaultName(parsedHash); + var initialState = Messages.codeInitialState; var editor = module.editor = CMeditor.fromTextArea($textarea[0], { lineNumbers: true, @@ -68,7 +69,7 @@ define([ mode: "javascript", readOnly: true }); - editor.setOption('placeholder', Messages.codeInitialState); + editor.setValue(Messages.codeInitialState); var setMode = module.setMode = function (mode, $select) { module.highlightMode = mode; @@ -84,8 +85,6 @@ define([ } }; - editor.setValue(''); - var setTheme = module.setTheme = (function () { var path = '/common/theme/'; @@ -562,7 +561,9 @@ define([ // Update the user list (metadata) from the hyperjson updateMetadata(userDoc); - editor.setValue(newDoc || ''); + if (newDoc) { + editor.setValue(newDoc); + } if (Cryptpad.initialName && document.title === defaultName) { updateTitle(Cryptpad.initialName); diff --git a/www/slide/main.js b/www/slide/main.js index cefcf0f26..86486227d 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -72,6 +72,7 @@ define([ var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox'); var parsedHash = Cryptpad.parsePadUrl(window.location.href); var defaultName = Cryptpad.getDefaultName(parsedHash); + var initialState = Messages.slideInitialState; var editor = module.editor = CMeditor.fromTextArea($textarea[0], { lineNumbers: true, @@ -88,7 +89,7 @@ define([ mode: "javascript", readOnly: true }); - editor.setOption('placeholder', Messages.slideInitialState); + editor.setValue(initialState); var setMode = module.setMode = function (mode, $select) { module.highlightMode = mode; @@ -102,8 +103,6 @@ define([ }; setMode('markdown'); - editor.setValue(''); - var setTheme = module.setTheme = (function () { var path = '/common/theme/'; @@ -136,7 +135,7 @@ define([ var $modal = $pad.contents().find('#modal'); var $content = $pad.contents().find('#content'); - Slide.setModal($modal, $content, $pad, ifrw, Messages.slideInitialState); + Slide.setModal($modal, $content, $pad, ifrw, initialState); var enterPresentationMode = function (shouldLog) { Slide.show(true, $textarea.val()); @@ -634,7 +633,7 @@ define([ // Update the user list (metadata) from the hyperjson updateMetadata(userDoc); - editor.setValue(newDoc || ''); + editor.setValue(newDoc || initialState); Slide.update(newDoc); if (Cryptpad.initialName && APP.title === defaultName) {