diff options
author | Wu Cheng-Han | 2016-01-17 09:56:36 -0600 |
---|---|---|
committer | Wu Cheng-Han | 2016-01-17 09:56:36 -0600 |
commit | eddff9e8634a89ea637da3c312ddf74b152c7ae2 (patch) | |
tree | 471b9d95b0a6c281b3c25564be6fb560e698d944 /public/js | |
parent | 5c0a36f4d9ea56846b627ddad2cbd4245cc7e00d (diff) |
Added editor placeholder and auto set mode by content existence
Diffstat (limited to '')
-rw-r--r-- | public/js/index.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/public/js/index.js b/public/js/index.js index 86771fde..3ba9ee5e 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -236,7 +236,8 @@ var editor = CodeMirror.fromTextArea(textit, { extraKeys: defaultExtraKeys, flattenSpans: true, addModeClass: true, - readOnly: true + readOnly: true, + placeholder: "← Start by enter title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)" }); var inlineAttach = inlineAttachment.editors.codemirror4.attach(editor); defaultTextHeight = parseInt($(".CodeMirror").css('line-height')); @@ -1214,7 +1215,18 @@ socket.on('refresh', function (data) { updateLastChange(); updateLastChangeUser(data); if (!loaded) { + var nocontent = editor.getValue().length <= 0; + if (nocontent) { + if (visibleXS) + currentMode = modeType.edit; + else + currentMode = modeType.both; + } changeMode(currentMode); + if (nocontent) { + editor.focus(); + editor.refresh(); + } loaded = true; emitUserStatus(); //send first user status updateOnlineStatus(); //update first online status |