jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/374972 )
Change subject: BlueSpiceExtensions, TinyMCE Plugin bswikicode Fix: Browser
freezes if a spezial tag has a template in it.
......................................................................
BlueSpiceExtensions, TinyMCE Plugin bswikicode Fix: Browser freezes if a
spezial tag has a template in it.
Browser freezes if a spezial tag has a template in it and you change from wiki
editor to the visual editor.
Fix for ERM#6743
Has to cherry pick to REL1_27
Patch Set 2: Changed the order of reverse action
Change-Id: I3b310140b15c3bc9e899b9c30512583cde656bb4
---
M VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
1 file changed, 44 insertions(+), 45 deletions(-)
Approvals:
Mglaser: Looks good to me, approved
jenkins-bot: Verified
diff --git a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
index 78c55a2..2124cb6 100644
--- a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
+++ b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
@@ -1730,6 +1730,42 @@
i++;
}
+ //quirky. Needs to be there for the occasional second pass of
cleanup
+ if (!_specialtags) {
+ _specialtags = new Array();
+ }
+
+ specialTagsList =
mw.config.get('BsVisualEditorConfigDefault').specialtaglist;
+ // Tags without innerHTML need /> as end marker. Maybe this
should be task of a preprocessor, in order to allow mw style tags without /.
+ regex = '<(' + specialTagsList +
')((\\s|\\r|\\n)+[^>]*)*?((\\s\\/>)|(\\/>)|(>([\\S\\s]*?((<\\/\\1>)|(<\\/
\\1>)))))';
+
+ matcher = new RegExp(regex, 'gmi');
+ mtext = text;
+ i = 0;
+ st = '';
+
+ innerText = '';
+ var retValue = false;
+ var moreAttribs = '';
+
+ while ((st = matcher.exec(mtext)) !== null) {
+ retValue = $(document).triggerHandler(
'BSVisualEditorRenderSpecialTag', [this, st[1], st] );
+ if ( retValue ) {
+ innerText = retValue.innerText;
+ moreAttribs = retValue.moreAttribs;
+ } else {
+ innerText = '< ' + st[1] + ' >';
+ }
+ text = text.replace(
+ st[0],
+ '<span class="mceNonEditable tag"
id="bs_specialtag:@@@ST' + i + '@@@" data-bs-name="' + st[1] + '"
data-bs-type="tag" data-bs-id="' + i + '" ' + moreAttribs + '>'
+ + innerText
+ + '</span>'
+ );
+ _specialtags[i] = st[0];
+ i++;
+ }
+
curlyBraceDepth = 0;
squareBraceDepth = 0;
templateDepth = 0;
@@ -1801,45 +1837,8 @@
+ templateName + '"
data-bs-type="template" data-bs-id="' + i + '">'
+ '{{ ' + templateName + ' }}'
+ '</span>'
- );
- }
- }
-
- //quirky. Needs to be there for the occasional second pass of
cleanup
- if (!_specialtags) {
- _specialtags = new Array();
- }
-
- specialTagsList =
mw.config.get('BsVisualEditorConfigDefault').specialtaglist;
- // Tags without innerHTML need /> as end marker. Maybe this
should be task of a preprocessor, in order to allow mw style tags without /.
- regex = '<(' + specialTagsList +
')((\\s|\\r|\\n)+[^>]*)*?((\\s\\/>)|(\\/>)|(>([\\S\\s]*?((<\\/\\1>)|(<\\/
\\1>)))))';
-
- matcher = new RegExp(regex, 'gmi');
- mtext = text;
- i = 0;
- st = '';
-
- var innerText = '';
- var retValue = false;
- var moreAttribs = '';
-
- while ((st = matcher.exec(mtext)) !== null) {
- retValue = $(document).triggerHandler(
'BSVisualEditorRenderSpecialTag', [this, st[1], st] );
- if ( retValue ) {
- innerText = retValue.innerText;
- moreAttribs = retValue.moreAttribs;
- } else {
- innerText = '< ' + st[1] + ' >';
- }
- text = text.replace(
- st[0],
- '<span class="mceNonEditable tag"
id="bs_specialtag:@@@ST' + i + '@@@" data-bs-name="' + st[1] + '"
data-bs-type="tag" data-bs-id="' + i + '" ' + moreAttribs + '>'
- //+ '< ' + st[1] + ' >'
- + innerText
- + '</span>'
);
- _specialtags[i] = st[0];
- i++;
+ }
}
if (!_comments) {
@@ -1899,6 +1898,13 @@
// this must be in inverse order as preserveSpecialTags
// in order to allow for nested constructions
+ if (_templates) {
+ for (i = 0; i < _templates.length; i++) {
+ matcher = new
RegExp('<span[^>]*?id=(\'|")bs_template:@@@TPL' + i +
'@@@(\'|")[^>]*?>.*?<\\/\s*?span\s*?>', 'gmi');
+ text = text.replace(matcher, _templates[i]);
+ }
+ }
+
if (_specialtags) {
for (i = 0; i < _specialtags.length; i++) {
matcher = new
RegExp('(<span[^>]*?id=(\'|")bs_specialtag:@@@ST' + i +
'@@@(\'|")[^>]*?>)(.*?)<\\/\s*?span\s*?>', 'gmi');
@@ -1910,13 +1916,6 @@
}
text = text.replace(matcher, innerText);
- }
- }
-
- if (_templates) {
- for (i = 0; i < _templates.length; i++) {
- matcher = new
RegExp('<span[^>]*?id=(\'|")bs_template:@@@TPL' + i +
'@@@(\'|")[^>]*?>.*?<\\/\s*?span\s*?>', 'gmi');
- text = text.replace(matcher, _templates[i]);
}
}
--
To view, visit https://gerrit.wikimedia.org/r/374972
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3b310140b15c3bc9e899b9c30512583cde656bb4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_27
Gerrit-Owner: Mglaser <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Nasty <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits