mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
Fix detection of headings in NWE format menu
Use regex to include match any character after '='. Bug: T147585 Change-Id: I22228bedf497613506a676eca465d3bc7bc5fe67
This commit is contained in:
parent
7551b0e788
commit
3d39b80991
|
@ -28,7 +28,7 @@ OO.inheritClass( ve.dm.MWWikitextSurfaceFragment, ve.dm.SourceSurfaceFragment );
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.dm.MWWikitextSurfaceFragment.prototype.hasMatchingAncestor = function ( type, attributes ) {
|
||||
var i, len, text, command,
|
||||
var i, len, text,
|
||||
nodes = this.getSelectedLeafNodes(),
|
||||
all = !!nodes.length;
|
||||
|
||||
|
@ -48,10 +48,8 @@ ve.dm.MWWikitextSurfaceFragment.prototype.hasMatchingAncestor = function ( type,
|
|||
all = text.slice( 0, 12 ) === '<blockquote>';
|
||||
break;
|
||||
case 'mwHeading':
|
||||
command = ve.ui.wikitextCommandRegistry.lookup( 'heading' + attributes.level );
|
||||
if ( text.indexOf( command.args[ 0 ] ) !== 0 || text.indexOf( command.args[ 1 ] ) !== text.length - command.args[ 1 ].length ) {
|
||||
all = false;
|
||||
}
|
||||
all = text.match( new RegExp( '^={' + attributes.level + '}[^=]' ) ) &&
|
||||
text.match( new RegExp( '[^=]={' + attributes.level + '}$' ) );
|
||||
break;
|
||||
default:
|
||||
all = false;
|
||||
|
|
Loading…
Reference in a new issue