ckeditor fixes

demo-plugin
TemproryApcStorage
This commit is contained in:
RainLoop Team 2015-02-12 21:54:12 +04:00
parent 000711086a
commit 844afadd6f
40 changed files with 2371 additions and 197 deletions

View file

@ -3,15 +3,7 @@ rl_signature_replacer = function (editor, sText, sSignature, bHtml, bInsertBefor
{
var
bEmptyText = '' === $.trim(sText),
sNewLine = (bHtml ? '<br />' : "\n"),
sS1 = "\u0002\u0002",
sE1 = "\u0003\u0003",
sSS1 = '---1beg1---',
sEE1 = '---1end1---',
sS2 = "\u0004\u0004",
sE2 = "\u0005\u0005",
sSS2 = '---2beg2---',
sEE2 = '---2end2---'
sNewLine = (bHtml ? '<br />' : "\n")
;
if (!bEmptyText && bHtml)
@ -19,37 +11,27 @@ rl_signature_replacer = function (editor, sText, sSignature, bHtml, bInsertBefor
bEmptyText = '' !== $.trim(editor.__plainUtils.htmlToPlain(sText));
}
sText = sText.replace(sS1, sSS1).replace(sS1, sSS1).replace(sS1, sSS1).replace(sS1, sSS1);
sText = sText.replace(sE1, sEE1).replace(sE1, sEE1).replace(sE1, sEE1).replace(sE1, sEE1);
sText = sText.replace(sS2, sSS2).replace(sS2, sSS2).replace(sS2, sSS2).replace(sS2, sSS2);
sText = sText.replace(sE2, sEE2).replace(sE2, sEE2).replace(sE2, sEE2).replace(sE2, sEE2);
if (!/---1beg1---/gm.test(sText))
if (!/\u0002\u0002/gm.test(sText))
{
sText = sSS1 + sEE1 + sText;
sText = "\u0002\u0002\u0003\u0003" + sText;
}
if (!/---2beg2---/gm.test(sText))
if (!/\u0004\u0004/gm.test(sText))
{
sText = sText + sSS2 + sEE2;
sText = sText + "\u0004\u0004\u0005\u0005";
}
if (bInsertBefore)
{
sText = sText.replace(/---1beg1---[\s\S]*---1end1---/gm, sSS1 + sSignature + sNewLine + sEE1);
sText = sText.replace(/---2beg2---[\s\S]*---2end2---/gm, sSS2 + '' + sEE2);
sText = sText.replace(/\u0002\u0002[\s\S]*\u0003\u0003/gm, "\u0002\u0002" + sSignature + sNewLine + "\u0003\u0003");
sText = sText.replace(/\u0004\u0004[\s\S]*\u0005\u0005/gm, "\u0004\u0004\u0005\u0005");
}
else
{
sText = sText.replace(/---1beg1---[\s\S]*---1end1---/gm, sSS1 + '' + sEE1);
sText = sText.replace(/---2beg2---[\s\S]*---2end2---/gm, sSS2 + (bEmptyText ? '' : sNewLine) + sSignature + sEE2);
sText = sText.replace(/\u0002\u0002[\s\S]*\u0003\u0003/gm, "\u0002\u0002\u0003\u0003");
sText = sText.replace(/\u0004\u0004[\s\S]*\u0005\u0005/gm, "\u0004\u0004" + (bEmptyText ? '' : sNewLine) + sSignature + "\u0005\u0005");
}
sText = sText.replace(/---1beg1---/g, sS1);
sText = sText.replace(/---1end1---/g, sE1);
sText = sText.replace(/---2beg2---/g, sS2);
sText = sText.replace(/---2end2---/g, sE2);
return sText;
};