Generate commit messages when using live preview.
This commit is contained in:
@@ -74,23 +74,29 @@ window.onload = function() {
|
|||||||
$.save = function() {
|
$.save = function() {
|
||||||
// if &create=true then handle create instead of edit.
|
// if &create=true then handle create instead of edit.
|
||||||
var create = $.key("create");
|
var create = $.key("create");
|
||||||
|
var POST = "POST";
|
||||||
|
var pageName = $.key("page");
|
||||||
|
var markdown = "markdown";
|
||||||
|
var txt = editorSession.getValue();
|
||||||
|
var msg = pageName + " ("+markdown+")"
|
||||||
|
var newLocation = location + "/" + pageName;
|
||||||
|
|
||||||
if (create) {
|
if (create) {
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: "POST",
|
type: POST,
|
||||||
url: "/create",
|
url: "/create",
|
||||||
data: { page: $.key("page"), format: "markdown", content: editorSession.getValue() },
|
data: { page: pageName, format: markdown, content: txt, message: "Created " + msg },
|
||||||
success: function() {
|
success: function() {
|
||||||
window.location = window.location.origin + "/" + $.key("page");
|
window.location = newLocation;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: "POST",
|
type: POST,
|
||||||
url: "/edit/" + $.key("page"),
|
url: "/edit/" + pageName,
|
||||||
data: { format: "markdown", content: editorSession.getValue() },
|
data: { format: markdown, content: txt, message: "Updated " + msg },
|
||||||
success: function() {
|
success: function() {
|
||||||
window.location = window.location.origin + "/" + $.key("page");
|
window.location = newLocation;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} // end else
|
} // end else
|
||||||
|
|||||||
Reference in New Issue
Block a user