Skip to content
Snippets Groups Projects
Unverified Commit 6ef45cc1 authored by Michael Große's avatar Michael Große
Browse files

:sparkles: allow to send more fields when saving ajax-drafts

Plugins may want to add further fields to be present when saving drafts
parent 5f9bb75c
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,12 @@ var dw_locktimer = {
lasttime: null,
msg: LANG.willexpire,
pageid: '',
fieldsToSaveAsDraft: [
'input[name=prefix]',
'textarea[name=wikitext]',
'input[name=suffix]',
'input[name=date]',
],
/**
* Initialize the lock timer
......@@ -42,6 +48,13 @@ var dw_locktimer = {
dw_locktimer.reset();
},
/**
* Add another field of the editform to be posted to the server when a draft is saved
*/
addField: function(selector) {
dw_locktimer.fieldsToSaveAsDraft.push(selector);
},
/**
* (Re)start the warning timer
*/
......@@ -84,10 +97,7 @@ var dw_locktimer = {
// POST everything necessary for draft saving
if(dw_locktimer.draft && jQuery('#dw__editform').find('textarea[name=wikitext]').length > 0){
params += jQuery('#dw__editform').find('input[name=prefix], ' +
'textarea[name=wikitext], ' +
'input[name=suffix], ' +
'input[name=date]').serialize();
params += jQuery('#dw__editform').find(dw_locktimer.fieldsToSaveAsDraft.join(', ')).serialize();
}
jQuery.post(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment