Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/314723
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, 2 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/23/314723/1
diff --git a/modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
b/modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
index 316facd..c23f417 100644
--- a/modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
+++ b/modules/ve-mw/dm/ve.dm.MWWikitextSurfaceFragment.js
@@ -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: newchange
Gerrit-Change-Id: I22228bedf497613506a676eca465d3bc7bc5fe67
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits