User:DannyS712/EFFPRH/sandbox.js: Difference between revisions

Content deleted Content added
force reload()
make response wikitext computed in vue app in preparation for adding a preview
Line 177:
canSubmit: function () {
return !this.haveSubmitted && this.selectedResponse !== 'none';
},
responseWikiText: function () {
// Computed here so that we can use it for the api preview,
// does not include the leading newline
let responseText = '\n: {{EFFP|' + this.responseOption + '}}';
if ( this.commentValue ) {
responseText += ' --~~~~' + this.commentValue;
}
responseText += ' --~~~~';
return responseText;
}
},
Line 196 ⟶ 206:
this.reporterName,
this.sectionNum,
this.selectedResponse,wikitextToAdd
this.commentValue
).then(
// arrow functions to simplify `this`
Line 252 ⟶ 261:
reporterName,
sectionNum,
responseWikiText
responseOption,
extraComment
) {
return new Promise( function ( resolve, reject ) {
// wikitext is computed in Vue app so that it can have a preview too,
let responseText = '\n: {{EFFP|' + responseOption + '}}';
// we just need to add the leading newline
if ( extraComment ) {
responseTextconst wikitextToAdd += ' \n' + extraCommentresponseWikiText;
}
responseText += ' --~~~~';
const editParams = {
action: 'edit',
Line 269 ⟶ 275:
baserevid: mw.config.get( 'wgCurRevisionId' ),
nocreate: true,
appendtext: responseTextwikitextToAdd,
assert: 'user',
assertuser: mw.config.get( 'wgUserName' )