summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/js/index.js442
-rw-r--r--public/views/body.ejs3
-rw-r--r--public/views/head.ejs2
-rw-r--r--public/views/header.ejs10
-rw-r--r--public/views/help-modal.ejs132
-rw-r--r--public/views/html.hbs2
-rw-r--r--public/views/index.ejs16
-rw-r--r--public/views/pretty.ejs2
-rw-r--r--public/views/signin-modal.ejs (renamed from public/views/modal.ejs)0
9 files changed, 371 insertions, 238 deletions
diff --git a/public/js/index.js b/public/js/index.js
index f38e2baf..3f0ed593 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1,22 +1,23 @@
var defaultTextHeight = 20;
var viewportMargin = 20;
var defaultExtraKeys = {
- "F11": function(cm) {
- cm.setOption("fullScreen", !cm.getOption("fullScreen"));
+ "F10": function (cm) {
+ cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
- "Esc": function(cm) {
- if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
+ "Esc": function (cm) {
+ if (cm.getOption('keyMap').substr(0, 3) === 'vim') return CodeMirror.Pass;
+ else if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
},
"Cmd-S": function () {
- return CodeMirror.PASS
+ return false;
},
"Ctrl-S": function () {
- return CodeMirror.PASS
+ return false;
},
"Enter": "newlineAndIndentContinueMarkdownList",
- "Tab": function(cm) {
+ "Tab": function (cm) {
var tab = '\t';
- var spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
+ var spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
//auto indent whole line when in list or blockquote
var cursor = cm.getCursor();
var line = cm.getLine(cursor.line);
@@ -31,19 +32,19 @@ var defaultExtraKeys = {
line: cursor.line,
ch: ch
};
- if (cm.getOption('indentWithTabs'))
- cm.replaceRange(tab, pos, pos, '+input');
- else
- cm.replaceRange(spaces, pos, pos, '+input');
+ if (cm.getOption('indentWithTabs'))
+ cm.replaceRange(tab, pos, pos, '+input');
+ else
+ cm.replaceRange(spaces, pos, pos, '+input');
} else {
if (cm.getOption('indentWithTabs'))
cm.execCommand('defaultTab');
else {
- cm.replaceSelection(spaces);
- }
+ cm.replaceSelection(spaces);
+ }
}
},
- "Cmd-Left": "goLineLeftSmart",
+ "Cmd-Left": "goLineLeftSmart",
"Cmd-Right": "goLineRight"
};
@@ -312,7 +313,7 @@ function addStatusBar() {
statusPanel = editor.addPanel(statusBar[0], {
position: "bottom"
});
-
+
setIndent();
setKeymap();
}
@@ -334,11 +335,11 @@ function setIndent() {
}
if (cookieTabSize)
editor.setOption('tabSize', cookieTabSize);
-
+
var type = statusIndicators.find('.indent-type');
var widthLabel = statusIndicators.find('.indent-width-label');
var widthInput = statusIndicators.find('.indent-width-input');
-
+
function setType() {
if (editor.getOption('indentWithTabs')) {
Cookies.set('indent_type', 'tab', {
@@ -353,7 +354,7 @@ function setIndent() {
}
}
setType();
-
+
function setUnit() {
var unit = editor.getOption('indentUnit');
if (editor.getOption('indentWithTabs')) {
@@ -368,8 +369,8 @@ function setIndent() {
widthLabel.text(unit);
}
setUnit();
-
- type.click(function() {
+
+ type.click(function () {
if (editor.getOption('indentWithTabs')) {
editor.setOption('indentWithTabs', false);
cookieSpaceUnits = parseInt(Cookies.get('space_units'));
@@ -384,9 +385,9 @@ function setIndent() {
}
}
setType();
- setUnit();
+ setUnit();
});
- widthLabel.click(function() {
+ widthLabel.click(function () {
if (widthLabel.is(':visible')) {
widthLabel.addClass('hidden');
widthInput.removeClass('hidden');
@@ -397,19 +398,19 @@ function setIndent() {
widthInput.addClass('hidden');
}
});
- widthInput.on('change', function() {
+ widthInput.on('change', function () {
var val = parseInt(widthInput.val());
- if (!val) val = editor.getOption('indentUnit');
+ if (!val) val = editor.getOption('indentUnit');
if (val < 1) val = 1;
else if (val > 10) val = 10;
-
+
if (editor.getOption('indentWithTabs')) {
editor.setOption('tabSize', val);
}
editor.setOption('indentUnit', val);
setUnit();
});
- widthInput.on('blur', function() {
+ widthInput.on('blur', function () {
widthLabel.removeClass('hidden');
widthInput.addClass('hidden');
});
@@ -419,12 +420,12 @@ function setKeymap() {
var cookieKeymap = Cookies.get('keymap');
if (cookieKeymap)
editor.setOption('keyMap', cookieKeymap);
-
+
var label = statusIndicators.find('.ui-keymap-label');
var sublime = statusIndicators.find('.ui-keymap-sublime');
var emacs = statusIndicators.find('.ui-keymap-emacs');
var vim = statusIndicators.find('.ui-keymap-vim');
-
+
function setKeymapLabel() {
var keymap = editor.getOption('keyMap');
Cookies.set('keymap', keymap, {
@@ -433,16 +434,16 @@ function setKeymap() {
label.text(keymap);
}
setKeymapLabel();
-
- sublime.click(function() {
+
+ sublime.click(function () {
editor.setOption('keyMap', 'sublime');
setKeymapLabel();
});
- emacs.click(function() {
+ emacs.click(function () {
editor.setOption('keyMap', 'emacs');
setKeymapLabel();
});
- vim.click(function() {
+ vim.click(function () {
editor.setOption('keyMap', 'vim');
setKeymapLabel();
});
@@ -860,22 +861,22 @@ function showStatus(type, num) {
status.html("");
switch (currentStatus) {
- case statusType.connected:
- label.addClass(statusType.connected.label);
- fa.addClass(statusType.connected.fa);
- msg = statusType.connected.msg;
- break;
- case statusType.online:
- label.addClass(statusType.online.label);
- fa.addClass(statusType.online.fa);
- shortMsg = num;
- msg = num + " " + statusType.online.msg;
- break;
- case statusType.offline:
- label.addClass(statusType.offline.label);
- fa.addClass(statusType.offline.fa);
- msg = statusType.offline.msg;
- break;
+ case statusType.connected:
+ label.addClass(statusType.connected.label);
+ fa.addClass(statusType.connected.fa);
+ msg = statusType.connected.msg;
+ break;
+ case statusType.online:
+ label.addClass(statusType.online.label);
+ fa.addClass(statusType.online.fa);
+ shortMsg = num;
+ msg = num + " " + statusType.online.msg;
+ break;
+ case statusType.offline:
+ label.addClass(statusType.offline.label);
+ fa.addClass(statusType.offline.fa);
+ msg = statusType.offline.msg;
+ break;
}
label.append(fa);
@@ -890,15 +891,15 @@ function showStatus(type, num) {
function toggleMode() {
switch (currentMode) {
- case modeType.edit:
- changeMode(modeType.view);
- break;
- case modeType.view:
- changeMode(modeType.edit);
- break;
- case modeType.both:
- changeMode(modeType.view);
- break;
+ case modeType.edit:
+ changeMode(modeType.view);
+ break;
+ case modeType.view:
+ changeMode(modeType.edit);
+ break;
+ case modeType.both:
+ changeMode(modeType.view);
+ break;
}
}
@@ -919,24 +920,24 @@ function changeMode(type) {
ui.area.view.removeClass(scrollClass);
ui.area.view.removeClass(responsiveClass);
switch (currentMode) {
- case modeType.edit:
- ui.area.edit.show();
- ui.area.view.hide();
- if (!editShown) {
- editor.refresh();
- editShown = true;
- }
- break;
- case modeType.view:
- ui.area.edit.hide();
- ui.area.view.show();
- break;
- case modeType.both:
- ui.area.codemirror.addClass(scrollClass);
- ui.area.edit.addClass(responsiveClass).show();
- ui.area.view.addClass(scrollClass);
- ui.area.view.show();
- break;
+ case modeType.edit:
+ ui.area.edit.show();
+ ui.area.view.hide();
+ if (!editShown) {
+ editor.refresh();
+ editShown = true;
+ }
+ break;
+ case modeType.view:
+ ui.area.edit.hide();
+ ui.area.view.show();
+ break;
+ case modeType.both:
+ ui.area.codemirror.addClass(scrollClass);
+ ui.area.edit.addClass(responsiveClass).show();
+ ui.area.view.addClass(scrollClass);
+ ui.area.view.show();
+ break;
}
if (currentMode == modeType.view) {
editor.getInputField().blur();
@@ -973,13 +974,13 @@ function changeMode(type) {
}
windowResizeInner();
-
+
restoreInfo();
-
+
if (lastMode == modeType.view && currentMode == modeType.both) {
syncScrollToEdit();
}
-
+
if (lastMode != modeType.edit && currentMode == modeType.edit) {
editor.refresh();
}
@@ -1053,8 +1054,8 @@ ui.toolbar.publish.attr("href", noteurl + "/publish");
//download
//markdown
ui.toolbar.download.markdown.click(function (e) {
- e.preventDefault();
- e.stopPropagation();
+ e.preventDefault();
+ e.stopPropagation();
var filename = renderFilename(ui.area.markdown) + '.md';
var markdown = editor.getValue();
var blob = new Blob([markdown], {
@@ -1064,8 +1065,8 @@ ui.toolbar.download.markdown.click(function (e) {
});
//html
ui.toolbar.download.html.click(function (e) {
- e.preventDefault();
- e.stopPropagation();
+ e.preventDefault();
+ e.stopPropagation();
exportToHTML(ui.area.markdown);
});
//export to dropbox
@@ -1095,12 +1096,12 @@ function uploadToGoogleDrive(accessToken) {
var uploader = new MediaUploader({
file: blob,
token: accessToken,
- onComplete: function(data) {
+ onComplete: function (data) {
data = JSON.parse(data);
showMessageModal('<i class="fa fa-cloud-upload"></i> Export to Google Drive', 'Export Complete!', data.alternateLink, 'Click here to view your file', true);
ui.spinner.hide();
},
- onError: function(data) {
+ onError: function (data) {
var modal = $('.export-modal');
showMessageModal('<i class="fa fa-cloud-upload"></i> Export to Google Drive', 'Export Error :(', '', data, false);
ui.spinner.hide();
@@ -1110,11 +1111,11 @@ function uploadToGoogleDrive(accessToken) {
}
function googleApiAuth(immediate, callback) {
gapi.auth.authorize(
- {
- 'client_id': GOOGLE_CLIENT_ID,
- 'scope': 'https://www.googleapis.com/auth/drive.file',
- 'immediate': immediate
- }, callback ? callback : function() {});
+ {
+ 'client_id': GOOGLE_CLIENT_ID,
+ 'scope': 'https://www.googleapis.com/auth/drive.file',
+ 'immediate': immediate
+ }, callback ? callback : function () { });
}
function onGoogleClientLoaded() {
googleApiAuth(true);
@@ -1126,7 +1127,7 @@ ui.toolbar.export.googleDrive.click(function (e) {
if (token) {
uploadToGoogleDrive(token.access_token);
} else {
- googleApiAuth(false, function(result) {
+ googleApiAuth(false, function (result) {
uploadToGoogleDrive(result.access_token);
});
}
@@ -1154,18 +1155,17 @@ function buildImportFromGoogleDrive() {
apiKey: GOOGLE_API_KEY,
clientId: GOOGLE_CLIENT_ID,
buttonEl: ui.toolbar.import.googleDrive,
- onSelect: function(file) {
+ onSelect: function (file) {
if (file.downloadUrl) {
ui.spinner.show();
var accessToken = gapi.auth.getToken().access_token;
$.ajax({
type: 'GET',
- beforeSend: function (request)
- {
+ beforeSend: function (request) {
request.setRequestHeader('Authorization', 'Bearer ' + accessToken);
},
url: file.downloadUrl,
- success: function(data) {
+ success: function (data) {
if (file.fileExtension == 'html')
parseToEditor(data);
else
@@ -1268,17 +1268,17 @@ function updateScrollspy() {
for (var i = 0; i < headers.length; i++) {
headerMap.push($(headers[i]).offset().top - parseInt($(headers[i]).css('margin-top')));
}
- applyScrollspyActive($(window).scrollTop(), headerMap, headers,
- $('.scrollspy-body'), 0);
+ applyScrollspyActive($(window).scrollTop(), headerMap, headers,
+ $('.scrollspy-body'), 0);
var offset = ui.area.view.scrollTop() - ui.area.view.offset().top;
- applyScrollspyActive(ui.area.view.scrollTop(), headerMap, headers,
- $('.scrollspy-view'), offset - 10);
+ applyScrollspyActive(ui.area.view.scrollTop(), headerMap, headers,
+ $('.scrollspy-view'), offset - 10);
}
function applyScrollspyActive(top, headerMap, headers, target, offset) {
var index = 0;
- for(var i = headerMap.length - 1; i >= 0; i--) {
- if(top >= (headerMap[i] + offset) && headerMap[i + 1] && top < (headerMap[i + 1] + offset)) {
+ for (var i = headerMap.length - 1; i >= 0; i--) {
+ if (top >= (headerMap[i] + offset) && headerMap[i + 1] && top < (headerMap[i + 1] + offset)) {
index = i;
break;
}
@@ -1364,9 +1364,9 @@ function replaceAll(data) {
line: 0,
ch: 0
}, {
- line: editor.lastLine(),
- ch: editor.lastLine().length
- }, '+input');
+ line: editor.lastLine(),
+ ch: editor.lastLine().length
+ }, '+input');
}
function importFromUrl(url) {
@@ -1457,22 +1457,22 @@ function updatePermission(newPermission) {
var label = null;
var title = null;
switch (permission) {
- case "freely":
- label = '<i class="fa fa-leaf"></i> Freely';
- title = "Anyone can edit";
- break;
- case "editable":
- label = '<i class="fa fa-shield"></i> Editable';
- title = "Signed people can edit";
- break;
- case "locked":
- label = '<i class="fa fa-lock"></i> Locked';
- title = "Only owner can edit";
- break;
- case "private":
- label = '<i class="fa fa-hand-stop-o"></i> Private';
- title = "Only owner can view & edit";
- break;
+ case "freely":
+ label = '<i class="fa fa-leaf"></i> Freely';
+ title = "Anyone can edit";
+ break;
+ case "editable":
+ label = '<i class="fa fa-shield"></i> Editable';
+ title = "Signed people can edit";
+ break;
+ case "locked":
+ label = '<i class="fa fa-lock"></i> Locked';
+ title = "Only owner can edit";
+ break;
+ case "private":
+ label = '<i class="fa fa-hand-stop-o"></i> Private';
+ title = "Only owner can view & edit";
+ break;
}
if (personalInfo.userid && personalInfo.userid == owner) {
label += ' <i class="fa fa-caret-down"></i>';
@@ -1486,24 +1486,24 @@ function updatePermission(newPermission) {
function havePermission() {
var bool = false;
switch (permission) {
- case "freely":
- bool = true;
- break;
- case "editable":
- if (!personalInfo.login) {
- bool = false;
- } else {
- bool = true;
- }
- break;
- case "locked":
- case "private":
- if (personalInfo.userid != owner) {
- bool = false;
- } else {
+ case "freely":
bool = true;
- }
- break;
+ break;
+ case "editable":
+ if (!personalInfo.login) {
+ bool = false;
+ } else {
+ bool = true;
+ }
+ break;
+ case "locked":
+ case "private":
+ if (personalInfo.userid != owner) {
+ bool = false;
+ } else {
+ bool = true;
+ }
+ break;
}
return bool;
}
@@ -1527,15 +1527,15 @@ socket.emit = function () {
socket.on('info', function (data) {
console.error(data);
switch (data.code) {
- case 403:
- location.href = "./403";
- break;
- case 404:
- location.href = "./404";
- break;
- case 500:
- location.href = "./500";
- break;
+ case 403:
+ location.href = "./403";
+ break;
+ case 404:
+ location.href = "./404";
+ break;
+ case 500:
+ location.href = "./500";
+ break;
}
});
socket.on('error', function (data) {
@@ -2021,18 +2021,18 @@ function buildCursor(user) {
coord.top = coord.top < 0 ? 0 : coord.top;
var iconClass = 'fa-user';
switch (user.type) {
- case 'xs':
- iconClass = 'fa-mobile';
- break;
- case 'sm':
- iconClass = 'fa-tablet';
- break;
- case 'md':
- iconClass = 'fa-desktop';
- break;
- case 'lg':
- iconClass = 'fa-desktop';
- break;
+ case 'xs':
+ iconClass = 'fa-mobile';
+ break;
+ case 'sm':
+ iconClass = 'fa-tablet';
+ break;
+ case 'md':
+ iconClass = 'fa-desktop';
+ break;
+ case 'lg':
+ iconClass = 'fa-desktop';
+ break;
}
if ($('.other-cursors').length <= 0) {
$("<div class='other-cursors'>").insertAfter('.CodeMirror-cursors');
@@ -2127,7 +2127,7 @@ function buildCursor(user) {
var cursortag = cursor.find('.cursortag');
cursortag.find('i').removeClass().addClass('fa').addClass(iconClass);
cursortag.find(".name").text(user.name);
-
+
if (cursor.css('display') === 'none') {
cursor[0].style.left = coord.left + 'px';
cursor[0].style.top = coord.top + 'px';
@@ -2136,9 +2136,9 @@ function buildCursor(user) {
"left": coord.left,
"top": coord.top
}, {
- duration: cursorAnimatePeriod,
- queue: false
- });
+ duration: cursorAnimatePeriod,
+ queue: false
+ });
}
if (user.idle && cursor.css('display') !== 'none')
@@ -2180,13 +2180,13 @@ editor.on('beforeChange', function (cm, change) {
if (!havePermission()) {
change.canceled = true;
switch (permission) {
- case "editable":
- $('.signin-modal').modal('show');
- break;
- case "locked":
- case "private":
- $('.locked-modal').modal('show');
- break;
+ case "editable":
+ $('.signin-modal').modal('show');
+ break;
+ case "locked":
+ case "private":
+ $('.locked-modal').modal('show');
+ break;
}
}
} else {
@@ -2198,10 +2198,10 @@ editor.on('beforeChange', function (cm, change) {
if (cmClient && !socket.connected)
cmClient.editorAdapter.ignoreNextChange = true;
});
-editor.on('cut', function() {
+editor.on('cut', function () {
windowResize(); //workaround for scrollMap
});
-editor.on('paste', function() {
+editor.on('paste', function () {
windowResize(); //workaround for scrollMap
});
editor.on('changes', function (cm, changes) {
@@ -2271,23 +2271,23 @@ function saveInfo() {
var left = $(window).scrollLeft();
var top = $(window).scrollTop();
switch (currentMode) {
- case modeType.edit:
- if (scrollbarStyle == 'native') {
- lastInfo.edit.scroll.left = left;
- lastInfo.edit.scroll.top = top;
- } else {
+ case modeType.edit:
+ if (scrollbarStyle == 'native') {
+ lastInfo.edit.scroll.left = left;
+ lastInfo.edit.scroll.top = top;
+ } else {
+ lastInfo.edit.scroll = editor.getScrollInfo();
+ }
+ break;
+ case modeType.view:
+ lastInfo.view.scroll.left = left;
+ lastInfo.view.scroll.top = top;
+ break;
+ case modeType.both:
lastInfo.edit.scroll = editor.getScrollInfo();
- }
- break;
- case modeType.view:
- lastInfo.view.scroll.left = left;
- lastInfo.view.scroll.top = top;
- break;
- case modeType.both:
- lastInfo.edit.scroll = editor.getScrollInfo();
- lastInfo.view.scroll.left = ui.area.view.scrollLeft();
- lastInfo.view.scroll.top = ui.area.view.scrollTop();
- break;
+ lastInfo.view.scroll.left = ui.area.view.scrollLeft();
+ lastInfo.view.scroll.top = ui.area.view.scrollTop();
+ break;
}
lastInfo.edit.cursor = editor.getCursor();
lastInfo.needRestore = true;
@@ -2300,29 +2300,29 @@ function restoreInfo() {
var ch = lastInfo.edit.cursor.ch;
editor.setCursor(line, ch);
switch (currentMode) {
- case modeType.edit:
- if (scrollbarStyle == 'native') {
- $(window).scrollLeft(lastInfo.edit.scroll.left);
- $(window).scrollTop(lastInfo.edit.scroll.top);
- } else {
+ case modeType.edit:
+ if (scrollbarStyle == 'native') {
+ $(window).scrollLeft(lastInfo.edit.scroll.left);
+ $(window).scrollTop(lastInfo.edit.scroll.top);
+ } else {
+ var left = lastInfo.edit.scroll.left;
+ var top = lastInfo.edit.scroll.top;
+ editor.scrollIntoView();
+ editor.scrollTo(left, top);
+ }
+ break;
+ case modeType.view:
+ $(window).scrollLeft(lastInfo.view.scroll.left);
+ $(window).scrollTop(lastInfo.view.scroll.top);
+ break;
+ case modeType.both:
var left = lastInfo.edit.scroll.left;
var top = lastInfo.edit.scroll.top;
editor.scrollIntoView();
editor.scrollTo(left, top);
- }
- break;
- case modeType.view:
- $(window).scrollLeft(lastInfo.view.scroll.left);
- $(window).scrollTop(lastInfo.view.scroll.top);
- break;
- case modeType.both:
- var left = lastInfo.edit.scroll.left;
- var top = lastInfo.edit.scroll.top;
- editor.scrollIntoView();
- editor.scrollTo(left, top);
- ui.area.view.scrollLeft(lastInfo.view.scroll.left);
- ui.area.view.scrollTop(lastInfo.view.scroll.top);
- break;
+ ui.area.view.scrollLeft(lastInfo.view.scroll.left);
+ ui.area.view.scrollTop(lastInfo.view.scroll.top);
+ break;
}
lastInfo.needRestore = false;
@@ -2704,11 +2704,11 @@ $(editor.getInputField())
var list = [];
$.map(emojify.emojiNames, function (emoji) {
if (emoji.indexOf(term) === 0) //match at first character
- list.push(emoji);
+ list.push(emoji);
});
$.map(emojify.emojiNames, function (emoji) {
if (emoji.indexOf(term) !== -1) //match inside the word
- list.push(emoji);
+ list.push(emoji);
});
callback(list);
},
@@ -2725,7 +2725,7 @@ $(editor.getInputField())
checkInContainerSyntax();
return !isInCode && !isInContainerSyntax;
}
- },
+ },
{ // Code block language strategy
langs: supportCodeModes,
charts: supportCharts,
@@ -2767,7 +2767,7 @@ $(editor.getInputField())
context: function (text) {
return isInCode;
}
- },
+ },
{ // Container strategy
containers: supportContainers,
match: /(^|\n):::(\s*)(\w*)$/,
@@ -2803,7 +2803,7 @@ $(editor.getInputField())
context: function (text) {
return !isInCode && isInContainer;
}
- },
+ },
{ //header
match: /(?:^|\n)(\s{0,3})(#{1,6}\w*)$/,
search: function (term, callback) {
@@ -2817,7 +2817,7 @@ $(editor.getInputField())
context: function (text) {
return !isInCode;
}
- },
+ },
{ //extra tags for blockquote
match: /(?:^|\n|\s)(\>.*)(\[\])(\w*)$/,
search: function (term, callback) {
@@ -2838,7 +2838,7 @@ $(editor.getInputField())
context: function (text) {
return !isInCode;
}
- },
+ },
{ //extra tags for list
match: /(^[>\s]*[\-\+\*]\s(?:\[[x ]\]|.*))(\[\])(\w*)$/,
search: function (term, callback) {
@@ -2859,7 +2859,7 @@ $(editor.getInputField())
context: function (text) {
return !isInCode;
}
- },
+ },
{ //referral
match: /(^|\n|\s)(\!|\!|\[\])(\w*)$/,
search: function (term, callback) {
@@ -2873,7 +2873,7 @@ $(editor.getInputField())
context: function (text) {
return !isInCode;
}
- },
+ },
{ //externals
match: /(^|\n|\s)\{\}(\w*)$/,
search: function (term, callback) {
@@ -2887,8 +2887,8 @@ $(editor.getInputField())
context: function (text) {
return !isInCode;
}
- }
-], {
+ }
+ ], {
appendTo: $('.cursor-menu')
})
.on({
@@ -2905,19 +2905,19 @@ $(editor.getInputField())
$(this).data('autocompleting', true);
editor.setOption("extraKeys", {
"Up": function () {
- return CodeMirror.PASS;
+ return false;
},
"Right": function () {
editor.doc.cm.execCommand("goCharRight");
},
"Down": function () {
- return CodeMirror.PASS;
+ return false;
},
"Left": function () {
editor.doc.cm.execCommand("goCharLeft");
},
"Enter": function () {
- return CodeMirror.PASS;
+ return false;
},
"Backspace": function () {
editor.doc.cm.execCommand("delCharBefore");
@@ -2928,4 +2928,4 @@ $(editor.getInputField())
$(this).data('autocompleting', false);
editor.setOption("extraKeys", defaultExtraKeys);
}
- }); \ No newline at end of file
+ });
diff --git a/public/views/body.ejs b/public/views/body.ejs
index 771da880..11bccfef 100644
--- a/public/views/body.ejs
+++ b/public/views/body.ejs
@@ -151,4 +151,5 @@
</div>
</div>
</div>
-<%- include modal %> \ No newline at end of file
+<%- include signin-modal %>
+<%- include help-modal %> \ No newline at end of file
diff --git a/public/views/head.ejs b/public/views/head.ejs
index cdc59048..ba78b9dc 100644
--- a/public/views/head.ejs
+++ b/public/views/head.ejs
@@ -12,7 +12,7 @@
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
<% if(useCDN) { %>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
-<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
diff --git a/public/views/header.ejs b/public/views/header.ejs
index 0c7f6e17..1092a2d1 100644
--- a/public/views/header.ejs
+++ b/public/views/header.ejs
@@ -13,7 +13,7 @@
<ul class="dropdown-menu list" role="menu" aria-labelledby="menu">
</ul>
</div>
- <a class="navbar-brand" href="<%- url %>/"><i class="fa fa-file-text"></i> HackMD</a>
+ <a class="navbar-brand pull-left" href="<%- url %>"><i class="fa fa-file-text"></i> HackMD</a>
<div class="nav-mobile pull-right visible-xs">
<span class="btn btn-link btn-file ui-upload-image" title="Upload Image" style="display:none;">
<i class="fa fa-camera"></i><input type="file" accept="image/*" name="upload" multiple>
@@ -69,7 +69,7 @@
<li role="presentation"><a role="menuitem" class="ui-download-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> HTML</a>
</li>
<li class="divider"></li>
- <li><a href="https://www.facebook.com/messages/866415986748945" class="ui-feedback" title="Feedback" target="_blank"><i class="fa fa-bullhorn fa-fw"></i> Feedback</a>
+ <li role="presentation"><a role="menuitem" class="ui-help" href="#" data-toggle="modal" data-target=".help-modal"><i class="fa fa-question-circle fa-fw"></i> Help</a>
</li>
</ul>
<a class="btn btn-link ui-mode">
@@ -90,9 +90,9 @@
<input type="radio" name="mode" autocomplete="off"><i class="fa fa-columns"></i>
</label>
</div>
- <a href="https://www.facebook.com/messages/866415986748945" class="btn btn-link ui-feedback" title="Feedback" target="_blank">
- <i class="fa fa-bullhorn"></i>
- </a>
+ <span class="btn btn-link btn-file ui-help" title="Help" data-toggle="modal" data-target=".help-modal">
+ <i class="fa fa-question-circle"></i>
+ </span>
<span class="btn btn-link btn-file ui-upload-image" title="Upload Image" style="display:none;">
<i class="fa fa-camera"></i><input type="file" accept="image/*" name="upload" multiple>
</span>
diff --git a/public/views/help-modal.ejs b/public/views/help-modal.ejs
new file mode 100644
index 00000000..15342262
--- /dev/null
+++ b/public/views/help-modal.ejs
@@ -0,0 +1,132 @@
+<!-- help modal -->
+<div class="modal fade help-modal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
+ <div class="modal-dialog modal-lg">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
+ </button>
+ <h4 class="modal-title" id="mySmallModalLabel"><i class="fa fa-question-circle"></i> Help</h4>
+ </div>
+ <div class="modal-body">
+ <div class="row">
+ <div class="col-lg-3">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Contacts</h3>
+ </div>
+ <div class="panel-body">
+ <a href="https://github.com/hackmdio/hackmd/issues" title="Report an issue" target="_blank"><i class="fa fa-tag fa-fw"></i> Report an issue</a>
+ <br>
+ <a href="mailto:hackmdio@gmail.com" title="Send us email"><i class="fa fa-envelope fa-fw"></i> Send us email</a>
+ </div>
+ </div>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Documents</h3>
+ </div>
+ <div class="panel-body">
+ <a href="./features" title="Features" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> Features</a>
+ <br>
+ <a href="./yaml-metadata" title="YAML Metadata" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> YAML Metadata</a>
+ <br>
+ <a href="./slide-example" title="Slide Example" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> Slide Example</a>
+ </div>
+ </div>
+ </div>
+ <div class="col-lg-9">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Cheatsheet</h3>
+ </div>
+ <div class="panel-body" style="max-height: 470px; overflow: auto;">
+ <table class="table table-condensed">
+ <thead>
+ <tr>
+ <th>Example</th>
+ <th>Syntax</th>
+ </tr>
+ </thead>
+ <tbody class="markdown-body" style="font-family: inherit; font-size: 14px; padding: 0; max-width: inherit;">
+ <tr>
+ <td>Header</td>
+ <td># Header</td>
+ </tr>
+ <tr>
+ <td><ul><li>Unordered List</li></ul><ol><li>Ordered List</li></ol><ul><li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled><label></label>Todo List</li></ul></td>
+ <td>- Unordered List<br>1. Ordered List<br>- [ ] Todo List</td>
+ </tr>
+ <tr>
+ <td><blockquote> Blockquote</blockquote></td>
+ <td>> Blockquote</td>
+ </tr>
+ <tr>
+ <td><strong>Bold font</strong></td>
+ <td>**Bold font**</td>
+ </tr>
+ <tr>
+ <td><i>Italics font</i></td>
+ <td>*Italics font*</td>
+ </tr>
+ <tr>
+ <td><s>Strikethrough</s></td>
+ <td>~~strikethrough~~</td>
+ </tr>
+ <tr>
+ <td>19<sup>th</sup></td>
+ <td>19^th^</td>
+ </tr>
+ <tr>
+ <td>H<sub>2</sub>O</td>
+ <td>H~2~O</td>
+ </tr>
+ <tr>
+ <td><ins>Inserted text</ins></td>
+ <td>++Inserted text++</td>
+ </tr>
+ <tr>
+ <td><mark>Marked text</mark></td>
+ <td>==Marked text==</td>
+ </tr>
+ <tr>
+ <td><a>Link</a></td>
+ <td>[title](http://)</td>
+ </tr>
+ <tr>
+ <td>Image</td>
+ <td>![alt](http:// title)</td>
+ </tr>
+ <tr>
+ <td><code>Code</code></td>
+ <td>`code`</td>
+ </tr>
+ <tr>
+ <td><pre style="border:none !important;"><code class="javascript hljs"><div class="wrapper"><div class="gutter linenumber"><span data-linenumber="1"></span></div><div class="code"><span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>;
+</div></div></code></pre></td>
+ <td>```javascript<br>var i = 0;<br>```</td>
+ </tr>
+ <tr>
+ <td><img align="absmiddle" alt=":smile:" class="emoji" src="./vendor/emojify/images/smile.png" title=":smile:"></img></td>
+ <td>:smile:</td>
+ </tr>
+ <tr>
+ <td>Externals</td>
+ <td>{%youtube youtube_id %}</td>
+ </tr>
+ <tr>
+ <td>L<sup>a</sup>T<sub>e</sub>X</td>
+ <td>$L^aT_eX$</td>
+ </tr>
+ <tr>
+ <td><div class="alert alert-info"><p>This is a alert area.</p></div></td>
+ <td>:::info<br>This is a alert area.<br>:::</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/public/views/html.hbs b/public/views/html.hbs
index d59c4afe..4c6ff00d 100644
--- a/public/views/html.hbs
+++ b/public/views/html.hbs
@@ -17,7 +17,7 @@
<link rel="apple-touch-icon" href="{{{url}}}/apple-touch-icon.png">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/8.8.0/styles/github-gist.min.css">
diff --git a/public/views/index.ejs b/public/views/index.ejs
index 4b6ccab9..7648211f 100644
--- a/public/views/index.ejs
+++ b/public/views/index.ejs
@@ -17,13 +17,13 @@
<!-- Bootstrap core CSS -->
<% if(useCDN) { %>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
- <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
- <% } else { %>
- <link rel="stylesheet" href="<%- url %>/vendor/bootstrap/dist/css/bootstrap.min.css">
- <link rel="stylesheet" href="<%- url %>/vendor/font-awesome/css/font-awesome.min.css">
- <link rel="stylesheet" href="<%- url %>/css/bootstrap-social.css">
- <% } %>
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
+ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
+ <% } else { %>
+ <link rel="stylesheet" href="<%- url %>/vendor/bootstrap/dist/css/bootstrap.min.css">
+ <link rel="stylesheet" href="<%- url %>/vendor/font-awesome/css/font-awesome.min.css">
+ <link rel="stylesheet" href="<%- url %>/css/bootstrap-social.css">
+ <% } %>
<link rel="stylesheet" href="<%- url %>/vendor/select2/select2.css">
<link rel="stylesheet" href="<%- url %>/vendor/select2/select2-bootstrap.css">
<!-- Custom styles for this template -->
@@ -178,7 +178,7 @@
</div>
</div>
</div>
- <%- include modal %>
+ <%- include signin-modal %>
<!-- Bootstrap core JavaScript
================================================== -->
diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs
index 0ef3a104..3387e3e7 100644
--- a/public/views/pretty.ejs
+++ b/public/views/pretty.ejs
@@ -16,7 +16,7 @@
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
<% if(useCDN) { %>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
<% } else { %>
diff --git a/public/views/modal.ejs b/public/views/signin-modal.ejs
index 260ff423..260ff423 100644
--- a/public/views/modal.ejs
+++ b/public/views/signin-modal.ejs