mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Fixed strange characters in plain text mode (Firefox) (Closes #462)
This commit is contained in:
parent
2a90664574
commit
e3064b10aa
24 changed files with 206 additions and 159 deletions
|
|
@ -81,7 +81,6 @@ class Template
|
|||
public function SetPopulateAlways($bPopulateAlways)
|
||||
{
|
||||
$this->bPopulateAlways = !!$bPopulateAlways;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -123,12 +122,18 @@ class Template
|
|||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
$aResult = array(
|
||||
'ID' => $this->Id(),
|
||||
'Name' => $this->Name(),
|
||||
'Populated' => $bPopulated,
|
||||
'Body' => $sBody
|
||||
);
|
||||
|
||||
if ($bAjax)
|
||||
{
|
||||
$aResult['Populated'] = $bPopulated;
|
||||
}
|
||||
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<div class="b-folders g-ui-user-select-none thm-folders" data-bind="css: {'focused': folderList.focused}">
|
||||
<div class="b-folders g-ui-user-select-none thm-folders" data-bind="css: {'focused': folderList.focused,
|
||||
'single-root-inbox': foldersListWithSingleInboxRootFolder}">
|
||||
<div class="b-toolbar btn-toolbar">
|
||||
<a class="btn buttonCompose pull-left" data-tooltip-placement="bottom"
|
||||
data-bind="click: composeClick, tooltip: 'FOLDER_LIST/BUTTON_COMPOSE', css: {'btn-warning': composeInEdit}">
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<div class="e-item" data-bind="visible: visible">
|
||||
<div class="e-item" data-bind="visible: visible, css: { 'i-am-inbox-wrapper': isInbox }">
|
||||
<a class="e-link" data-bind="droppable: function (oEvent, oUi) { $root.messagesDrop($data, oUi); },
|
||||
droppableOver: function (oEvent, oUi) { $root.messagesDropOver($data, oUi); },
|
||||
droppableOut: function (oEvent, oUi) { $root.messagesDropOut($data, oUi); },
|
||||
css: { 'selected': selected() && !isSystemFolder(), 'selectable': selectableForFolderList, 'hidden' : hidden, 'print-count': hasUnreadMessages, 'unread-sub': hasSubScribedUnreadMessagesSubfolders, 'system': isSystemFolder, 'anim-action-class': actionBlink }">
|
||||
css: { 'i-am-inbox': isInbox, 'selected': selected() && !isSystemFolder(), 'selectable': selectableForFolderList, 'hidden' : hidden, 'print-count': hasUnreadMessages, 'unread-sub': hasSubScribedUnreadMessagesSubfolders, 'system': isSystemFolder, 'anim-action-class': actionBlink }">
|
||||
<span class="badge pull-right count" data-bind="text: printableUnreadCount"></span>
|
||||
<i data-bind="css: collapsedCss()"></i>
|
||||
<span class="name" data-bind="text: name"></span>
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
<div class="message-fixed-button-toolbar clearfix" data-bind="visible: message">
|
||||
<nobr>
|
||||
<div class="btn-group colored-toggle pull-right">
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn btn-dark-disabled-border buttonReply" data-tooltip-placement="bottom"
|
||||
data-bind="visible: 'reply' === lastReplyAction(), command: replyCommand, tooltip: 'MESSAGE/BUTTON_REPLY'">
|
||||
<i class="icon-reply"></i>
|
||||
|
|
@ -182,6 +182,17 @@
|
|||
<i class="icon-pencil icon-white"></i>
|
||||
</a>
|
||||
</div>
|
||||
<!-- <div class="btn-group pull-right" data-bind="visible: true" style="margin-right: 5px">
|
||||
<a class="btn btn-thin" data-tooltip-placement="bottom">
|
||||
<i class="icon-left-middle"></i>
|
||||
</a>
|
||||
<a class="btn btn-thin" data-tooltip-placement="bottom">
|
||||
<b>1 / 4</b>
|
||||
</a>
|
||||
<a class="btn btn-thin" data-tooltip-placement="bottom">
|
||||
<i class="icon-right-middle"></i>
|
||||
</a>
|
||||
</div>-->
|
||||
</nobr>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
<div class="form-horizontal">
|
||||
<div class="legend">
|
||||
<span class="i18n" data-i18n-text="SETTINGS_FILTERS/LEGEND_FILTERS"></span>
|
||||
|
||||
<i class="icon-spinner animated" style="margin-top: 5px" data-bind="visible: filters.loading"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" data-bind="visible: inited() && !serverError()">
|
||||
|
|
@ -46,13 +48,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="span8">
|
||||
<div class="process-place g-ui-user-select-none" data-bind="style: {'visibility': visibility }">
|
||||
<i class="icon-spinner animated"></i>
|
||||
|
||||
<span data-bind="text: processText"></span>
|
||||
</div>
|
||||
<div class="control-group" data-bind="css: {'error': filterRaw.error}, visible: inited() && filterRaw.allow() && filterRaw.active()">
|
||||
<div class="controls">
|
||||
<pre style="word-break: break-word;" data-bind="visible: '' !== filterRaw.capa()">
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
<div class="form-horizontal">
|
||||
<div class="legend">
|
||||
<span class="i18n" data-i18n-text="SETTINGS_FOLDERS/LEGEND_FOLDERS"></span>
|
||||
|
||||
<i class="icon-spinner animated" style="margin-top: 5px" data-bind="visible: loading"></i>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn" data-bind="click: createFolder">
|
||||
|
|
@ -24,11 +26,9 @@
|
|||
<button type="button" class="close" data-bind="click: function () { folderList.error(''); }">×</button>
|
||||
<span data-bind="text: folderList.error"></span>
|
||||
</div>
|
||||
<div class="process-place" data-bind="style: {'visibility': visibility }">
|
||||
<i class="icon-spinner animated"></i>
|
||||
|
||||
<span data-bind="text: processText"></span>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<table class="table table-hover list-table" data-bind="i18nUpdate: folderList">
|
||||
<colgroup>
|
||||
<col />
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
<div class="form-horizontal">
|
||||
<div class="legend">
|
||||
<span class="i18n" data-i18n-text="SETTINGS_TEMPLATES/LEGEND_TEMPLATES"></span>
|
||||
|
||||
<i class="icon-spinner animated" style="margin-top: 5px" data-bind="visible: templates.loading"></i>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn" data-bind="click: addNewTemplate">
|
||||
|
|
@ -9,11 +11,9 @@
|
|||
|
||||
<span class="i18n" data-i18n-text="SETTINGS_TEMPLATES/BUTTON_ADD_TEMPLATE"></span>
|
||||
</a>
|
||||
<div class="process-place" data-bind="style: {'visibility': visibility }">
|
||||
<i class="icon-spinner animated"></i>
|
||||
|
||||
<span data-bind="text: processText"></span>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<table class="table table-hover list-table templates-list" data-bind="i18nUpdate: templates">
|
||||
<colgroup>
|
||||
<col />
|
||||
|
|
|
|||
|
|
@ -1,10 +1,18 @@
|
|||
|
||||
rl_signature_replacer = function (editor, sText, sSignature, bHtml, bInsertBefore)
|
||||
{
|
||||
if (!bHtml)
|
||||
{
|
||||
sText = sText
|
||||
.replace(/\u200C\u200C/g, '\u0002\u0002')
|
||||
.replace(/\u200D\u200D/g, '\u0003\u0003')
|
||||
;
|
||||
}
|
||||
|
||||
var
|
||||
sTextWithoutSignature = sText
|
||||
.replace(/\u0002\u0002[\s\S]*\u0003\u0003/gm, '')
|
||||
.replace(/\u0004\u0004[\s\S]*\u0005\u0005/gm, ''),
|
||||
.replace(/\u0002\u0002[\s\S]*\u0002\u0002/gm, '')
|
||||
.replace(/\u0003\u0003[\s\S]*\u0003\u0003/gm, ''),
|
||||
bEmptyText = '' === $.trim(sTextWithoutSignature),
|
||||
sNewLine = (bHtml ? '<br />' : "\n")
|
||||
;
|
||||
|
|
@ -16,23 +24,31 @@ rl_signature_replacer = function (editor, sText, sSignature, bHtml, bInsertBefor
|
|||
|
||||
if (!/\u0002\u0002/gm.test(sText))
|
||||
{
|
||||
sText = "\u0002\u0002\u0003\u0003" + sText;
|
||||
sText = "\u0002\u0002\u0002\u0002" + sText;
|
||||
}
|
||||
|
||||
if (!/\u0004\u0004/gm.test(sText))
|
||||
if (!/\u0003\u0003/gm.test(sText))
|
||||
{
|
||||
sText = sText + "\u0004\u0004\u0005\u0005";
|
||||
sText = sText + "\u0003\u0003\u0003\u0003";
|
||||
}
|
||||
|
||||
if (bInsertBefore)
|
||||
{
|
||||
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");
|
||||
sText = sText.replace(/\u0002\u0002[\s\S]*\u0002\u0002/gm, "\u0002\u0002" + sSignature + (bEmptyText ? '' : sNewLine) + "\u0002\u0002");
|
||||
sText = sText.replace(/\u0003\u0003[\s\S]*\u0003\u0003/gm, "\u0003\u0003\u0003\u0003");
|
||||
}
|
||||
else
|
||||
{
|
||||
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(/\u0002\u0002[\s\S]*\u0002\u0002/gm, "\u0002\u0002\u0002\u0002");
|
||||
sText = sText.replace(/\u0003\u0003[\s\S]*\u0003\u0003/gm, "\u0003\u0003" + (bEmptyText ? '' : sNewLine) + sSignature + "\u0003\u0003");
|
||||
}
|
||||
|
||||
if (!bHtml)
|
||||
{
|
||||
sText = sText
|
||||
.replace(/\u0002\u0002/g, '\u200C\u200C')
|
||||
.replace(/\u0003\u0003/g, '\u200D\u200D')
|
||||
;
|
||||
}
|
||||
|
||||
return sText;
|
||||
|
|
@ -42,40 +58,58 @@ CKEDITOR.plugins.add('signature', {
|
|||
init: function(editor) {
|
||||
editor.addCommand('insertSignature', {
|
||||
modes: { wysiwyg: 1, plain: 1 },
|
||||
exec: function (editor, cfg) {
|
||||
exec: function (editor, cfg)
|
||||
{
|
||||
|
||||
var
|
||||
bIsHtml = false,
|
||||
bInsertBefore = false,
|
||||
sSignature = ''
|
||||
sSignature = '',
|
||||
sResultSignature = ''
|
||||
;
|
||||
|
||||
if (cfg) {
|
||||
if (cfg)
|
||||
{
|
||||
bIsHtml = undefined === cfg.isHtml ? false : !!cfg.isHtml;
|
||||
bInsertBefore = undefined === cfg.insertBefore ? false : !!cfg.insertBefore;
|
||||
sSignature = undefined === cfg.signature ? '' : cfg.signature;
|
||||
}
|
||||
|
||||
try {
|
||||
if ('plain' === editor.mode && editor.__plain && editor.__plainUtils) {
|
||||
if (bIsHtml && editor.__plainUtils.htmlToPlain) {
|
||||
sSignature = editor.__plainUtils.htmlToPlain(sSignature);
|
||||
sResultSignature = sSignature;
|
||||
|
||||
try
|
||||
{
|
||||
if ('plain' === editor.mode && editor.__plain && editor.__plainUtils)
|
||||
{
|
||||
if (editor.__plainUtils && editor.__plainUtils.htmlToPlain)
|
||||
{
|
||||
if (bIsHtml)
|
||||
{
|
||||
sResultSignature = editor.__plainUtils.htmlToPlain(sResultSignature);
|
||||
}
|
||||
}
|
||||
|
||||
editor.__plain.setRawData(
|
||||
rl_signature_replacer(editor,
|
||||
editor.__plain.getRawData(), sSignature, false, bInsertBefore));
|
||||
editor.__plain.getRawData(), sResultSignature, false, bInsertBefore));
|
||||
|
||||
} else {
|
||||
if (!bIsHtml && editor.__plainUtils && editor.__plainUtils.plainToHtml) {
|
||||
sSignature = editor.__plainUtils.plainToHtml(sSignature);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (editor.__plainUtils && editor.__plainUtils.plainToHtml)
|
||||
{
|
||||
if (!bIsHtml)
|
||||
{
|
||||
sResultSignature = editor.__plainUtils.plainToHtml(sResultSignature);
|
||||
}
|
||||
}
|
||||
|
||||
editor.setData(
|
||||
rl_signature_replacer(editor,
|
||||
editor.getData(), sSignature, true, bInsertBefore));
|
||||
editor.getData(), sResultSignature, true, bInsertBefore));
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue