Ljonka has uploaded a new change for review.
https://gerrit.wikimedia.org/r/223753
Change subject: Fix for line break in p tag
......................................................................
Fix for line break in p tag
Change-Id: I3a24353f06c86ec8a74629c7e6e71e6a5e2796a1
---
M VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
1 file changed, 15 insertions(+), 6 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/53/223753/1
diff --git a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
index 774e670..0bae3a3 100644
--- a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
+++ b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
@@ -1089,11 +1089,13 @@
emptyLineAfter = false,
lastLine = false;
+ //Walk trough text line by line
for (var i = 0; i < lines.length; i++) {
// Prevent REDIRECT from being rendered as list
line = lines[i].match(/^(\*|#(?!REDIRECT)|:|;)+/);
lastLine = (i == lines.length - 1);
+ //Special Line --
if (line && line !== '') {
lines[i] =
lines[i].replace(/^(\*|#|:|;)*\s*(.*?)$/gmi, "$2");
if (line[0].indexOf(':') === 0) {
@@ -1124,7 +1126,7 @@
inParagraph = false;
}
- } else {
+ } else { //Normal Line processing
emptyLine = lines[i].match(/^(\s| )*$/);
if (emptyLine) {
emptyLineCount++;
@@ -1215,6 +1217,11 @@
lines[i] = '</p>' + lines[i];
inParagraph = false;
}
+
+ //Inser break tag <br /> if new line in
paragraph
+ if(inParagraph && !matchStartTags &&
!matchEndTags && !emptyLineBefore){
+ lines[i] = '<br />' + lines[i];
+ }
// 090929-- MRG. this was deactivated. Highly
experimental!!
// @todo Plays anybody still with that or can
it go to trash?
@@ -1233,6 +1240,7 @@
emptyLineBefore = false;
}
}
+
return lines.join("\n");
}
@@ -1268,7 +1276,7 @@
// call the event listeners
$(document).trigger('BsVisualEditorBeforeWikiToHtml',
[textObject]);
// get the text back
- text = tinymce.util.Tools.trim(textObject.text);
+ text = tinymce.util.Tools.trim(textObject.text);
// @todo it's done before in _preprocessWiki2Html, can we save
this step?
text = _preservePres(text);
@@ -1318,10 +1326,10 @@
// We need this additional line in order to clean up the last
blocklevel
text = text + "\n";
-
+
// process block levels
- text = _blockLevels2html(text);
-
+ text = _blockLevels2html(text); //TODO: Fix missing break here,
add <br /> for simple linebreaks
+
// @todo check this, might be unneccessary
text = text.replace(/<div
style='text-align:left'>(.*?)<\/div>/gmi, "<div align='left'>$1</div>");
text = text.replace(/<div
style='text-align:right'>(.*?)<\/div>/gmi, "<div align='right'>$1</div>");
@@ -1330,7 +1338,7 @@
// delete additional line feeds
text = text.replace(/\n/gi, "");
-
+
// fill empty table cells
// @todo maybe in the _table2html method
text = text.replace(/<td([^>]*)>(\s|<br([^>]*)>)*<\/td>/gmi,
'<td$1><br mce_bogus="1" /></td>');
@@ -1637,6 +1645,7 @@
text = text.replace(/<br
data-attributes="[^>]*data-attributes[^>]*" ?\/?>/gmi, '<br/>');
text = text.replace(/<br [^>]*data-mce-bogus="1"[^>]*>/gmi, '');
text = text.replace(/^\n*/gi, '');
+ text = text.replace(/<br \/>/g, '\n'); //Fix for BlueSpice
VisualEditor, LV, 09.07.2015
// wrap the text in an object to send it to event listeners
textObject = {text: text};
--
To view, visit https://gerrit.wikimedia.org/r/223753
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a24353f06c86ec8a74629c7e6e71e6a5e2796a1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Ljonka <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits