Merge branch 'soon'

pull/1/head
ansuz 8 years ago
commit 0e2140dc13

@ -253,19 +253,21 @@ define([
var clike = /^\s*(\/\*|\/\/)(.*)?(\*\/)*$/; var clike = /^\s*(\/\*|\/\/)(.*)?(\*\/)*$/;
if (clike.test(line)) { if (clike.test(line)) {
line.replace(clike, function (a, one, two) { line.replace(clike, function (a, one, two) {
if (!two && two.replace) { return; } if (!(two && two.replace)) { return; }
text = two.replace(/\*\/\s*$/, '').trim(); text = two.replace(/\*\/\s*$/, '').trim();
}); });
return true; return true;
} }
// TODO make one more pass for multiline comments
}); });
return text.trim(); return text.trim();
}; };
var suggestName = function () { var suggestName = function (fallback) {
if (document.title === defaultName) { if (document.title === defaultName) {
return getHeadingText() || ""; return getHeadingText() || fallback || "";
} else { } else {
return document.title || getHeadingText() || defaultName; return document.title || getHeadingText() || defaultName;
} }
@ -276,7 +278,7 @@ define([
var ext = Modes.extensionOf(module.highlightMode); var ext = Modes.extensionOf(module.highlightMode);
var title = Cryptpad.fixFileName(suggestName()) + ext; var title = Cryptpad.fixFileName(suggestName('cryptpad')) + (ext || '.txt');
Cryptpad.prompt(Messages.exportPrompt, title, function (filename) { Cryptpad.prompt(Messages.exportPrompt, title, function (filename) {
if (filename === null) { return; } if (filename === null) { return; }

@ -321,9 +321,9 @@ define([
})) { return text; } })) { return text; }
}; };
var suggestName = function () { var suggestName = function (fallback) {
if (document.title === defaultName) { if (document.title === defaultName) {
return getHeadingText() || ""; return getHeadingText() || fallback || "";
} else { } else {
return document.title || getHeadingText() || defaultName; return document.title || getHeadingText() || defaultName;
} }
@ -510,7 +510,7 @@ define([
var exportFile = function () { var exportFile = function () {
var html = getHTML(); var html = getHTML();
var suggestion = suggestName(); var suggestion = suggestName('cryptpad-document');
Cryptpad.prompt(Messages.exportPrompt, Cryptpad.prompt(Messages.exportPrompt,
Cryptpad.fixFileName(suggestion) + '.html', function (filename) { Cryptpad.fixFileName(suggestion) + '.html', function (filename) {
if (!(typeof(filename) === 'string' && filename)) { return; } if (!(typeof(filename) === 'string' && filename)) { return; }

Loading…
Cancel
Save