Nasty has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371054 )

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

Change-Id: I3b310140b15c3bc9e899b9c30512583cde656bb4
---
M VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
1 file changed, 37 insertions(+), 38 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/54/371054/1

diff --git a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js 
b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
index 78c55a2..772a594 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 = '&lt; ' + st[1] + ' &gt;';
+                       }
+                       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 = '&lt; ' + st[1] + ' &gt;';
-                       }
-                       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 + '>'
-                               //+ '&lt; ' + st[1] + ' &gt;'
-                               + innerText
-                               + '</span>'
                                );
-                       _specialtags[i] = st[0];
-                       i++;
+                       }
                }
 
                if (!_comments) {

-- 
To view, visit https://gerrit.wikimedia.org/r/371054
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b310140b15c3bc9e899b9c30512583cde656bb4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Nasty <kon...@hallowelt.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to