jenkins-bot has submitted this change and it was merged.
Change subject: Insert section name in edit summary
..
Insert section name in edit summary
To be consistent with desktop and app edits, add the section
name to the summary automatically when the user saves an edit.
Bug: 60134
Change-Id: Iebecb63f9c8766eaa06ea5b7c8d98c26931c4a57
---
M javascripts/modules/editor/EditorApi.js
M javascripts/modules/editor/EditorOverlay.js
2 files changed, 17 insertions(+), 4 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/javascripts/modules/editor/EditorApi.js
b/javascripts/modules/editor/EditorApi.js
index aa7cb4c..e1eb1b4 100644
--- a/javascripts/modules/editor/EditorApi.js
+++ b/javascripts/modules/editor/EditorApi.js
@@ -173,7 +173,7 @@
},
getPreview: function( options ) {
- var result = $.Deferred();
+ var result = $.Deferred(), sectionLine = '', self =
this;
$.extend( options, {
action: 'parse',
@@ -184,12 +184,19 @@
// Output mobile HTML (bug 54243)
mobileformat: true,
title: this.title,
- prop: 'text'
+ prop: ['text', 'sections']
} );
this.post( options ).done( function( resp ) {
if ( resp resp.parse resp.parse.text ) {
- result.resolve( resp.parse.text['*'] );
+ // section 0 haven't a section name so
skip
+ if ( self.sectionId !== 0
+ resp.parse.sections
+ resp.parse.sections[0].line !==
undefined
+ ) {
+ sectionLine =
resp.parse.sections[0].line;
+ }
+ result.resolve( resp.parse.text['*'],
sectionLine );
} else {
result.reject();
}
diff --git a/javascripts/modules/editor/EditorOverlay.js
b/javascripts/modules/editor/EditorOverlay.js
index ff123bd..b303c3f 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -20,6 +20,7 @@
content: M.template.get(
'modules/editor/EditorOverlay.hogan' )
},
editor: 'SourceEditor',
+ sectionLine: '',
initialize: function( options ) {
this.api = new EditorApi( {
@@ -134,7 +135,9 @@
if ( mw.config.get( 'wgIsMainPage' ) ) {
params.mainpage = 1; // Setting it to 0 will
have the same effect
}
- this.api.getPreview( params ).done( function(
parsedText ) {
+ this.api.getPreview( params ).done( function(
parsedText, parsedSectionLine ) {
+ // On desktop edit summaries strip tags. Mimic
this behavior on mobile devices
+ self.sectionLine = $( 'div/' ).html(
parsedSectionLine ).text();
new Section( {
el: self.$preview,
content: parsedText
@@ -225,6 +228,9 @@
var self = this,
options = { summary: this.$( '.summary' ).val()
};
+ if ( self.sectionLine !== '' ) {
+ options.summary = '/* ' + self.sectionLine + '
*/' + options.summary;
+ }
this._super();
if ( this.confirmAborted ) {
return;
--
To view, visit https://gerrit.wikimedia.org/r/135311
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iebecb63f9c8766eaa06ea5b7c8d98c26931c4a57
Gerrit-PatchSet: 18
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow florian.schmidt.wel...@t-online.de
Gerrit-Reviewer: Awjrichards aricha...@wikimedia.org
Gerrit-Reviewer: Florianschmidtwelzow florian.schmidt.wel...@t-online.de
Gerrit-Reviewer: JGonera jgon...@wikimedia.org
Gerrit-Reviewer: Jdlrobson jrob...@wikimedia.org
Gerrit-Reviewer: Kaldari rkald...@wikimedia.org
Gerrit-Reviewer: Liangent liang...@gmail.com
Gerrit-Reviewer: MaxSem maxsem.w...@gmail.com
Gerrit-Reviewer: jenkins-bot