Markdown editor improvements
This commit is contained in:
@@ -1,32 +1,14 @@
|
||||
|
||||
if($('#page-type-create').length) {
|
||||
|
||||
let pageEntryPath = $('#page-type-create').data('entrypath');
|
||||
|
||||
//-> Discard
|
||||
|
||||
$('.btn-create-discard').on('click', (ev) => {
|
||||
$('#modal-create-discard').toggleClass('is-active');
|
||||
});
|
||||
|
||||
//-> Save
|
||||
|
||||
$('.btn-create-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-create').data('entrypath'));
|
||||
} else {
|
||||
alerts.pushError('Something went wrong', rData.error);
|
||||
}
|
||||
}, (rXHR, rStatus, err) => {
|
||||
alerts.pushError('Something went wrong', 'Save operation failed.');
|
||||
});
|
||||
|
||||
});
|
||||
//=include ../components/editor.js
|
||||
|
||||
}
|
@@ -1,8 +1,7 @@
|
||||
|
||||
if($('#page-type-edit').length) {
|
||||
|
||||
$('.editor-toolbar').attr('data-margin-top', $('#header').height());
|
||||
var editorToolbarSticky = new Sticky('.editor-toolbar');
|
||||
let pageEntryPath = $('#page-type-edit').data('entrypath');
|
||||
|
||||
//-> Discard
|
||||
|
||||
@@ -10,26 +9,6 @@ if($('#page-type-edit').length) {
|
||||
$('#modal-edit-discard').toggleClass('is-active');
|
||||
});
|
||||
|
||||
//-> Save
|
||||
|
||||
$('.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.');
|
||||
});
|
||||
|
||||
});
|
||||
//=include ../components/editor.js
|
||||
|
||||
}
|
Reference in New Issue
Block a user