Matmarex has uploaded a new change for review.
https://gerrit.wikimedia.org/r/68868
Change subject: Show "edit source" section edit links in addition to VE ones
......................................................................
Show "edit source" section edit links in addition to VE ones
Handled similarly to the article tabs - switch the function of
standard ones to VE-editing, add new ones allowing the user to select
the source editor.
Bug: 48429
Change-Id: I13bbb9549c999bb7301bbcf530706a813184425d
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
3 files changed, 15 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/68/68868/1
diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 2bace7b..4ce7a558 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -22,6 +22,7 @@
'visualeditor-browserwarning' => 'You are using a browser which is not
officially supported by VisualEditor.',
'visualeditor-ca-createsource' => 'Create source',
'visualeditor-ca-editsource' => 'Edit source',
+ 'visualeditor-ca-editsource-section' => 'edit source',
'visualeditor-ca-ve-create' => 'VisualEditor',
'visualeditor-ca-ve-edit' => 'VisualEditor',
'visualeditor-clearbutton-tooltip' => 'Clear formatting',
@@ -169,6 +170,8 @@
'visualeditor-ca-editsource' => 'Text for the "Edit source" tab, if the
page exists.
If the page doesn\'t exist, the following link text is used:
{{msg-mw|Visualeditor-ca-createsource}}',
+ 'visualeditor-ca-editsource-section' => 'Text for "edit source" mode of
section edit links.
+Corresponds to the {{msg-mw|editsection}} message for default mode.',
'visualeditor-ca-ve-create' => 'Link text of the dedicated VisualEditor
"Create" tab.',
'visualeditor-ca-ve-edit' => 'Link text of the dedicated VisualEditor
"Edit" tab.',
'visualeditor-clearbutton-tooltip' => 'Tooltip text for the clear
formatting button',
diff --git a/VisualEditor.php b/VisualEditor.php
index b3bcfd6..e16eca5 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -156,6 +156,7 @@
'tooltip-ca-ve-edit',
'visualeditor-ca-createsource',
'visualeditor-ca-editsource',
+ 'visualeditor-ca-editsource-section',
'visualeditor-ca-ve-create',
'visualeditor-ca-ve-edit',
'visualeditor-loadwarning',
diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
index acd1984..230eb9b 100644
--- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
@@ -986,11 +986,19 @@
*/
ve.init.mw.ViewPageTarget.prototype.setupSectionEditLinks = function () {
var veEditUri = this.veEditUri,
- $links = $( '#mw-content-text .mw-editsection a' );
+ $editsections = $( '#mw-content-text .mw-editsection' ),
+ handler = ve.bind( this.onEditSectionLinkClick, this );
if ( this.isViewPage ) {
- $links.click( ve.bind( this.onEditSectionLinkClick, this ) );
+ $editsections.each( function () {
+ var $this = $(this);
+ // Double the links; attach events to the "edit" ones,
+ // change text of the "edit source" ones
+ $this.append( ' ', $( this.childNodes ).clone() );
+ $this.find( 'a:first' ).click( handler );
+ $this.find( 'a:last' ).text( mw.msg(
'visualeditor-ca-editsource-section' ) );
+ } );
} else {
- $links.each( function () {
+ $editsections.find( 'a' ).each( function () {
var veSectionEditUri = new mw.Uri( veEditUri.toString()
),
sectionEditUri = new mw.Uri( $(this).attr(
'href' ) );
veSectionEditUri.extend( { 'vesection':
sectionEditUri.query.section } );
--
To view, visit https://gerrit.wikimedia.org/r/68868
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I13bbb9549c999bb7301bbcf530706a813184425d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits