Merge "Make edit click handling consistent"
This commit is contained in:
commit
bad8347fb2
|
@ -52,6 +52,21 @@
|
||||||
blockInfo = false;
|
blockInfo = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handler for edit link clicks. Will prevent default link
|
||||||
|
* behaviour and will not allow propagation
|
||||||
|
* @method
|
||||||
|
* @ignore
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
function onEditLinkClick() {
|
||||||
|
issues.log( { action: 'editClicked' } );
|
||||||
|
|
||||||
|
router.navigate( '#/editor/' + $( this ).data( 'section' ) );
|
||||||
|
// prevent folding section when clicking Edit by stopping propagation
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: rename addEditSectionButton and evaluate whether the page edit button
|
// TODO: rename addEditSectionButton and evaluate whether the page edit button
|
||||||
// can leverage the same code. Also: change the CSS class name to use
|
// can leverage the same code. Also: change the CSS class name to use
|
||||||
// the word "section" instead of "page".
|
// the word "section" instead of "page".
|
||||||
|
@ -67,10 +82,8 @@
|
||||||
function addEditButton( section, container ) {
|
function addEditButton( section, container ) {
|
||||||
$( container ).find( 'a' ).remove();
|
$( container ).find( 'a' ).remove();
|
||||||
return $( '<a class="edit-page">' )
|
return $( '<a class="edit-page">' )
|
||||||
.attr( {
|
.data( 'section', section )
|
||||||
href: '#/editor/' + section,
|
.on( 'click', onEditLinkClick )
|
||||||
title: $( container ).attr( 'title' )
|
|
||||||
} )
|
|
||||||
.text( mw.msg( 'mobile-frontend-editor-edit' ) )
|
.text( mw.msg( 'mobile-frontend-editor-edit' ) )
|
||||||
.prependTo( container );
|
.prependTo( container );
|
||||||
}
|
}
|
||||||
|
@ -161,13 +174,8 @@
|
||||||
alert( mw.msg( 'mobile-frontend-editor-undo-unsupported' ) );
|
alert( mw.msg( 'mobile-frontend-editor-undo-unsupported' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
page.$( '.edit-page, .edit-link' ).removeClass( disabledClass ).on( 'click', function () {
|
page.$( '.edit-page, .edit-link' ).removeClass( disabledClass )
|
||||||
issues.log( { action: 'editClicked' } );
|
.on( 'click', onEditLinkClick );
|
||||||
|
|
||||||
router.navigate( '#/editor/' + $( this ).data( 'section' ) );
|
|
||||||
// prevent folding section when clicking Edit by stopping propagation
|
|
||||||
return false;
|
|
||||||
} );
|
|
||||||
overlayManager.add( /^\/editor\/(\d+|all)$/, function ( sectionId ) {
|
overlayManager.add( /^\/editor\/(\d+|all)$/, function ( sectionId ) {
|
||||||
var
|
var
|
||||||
$content = $( '#mw-content-text' ),
|
$content = $( '#mw-content-text' ),
|
||||||
|
|
Loading…
Reference in New Issue