mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:40:16 +00:00
waitman gobble fix for escaping code blocks in tinymce
This commit is contained in:
parent
f5c5da742d
commit
cb9d0993f1
1 changed files with 65 additions and 8 deletions
|
@ -45,7 +45,33 @@
|
|||
s = tinymce.trim(s);
|
||||
|
||||
function rep(re, str) {
|
||||
s = s.replace(re, str);
|
||||
|
||||
//modify code to keep stuff intact within [code][/code] blocks
|
||||
//Waitman Gobble NO WARRANTY
|
||||
|
||||
|
||||
var o = new Array();
|
||||
var x = s.split("[code]");
|
||||
var i = 0;
|
||||
|
||||
var si = "";
|
||||
si = x.shift();
|
||||
si = si.replace(re,str);
|
||||
o.push(si);
|
||||
|
||||
for (i = 0; i < x.length; i++) {
|
||||
var no = new Array();
|
||||
var j = x.shift();
|
||||
var g = j.split("[/code]");
|
||||
no.push(g.shift());
|
||||
si = g.shift();
|
||||
si = si.replace(re,str);
|
||||
no.push(si);
|
||||
o.push(no.join("[/code]"));
|
||||
}
|
||||
|
||||
s = o.join("[code]");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -124,10 +150,41 @@
|
|||
_dfrn_bbcode2html : function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
|
||||
function rep(re, str) {
|
||||
s = s.replace(re, str);
|
||||
|
||||
//modify code to keep stuff intact within [code][/code] blocks
|
||||
//Waitman Gobble NO WARRANTY
|
||||
|
||||
|
||||
var o = new Array();
|
||||
var x = s.split("[code]");
|
||||
var i = 0;
|
||||
|
||||
var si = "";
|
||||
si = x.shift();
|
||||
si = si.replace(re,str);
|
||||
o.push(si);
|
||||
|
||||
for (i = 0; i < x.length; i++) {
|
||||
var no = new Array();
|
||||
var j = x.shift();
|
||||
var g = j.split("[/code]");
|
||||
no.push(g.shift());
|
||||
si = g.shift();
|
||||
si = si.replace(re,str);
|
||||
no.push(si);
|
||||
o.push(no.join("[/code]"));
|
||||
}
|
||||
|
||||
s = o.join("[code]");
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// example: [b] to <strong>
|
||||
rep(/\n/gi,"<br />");
|
||||
rep(/\[b\]/gi,"<strong>");
|
||||
|
|
Loading…
Reference in a new issue