jenkins-bot has submitted this change and it was merged.
Change subject: Fix detection of headings in NWE format menu
......................................................................
Fix detection of headings in NWE format menu
Use regex to include match any character after '='.
Bug: T147585
Change-Id: I22228bedf497613506a676eca465d3bc7bc5fe67
---
M modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
1 file changed, 3 insertions(+), 5 deletions(-)
Approvals:
Alex Monk: Looks good to me, approved
Jforrester: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
b/modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
index 316facd..2a2be95 100644
--- a/modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
+++ b/modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
@@ -28,7 +28,7 @@
* @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 @@
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;
--
To view, visit https://gerrit.wikimedia.org/r/314723
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I22228bedf497613506a676eca465d3bc7bc5fe67
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits