mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
Many small fixes.
This commit is contained in:
parent
9188228f5d
commit
ab374bbb71
13 changed files with 339 additions and 396 deletions
|
|
@ -340,11 +340,6 @@ class AbstractApp extends AbstractBoot
|
||||||
leftPanelDisabled(false);
|
leftPanelDisabled(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Settings.appSettingsGet('loginGlassStyle'))
|
|
||||||
{
|
|
||||||
$html.addClass('glass');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mobile)
|
if (!mobile)
|
||||||
{
|
{
|
||||||
ssm.addState({
|
ssm.addState({
|
||||||
|
|
|
||||||
|
|
@ -92,12 +92,11 @@ class HtmlEditor
|
||||||
* @param {bool} insertBefore
|
* @param {bool} insertBefore
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
setSignature(signature, html, insertBefore = false, first = false) {
|
setSignature(signature, html, insertBefore = false) {
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
{
|
{
|
||||||
this.editor.execCommand('insertSignature', {
|
this.editor.execCommand('insertSignature', {
|
||||||
isHtml: html,
|
isHtml: html,
|
||||||
isFirst: first,
|
|
||||||
insertBefore: insertBefore,
|
insertBefore: insertBefore,
|
||||||
signature: signature
|
signature: signature
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -826,7 +826,7 @@ export function htmlToPlain(html)
|
||||||
.replace(/</gi, '<')
|
.replace(/</gi, '<')
|
||||||
.replace(/&/gi, '&');
|
.replace(/&/gi, '&');
|
||||||
|
|
||||||
text = splitPlainText(trim(text));
|
text = splitPlainText(text);
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
limit = 800;
|
limit = 800;
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,6 @@
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
||||||
&.animated {
|
|
||||||
right: -25px;
|
|
||||||
bottom: -25px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#rl-content {
|
#rl-content {
|
||||||
|
|
|
||||||
|
|
@ -866,7 +866,7 @@ class ComposePopupView extends AbstractViewNext
|
||||||
return signature;
|
return signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSignatureFromIdentity(identity, first = false) {
|
setSignatureFromIdentity(identity) {
|
||||||
if (identity)
|
if (identity)
|
||||||
{
|
{
|
||||||
this.editor((editor) => {
|
this.editor((editor) => {
|
||||||
|
|
@ -883,7 +883,7 @@ class ComposePopupView extends AbstractViewNext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.setSignature(this.converSignature(signature), isHtml, !!identity.signatureInsertBefore(), first);
|
editor.setSignature(this.converSignature(signature), isHtml, !!identity.signatureInsertBefore());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1168,7 +1168,7 @@ class ComposePopupView extends AbstractViewNext
|
||||||
|
|
||||||
if (identity && ComposeType.Draft !== lineComposeType && ComposeType.EditAsNew !== lineComposeType)
|
if (identity && ComposeType.Draft !== lineComposeType && ComposeType.EditAsNew !== lineComposeType)
|
||||||
{
|
{
|
||||||
this.setSignatureFromIdentity(identity, true);
|
this.setSignatureFromIdentity(identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setFocusInPopup();
|
this.setFocusInPopup();
|
||||||
|
|
@ -1192,7 +1192,7 @@ class ComposePopupView extends AbstractViewNext
|
||||||
|
|
||||||
if (identity)
|
if (identity)
|
||||||
{
|
{
|
||||||
this.setSignatureFromIdentity(identity, true);
|
this.setSignatureFromIdentity(identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setFocusInPopup();
|
this.setFocusInPopup();
|
||||||
|
|
@ -1216,7 +1216,7 @@ class ComposePopupView extends AbstractViewNext
|
||||||
|
|
||||||
if (identity && ComposeType.Draft !== lineComposeType && ComposeType.EditAsNew !== lineComposeType)
|
if (identity && ComposeType.Draft !== lineComposeType && ComposeType.EditAsNew !== lineComposeType)
|
||||||
{
|
{
|
||||||
this.setSignatureFromIdentity(identity, true);
|
this.setSignatureFromIdentity(identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setFocusInPopup();
|
this.setFocusInPopup();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import $ from '$';
|
|
||||||
import _ from '_';
|
import _ from '_';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
|
|
@ -457,11 +456,6 @@ class LoginUserView extends AbstractViewNext
|
||||||
}, Magics.Time50ms);
|
}, Magics.Time50ms);
|
||||||
|
|
||||||
triggerAutocompleteInputChange(true);
|
triggerAutocompleteInputChange(true);
|
||||||
|
|
||||||
if (Settings.appSettingsGet('activeBackgroud'))
|
|
||||||
{
|
|
||||||
this.initActiveBackgroud();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
|
@ -486,28 +480,6 @@ class LoginUserView extends AbstractViewNext
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
initActiveBackgroud() {
|
|
||||||
|
|
||||||
const
|
|
||||||
$bg = $('#rl-bg'),
|
|
||||||
movementStrength = 25,
|
|
||||||
winHeight = $win.height(),
|
|
||||||
winWidth = $win.width(),
|
|
||||||
height = movementStrength / winHeight,
|
|
||||||
width = movementStrength / winWidth,
|
|
||||||
winHeightHalf = winHeight / 2,
|
|
||||||
winWidthHalf = winWidth / 2;
|
|
||||||
|
|
||||||
$bg.addClass('animated');
|
|
||||||
|
|
||||||
$('#rl-app').on('mousemove', _.throttle((e) => {
|
|
||||||
$bg.css({
|
|
||||||
top: height * (e.pageY - winHeightHalf) * -1 - movementStrength,
|
|
||||||
left: width * (e.pageX - winWidthHalf) * -1 - movementStrength
|
|
||||||
});
|
|
||||||
}, 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {LoginUserView, LoginUserView as default};
|
export {LoginUserView, LoginUserView as default};
|
||||||
|
|
|
||||||
|
|
@ -1,95 +1,95 @@
|
||||||
(function ($, window) {
|
(function ($, window) {
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
var
|
var
|
||||||
nId = null,
|
nId = null,
|
||||||
bStarted = false
|
bStarted = false
|
||||||
;
|
;
|
||||||
|
|
||||||
function ShowRecaptcha()
|
function ShowRecaptcha()
|
||||||
{
|
{
|
||||||
if (window.grecaptcha)
|
if (window.grecaptcha)
|
||||||
{
|
{
|
||||||
if (null === nId)
|
if (null === nId)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
oEl = null,
|
oEl = null,
|
||||||
oLink = $('.plugin-mark-Login-BottomControlGroup')
|
oLink = $('.plugin-mark-Login-BottomControlGroup')
|
||||||
;
|
;
|
||||||
|
|
||||||
if (oLink && oLink[0])
|
if (oLink && oLink[0])
|
||||||
{
|
{
|
||||||
oEl = $('<div class="controls"></div>');
|
oEl = $('<div class="controls"></div>');
|
||||||
|
|
||||||
$(oLink[0]).after(oEl);
|
$(oLink[0]).after(oEl);
|
||||||
|
|
||||||
nId = window.grecaptcha.render(oEl[0], {
|
nId = window.grecaptcha.render(oEl[0], {
|
||||||
'sitekey': window.rl.pluginSettingsGet('recaptcha', 'public_key'),
|
'sitekey': window.rl.pluginSettingsGet('recaptcha', 'public_key'),
|
||||||
'theme': window.rl.pluginSettingsGet('recaptcha', 'theme')
|
'theme': window.rl.pluginSettingsGet('recaptcha', 'theme')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.__globalShowRecaptcha = ShowRecaptcha;
|
window.__globalShowRecaptcha = ShowRecaptcha;
|
||||||
|
|
||||||
function StartRecaptcha()
|
function StartRecaptcha()
|
||||||
{
|
{
|
||||||
if (!window.grecaptcha && window.rl)
|
if (!window.grecaptcha && window.rl)
|
||||||
{
|
{
|
||||||
$.getScript('https://www.google.com/recaptcha/api.js?onload=__globalShowRecaptcha&render=explicit&hl=' + window.rl.settingsGet('Language'));
|
$.getScript('https://www.google.com/recaptcha/api.js?onload=__globalShowRecaptcha&render=explicit&hl=' + window.rl.settingsGet('Language'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowRecaptcha();
|
ShowRecaptcha();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.rl)
|
if (window.rl)
|
||||||
{
|
{
|
||||||
window.rl.addHook('user-login-submit', function (fSubmitResult) {
|
window.rl.addHook('user-login-submit', function (fSubmitResult) {
|
||||||
if (null !== nId && !window.grecaptcha.getResponse(nId))
|
if (null !== nId && !window.grecaptcha.getResponse(nId))
|
||||||
{
|
{
|
||||||
fSubmitResult(105);
|
fSubmitResult(105);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.rl.addHook('view-model-on-show', function (sName, oViewModel) {
|
window.rl.addHook('view-model-on-show', function (sName, oViewModel) {
|
||||||
if (!bStarted && oViewModel &&
|
if (!bStarted && oViewModel &&
|
||||||
('View:RainLoop:Login' === sName || 'View/App/Login' === sName || 'LoginViewModel' === sName || 'LoginAppView' === sName) &&
|
('View:RainLoop:Login' === sName || 'View/App/Login' === sName || 'LoginViewModel' === sName || 'LoginAppView' === sName) &&
|
||||||
window.rl.pluginSettingsGet('recaptcha', 'show_captcha_on_login'))
|
window.rl.pluginSettingsGet('recaptcha', 'show_captcha_on_login'))
|
||||||
{
|
{
|
||||||
bStarted = true;
|
bStarted = true;
|
||||||
StartRecaptcha();
|
StartRecaptcha();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.rl.addHook('ajax-default-request', function (sAction, oParameters) {
|
window.rl.addHook('ajax-default-request', function (sAction, oParameters) {
|
||||||
if ('Login' === sAction && oParameters && null !== nId && window.grecaptcha)
|
if ('Login' === sAction && oParameters && null !== nId && window.grecaptcha)
|
||||||
{
|
{
|
||||||
oParameters['RecaptchaResponse'] = window.grecaptcha.getResponse(nId);
|
oParameters['RecaptchaResponse'] = window.grecaptcha.getResponse(nId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.rl.addHook('ajax-default-response', function (sAction, oData, sType) {
|
window.rl.addHook('ajax-default-response', function (sAction, oData, sType) {
|
||||||
if ('Login' === sAction)
|
if ('Login' === sAction)
|
||||||
{
|
{
|
||||||
if (!oData || 'success' !== sType || !oData['Result'])
|
if (!oData || 'success' !== sType || !oData['Result'])
|
||||||
{
|
{
|
||||||
if (null !== nId && window.grecaptcha)
|
if (null !== nId && window.grecaptcha)
|
||||||
{
|
{
|
||||||
window.grecaptcha.reset(nId);
|
window.grecaptcha.reset(nId);
|
||||||
}
|
}
|
||||||
else if (oData && oData['Captcha'])
|
else if (oData && oData['Captcha'])
|
||||||
{
|
{
|
||||||
StartRecaptcha();
|
StartRecaptcha();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}($, window));
|
}($, window));
|
||||||
|
|
@ -1455,9 +1455,7 @@ class Actions
|
||||||
'customLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''),
|
'customLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''),
|
||||||
'forgotPasswordLinkUrl' => \trim($oConfig->Get('login', 'forgot_password_link_url', '')),
|
'forgotPasswordLinkUrl' => \trim($oConfig->Get('login', 'forgot_password_link_url', '')),
|
||||||
'registrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
|
'registrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
|
||||||
'loginGlassStyle' => (bool) $oConfig->Get('login', 'glass_style', true),
|
|
||||||
'hideSubmitButton' => (bool) $oConfig->Get('login', 'hide_submit_button', true),
|
'hideSubmitButton' => (bool) $oConfig->Get('login', 'hide_submit_button', true),
|
||||||
'activeBackgroud' => (bool) $oConfig->Get('login', 'active_backgroud', false),
|
|
||||||
'jsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
|
'jsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
|
||||||
'useImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
|
'useImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
|
||||||
'useImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
|
'useImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
|
||||||
|
|
|
||||||
|
|
@ -251,9 +251,7 @@ class Application extends \RainLoop\Config\AbstractConfig
|
||||||
|
|
||||||
'welcome_page' => array(false, ''),
|
'welcome_page' => array(false, ''),
|
||||||
|
|
||||||
'glass_style' => array(true),
|
|
||||||
'hide_submit_button' => array(true),
|
'hide_submit_button' => array(true),
|
||||||
'active_backgroud' => array(false),
|
|
||||||
|
|
||||||
'forgot_password_link_url' => array('', ''),
|
'forgot_password_link_url' => array('', ''),
|
||||||
'registration_link_url' => array('', ''),
|
'registration_link_url' => array('', ''),
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,30 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="no-js rl-booted-trigger rl-started-trigger" dir="{{BaseDir}}">
|
<html class="no-js rl-booted-trigger rl-started-trigger glass" dir="{{BaseDir}}">
|
||||||
<head>
|
<head>
|
||||||
<noscript>
|
<noscript>
|
||||||
<meta http-equiv="refresh" content="0; URL=./?/NoScript" />
|
<meta http-equiv="refresh" content="0; URL=./?/NoScript" />
|
||||||
</noscript>
|
</noscript>
|
||||||
<!--[if lte IE 8]>
|
<!--[if lte IE 8]>
|
||||||
<meta http-equiv="refresh" content="0; URL=./?/BadBrowser" />
|
<meta http-equiv="refresh" content="0; URL=./?/BadBrowser" />
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
<meta name="viewport" content="{{BaseViewport}}">
|
<meta name="viewport" content="{{BaseViewport}}">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<meta name="google" content="notranslate" />
|
<meta name="google" content="notranslate" />
|
||||||
<meta name="robots" content="noindex,nofollow,noodp" />
|
<meta name="robots" content="noindex,nofollow,noodp" />
|
||||||
<meta name="AppBootData" content='{{RainloopBootData}}' id="app-boot-data" />
|
<meta name="AppBootData" content='{{RainloopBootData}}' id="app-boot-data" />
|
||||||
{{BaseContentSecurityPolicy}}
|
{{BaseContentSecurityPolicy}}
|
||||||
<title></title>
|
<title></title>
|
||||||
{{BaseAppFaviconPngLinkTag}}
|
{{BaseAppFaviconPngLinkTag}}
|
||||||
{{BaseAppFaviconTouchLinkTag}}
|
{{BaseAppFaviconTouchLinkTag}}
|
||||||
<link type="text/css" rel="stylesheet" href="{{BaseAppMainCssLink}}" />
|
<link type="text/css" rel="stylesheet" href="{{BaseAppMainCssLink}}" />
|
||||||
<link type="text/css" rel="stylesheet" href="{{BaseAppThemeCssLink}}" id="app-theme-link" />
|
<link type="text/css" rel="stylesheet" href="{{BaseAppThemeCssLink}}" id="app-theme-link" />
|
||||||
<link rel="manifest" href="{{BaseAppManifestLink}}" />
|
<link rel="manifest" href="{{BaseAppManifestLink}}" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="rl-app"></div>
|
<div id="rl-app"></div>
|
||||||
<div id="rl-check"></div>
|
<div id="rl-check"></div>
|
||||||
<script type="text/javascript" data-cfasync="false" src="{{BaseAppBootScriptLink}}"></script>
|
<script type="text/javascript" data-cfasync="false" src="{{BaseAppBootScriptLink}}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
|
|
||||||
.b-login-content .loginFormWrapper {
|
.b-login-content .loginFormWrapper {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
.wrapper {
|
.wrapper {
|
||||||
padding: 30px 30px 10px 30px;
|
padding: 30px 30px 10px 30px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.thm-login {
|
.thm-login {
|
||||||
|
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
width: calc(~'100% - 60px') !important;
|
width: calc(~'100% - 60px') !important;
|
||||||
max-width: 303px !important;
|
max-width: 303px !important;
|
||||||
|
|
||||||
box-shadow: 0 1px 4px #ccc !important;
|
box-shadow: 0 1px 4px #ccc !important;
|
||||||
box-shadow: 0 1px 5px rgba(0,0,0,.2) !important;
|
box-shadow: 0 1px 5px rgba(0,0,0,.2) !important;
|
||||||
box-shadow: 0 0 0 1px rgba(0,0,0,.04),0 1px 5px rgba(0,0,0,.1) !important;
|
box-shadow: 0 0 0 1px rgba(0,0,0,.04),0 1px 5px rgba(0,0,0,.1) !important;
|
||||||
}
|
}
|
||||||
374
vendors/ckeditor-plugins/plain/plugin.js
vendored
374
vendors/ckeditor-plugins/plain/plugin.js
vendored
|
|
@ -1,187 +1,187 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var
|
var
|
||||||
simplePlainToHtml = function (sPlain) {
|
simplePlainToHtml = function (sPlain) {
|
||||||
return sPlain
|
return sPlain
|
||||||
.replace(/&/g, '&')
|
.replace(/&/g, '&')
|
||||||
.replace(/>/g, '>').replace(/</g, '<')
|
.replace(/>/g, '>').replace(/</g, '<')
|
||||||
.replace(/[\-_~]{10,}/g, '<hr />')
|
.replace(/[\-_~]{10,}/g, '<hr />')
|
||||||
.replace(/\n/g, '<br />')
|
.replace(/\n/g, '<br />')
|
||||||
.replace(/ /g, ' ')
|
.replace(/ /g, ' ')
|
||||||
;
|
;
|
||||||
},
|
},
|
||||||
simpleHtmlToPlain = function (sHtml) {
|
simpleHtmlToPlain = function (sHtml) {
|
||||||
|
|
||||||
var sText = sHtml
|
var sText = sHtml
|
||||||
.replace(/[\s]+/gm, ' ')
|
.replace(/[\s]+/gm, ' ')
|
||||||
.replace(/<br[^>]*>/gmi, '\n')
|
.replace(/<br[^>]*>/gmi, '\n')
|
||||||
.replace(/<\/h[\d]>/gi, '\n')
|
.replace(/<\/h[\d]>/gi, '\n')
|
||||||
.replace(/<\/p>/gi, '\n\n')
|
.replace(/<\/p>/gi, '\n\n')
|
||||||
.replace(/<\/li>/gi, '\n')
|
.replace(/<\/li>/gi, '\n')
|
||||||
.replace(/<\/td>/gi, '\n')
|
.replace(/<\/td>/gi, '\n')
|
||||||
.replace(/<\/tr>/gi, '\n')
|
.replace(/<\/tr>/gi, '\n')
|
||||||
.replace(/<\/div>/gi, '\n')
|
.replace(/<\/div>/gi, '\n')
|
||||||
.replace(/<blockquote[^>]*>/gmi, '\n')
|
.replace(/<blockquote[^>]*>/gmi, '\n')
|
||||||
.replace(/<\/blockquote>/gi, '\n')
|
.replace(/<\/blockquote>/gi, '\n')
|
||||||
.replace(/<hr[^>]*>/gmi, '\n_______________________________\n\n')
|
.replace(/<hr[^>]*>/gmi, '\n_______________________________\n\n')
|
||||||
.replace(/ /gi, ' ')
|
.replace(/ /gi, ' ')
|
||||||
.replace(/"/gi, '"')
|
.replace(/"/gi, '"')
|
||||||
.replace(/<[^>]*>/gm, '')
|
.replace(/<[^>]*>/gm, '')
|
||||||
;
|
;
|
||||||
|
|
||||||
sText = $('<div></div>').html(sText).text();
|
sText = $('<div></div>').html(sText).text();
|
||||||
|
|
||||||
sText = sText
|
sText = sText
|
||||||
.replace(/\n[ \t]+/gm, '\n')
|
.replace(/\n[ \t]+/gm, '\n')
|
||||||
.replace(/[\n]{3,}/gm, '\n\n')
|
.replace(/[\n]{3,}/gm, '\n\n')
|
||||||
.replace(/>/gi, '>')
|
.replace(/>/gi, '>')
|
||||||
.replace(/</gi, '<')
|
.replace(/</gi, '<')
|
||||||
.replace(/&/gi, '&')
|
.replace(/&/gi, '&')
|
||||||
;
|
;
|
||||||
|
|
||||||
return sText;
|
return sText;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
CKEDITOR.plugins.add('plain', {
|
CKEDITOR.plugins.add('plain', {
|
||||||
lang: '',
|
lang: '',
|
||||||
icons: 'plain',
|
icons: 'plain',
|
||||||
hidpi: true,
|
hidpi: true,
|
||||||
init: function(editor)
|
init: function(editor)
|
||||||
{
|
{
|
||||||
if (editor.elementMode === CKEDITOR.ELEMENT_MODE_INLINE)
|
if (editor.elementMode === CKEDITOR.ELEMENT_MODE_INLINE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
editor.__plainUtils = {
|
editor.__plainUtils = {
|
||||||
plainToHtml: function(data) {
|
plainToHtml: function(data) {
|
||||||
return window.rainloop_Utils_plainToHtml ?
|
return window.rainloop_Utils_plainToHtml ?
|
||||||
window.rainloop_Utils_plainToHtml(data, true) : simplePlainToHtml(data);
|
window.rainloop_Utils_plainToHtml(data, true) : simplePlainToHtml(data);
|
||||||
},
|
},
|
||||||
htmlToPlain: function(data) {
|
htmlToPlain: function(data) {
|
||||||
return window.rainloop_Utils_htmlToPlain ?
|
return window.rainloop_Utils_htmlToPlain ?
|
||||||
window.rainloop_Utils_htmlToPlain(data, true) : simpleHtmlToPlain(data);
|
window.rainloop_Utils_htmlToPlain(data, true) : simpleHtmlToPlain(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var plain = CKEDITOR.plugins.plain;
|
var plain = CKEDITOR.plugins.plain;
|
||||||
editor.addMode('plain', function(callback) {
|
editor.addMode('plain', function(callback) {
|
||||||
|
|
||||||
var
|
var
|
||||||
contentsSpace = editor.ui.space('contents'),
|
contentsSpace = editor.ui.space('contents'),
|
||||||
textarea = contentsSpace.getDocument().createElement('textarea')
|
textarea = contentsSpace.getDocument().createElement('textarea')
|
||||||
;
|
;
|
||||||
|
|
||||||
textarea.setStyles(
|
textarea.setStyles(
|
||||||
CKEDITOR.tools.extend({
|
CKEDITOR.tools.extend({
|
||||||
width: CKEDITOR.env.ie7Compat ? '99%' : '100%',
|
width: CKEDITOR.env.ie7Compat ? '99%' : '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
resize: 'none',
|
resize: 'none',
|
||||||
outline: 'none',
|
outline: 'none',
|
||||||
'text-align': 'left'
|
'text-align': 'left'
|
||||||
},
|
},
|
||||||
CKEDITOR.tools.cssVendorPrefix('tab-size', 4)))
|
CKEDITOR.tools.cssVendorPrefix('tab-size', 4)))
|
||||||
;
|
;
|
||||||
|
|
||||||
textarea.setAttribute('dir', 'ltr');
|
textarea.setAttribute('dir', 'ltr');
|
||||||
textarea.addClass('cke_plain');
|
textarea.addClass('cke_plain');
|
||||||
|
|
||||||
CKEDITOR.plugins.clipboard.preventDefaultDropOnElement(textarea);
|
CKEDITOR.plugins.clipboard.preventDefaultDropOnElement(textarea);
|
||||||
|
|
||||||
contentsSpace.append(textarea);
|
contentsSpace.append(textarea);
|
||||||
|
|
||||||
var editable = editor.editable(new plainEditable(editor, textarea));
|
var editable = editor.editable(new plainEditable(editor, textarea));
|
||||||
|
|
||||||
editable.setData(editor.getData(1));
|
editable.setData(editor.getData(1));
|
||||||
editor.__plain = editable;
|
editor.__plain = editable;
|
||||||
|
|
||||||
// Having to make <textarea> fixed sized to conquer the following bugs:
|
// Having to make <textarea> fixed sized to conquer the following bugs:
|
||||||
// 1. The textarea height/width='100%' doesn't constraint to the 'td' in IE6/7.
|
// 1. The textarea height/width='100%' doesn't constraint to the 'td' in IE6/7.
|
||||||
// 2. Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor
|
// 2. Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor
|
||||||
// if text content within it has overflowed. (#4762)
|
// if text content within it has overflowed. (#4762)
|
||||||
if (CKEDITOR.env.ie) {
|
if (CKEDITOR.env.ie) {
|
||||||
editable.attachListener(editor, 'resize', onResize, editable);
|
editable.attachListener(editor, 'resize', onResize, editable);
|
||||||
editable.attachListener(CKEDITOR.document.getWindow(), 'resize', onResize, editable);
|
editable.attachListener(CKEDITOR.document.getWindow(), 'resize', onResize, editable);
|
||||||
CKEDITOR.tools.setTimeout(onResize, 0, editable);
|
CKEDITOR.tools.setTimeout(onResize, 0, editable);
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.fire('ariaWidget', this);
|
editor.fire('ariaWidget', this);
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
editor.addCommand('plain', plain.commands.plain);
|
editor.addCommand('plain', plain.commands.plain);
|
||||||
|
|
||||||
if (editor.ui.addButton) {
|
if (editor.ui.addButton) {
|
||||||
editor.ui.addButton('plain', {
|
editor.ui.addButton('plain', {
|
||||||
label: window.rl && window.rl.i18n ? window.rl.i18n('EDITOR/TEXT_SWITCHER_PLAINT_TEXT') : 'Plain',
|
label: window.rl && window.rl.i18n ? window.rl.i18n('EDITOR/TEXT_SWITCHER_PLAINT_TEXT') : 'Plain',
|
||||||
command: 'plain',
|
command: 'plain',
|
||||||
toolbar: 'spec,10'
|
toolbar: 'spec,10'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.on('mode', function() {
|
editor.on('mode', function() {
|
||||||
editor.getCommand('plain').setState(editor.mode === 'plain' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF);
|
editor.getCommand('plain').setState(editor.mode === 'plain' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF);
|
||||||
editor.editable().addClass('cke_enable_context_menu');
|
editor.editable().addClass('cke_enable_context_menu');
|
||||||
});
|
});
|
||||||
|
|
||||||
function onResize() {
|
function onResize() {
|
||||||
this.hide();
|
this.hide();
|
||||||
this.setStyle('height', this.getParent().$.clientHeight + 'px');
|
this.setStyle('height', this.getParent().$.clientHeight + 'px');
|
||||||
this.setStyle('width', this.getParent().$.clientWidth + 'px');
|
this.setStyle('width', this.getParent().$.clientWidth + 'px');
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var plainEditable = CKEDITOR.tools.createClass({
|
var plainEditable = CKEDITOR.tools.createClass({
|
||||||
base: CKEDITOR.editable,
|
base: CKEDITOR.editable,
|
||||||
proto: {
|
proto: {
|
||||||
setData: function(data) {
|
setData: function(data) {
|
||||||
this.setValue(this.editor.__plainUtils.htmlToPlain(data));
|
this.setValue(this.editor.__plainUtils.htmlToPlain(data));
|
||||||
this.editor.fire('dataReady');
|
this.editor.fire('dataReady');
|
||||||
},
|
},
|
||||||
setRawData: function(data) {
|
setRawData: function(data) {
|
||||||
this.setValue(data);
|
this.setValue(data);
|
||||||
this.editor.fire('dataReady');
|
this.editor.fire('dataReady');
|
||||||
},
|
},
|
||||||
getData: function() {
|
getData: function() {
|
||||||
return this.editor.__plainUtils.plainToHtml(this.getValue());
|
return this.editor.__plainUtils.plainToHtml(this.getValue());
|
||||||
},
|
},
|
||||||
getRawData: function() {
|
getRawData: function() {
|
||||||
return this.getValue();
|
return this.getValue();
|
||||||
},
|
},
|
||||||
insertHtml: function() {},
|
insertHtml: function() {},
|
||||||
insertElement: function() {},
|
insertElement: function() {},
|
||||||
insertText: function() {},
|
insertText: function() {},
|
||||||
setReadOnly: function( isReadOnly ) {
|
setReadOnly: function( isReadOnly ) {
|
||||||
this[(isReadOnly ? 'set' : 'remove') + 'Attribute' ]('readOnly', 'readonly');
|
this[(isReadOnly ? 'set' : 'remove') + 'Attribute' ]('readOnly', 'readonly');
|
||||||
},
|
},
|
||||||
detach: function() {
|
detach: function() {
|
||||||
plainEditable.baseProto.detach.call( this );
|
plainEditable.baseProto.detach.call( this );
|
||||||
this.clearCustomData();
|
this.clearCustomData();
|
||||||
this.remove();
|
this.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
CKEDITOR.plugins.plain = {
|
CKEDITOR.plugins.plain = {
|
||||||
commands: {
|
commands: {
|
||||||
plain: {
|
plain: {
|
||||||
modes: {
|
modes: {
|
||||||
wysiwyg: 1, plain: 1
|
wysiwyg: 1, plain: 1
|
||||||
},
|
},
|
||||||
editorFocus: false,
|
editorFocus: false,
|
||||||
readOnly: 1,
|
readOnly: 1,
|
||||||
exec: function(editor) {
|
exec: function(editor) {
|
||||||
if (editor.mode === 'wysiwyg') {
|
if (editor.mode === 'wysiwyg') {
|
||||||
editor.fire('saveSnapshot');
|
editor.fire('saveSnapshot');
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.getCommand('plain').setState(CKEDITOR.TRISTATE_DISABLED);
|
editor.getCommand('plain').setState(CKEDITOR.TRISTATE_DISABLED);
|
||||||
editor.setMode(editor.mode === 'plain' ? 'wysiwyg' : 'plain');
|
editor.setMode(editor.mode === 'plain' ? 'wysiwyg' : 'plain');
|
||||||
},
|
},
|
||||||
canUndo: false
|
canUndo: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
22
vendors/ckeditor-plugins/signature/plugin.js
vendored
22
vendors/ckeditor-plugins/signature/plugin.js
vendored
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var rl_signature_replacer = function(editor, text, signature, isHtml, insertBefore, isFirst) {
|
var rl_signature_replacer = function(editor, text, signature, isHtml, insertBefore) {
|
||||||
|
|
||||||
var
|
var
|
||||||
skipInsert = false,
|
skipInsert = false,
|
||||||
|
|
@ -60,19 +60,7 @@
|
||||||
|
|
||||||
if (!skipInsert)
|
if (!skipInsert)
|
||||||
{
|
{
|
||||||
if (isEmptyText)
|
signature = newLine + newLine + (isHtml ? '<signature>' : '') + signature + (isHtml ? '</signature>' : '');
|
||||||
{
|
|
||||||
signature = newLine + newLine + signature;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
signature = insertBefore ? signature + newLine + newLine : newLine + newLine + signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isHtml)
|
|
||||||
{
|
|
||||||
signature = '<signature>' + signature + '</signature>';
|
|
||||||
}
|
|
||||||
|
|
||||||
text = insertBefore ? signature + text : text + signature;
|
text = insertBefore ? signature + text : text + signature;
|
||||||
|
|
||||||
|
|
@ -101,7 +89,6 @@
|
||||||
|
|
||||||
var
|
var
|
||||||
bIsHtml = false,
|
bIsHtml = false,
|
||||||
bIsFirst = false,
|
|
||||||
bInsertBefore = false,
|
bInsertBefore = false,
|
||||||
sSignature = '',
|
sSignature = '',
|
||||||
sResultSignature = '';
|
sResultSignature = '';
|
||||||
|
|
@ -109,7 +96,6 @@
|
||||||
if (cfg)
|
if (cfg)
|
||||||
{
|
{
|
||||||
bIsHtml = undefined === cfg.isHtml ? false : !!cfg.isHtml;
|
bIsHtml = undefined === cfg.isHtml ? false : !!cfg.isHtml;
|
||||||
bIsFirst = undefined === cfg.isFirst ? false : !!cfg.isFirst;
|
|
||||||
bInsertBefore = undefined === cfg.insertBefore ? false : !!cfg.insertBefore;
|
bInsertBefore = undefined === cfg.insertBefore ? false : !!cfg.insertBefore;
|
||||||
sSignature = undefined === cfg.signature ? '' : cfg.signature;
|
sSignature = undefined === cfg.signature ? '' : cfg.signature;
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +115,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.__plain.setRawData(
|
editor.__plain.setRawData(
|
||||||
rl_signature_replacer(editor, editor.__plain.getRawData(), sResultSignature, false, bInsertBefore, bIsFirst));
|
rl_signature_replacer(editor, editor.__plain.getRawData(), sResultSignature, false, bInsertBefore));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -143,7 +129,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.setData(
|
editor.setData(
|
||||||
rl_signature_replacer(editor, editor.getData(), sResultSignature, true, bInsertBefore, bIsFirst));
|
rl_signature_replacer(editor, editor.getData(), sResultSignature, true, bInsertBefore));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue