mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 06:58:27 +03:00
Add some signature improvements (#1238)
This commit is contained in:
parent
ca4897038a
commit
9d60dd0786
5 changed files with 23 additions and 16 deletions
|
|
@ -92,11 +92,12 @@ class HtmlEditor
|
|||
* @param {bool} insertBefore
|
||||
* @returns {void}
|
||||
*/
|
||||
setSignature(signature, html, insertBefore) {
|
||||
setSignature(signature, html, insertBefore = false, first = false) {
|
||||
if (this.editor)
|
||||
{
|
||||
this.editor.execCommand('insertSignature', {
|
||||
isHtml: html,
|
||||
isFirst: first,
|
||||
insertBefore: insertBefore,
|
||||
signature: signature
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
|
||||
import $ from '$';
|
||||
import _ from '_';
|
||||
|
||||
import {$win} from 'Common/Globals';
|
||||
|
||||
import {AbstractScreen} from 'Knoin/AbstractScreen';
|
||||
|
||||
import {LoginUserView} from 'View/User/Login';
|
||||
|
|
|
|||
|
|
@ -866,7 +866,7 @@ class ComposePopupView extends AbstractViewNext
|
|||
return signature;
|
||||
}
|
||||
|
||||
setSignatureFromIdentity(identity) {
|
||||
setSignatureFromIdentity(identity, first = false) {
|
||||
if (identity)
|
||||
{
|
||||
this.editor((editor) => {
|
||||
|
|
@ -883,7 +883,7 @@ class ComposePopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
editor.setSignature(this.converSignature(signature), isHtml, !!identity.signatureInsertBefore());
|
||||
editor.setSignature(this.converSignature(signature), isHtml, !!identity.signatureInsertBefore(), first);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1133,8 +1133,8 @@ class ComposePopupView extends AbstractViewNext
|
|||
});
|
||||
|
||||
sText = '<br /><br />' + sReplyTitle + ':' +
|
||||
'<br /><br />' +
|
||||
'<blockquote>' + trim(sText) + '</blockquote>';
|
||||
// '<blockquote><p>' + trim(sText) + '</p></blockquote>';
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -1169,7 +1169,7 @@ class ComposePopupView extends AbstractViewNext
|
|||
|
||||
if (identity && ComposeType.Draft !== lineComposeType && ComposeType.EditAsNew !== lineComposeType)
|
||||
{
|
||||
this.setSignatureFromIdentity(identity);
|
||||
this.setSignatureFromIdentity(identity, true);
|
||||
}
|
||||
|
||||
this.setFocusInPopup();
|
||||
|
|
@ -1193,7 +1193,7 @@ class ComposePopupView extends AbstractViewNext
|
|||
|
||||
if (identity)
|
||||
{
|
||||
this.setSignatureFromIdentity(identity);
|
||||
this.setSignatureFromIdentity(identity, true);
|
||||
}
|
||||
|
||||
this.setFocusInPopup();
|
||||
|
|
@ -1217,7 +1217,7 @@ class ComposePopupView extends AbstractViewNext
|
|||
|
||||
if (identity && ComposeType.Draft !== lineComposeType && ComposeType.EditAsNew !== lineComposeType)
|
||||
{
|
||||
this.setSignatureFromIdentity(identity);
|
||||
this.setSignatureFromIdentity(identity, true);
|
||||
}
|
||||
|
||||
this.setFocusInPopup();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
import window from 'window';
|
||||
import $ from '$';
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
|
|
|
|||
18
vendors/ckeditor-plugins/signature/plugin.js
vendored
18
vendors/ckeditor-plugins/signature/plugin.js
vendored
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var rl_signature_replacer = function(editor, text, signature, isHtml, insertBefore) {
|
||||
var rl_signature_replacer = function(editor, text, signature, isHtml, insertBefore, isFirst) {
|
||||
|
||||
var
|
||||
skipInsert = false,
|
||||
|
|
@ -60,7 +60,15 @@
|
|||
|
||||
if (!skipInsert)
|
||||
{
|
||||
signature = insertBefore ? signature + (isEmptyText ? '' : newLine) : (isEmptyText ? '' : newLine) + signature;
|
||||
if (isEmptyText)
|
||||
{
|
||||
signature = newLine + newLine + signature;
|
||||
}
|
||||
else
|
||||
{
|
||||
signature = insertBefore ? signature + newLine + newLine : newLine + newLine + signature;
|
||||
}
|
||||
|
||||
if (isHtml)
|
||||
{
|
||||
signature = '<signature>' + signature + '</signature>';
|
||||
|
|
@ -93,6 +101,7 @@
|
|||
|
||||
var
|
||||
bIsHtml = false,
|
||||
bIsFirst = false,
|
||||
bInsertBefore = false,
|
||||
sSignature = '',
|
||||
sResultSignature = '';
|
||||
|
|
@ -100,6 +109,7 @@
|
|||
if (cfg)
|
||||
{
|
||||
bIsHtml = undefined === cfg.isHtml ? false : !!cfg.isHtml;
|
||||
bIsFirst = undefined === cfg.isFirst ? false : !!cfg.isFirst;
|
||||
bInsertBefore = undefined === cfg.insertBefore ? false : !!cfg.insertBefore;
|
||||
sSignature = undefined === cfg.signature ? '' : cfg.signature;
|
||||
}
|
||||
|
|
@ -119,7 +129,7 @@
|
|||
}
|
||||
|
||||
editor.__plain.setRawData(
|
||||
rl_signature_replacer(editor, editor.__plain.getRawData(), sResultSignature, false, bInsertBefore));
|
||||
rl_signature_replacer(editor, editor.__plain.getRawData(), sResultSignature, false, bInsertBefore, bIsFirst));
|
||||
|
||||
}
|
||||
else
|
||||
|
|
@ -133,7 +143,7 @@
|
|||
}
|
||||
|
||||
editor.setData(
|
||||
rl_signature_replacer(editor, editor.getData(), sResultSignature, true, bInsertBefore));
|
||||
rl_signature_replacer(editor, editor.getData(), sResultSignature, true, bInsertBefore, bIsFirst));
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue