Edit save + git commit + push sync
This commit is contained in:
@@ -39,7 +39,7 @@ jQuery( document ).ready(function( $ ) {
|
||||
|
||||
if($('#mk-editor').length === 1) {
|
||||
|
||||
let mde = new SimpleMDE({
|
||||
var mde = new SimpleMDE({
|
||||
autofocus: true,
|
||||
autoDownloadFontAwesome: false,
|
||||
element: $("#mk-editor").get(0),
|
||||
|
@@ -11,7 +11,21 @@ if($('#page-type-edit').length) {
|
||||
|
||||
$('.btn-edit-save').on('click', (ev) => {
|
||||
|
||||
|
||||
$.ajax(window.location.href, {
|
||||
data: {
|
||||
markdown: mde.value()
|
||||
},
|
||||
dataType: 'json',
|
||||
method: 'PUT'
|
||||
}).then((rData, rStatus, rXHR) => {
|
||||
if(rData.ok) {
|
||||
window.location.assign('/' + $('#page-type-edit').data('entrypath'));
|
||||
} else {
|
||||
alerts.pushError('Something went wrong', rData.error);
|
||||
}
|
||||
}, (rXHR, rStatus, err) => {
|
||||
alerts.pushError('Something went wrong', 'Save operation failed.');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user