Code refactoring (Translator, Stores, ko)

This commit is contained in:
RainLoop Team 2015-01-26 03:09:22 +04:00
parent 929bffccef
commit b42ce01e7e
102 changed files with 6775 additions and 6511 deletions

View file

@ -12,6 +12,7 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),
Events = require('Common/Events'), Events = require('Common/Events'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
@ -248,9 +249,7 @@
ko.components.register('Checkbox', require('Component/Checkbox')); ko.components.register('Checkbox', require('Component/Checkbox'));
} }
Utils.initOnStartOrLangChange(function () { Translator.initOnStartOrLangChange(Translator.initNotificationLanguage, Translator);
Utils.initNotificationLanguage();
}, null);
_.delay(Utils.windowResizeCallback, 1000); _.delay(Utils.windowResizeCallback, 1000);

View file

@ -12,6 +12,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'), Data = require('Storage/Admin/Data'),
@ -215,14 +216,14 @@
Enums.Notification.LicensingExpired Enums.Notification.LicensingExpired
])) ]))
{ {
Data.licenseError(Utils.getNotification(Utils.pInt(oData.ErrorCode))); Data.licenseError(Translator.getNotification(Utils.pInt(oData.ErrorCode)));
Data.licensing(true); Data.licensing(true);
} }
else else
{ {
if (Enums.StorageResultType.Abort === sResult) if (Enums.StorageResultType.Abort === sResult)
{ {
Data.licenseError(Utils.getNotification(Enums.Notification.LicensingServerIsUnavailable)); Data.licenseError(Translator.getNotification(Enums.Notification.LicensingServerIsUnavailable));
Data.licensing(true); Data.licensing(true);
} }
else else

View file

@ -17,9 +17,13 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),
Events = require('Common/Events'), Events = require('Common/Events'),
Translator = require('Common/Translator'),
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
SocialStore = require('Stores/Social'),
UserSettingsStore = require('Stores/UserSettings'),
Local = require('Storage/Local'), Local = require('Storage/Local'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
@ -154,7 +158,7 @@
{ {
var var
self = this, self = this,
iOffset = (Data.messageListPage() - 1) * Data.messagesPerPage() iOffset = (Data.messageListPage() - 1) * UserSettingsStore.messagesPerPage()
; ;
if (Utils.isUnd(bDropCurrenFolderCache) ? false : !!bDropCurrenFolderCache) if (Utils.isUnd(bDropCurrenFolderCache) ? false : !!bDropCurrenFolderCache)
@ -187,16 +191,16 @@
Data.messageList([]); Data.messageList([]);
Data.messageListLoading(false); Data.messageListLoading(false);
Data.messageListError(oData && oData.ErrorCode ? Data.messageListError(oData && oData.ErrorCode ?
Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST') Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST')
); );
} }
}, Data.currentFolderFullNameRaw(), iOffset, Data.messagesPerPage(), Data.messageListSearch()); }, Data.currentFolderFullNameRaw(), iOffset, UserSettingsStore.messagesPerPage(), Data.messageListSearch());
}; };
AppUser.prototype.recacheInboxMessageList = function () AppUser.prototype.recacheInboxMessageList = function ()
{ {
Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, Data.messagesPerPage(), '', true); Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, UserSettingsStore.messagesPerPage(), '', true);
}; };
AppUser.prototype.reloadMessageListHelper = function (bEmptyList) AppUser.prototype.reloadMessageListHelper = function (bEmptyList)
@ -302,7 +306,7 @@
if (oData && -1 < Utils.inArray(oData.ErrorCode, if (oData && -1 < Utils.inArray(oData.ErrorCode,
[Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage])) [Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage]))
{ {
window.alert(Utils.getNotification(oData.ErrorCode)); window.alert(Translator.getNotification(oData.ErrorCode));
} }
} }
@ -372,7 +376,7 @@
else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType && else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType &&
(sFromFolderFullNameRaw === Data.spamFolder() || sFromFolderFullNameRaw === Data.trashFolder()))) (sFromFolderFullNameRaw === Data.spamFolder() || sFromFolderFullNameRaw === Data.trashFolder())))
{ {
kn.showScreenPopup(require('View/Popup/Ask'), [Utils.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () { kn.showScreenPopup(require('View/Popup/Ask'), [Translator.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () {
self.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove); self.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
Data.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove); Data.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
@ -581,8 +585,8 @@
Utils.isArray(oData.Result) && 1 < oData.Result.length && Utils.isArray(oData.Result) && 1 < oData.Result.length &&
Utils.isPosNumeric(oData.Result[0], true) && Utils.isPosNumeric(oData.Result[1], true)) Utils.isPosNumeric(oData.Result[0], true) && Utils.isPosNumeric(oData.Result[1], true))
{ {
Data.userQuota(Utils.pInt(oData.Result[1]) * 1024); require('Stores/Quota').populateData(
Data.userUsageSize(Utils.pInt(oData.Result[0]) * 1024); Utils.pInt(oData.Result[1]), Utils.pInt(oData.Result[0]));
} }
}); });
}; };
@ -822,53 +826,49 @@
*/ */
AppUser.prototype.socialUsers = function (bFireAllActions) AppUser.prototype.socialUsers = function (bFireAllActions)
{ {
if (bFireAllActions) if (true === bFireAllActions)
{ {
Data.googleActions(true); SocialStore.google.loading(true);
Data.facebookActions(true); SocialStore.facebook.loading(true);
Data.twitterActions(true); SocialStore.twitter.loading(true);
} }
Remote.socialUsers(function (sResult, oData) { Remote.socialUsers(function (sResult, oData) {
if (Enums.StorageResultType.Success === sResult && oData && oData.Result) if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{ {
Data.googleUserName(oData.Result['Google'] || ''); SocialStore.google.userName(oData.Result['Google'] || '');
Data.facebookUserName(oData.Result['Facebook'] || ''); SocialStore.facebook.userName(oData.Result['Facebook'] || '');
Data.twitterUserName(oData.Result['Twitter'] || ''); SocialStore.twitter.userName(oData.Result['Twitter'] || '');
} }
else else
{ {
Data.googleUserName(''); SocialStore.google.userName('');
Data.facebookUserName(''); SocialStore.facebook.userName('');
Data.twitterUserName(''); SocialStore.twitter.userName('');
} }
Data.googleLoggined('' !== Data.googleUserName()); SocialStore.google.loading(false);
Data.facebookLoggined('' !== Data.facebookUserName()); SocialStore.facebook.loading(false);
Data.twitterLoggined('' !== Data.twitterUserName()); SocialStore.twitter.loading(false);
Data.googleActions(false);
Data.facebookActions(false);
Data.twitterActions(false);
}); });
}; };
AppUser.prototype.googleDisconnect = function () AppUser.prototype.googleDisconnect = function ()
{ {
Data.googleActions(true); SocialStore.google.loading(true);
Remote.googleDisconnect(this.socialUsers); Remote.googleDisconnect(this.socialUsers);
}; };
AppUser.prototype.facebookDisconnect = function () AppUser.prototype.facebookDisconnect = function ()
{ {
Data.facebookActions(true); SocialStore.facebook.loading(true);
Remote.facebookDisconnect(this.socialUsers); Remote.facebookDisconnect(this.socialUsers);
}; };
AppUser.prototype.twitterDisconnect = function () AppUser.prototype.twitterDisconnect = function ()
{ {
Data.twitterActions(true); SocialStore.twitter.loading(true);
Remote.twitterDisconnect(this.socialUsers); Remote.twitterDisconnect(this.socialUsers);
}; };
@ -999,7 +999,7 @@
Data.messageListCount(iCount); Data.messageListCount(iCount);
Data.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); Data.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
Data.messageListPage(window.Math.ceil((iOffset / Data.messagesPerPage()) + 1)); Data.messageListPage(window.Math.ceil((iOffset / UserSettingsStore.messagesPerPage()) + 1));
Data.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : ''); Data.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
Data.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); Data.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
Data.messageListEndPage(Data.messageListPage()); Data.messageListEndPage(Data.messageListPage());
@ -1023,7 +1023,7 @@
{ {
Data.messageListCount(0); Data.messageListCount(0);
Data.messageList([]); Data.messageList([]);
Data.messageListError(Utils.getNotification( Data.messageListError(Translator.getNotification(
oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantGetMessageList oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantGetMessageList
)); ));
} }
@ -1408,7 +1408,7 @@
if (!!Settings.settingsGet('Auth')) if (!!Settings.settingsGet('Auth'))
{ {
this.setTitle(Utils.i18n('TITLES/LOADING')); this.setTitle(Translator.i18n('TITLES/LOADING'));
//require.ensure([], function() { // require code splitting //require.ensure([], function() { // require code splitting
@ -1574,7 +1574,7 @@
if (bGoogle) if (bGoogle)
{ {
window['rl_' + sJsHash + '_google_service'] = function () { window['rl_' + sJsHash + '_google_service'] = function () {
Data.googleActions(true); SocialStore.google.loading(true);
self.socialUsers(); self.socialUsers();
}; };
} }
@ -1582,7 +1582,7 @@
if (bFacebook) if (bFacebook)
{ {
window['rl_' + sJsHash + '_facebook_service'] = function () { window['rl_' + sJsHash + '_facebook_service'] = function () {
Data.facebookActions(true); SocialStore.facebook.loading(true);
self.socialUsers(); self.socialUsers();
}; };
} }
@ -1590,7 +1590,7 @@
if (bTwitter) if (bTwitter)
{ {
window['rl_' + sJsHash + '_twitter_service'] = function () { window['rl_' + sJsHash + '_twitter_service'] = function () {
Data.twitterActions(true); SocialStore.twitter.loading(true);
self.socialUsers(); self.socialUsers();
}; };
} }

View file

@ -208,7 +208,7 @@
/** /**
* @enum {number} * @enum {number}
*/ */
Enums.DesktopNotifications = { Enums.DesktopNotification = {
'Allowed': 0, 'Allowed': 0,
'NotAllowed': 1, 'NotAllowed': 1,
'Denied': 2, 'Denied': 2,

View file

@ -40,11 +40,6 @@
*/ */
Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0}); Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
/**
* @type {?}
*/
Globals.langChangeTrigger = ko.observable(true);
/** /**
* @type {boolean} * @type {boolean}
*/ */
@ -189,10 +184,6 @@
}); });
} }
Globals.oI18N = window['rainloopI18N'] || {};
Globals.oNotificationI18N = {};
Globals.aBootstrapDropdowns = []; Globals.aBootstrapDropdowns = [];
Globals.aViewModels = { Globals.aViewModels = {

View file

@ -4,6 +4,7 @@
'use strict'; 'use strict';
var var
window = require('window'),
Utils = require('Common/Utils') Utils = require('Common/Utils')
; ;
@ -326,7 +327,7 @@
sPrefix = ''; sPrefix = '';
} }
return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png'; return sPrefix + 'themes/' + window.encodeURI(sTheme) + '/images/preview.png';
}; };
/** /**

306
dev/Common/Translator.js Normal file
View file

@ -0,0 +1,306 @@
(function () {
'use strict';
var
window = require('window'),
$ = require('$'),
_ = require('_'),
ko = require('ko'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals')
;
/**
* @constructor
*/
function Translator()
{
this.data = window['rainloopI18N'] || {};
this.notificationI18N = {};
this.trigger = ko.observable(false);
this.i18n = _.bind(this.i18n, this);
}
Translator.prototype.data = {};
Translator.prototype.notificationI18N = {};
/**
* @param {string} sKey
* @param {Object=} oValueList
* @param {string=} sDefaulValue
* @return {string}
*/
Translator.prototype.i18n = function (sKey, oValueList, sDefaulValue)
{
var
sValueName = '',
sResult = _.isUndefined(this.data[sKey]) ? (_.isUndefined(sDefaulValue) ? sKey : sDefaulValue) : this.data[sKey]
;
if (!_.isUndefined(oValueList) && !_.isNull(oValueList))
{
for (sValueName in oValueList)
{
if (_.has(oValueList, sValueName))
{
sResult = sResult.replace('%' + sValueName + '%', oValueList[sValueName]);
}
}
}
return sResult;
};
/**
* @param {Object} oElement
* @param {boolean=} bAnimate = false
*/
Translator.prototype.i18nToNode = function (oElement, bAnimate)
{
var self = this;
_.defer(function () {
$('.i18n', oElement).each(function () {
var
jqThis = $(this),
sKey = ''
;
sKey = jqThis.data('i18n-text');
if (sKey)
{
jqThis.text(self.i18n(sKey));
}
else
{
sKey = jqThis.data('i18n-html');
if (sKey)
{
jqThis.html(self.i18n(sKey));
}
sKey = jqThis.data('i18n-placeholder');
if (sKey)
{
jqThis.attr('placeholder', self.i18n(sKey));
}
sKey = jqThis.data('i18n-title');
if (sKey)
{
jqThis.attr('title', self.i18n(sKey));
}
}
});
if (bAnimate && Globals.bAnimationSupported)
{
$('.i18n-animation.i18n', oElement).letterfx({
'fx': 'fall fade', 'backwards': false, 'timing': 50, 'fx_duration': '50ms', 'letter_end': 'restore', 'element_end': 'restore'
});
}
});
};
Translator.prototype.reloadData = function ()
{
if (window['rainloopI18N'])
{
this.data = window['rainloopI18N'] || {};
this.i18nToNode($(window.document), true);
this.trigger(!this.trigger());
}
window['rainloopI18N'] = null;
};
Translator.prototype.initNotificationLanguage = function ()
{
var oN = this.notificationI18N || {};
oN[Enums.Notification.InvalidToken] = this.i18n('NOTIFICATIONS/INVALID_TOKEN');
oN[Enums.Notification.AuthError] = this.i18n('NOTIFICATIONS/AUTH_ERROR');
oN[Enums.Notification.AccessError] = this.i18n('NOTIFICATIONS/ACCESS_ERROR');
oN[Enums.Notification.ConnectionError] = this.i18n('NOTIFICATIONS/CONNECTION_ERROR');
oN[Enums.Notification.CaptchaError] = this.i18n('NOTIFICATIONS/CAPTCHA_ERROR');
oN[Enums.Notification.SocialFacebookLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.SocialTwitterLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.SocialGoogleLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.DomainNotAllowed] = this.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED');
oN[Enums.Notification.AccountNotAllowed] = this.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED');
oN[Enums.Notification.AccountTwoFactorAuthRequired] = this.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED');
oN[Enums.Notification.AccountTwoFactorAuthError] = this.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR');
oN[Enums.Notification.CouldNotSaveNewPassword] = this.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD');
oN[Enums.Notification.CurrentPasswordIncorrect] = this.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT');
oN[Enums.Notification.NewPasswordShort] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT');
oN[Enums.Notification.NewPasswordWeak] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK');
oN[Enums.Notification.NewPasswordForbidden] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT');
oN[Enums.Notification.ContactsSyncError] = this.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR');
oN[Enums.Notification.CantGetMessageList] = this.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST');
oN[Enums.Notification.CantGetMessage] = this.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
oN[Enums.Notification.CantDeleteMessage] = this.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
oN[Enums.Notification.CantMoveMessage] = this.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
oN[Enums.Notification.CantCopyMessage] = this.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
oN[Enums.Notification.CantSaveMessage] = this.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
oN[Enums.Notification.CantSendMessage] = this.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
oN[Enums.Notification.InvalidRecipients] = this.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
oN[Enums.Notification.CantSaveFilters] = this.i18n('NOTIFICATIONS/CANT_SAVE_FILTERS');
oN[Enums.Notification.FiltersAreNotCorrect] = this.i18n('NOTIFICATIONS/FILTERS_ARE_NOT_CORRECT');
oN[Enums.Notification.CantCreateFolder] = this.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
oN[Enums.Notification.CantRenameFolder] = this.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
oN[Enums.Notification.CantDeleteFolder] = this.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
oN[Enums.Notification.CantDeleteNonEmptyFolder] = this.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER');
oN[Enums.Notification.CantSubscribeFolder] = this.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER');
oN[Enums.Notification.CantUnsubscribeFolder] = this.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER');
oN[Enums.Notification.CantSaveSettings] = this.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS');
oN[Enums.Notification.CantSavePluginSettings] = this.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS');
oN[Enums.Notification.DomainAlreadyExists] = this.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS');
oN[Enums.Notification.CantInstallPackage] = this.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE');
oN[Enums.Notification.CantDeletePackage] = this.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE');
oN[Enums.Notification.InvalidPluginPackage] = this.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE');
oN[Enums.Notification.UnsupportedPluginPackage] = this.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE');
oN[Enums.Notification.LicensingServerIsUnavailable] = this.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE');
oN[Enums.Notification.LicensingExpired] = this.i18n('NOTIFICATIONS/LICENSING_EXPIRED');
oN[Enums.Notification.LicensingBanned] = this.i18n('NOTIFICATIONS/LICENSING_BANNED');
oN[Enums.Notification.DemoSendMessageError] = this.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
oN[Enums.Notification.AccountAlreadyExists] = this.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
oN[Enums.Notification.AccountDoesNotExist] = this.i18n('NOTIFICATIONS/ACCOUNT_DOES_NOT_EXIST');
oN[Enums.Notification.MailServerError] = this.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
oN[Enums.Notification.InvalidInputArgument] = this.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
oN[Enums.Notification.UnknownNotification] = this.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
oN[Enums.Notification.UnknownError] = this.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
};
/**
* @param {Function} fCallback
* @param {Object} oScope
* @param {Function=} fLangCallback
*/
Translator.prototype.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
{
if (fCallback)
{
fCallback.call(oScope);
}
if (fLangCallback)
{
this.trigger.subscribe(function () {
if (fCallback)
{
fCallback.call(oScope);
}
fLangCallback.call(oScope);
});
}
else if (fCallback)
{
this.trigger.subscribe(fCallback, oScope);
}
};
/**
* @param {number} iCode
* @param {*=} mMessage = ''
* @return {string}
*/
Translator.prototype.getNotification = function (iCode, mMessage)
{
iCode = window.parseInt(iCode, 10) || 0;
if (Enums.Notification.ClientViewError === iCode && mMessage)
{
return mMessage;
}
return _.isUndefined(this.notificationI18N[iCode]) ? '' : this.notificationI18N[iCode];
};
/**
* @param {*} mCode
* @return {string}
*/
Translator.prototype.getUploadErrorDescByCode = function (mCode)
{
var sResult = '';
switch (window.parseInt(mCode, 10) || 0) {
case Enums.UploadErrorCode.FileIsTooBig:
sResult = this.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG');
break;
case Enums.UploadErrorCode.FilePartiallyUploaded:
sResult = this.i18n('UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED');
break;
case Enums.UploadErrorCode.FileNoUploaded:
sResult = this.i18n('UPLOAD/ERROR_NO_FILE_UPLOADED');
break;
case Enums.UploadErrorCode.MissingTempFolder:
sResult = this.i18n('UPLOAD/ERROR_MISSING_TEMP_FOLDER');
break;
case Enums.UploadErrorCode.FileOnSaveingError:
sResult = this.i18n('UPLOAD/ERROR_ON_SAVING_FILE');
break;
case Enums.UploadErrorCode.FileType:
sResult = this.i18n('UPLOAD/ERROR_FILE_TYPE');
break;
default:
sResult = this.i18n('UPLOAD/ERROR_UNKNOWN');
break;
}
return sResult;
};
/**
* @param {string} sLanguage
* @param {Function=} fDone
* @param {Function=} fFail
*/
Translator.prototype.reload = function (sLanguage, fDone, fFail)
{
var
self = this,
$html = $('html'),
fEmptyFunction = function () {},
iStart = (new Date()).getTime()
;
$html.addClass('rl-changing-language');
$.ajax({
'url': require('Common/Links').langLink(sLanguage),
'dataType': 'script',
'cache': true
})
.fail(fFail || fEmptyFunction)
.done(function () {
_.delay(function () {
self.reloadData();
(fDone || fEmptyFunction)();
$html.removeClass('rl-changing-language');
}, 500 < (new Date()).getTime() - iStart ? 1 : 500);
})
;
};
module.exports = new Translator();
}());

View file

@ -18,7 +18,6 @@
Mime = require('Common/Mime'), Mime = require('Common/Mime'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Consts = require('Common/Consts'),
Globals = require('Common/Globals') Globals = require('Common/Globals')
; ;
@ -108,14 +107,6 @@
return Utils.isArray(aValue) && 0 < aValue.length; return Utils.isArray(aValue) && 0 < aValue.length;
}; };
/**
* @return {*|null}
*/
Utils.notificationClass = function ()
{
return window.Notification && window.Notification.requestPermission ? window.Notification : null;
};
/** /**
* @param {string} sQueryString * @param {string} sQueryString
* @return {Object} * @return {Object}
@ -380,125 +371,6 @@
return oObject && window.Object && window.Object.hasOwnProperty ? window.Object.hasOwnProperty.call(oObject, sProp) : false; return oObject && window.Object && window.Object.hasOwnProperty ? window.Object.hasOwnProperty.call(oObject, sProp) : false;
}; };
/**
* @param {string} sKey
* @param {Object=} oValueList
* @param {string=} sDefaulValue
* @return {string}
*/
Utils.i18n = function (sKey, oValueList, sDefaulValue)
{
var
sValueName = '',
sResult = Utils.isUnd(Globals.oI18N[sKey]) ? (Utils.isUnd(sDefaulValue) ? sKey : sDefaulValue) : Globals.oI18N[sKey]
;
if (!Utils.isUnd(oValueList) && !Utils.isNull(oValueList))
{
for (sValueName in oValueList)
{
if (Utils.hos(oValueList, sValueName))
{
sResult = sResult.replace('%' + sValueName + '%', oValueList[sValueName]);
}
}
}
return sResult;
};
/**
* @param {Object} oElement
* @param {boolean=} bAnimate = false
*/
Utils.i18nToNode = function (oElement, bAnimate)
{
_.defer(function () {
$('.i18n', oElement).each(function () {
var
jqThis = $(this),
sKey = ''
;
sKey = jqThis.data('i18n-text');
if (sKey)
{
jqThis.text(Utils.i18n(sKey));
}
else
{
sKey = jqThis.data('i18n-html');
if (sKey)
{
jqThis.html(Utils.i18n(sKey));
}
sKey = jqThis.data('i18n-placeholder');
if (sKey)
{
jqThis.attr('placeholder', Utils.i18n(sKey));
}
sKey = jqThis.data('i18n-title');
if (sKey)
{
jqThis.attr('title', Utils.i18n(sKey));
}
}
});
if (bAnimate && Globals.bAnimationSupported)
{
$('.i18n-animation.i18n', oElement).letterfx({
'fx': 'fall fade', 'backwards': false, 'timing': 50, 'fx_duration': '50ms', 'letter_end': 'restore', 'element_end': 'restore'
});
}
});
};
Utils.i18nReload = function ()
{
if (window['rainloopI18N'])
{
Globals.oI18N = window['rainloopI18N'] || {};
Utils.i18nToNode(Globals.$doc, true);
Globals.langChangeTrigger(!Globals.langChangeTrigger());
}
window['rainloopI18N'] = null;
};
/**
* @param {Function} fCallback
* @param {Object} oScope
* @param {Function=} fLangCallback
*/
Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
{
if (fCallback)
{
fCallback.call(oScope);
}
if (fLangCallback)
{
Globals.langChangeTrigger.subscribe(function () {
if (fCallback)
{
fCallback.call(oScope);
}
fLangCallback.call(oScope);
});
}
else if (fCallback)
{
Globals.langChangeTrigger.subscribe(fCallback, oScope);
}
};
/** /**
* @return {boolean} * @return {boolean}
*/ */
@ -649,126 +521,6 @@
} }
}; };
/**
* @param {number} iCode
* @param {*=} mMessage = ''
* @return {string}
*/
Utils.getNotification = function (iCode, mMessage)
{
iCode = Utils.pInt(iCode);
if (Enums.Notification.ClientViewError === iCode && mMessage)
{
return mMessage;
}
return Utils.isUnd(Globals.oNotificationI18N[iCode]) ? '' : Globals.oNotificationI18N[iCode];
};
Utils.initNotificationLanguage = function ()
{
var oN = Globals.oNotificationI18N || {};
oN[Enums.Notification.InvalidToken] = Utils.i18n('NOTIFICATIONS/INVALID_TOKEN');
oN[Enums.Notification.AuthError] = Utils.i18n('NOTIFICATIONS/AUTH_ERROR');
oN[Enums.Notification.AccessError] = Utils.i18n('NOTIFICATIONS/ACCESS_ERROR');
oN[Enums.Notification.ConnectionError] = Utils.i18n('NOTIFICATIONS/CONNECTION_ERROR');
oN[Enums.Notification.CaptchaError] = Utils.i18n('NOTIFICATIONS/CAPTCHA_ERROR');
oN[Enums.Notification.SocialFacebookLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.SocialTwitterLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.SocialGoogleLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.DomainNotAllowed] = Utils.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED');
oN[Enums.Notification.AccountNotAllowed] = Utils.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED');
oN[Enums.Notification.AccountTwoFactorAuthRequired] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED');
oN[Enums.Notification.AccountTwoFactorAuthError] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR');
oN[Enums.Notification.CouldNotSaveNewPassword] = Utils.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD');
oN[Enums.Notification.CurrentPasswordIncorrect] = Utils.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT');
oN[Enums.Notification.NewPasswordShort] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT');
oN[Enums.Notification.NewPasswordWeak] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK');
oN[Enums.Notification.NewPasswordForbidden] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT');
oN[Enums.Notification.ContactsSyncError] = Utils.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR');
oN[Enums.Notification.CantGetMessageList] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST');
oN[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
oN[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
oN[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
oN[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
oN[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
oN[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
oN[Enums.Notification.InvalidRecipients] = Utils.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
oN[Enums.Notification.CantSaveFilters] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_FILTERS');
oN[Enums.Notification.FiltersAreNotCorrect] = Utils.i18n('NOTIFICATIONS/FILTERS_ARE_NOT_CORRECT');
oN[Enums.Notification.CantCreateFolder] = Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
oN[Enums.Notification.CantRenameFolder] = Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
oN[Enums.Notification.CantDeleteFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
oN[Enums.Notification.CantDeleteNonEmptyFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER');
oN[Enums.Notification.CantSubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER');
oN[Enums.Notification.CantUnsubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER');
oN[Enums.Notification.CantSaveSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS');
oN[Enums.Notification.CantSavePluginSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS');
oN[Enums.Notification.DomainAlreadyExists] = Utils.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS');
oN[Enums.Notification.CantInstallPackage] = Utils.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE');
oN[Enums.Notification.CantDeletePackage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE');
oN[Enums.Notification.InvalidPluginPackage] = Utils.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE');
oN[Enums.Notification.UnsupportedPluginPackage] = Utils.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE');
oN[Enums.Notification.LicensingServerIsUnavailable] = Utils.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE');
oN[Enums.Notification.LicensingExpired] = Utils.i18n('NOTIFICATIONS/LICENSING_EXPIRED');
oN[Enums.Notification.LicensingBanned] = Utils.i18n('NOTIFICATIONS/LICENSING_BANNED');
oN[Enums.Notification.DemoSendMessageError] = Utils.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
oN[Enums.Notification.AccountAlreadyExists] = Utils.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
oN[Enums.Notification.AccountDoesNotExist] = Utils.i18n('NOTIFICATIONS/ACCOUNT_DOES_NOT_EXIST');
oN[Enums.Notification.MailServerError] = Utils.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
oN[Enums.Notification.InvalidInputArgument] = Utils.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
oN[Enums.Notification.UnknownNotification] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
oN[Enums.Notification.UnknownError] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
};
/**
* @param {*} mCode
* @return {string}
*/
Utils.getUploadErrorDescByCode = function (mCode)
{
var sResult = '';
switch (Utils.pInt(mCode)) {
case Enums.UploadErrorCode.FileIsTooBig:
sResult = Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG');
break;
case Enums.UploadErrorCode.FilePartiallyUploaded:
sResult = Utils.i18n('UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED');
break;
case Enums.UploadErrorCode.FileNoUploaded:
sResult = Utils.i18n('UPLOAD/ERROR_NO_FILE_UPLOADED');
break;
case Enums.UploadErrorCode.MissingTempFolder:
sResult = Utils.i18n('UPLOAD/ERROR_MISSING_TEMP_FOLDER');
break;
case Enums.UploadErrorCode.FileOnSaveingError:
sResult = Utils.i18n('UPLOAD/ERROR_ON_SAVING_FILE');
break;
case Enums.UploadErrorCode.FileType:
sResult = Utils.i18n('UPLOAD/ERROR_FILE_TYPE');
break;
default:
sResult = Utils.i18n('UPLOAD/ERROR_UNKNOWN');
break;
}
return sResult;
};
/** /**
* @param {?} oObject * @param {?} oObject
* @param {string} sMethodName * @param {string} sMethodName
@ -876,7 +628,6 @@
*/ */
Utils.initDataConstructorBySettings = function (oData) Utils.initDataConstructorBySettings = function (oData)
{ {
oData.editorDefaultType = ko.observable(Enums.EditorDefaultType.Html);
oData.showImages = ko.observable(false); oData.showImages = ko.observable(false);
oData.contactsAutosave = ko.observable(false); oData.contactsAutosave = ko.observable(false);
oData.interfaceAnimation = ko.observable(true); oData.interfaceAnimation = ko.observable(true);
@ -888,16 +639,10 @@
oData.useLocalProxyForExternalImages = ko.observable(false); oData.useLocalProxyForExternalImages = ko.observable(false);
oData.desktopNotifications = ko.observable(false);
oData.useThreads = ko.observable(true); oData.useThreads = ko.observable(true);
oData.replySameFolder = ko.observable(true); oData.replySameFolder = ko.observable(true);
oData.useCheckboxesInList = ko.observable(true); oData.useCheckboxesInList = ko.observable(true);
oData.layout = ko.observable(Enums.Layout.SidePreview);
oData.usePreviewPane = ko.computed(function () {
return Enums.Layout.NoPreview !== oData.layout();
});
oData.interfaceAnimation.subscribe(function (bValue) { oData.interfaceAnimation.subscribe(function (bValue) {
if (Globals.bMobileDevice || !bValue) if (Globals.bMobileDevice || !bValue)
{ {
@ -911,146 +656,6 @@
oData.interfaceAnimation.valueHasMutated(); oData.interfaceAnimation.valueHasMutated();
oData.desktopNotificationsPermisions = ko.computed(function () {
oData.desktopNotifications();
var
NotificationClass = Utils.notificationClass(),
iResult = Enums.DesktopNotifications.NotSupported
;
if (NotificationClass && NotificationClass.permission)
{
switch (NotificationClass.permission.toLowerCase())
{
case 'granted':
iResult = Enums.DesktopNotifications.Allowed;
break;
case 'denied':
iResult = Enums.DesktopNotifications.Denied;
break;
case 'default':
iResult = Enums.DesktopNotifications.NotAllowed;
break;
}
}
else if (window.webkitNotifications && window.webkitNotifications.checkPermission)
{
iResult = window.webkitNotifications.checkPermission();
}
return iResult;
});
oData.useDesktopNotifications = ko.computed({
'read': function () {
return oData.desktopNotifications() &&
Enums.DesktopNotifications.Allowed === oData.desktopNotificationsPermisions();
},
'write': function (bValue) {
if (bValue)
{
var
NotificationClass = Utils.notificationClass(),
iPermission = oData.desktopNotificationsPermisions()
;
if (NotificationClass && Enums.DesktopNotifications.Allowed === iPermission)
{
oData.desktopNotifications(true);
}
else if (NotificationClass && Enums.DesktopNotifications.NotAllowed === iPermission)
{
NotificationClass.requestPermission(function () {
oData.desktopNotifications.valueHasMutated();
if (Enums.DesktopNotifications.Allowed === oData.desktopNotificationsPermisions())
{
if (oData.desktopNotifications())
{
oData.desktopNotifications.valueHasMutated();
}
else
{
oData.desktopNotifications(true);
}
}
else
{
if (oData.desktopNotifications())
{
oData.desktopNotifications(false);
}
else
{
oData.desktopNotifications.valueHasMutated();
}
}
});
}
else
{
oData.desktopNotifications(false);
}
}
else
{
oData.desktopNotifications(false);
}
}
});
oData.language = ko.observable('');
oData.languages = ko.observableArray([]);
oData.mainLanguage = ko.computed({
'read': oData.language,
'write': function (sValue) {
if (sValue !== oData.language())
{
if (-1 < Utils.inArray(sValue, oData.languages()))
{
oData.language(sValue);
}
else if (0 < oData.languages().length)
{
oData.language(oData.languages()[0]);
}
}
else
{
oData.language.valueHasMutated();
}
}
});
oData.theme = ko.observable('');
oData.themes = ko.observableArray([]);
oData.themeBackgroundName = ko.observable('');
oData.themeBackgroundHash = ko.observable('');
oData.mainTheme = ko.computed({
'read': oData.theme,
'write': function (sValue) {
if (sValue !== oData.theme())
{
var aThemes = oData.themes();
if (-1 < Utils.inArray(sValue, aThemes))
{
oData.theme(sValue);
}
else if (0 < aThemes.length)
{
oData.theme(aThemes[0]);
}
}
else
{
oData.theme.valueHasMutated();
}
}
});
oData.capaAdditionalAccounts = ko.observable(false); oData.capaAdditionalAccounts = ko.observable(false);
oData.capaAdditionalIdentities = ko.observable(false); oData.capaAdditionalIdentities = ko.observable(false);
oData.capaGravatar = ko.observable(false); oData.capaGravatar = ko.observable(false);
@ -1061,54 +666,6 @@
oData.weakPassword = ko.observable(false); oData.weakPassword = ko.observable(false);
oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200});
oData.mainMessagesPerPage = oData.messagesPerPage;
oData.mainMessagesPerPage = ko.computed({
'read': oData.messagesPerPage,
'write': function (iValue) {
if (-1 < Utils.inArray(Utils.pInt(iValue), Consts.Defaults.MessagesPerPageArray))
{
if (iValue !== oData.messagesPerPage())
{
oData.messagesPerPage(iValue);
}
}
else
{
oData.messagesPerPage.valueHasMutated();
}
}
});
oData.facebookSupported = ko.observable(false);
oData.facebookEnable = ko.observable(false);
oData.facebookAppID = ko.observable('');
oData.facebookAppSecret = ko.observable('');
oData.twitterEnable = ko.observable(false);
oData.twitterConsumerKey = ko.observable('');
oData.twitterConsumerSecret = ko.observable('');
oData.googleEnable = ko.observable(false);
oData.googleEnable.auth = ko.observable(false);
oData.googleEnable.drive = ko.observable(false);
oData.googleEnable.preview = ko.observable(false);
oData.googleClientID = ko.observable('');
oData.googleClientSecret = ko.observable('');
oData.googleApiKey = ko.observable('');
oData.googleEnable.requireClientSettings = ko.computed(function () {
return oData.googleEnable() && (oData.googleEnable.auth() || oData.googleEnable.drive());
});
oData.googleEnable.requireApiKey = ko.computed(function () {
return oData.googleEnable() && oData.googleEnable.drive();
});
oData.dropboxEnable = ko.observable(false);
oData.dropboxApiKey = ko.observable('');
oData.contactsIsAllowed = ko.observable(false); oData.contactsIsAllowed = ko.observable(false);
}; };
@ -1153,13 +710,13 @@
} }
else if (oMomentNow.format('L') === oMoment.format('L')) else if (oMomentNow.format('L') === oMoment.format('L'))
{ {
sResult = Utils.i18n('MESSAGE_LIST/TODAY_AT', { sResult = require('Common/Translator').i18n('MESSAGE_LIST/TODAY_AT', {
'TIME': oMoment.format('LT') 'TIME': oMoment.format('LT')
}); });
} }
else if (oMomentNow.clone().subtract('days', 1).format('L') === oMoment.format('L')) else if (oMomentNow.clone().subtract('days', 1).format('L') === oMoment.format('L'))
{ {
sResult = Utils.i18n('MESSAGE_LIST/YESTERDAY_AT', { sResult = require('Common/Translator').i18n('MESSAGE_LIST/YESTERDAY_AT', {
'TIME': oMoment.format('LT') 'TIME': oMoment.format('LT')
}); });
} }
@ -1224,7 +781,7 @@
*/ */
Utils.convertLangName = function (sLanguage, bEng) Utils.convertLangName = function (sLanguage, bEng)
{ {
return Utils.i18n('LANGS_NAMES' + (true === bEng ? '_EN' : '') + '/LANG_' + return require('Common/Translator').i18n('LANGS_NAMES' + (true === bEng ? '_EN' : '') + '/LANG_' +
sLanguage.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, sLanguage); sLanguage.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, sLanguage);
}; };
@ -1291,7 +848,7 @@
$('#rl-content', oBody).html(oTemplate.html()); $('#rl-content', oBody).html(oTemplate.html());
$('html', oWin.document).addClass('external ' + $('html').attr('class')); $('html', oWin.document).addClass('external ' + $('html').attr('class'));
Utils.i18nToNode(oBody); require('Common/Translator').i18nToNode(oBody);
if (oViewModel && $('#rl-content', oBody)[0]) if (oViewModel && $('#rl-content', oBody)[0])
{ {
@ -1985,33 +1542,6 @@
} }
}; };
/**
* @param {string} sLanguage
* @param {Function=} fDone
* @param {Function=} fFail
*/
Utils.reloadLanguage = function (sLanguage, fDone, fFail)
{
var iStart = Utils.microtime();
Globals.$html.addClass('rl-changing-language');
$.ajax({
'url': require('Common/Links').langLink(sLanguage),
'dataType': 'script',
'cache': true
})
.fail(fFail || Utils.emptyFunction)
.done(function () {
_.delay(function () {
Utils.i18nReload();
(fDone || Utils.emptyFunction)();
Globals.$html.removeClass('rl-changing-language');
}, 500 < Utils.microtime() - iStart ? 1 : 500);
})
;
};
/** /**
* @param {Object} oParams * @param {Object} oParams
*/ */

View file

@ -50,7 +50,7 @@
{ {
oParams.element = $(oCmponentInfo.element); oParams.element = $(oCmponentInfo.element);
Utils.i18nToNode(oParams.element); require('Common/Translator').i18nToNode(oParams.element);
if (!Utils.isUnd(oParams.inline) && ko.unwrap(oParams.inline)) if (!Utils.isUnd(oParams.inline) && ko.unwrap(oParams.inline))
{ {

60
dev/External/ko.js vendored
View file

@ -41,7 +41,7 @@
sPlacement = '', sPlacement = '',
oSubscription = null, oSubscription = null,
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Utils = require('Common/Utils') Translator = require('Common/Translator')
; ;
if (!Globals.bMobileDevice) if (!Globals.bMobileDevice)
@ -63,7 +63,7 @@
'title': function () { 'title': function () {
var sValue = bi18n ? ko.unwrap(fValueAccessor()) : fValueAccessor()(); var sValue = bi18n ? ko.unwrap(fValueAccessor()) : fValueAccessor()();
return '' === sValue || $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' : return '' === sValue || $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' :
'<span class="tooltip-class ' + sClass + '">' + (bi18n ? Utils.i18n(sValue) : sValue) + '</span>'; '<span class="tooltip-class ' + sClass + '">' + (bi18n ? Translator.i18n(sValue) : sValue) + '</span>';
} }
}).on('click.koTooltip', function () { }).on('click.koTooltip', function () {
$oEl.tooltip('hide'); $oEl.tooltip('hide');
@ -286,16 +286,14 @@
ko.bindingHandlers.i18nInit = { ko.bindingHandlers.i18nInit = {
'init': function (oElement) { 'init': function (oElement) {
var Utils = require('Common/Utils'); require('Common/Translator').i18nToNode(oElement);
Utils.i18nToNode(oElement);
} }
}; };
ko.bindingHandlers.i18nUpdate = { ko.bindingHandlers.i18nUpdate = {
'update': function (oElement, fValueAccessor) { 'update': function (oElement, fValueAccessor) {
var Utils = require('Common/Utils');
ko.unwrap(fValueAccessor()); ko.unwrap(fValueAccessor());
Utils.i18nToNode(oElement); require('Common/Translator').i18nToNode(oElement);
} }
}; };
@ -788,6 +786,56 @@
return oResult; return oResult;
}; };
ko.extenders.limitedList = function (oTarget, mList)
{
var
Utils = require('Common/Utils'),
oResult = ko.computed({
'read': oTarget,
'write': function (sNewValue) {
var
sCurrentValue = ko.unwrap(oTarget),
aList = ko.unwrap(mList)
;
if (Utils.isNonEmptyArray(aList))
{
if (-1 < Utils.inArray(sNewValue, aList))
{
oTarget(sNewValue);
}
else if (-1 < Utils.inArray(sCurrentValue, aList))
{
oTarget(sCurrentValue + ' ');
oTarget(sCurrentValue);
}
else
{
oTarget(aList[0] + ' ');
oTarget(aList[0]);
}
}
else
{
oTarget('');
}
}
})
;
oResult(oTarget());
if (!oResult.valueHasMutated)
{
oResult.valueHasMutated = function () {
oTarget.valueHasMutated();
};
}
return oResult;
};
ko.extenders.reversible = function (oTarget) ko.extenders.reversible = function (oTarget)
{ {
var mValue = oTarget(); var mValue = oTarget();

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel')
; ;
@ -34,7 +35,7 @@
this.placeholderValue = ko.computed(function () { this.placeholderValue = ko.computed(function () {
var sPlaceholder = this.placeholder(); var sPlaceholder = this.placeholder();
return sPlaceholder ? Utils.i18n(sPlaceholder) : ''; return sPlaceholder ? Translator.i18n(sPlaceholder) : '';
}, this); }, this);
this.largeValue = ko.computed(function () { this.largeValue = ko.computed(function () {

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
@ -71,23 +72,23 @@
switch (this.actionType()) switch (this.actionType())
{ {
case Enums.FiltersAction.MoveTo: case Enums.FiltersAction.MoveTo:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', { sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', {
'FOLDER': fGetRealFolderName(sActionValue) 'FOLDER': fGetRealFolderName(sActionValue)
}); });
break; break;
case Enums.FiltersAction.Forward: case Enums.FiltersAction.Forward:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', { sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', {
'EMAIL': sActionValue 'EMAIL': sActionValue
}); });
break; break;
case Enums.FiltersAction.Vacation: case Enums.FiltersAction.Vacation:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_VACATION_MESSAGE'); sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_VACATION_MESSAGE');
break; break;
case Enums.FiltersAction.Reject: case Enums.FiltersAction.Reject:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_REJECT'); sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_REJECT');
break; break;
case Enums.FiltersAction.Discard: case Enums.FiltersAction.Discard:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_DISCARD'); sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_DISCARD');
break; break;
} }

View file

@ -8,9 +8,9 @@
ko = require('ko'), ko = require('ko'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Events = require('Common/Events'), Events = require('Common/Events'),
Translator = require('Common/Translator'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
@ -86,7 +86,7 @@
}, this); }, this);
this.visible = ko.computed(function () { this.visible = ko.computed(function () {
var var
bSubScribed = this.subScribed(), bSubScribed = this.subScribed(),
bSubFolders = this.hasSubScribedSubfolders() bSubFolders = this.hasSubScribedSubfolders()
@ -186,7 +186,7 @@
this.localName = ko.computed(function () { this.localName = ko.computed(function () {
Globals.langChangeTrigger(); Translator.trigger();
var var
iType = this.type(), iType = this.type(),
@ -198,22 +198,22 @@
switch (iType) switch (iType)
{ {
case Enums.FolderType.Inbox: case Enums.FolderType.Inbox:
sName = Utils.i18n('FOLDER_LIST/INBOX_NAME'); sName = Translator.i18n('FOLDER_LIST/INBOX_NAME');
break; break;
case Enums.FolderType.SentItems: case Enums.FolderType.SentItems:
sName = Utils.i18n('FOLDER_LIST/SENT_NAME'); sName = Translator.i18n('FOLDER_LIST/SENT_NAME');
break; break;
case Enums.FolderType.Draft: case Enums.FolderType.Draft:
sName = Utils.i18n('FOLDER_LIST/DRAFTS_NAME'); sName = Translator.i18n('FOLDER_LIST/DRAFTS_NAME');
break; break;
case Enums.FolderType.Spam: case Enums.FolderType.Spam:
sName = Utils.i18n('FOLDER_LIST/SPAM_NAME'); sName = Translator.i18n('FOLDER_LIST/SPAM_NAME');
break; break;
case Enums.FolderType.Trash: case Enums.FolderType.Trash:
sName = Utils.i18n('FOLDER_LIST/TRASH_NAME'); sName = Translator.i18n('FOLDER_LIST/TRASH_NAME');
break; break;
case Enums.FolderType.Archive: case Enums.FolderType.Archive:
sName = Utils.i18n('FOLDER_LIST/ARCHIVE_NAME'); sName = Translator.i18n('FOLDER_LIST/ARCHIVE_NAME');
break; break;
} }
} }
@ -224,7 +224,7 @@
this.manageFolderSystemName = ko.computed(function () { this.manageFolderSystemName = ko.computed(function () {
Globals.langChangeTrigger(); Translator.trigger();
var var
sSuffix = '', sSuffix = '',
@ -237,22 +237,22 @@
switch (iType) switch (iType)
{ {
case Enums.FolderType.Inbox: case Enums.FolderType.Inbox:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/INBOX_NAME') + ')'; sSuffix = '(' + Translator.i18n('FOLDER_LIST/INBOX_NAME') + ')';
break; break;
case Enums.FolderType.SentItems: case Enums.FolderType.SentItems:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/SENT_NAME') + ')'; sSuffix = '(' + Translator.i18n('FOLDER_LIST/SENT_NAME') + ')';
break; break;
case Enums.FolderType.Draft: case Enums.FolderType.Draft:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/DRAFTS_NAME') + ')'; sSuffix = '(' + Translator.i18n('FOLDER_LIST/DRAFTS_NAME') + ')';
break; break;
case Enums.FolderType.Spam: case Enums.FolderType.Spam:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/SPAM_NAME') + ')'; sSuffix = '(' + Translator.i18n('FOLDER_LIST/SPAM_NAME') + ')';
break; break;
case Enums.FolderType.Trash: case Enums.FolderType.Trash:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/TRASH_NAME') + ')'; sSuffix = '(' + Translator.i18n('FOLDER_LIST/TRASH_NAME') + ')';
break; break;
case Enums.FolderType.Archive: case Enums.FolderType.Archive:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')'; sSuffix = '(' + Translator.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')';
break; break;
} }
} }

View file

@ -10,6 +10,9 @@
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Events = require('Common/Events'), Events = require('Common/Events'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
@ -48,7 +51,8 @@
; ;
require('App/User').setTitle(('' === sEmail ? '' : require('App/User').setTitle(('' === sEmail ? '' :
(0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX')); (0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') +
sEmail + ' - ') + Translator.i18n('TITLES/MAILBOX'));
}; };
MailBoxUserScreen.prototype.onShow = function () MailBoxUserScreen.prototype.onShow = function ()
@ -67,7 +71,7 @@
{ {
if (Utils.isUnd(bPreview) ? false : !!bPreview) if (Utils.isUnd(bPreview) ? false : !!bPreview)
{ {
if (Enums.Layout.NoPreview === Data.layout() && !Data.message()) if (Enums.Layout.NoPreview === UserSettingsStore.layout() && !Data.message())
{ {
require('App/User').historyBack(); require('App/User').historyBack();
} }
@ -87,7 +91,7 @@
.messageListSearch(sSearch) .messageListSearch(sSearch)
; ;
if (Enums.Layout.NoPreview === Data.layout() && Data.message()) if (Enums.Layout.NoPreview === UserSettingsStore.layout() && Data.message())
{ {
Data.message(null); Data.message(null);
} }
@ -103,7 +107,7 @@
Data.messageList.subscribe(Utils.windowResizeCallback); Data.messageList.subscribe(Utils.windowResizeCallback);
Data.message.subscribe(Utils.windowResizeCallback); Data.message.subscribe(Utils.windowResizeCallback);
Data.layout.subscribe(function (nValue) { UserSettingsStore.layout.subscribe(function (nValue) {
Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue); Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
Globals.$html.toggleClass('rl-side-preview-pane', Enums.Layout.SidePreview === nValue); Globals.$html.toggleClass('rl-side-preview-pane', Enums.Layout.SidePreview === nValue);
@ -112,7 +116,7 @@
Events.pub('layout', [nValue]); Events.pub('layout', [nValue]);
}); });
Data.layout.valueHasMutated(); UserSettingsStore.layout.valueHasMutated();
Events.sub('mailbox.inbox-unread-count', function (nCount) { Events.sub('mailbox.inbox-unread-count', function (nCount) {
Data.foldersInboxUnreadCount(nCount); Data.foldersInboxUnreadCount(nCount);

View file

@ -7,8 +7,8 @@
_ = require('_'), _ = require('_'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
@ -29,8 +29,8 @@
require('View/User/Settings/Pane') require('View/User/Settings/Pane')
]); ]);
Utils.initOnStartOrLangChange(function () { Translator.initOnStartOrLangChange(function () {
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS'); this.sSettingsTitle = Translator.i18n('TITLES/SETTINGS');
}, this, function () { }, this, function () {
this.setSettingsTitle(); this.setSettingsTitle();
}); });

View file

@ -11,6 +11,8 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data') Data = require('Storage/Admin/Data')
; ;
@ -20,11 +22,10 @@
*/ */
function GeneralAdminSettings() function GeneralAdminSettings()
{ {
this.mainLanguage = Data.mainLanguage; this.language = UserSettingsStore.language;
this.mainTheme = Data.mainTheme; this.languages = UserSettingsStore.languages;
this.theme = UserSettingsStore.theme;
this.language = Data.language; this.themes = UserSettingsStore.themes;
this.theme = Data.theme;
this.capaThemes = Data.capaThemes; this.capaThemes = Data.capaThemes;
this.capaUserBackground = Data.capaUserBackground; this.capaUserBackground = Data.capaUserBackground;
@ -44,16 +45,16 @@
].join('') : ''; ].join('') : '';
this.themesOptions = ko.computed(function () { this.themesOptions = ko.computed(function () {
return _.map(Data.themes(), function (sTheme) { return _.map(this.themes(), function (sTheme) {
return { return {
'optValue': sTheme, 'optValue': sTheme,
'optText': Utils.convertThemeName(sTheme) 'optText': Utils.convertThemeName(sTheme)
}; };
}); });
}); }, this);
this.mainLanguageFullName = ko.computed(function () { this.languageFullName = ko.computed(function () {
return Utils.convertLangName(this.mainLanguage()); return Utils.convertLangName(this.language());
}, this); }, this);
this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);

View file

@ -8,7 +8,7 @@
ko = require('ko'), ko = require('ko'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Translator = require('Common/Translator'),
Data = require('Storage/Admin/Data'), Data = require('Storage/Admin/Data'),
Remote = require('Storage/Admin/Remote') Remote = require('Storage/Admin/Remote')
@ -61,11 +61,11 @@
{ {
if (oData && oData.ErrorCode) if (oData && oData.ErrorCode)
{ {
self.packagesError(Utils.getNotification(oData.ErrorCode)); self.packagesError(Translator.getNotification(oData.ErrorCode));
} }
else else
{ {
self.packagesError(Utils.getNotification( self.packagesError(Translator.getNotification(
bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage)); bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
} }
} }

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'), Data = require('Storage/Admin/Data'),
@ -99,7 +100,7 @@
} }
else else
{ {
this.pluginsError(Utils.getNotification(oData.ErrorCode)); this.pluginsError(Translator.getNotification(oData.ErrorCode));
} }
} }
} }

View file

@ -16,32 +16,42 @@
*/ */
function SocialAdminSettings() function SocialAdminSettings()
{ {
var Data = require('Storage/Admin/Data'); var SocialStore = require('Stores/Social');
this.googleEnable = Data.googleEnable; this.googleEnable = SocialStore.google.enabled;
this.googleClientID = Data.googleClientID; this.googleEnableAuth = SocialStore.google.capa.auth;
this.googleApiKey = Data.googleApiKey; this.googleEnableDrive = SocialStore.google.capa.drive;
this.googleClientSecret = Data.googleClientSecret; this.googleEnablePreview = SocialStore.google.capa.preview;
this.googleEnableRequireClientSettings = SocialStore.google.require.clientSettings;
this.googleEnableRequireApiKey = SocialStore.google.require.apiKeySettings;
this.googleClientID = SocialStore.google.clientID;
this.googleClientSecret = SocialStore.google.clientSecret;
this.googleApiKey = SocialStore.google.apiKey;
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle); this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle); this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle); this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
this.facebookSupported = Data.facebookSupported; this.facebookSupported = SocialStore.facebook.supported;
this.facebookEnable = Data.facebookEnable; this.facebookEnable = SocialStore.facebook.enabled;
this.facebookAppID = Data.facebookAppID; this.facebookAppID = SocialStore.facebook.appID;
this.facebookAppSecret = Data.facebookAppSecret; this.facebookAppSecret = SocialStore.facebook.appSecret;
this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle); this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle); this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.twitterEnable = Data.twitterEnable; this.twitterEnable = SocialStore.twitter.enabled;
this.twitterConsumerKey = Data.twitterConsumerKey; this.twitterConsumerKey = SocialStore.twitter.consumerKey;
this.twitterConsumerSecret = Data.twitterConsumerSecret; this.twitterConsumerSecret = SocialStore.twitter.consumerSecret;
this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle); this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle); this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.dropboxEnable = Data.dropboxEnable; this.dropboxEnable = SocialStore.dropbox.enabled;
this.dropboxApiKey = Data.dropboxApiKey; this.dropboxApiKey = SocialStore.dropbox.apiKey;
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle); this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
} }
@ -116,19 +126,19 @@
}); });
}); });
self.googleEnable.auth.subscribe(function (bValue) { self.googleEnableAuth.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, { Remote.saveAdminConfig(Utils.emptyFunction, {
'GoogleEnableAuth': bValue ? '1' : '0' 'GoogleEnableAuth': bValue ? '1' : '0'
}); });
}); });
self.googleEnable.drive.subscribe(function (bValue) { self.googleEnableDrive.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, { Remote.saveAdminConfig(Utils.emptyFunction, {
'GoogleEnableDrive': bValue ? '1' : '0' 'GoogleEnableDrive': bValue ? '1' : '0'
}); });
}); });
self.googleEnable.preview.subscribe(function (bValue) { self.googleEnablePreview.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, { Remote.saveAdminConfig(Utils.emptyFunction, {
'GoogleEnablePreview': bValue ? '1' : '0' 'GoogleEnablePreview': bValue ? '1' : '0'
}); });

View file

@ -9,7 +9,7 @@
ko = require('ko'), ko = require('ko'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Translator = require('Common/Translator'),
Links = require('Common/Links'), Links = require('Common/Links'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
@ -24,7 +24,7 @@
this.accounts = Data.accounts; this.accounts = Data.accounts;
this.processText = ko.computed(function () { this.processText = ko.computed(function () {
return Data.accountsLoading() ? Utils.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : ''; return Data.accountsLoading() ? Translator.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : '';
}, this); }, this);
this.visibility = ko.computed(function () { this.visibility = ko.computed(function () {

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote') Remote = require('Storage/User/Remote')
; ;
@ -53,7 +54,7 @@
if (this.newPassword() !== this.newPassword2()) if (this.newPassword() !== this.newPassword2())
{ {
this.passwordMismatch(true); this.passwordMismatch(true);
this.errorDescription(Utils.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH')); this.errorDescription(Translator.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
} }
else else
{ {
@ -112,7 +113,7 @@
this.passwordUpdateError(true); this.passwordUpdateError(true);
this.errorDescription(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : this.errorDescription(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.CouldNotSaveNewPassword)); Translator.getNotification(Enums.Notification.CouldNotSaveNewPassword));
} }
}; };

View file

@ -9,8 +9,9 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'), FilterStore = require('Stores/Filter'),
Remote = require('Storage/User/Remote') Remote = require('Storage/User/Remote')
; ;
@ -22,6 +23,9 @@
{ {
var self = this; var self = this;
this.modules = FilterStore.modules;
this.filters = FilterStore.collection;
this.haveChanges = ko.observable(false); this.haveChanges = ko.observable(false);
this.processText = ko.observable(''); this.processText = ko.observable('');
@ -29,22 +33,16 @@
this.visibility = ko.observable(false); this.visibility = ko.observable(false);
this.modules = Data.filterModules;
this.filters = ko.observableArray([]);
this.filters.loading = ko.observable(false).extend({'throttle': 200});
this.filters.saving = ko.observable(false).extend({'throttle': 200});
this.filters.subscribe(Utils.windowResizeCallback); this.filters.subscribe(Utils.windowResizeCallback);
this.filterRaw = ko.observable(''); this.filterRaw = FilterStore.raw;
this.filterRaw.capa = ko.observable(''); this.filterRaw.capa = FilterStore.capa;
this.filterRaw.active = ko.observable(false); this.filterRaw.active = ko.observable(false);
this.filterRaw.allow = ko.observable(false); this.filterRaw.allow = ko.observable(false);
this.filterRaw.error = ko.observable(false); this.filterRaw.error = ko.observable(false);
this.processText = ko.computed(function () { this.processText = ko.computed(function () {
return this.filters.loading() ? Utils.i18n('SETTINGS_FILTERS/LOADING_PROCESS') : ''; return this.filters.loading() ? Translator.i18n('SETTINGS_FILTERS/LOADING_PROCESS') : '';
}, this); }, this);
this.visibility = ko.computed(function () { this.visibility = ko.computed(function () {
@ -78,8 +76,8 @@
} }
else else
{ {
self.saveErrorText(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : self.saveErrorText(oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.CantSaveFilters)); Translator.getNotification(Enums.Notification.CantSaveFilters));
} }
}, this.filters(), this.filterRaw(), this.filterRaw.active()); }, this.filters(), this.filterRaw(), this.filterRaw.active());
@ -173,7 +171,6 @@
require('Knoin/Knoin').showScreenPopup( require('Knoin/Knoin').showScreenPopup(
require('View/Popup/Filter'), [oNew, function () { require('View/Popup/Filter'), [oNew, function () {
self.filters.push(oNew); self.filters.push(oNew);
self.haveChanges(true);
self.filterRaw.active(false); self.filterRaw.active(false);
}, false]); }, false]);
}; };

View file

@ -8,6 +8,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
@ -34,19 +35,19 @@
if (bCreating) if (bCreating)
{ {
return Utils.i18n('SETTINGS_FOLDERS/CREATING_PROCESS'); return Translator.i18n('SETTINGS_FOLDERS/CREATING_PROCESS');
} }
else if (bDeleting) else if (bDeleting)
{ {
return Utils.i18n('SETTINGS_FOLDERS/DELETING_PROCESS'); return Translator.i18n('SETTINGS_FOLDERS/DELETING_PROCESS');
} }
else if (bRenaming) else if (bRenaming)
{ {
return Utils.i18n('SETTINGS_FOLDERS/RENAMING_PROCESS'); return Translator.i18n('SETTINGS_FOLDERS/RENAMING_PROCESS');
} }
else if (bLoading) else if (bLoading)
{ {
return Utils.i18n('SETTINGS_FOLDERS/LOADING_PROCESS'); return Translator.i18n('SETTINGS_FOLDERS/LOADING_PROCESS');
} }
return ''; return '';
@ -105,7 +106,7 @@
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result) if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{ {
Data.folderList.error( Data.folderList.error(
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER')); oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
} }
require('App/User').folders(); require('App/User').folders();
@ -176,7 +177,7 @@
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result) if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{ {
Data.folderList.error( Data.folderList.error(
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER')); oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
} }
require('App/User').folders(); require('App/User').folders();
@ -188,7 +189,7 @@
} }
else if (0 < oFolderToRemove.privateMessageCountAll()) else if (0 < oFolderToRemove.privateMessageCountAll())
{ {
Data.folderList.error(Utils.getNotification(Enums.Notification.CantDeleteNonEmptyFolder)); Data.folderList.error(Translator.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
} }
}; };

View file

@ -11,6 +11,10 @@
Consts = require('Common/Consts'), Consts = require('Common/Consts'),
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
NotificationSettingsStore = require('Stores/NotificationSettings'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote') Remote = require('Storage/User/Remote')
@ -21,31 +25,28 @@
*/ */
function GeneralUserSettings() function GeneralUserSettings()
{ {
this.mainLanguage = Data.mainLanguage; this.language = UserSettingsStore.language;
this.mainMessagesPerPage = Data.mainMessagesPerPage; this.messagesPerPage = UserSettingsStore.messagesPerPage;
this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray; this.messagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
this.editorDefaultType = Data.editorDefaultType;
this.editorDefaultType = UserSettingsStore.editorDefaultType;
this.layout = UserSettingsStore.layout;
this.usePreviewPane = UserSettingsStore.usePreviewPane;
this.showImages = Data.showImages; this.showImages = Data.showImages;
this.useDesktopNotifications = Data.useDesktopNotifications;
this.enableDesktopNotification = NotificationSettingsStore.enableDesktopNotification;
this.isDesktopNotificationSupported = NotificationSettingsStore.isDesktopNotificationSupported;
this.isDesktopNotificationDenied = NotificationSettingsStore.isDesktopNotificationDenied;
this.threading = Data.threading; this.threading = Data.threading;
this.useThreads = Data.useThreads; this.useThreads = Data.useThreads;
this.replySameFolder = Data.replySameFolder; this.replySameFolder = Data.replySameFolder;
this.layout = Data.layout;
this.usePreviewPane = Data.usePreviewPane;
this.useCheckboxesInList = Data.useCheckboxesInList; this.useCheckboxesInList = Data.useCheckboxesInList;
this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings; this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
this.isDesktopNotificationsSupported = ko.computed(function () { this.languageFullName = ko.computed(function () {
return Enums.DesktopNotifications.NotSupported !== Data.desktopNotificationsPermisions(); return Utils.convertLangName(this.language());
});
this.isDesktopNotificationsDenied = ko.computed(function () {
return Enums.DesktopNotifications.NotSupported === Data.desktopNotificationsPermisions() ||
Enums.DesktopNotifications.Denied === Data.desktopNotificationsPermisions();
});
this.mainLanguageFullName = ko.computed(function () {
return Utils.convertLangName(this.mainLanguage());
}, this); }, this);
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100}); this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
@ -57,21 +58,21 @@
this.isAnimationSupported = Globals.bAnimationSupported; this.isAnimationSupported = Globals.bAnimationSupported;
this.editorDefaultTypes = ko.computed(function () { this.editorDefaultTypes = ko.computed(function () {
Globals.langChangeTrigger(); Translator.trigger();
return [ return [
{'id': Enums.EditorDefaultType.Html, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')}, {'id': Enums.EditorDefaultType.Html, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
{'id': Enums.EditorDefaultType.Plain, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')}, {'id': Enums.EditorDefaultType.Plain, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
{'id': Enums.EditorDefaultType.HtmlForced, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')}, {'id': Enums.EditorDefaultType.HtmlForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
{'id': Enums.EditorDefaultType.PlainForced, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')} {'id': Enums.EditorDefaultType.PlainForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
]; ];
}, this); }, this);
this.layoutTypes = ko.computed(function () { this.layoutTypes = ko.computed(function () {
Globals.langChangeTrigger(); Translator.trigger();
return [ return [
{'id': Enums.Layout.NoPreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')}, {'id': Enums.Layout.NoPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
{'id': Enums.Layout.SidePreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')}, {'id': Enums.Layout.SidePreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
{'id': Enums.Layout.BottomPreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')} {'id': Enums.Layout.BottomPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
]; ];
}, this); }, this);
} }
@ -96,11 +97,11 @@
} }
; ;
Data.language.subscribe(function (sValue) { self.language.subscribe(function (sValue) {
self.languageTrigger(Enums.SaveSettingsStep.Animate); self.languageTrigger(Enums.SaveSettingsStep.Animate);
Utils.reloadLanguage(sValue, Translator.reload(sValue,
fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult), fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult),
fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult)); fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult));
@ -109,13 +110,13 @@
}); });
}); });
Data.editorDefaultType.subscribe(function (sValue) { self.editorDefaultType.subscribe(function (sValue) {
Remote.saveSettings(f0, { Remote.saveSettings(f0, {
'EditorDefaultType': sValue 'EditorDefaultType': sValue
}); });
}); });
Data.messagesPerPage.subscribe(function (iValue) { self.messagesPerPage.subscribe(function (iValue) {
Remote.saveSettings(f1, { Remote.saveSettings(f1, {
'MPP': iValue 'MPP': iValue
}); });
@ -127,7 +128,7 @@
}); });
}); });
Data.useDesktopNotifications.subscribe(function (bValue) { self.enableDesktopNotification.subscribe(function (bValue) {
Utils.timeOutAction('SaveDesktopNotifications', function () { Utils.timeOutAction('SaveDesktopNotifications', function () {
Remote.saveSettings(null, { Remote.saveSettings(null, {
'DesktopNotifications': bValue ? '1' : '0' 'DesktopNotifications': bValue ? '1' : '0'
@ -152,7 +153,7 @@
}); });
}); });
Data.layout.subscribe(function (nValue) { self.layout.subscribe(function (nValue) {
Data.messageList([]); Data.messageList([]);
@ -172,7 +173,7 @@
GeneralUserSettings.prototype.onShow = function () GeneralUserSettings.prototype.onShow = function ()
{ {
Data.desktopNotifications.valueHasMutated(); this.enableDesktopNotification.valueHasMutated();
}; };
GeneralUserSettings.prototype.selectLanguage = function () GeneralUserSettings.prototype.selectLanguage = function ()

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
HtmlEditor = require('Common/HtmlEditor'), HtmlEditor = require('Common/HtmlEditor'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote') Remote = require('Storage/User/Remote')
@ -74,7 +75,7 @@
}, this); }, this);
this.processText = ko.computed(function () { this.processText = ko.computed(function () {
return Data.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : ''; return Data.identitiesLoading() ? Translator.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : '';
}, this); }, this);
this.visibility = ko.computed(function () { this.visibility = ko.computed(function () {

View file

@ -7,8 +7,8 @@
ko = require('ko'), ko = require('ko'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote') Remote = require('Storage/User/Remote')
; ;
@ -34,8 +34,8 @@
this.bFirst = true; this.bFirst = true;
this.viewTwoFactorStatus = ko.computed(function () { this.viewTwoFactorStatus = ko.computed(function () {
Globals.langChangeTrigger(); Translator.trigger();
return Utils.i18n( return Translator.i18n(
this.twoFactorStatus() ? this.twoFactorStatus() ?
'SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC' : 'SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC' :
'SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC' 'SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'

View file

@ -10,26 +10,29 @@
{ {
var var
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Data = require('Storage/User/Data') SocialStore = require('Stores/Social')
; ;
this.googleEnable = Data.googleEnable; this.googleEnable = SocialStore.google.enabled;
this.googleEnableAuth = SocialStore.google.capa.auth;
this.googleEnableDrive = SocialStore.google.capa.drive;
this.googleEnablePreview = SocialStore.google.capa.preview;
this.googleActions = Data.googleActions; this.googleActions = SocialStore.google.loading;
this.googleLoggined = Data.googleLoggined; this.googleLoggined = SocialStore.google.loggined;
this.googleUserName = Data.googleUserName; this.googleUserName = SocialStore.google.userName;
this.facebookEnable = Data.facebookEnable; this.facebookEnable = SocialStore.facebook.enabled;
this.facebookActions = Data.facebookActions; this.facebookActions = SocialStore.facebook.loading;
this.facebookLoggined = Data.facebookLoggined; this.facebookLoggined = SocialStore.facebook.loggined;
this.facebookUserName = Data.facebookUserName; this.facebookUserName = SocialStore.facebook.userName;
this.twitterEnable = Data.twitterEnable; this.twitterEnable = SocialStore.twitter.enabled;
this.twitterActions = Data.twitterActions; this.twitterActions = SocialStore.twitter.loading;
this.twitterLoggined = Data.twitterLoggined; this.twitterLoggined = SocialStore.twitter.loggined;
this.twitterUserName = Data.twitterUserName; this.twitterUserName = SocialStore.twitter.userName;
this.connectGoogle = Utils.createCommand(this, function () { this.connectGoogle = Utils.createCommand(this, function () {
if (!this.googleLoggined()) if (!this.googleLoggined())

View file

@ -12,6 +12,9 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote') Remote = require('Storage/User/Remote')
@ -22,12 +25,13 @@
*/ */
function ThemesUserSettings() function ThemesUserSettings()
{ {
this.mainTheme = Data.mainTheme; this.theme = UserSettingsStore.theme;
this.themes = UserSettingsStore.themes;
this.themesObjects = ko.observableArray([]); this.themesObjects = ko.observableArray([]);
this.background = {}; this.background = {};
this.background.name = Data.themeBackgroundName; this.background.name = UserSettingsStore.themeBackgroundName;
this.background.hash = Data.themeBackgroundHash; this.background.hash = UserSettingsStore.themeBackgroundHash;
this.background.uploaderButton = ko.observable(null); this.background.uploaderButton = ko.observable(null);
this.background.loading = ko.observable(false); this.background.loading = ko.observable(false);
this.background.error = ko.observable(''); this.background.error = ko.observable('');
@ -39,7 +43,7 @@
this.iTimer = 0; this.iTimer = 0;
this.oThemeAjaxRequest = null; this.oThemeAjaxRequest = null;
Data.theme.subscribe(function (sValue) { this.theme.subscribe(function (sValue) {
_.each(this.themesObjects(), function (oTheme) { _.each(this.themesObjects(), function (oTheme) {
oTheme.selected(sValue === oTheme.name); oTheme.selected(sValue === oTheme.name);
@ -54,14 +58,14 @@
}, this); }, this);
this.background.hash.subscribe(function (sValue) { this.background.hash.subscribe(function (sValue) {
Utils.changeTheme(Data.theme(), sValue, this.themeTrigger, Links); Utils.changeTheme(this.theme(), sValue, this.themeTrigger, Links);
}, this); }, this);
} }
ThemesUserSettings.prototype.onBuild = function () ThemesUserSettings.prototype.onBuild = function ()
{ {
var sCurrentTheme = Data.theme(); var sCurrentTheme = this.theme();
this.themesObjects(_.map(Data.themes(), function (sTheme) { this.themesObjects(_.map(this.themes(), function (sTheme) {
return { return {
'name': sTheme, 'name': sTheme,
'nameDisplay': Utils.convertThemeName(sTheme), 'nameDisplay': Utils.convertThemeName(sTheme),
@ -135,10 +139,10 @@
switch (oData.ErrorCode) switch (oData.ErrorCode)
{ {
case Enums.UploadErrorCode.FileIsTooBig: case Enums.UploadErrorCode.FileIsTooBig:
sError = Utils.i18n('SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG'); sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG');
break; break;
case Enums.UploadErrorCode.FileType: case Enums.UploadErrorCode.FileType:
sError = Utils.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR'); sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR');
break; break;
} }
} }
@ -148,7 +152,7 @@
sError = oData.ErrorMessage; sError = oData.ErrorMessage;
} }
this.background.error(sError || Utils.i18n('SETTINGS_THEMES/ERROR_UNKNOWN')); this.background.error(sError || Translator.i18n('SETTINGS_THEMES/ERROR_UNKNOWN'));
} }
return true; return true;

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {
@ -21,27 +20,6 @@
AbstractDataStorate.prototype.populateDataOnStart = function() AbstractDataStorate.prototype.populateDataOnStart = function()
{ {
var
mLayout = Utils.pInt(Settings.settingsGet('Layout')),
aLanguages = Settings.settingsGet('Languages'),
aThemes = Settings.settingsGet('Themes')
;
if (Utils.isArray(aLanguages))
{
this.languages(aLanguages);
}
if (Utils.isArray(aThemes))
{
this.themes(aThemes);
}
this.mainLanguage(Settings.settingsGet('Language'));
this.mainTheme(Settings.settingsGet('Theme'));
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
this.capaAdditionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts)); this.capaAdditionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts));
this.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities)); this.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities));
this.capaGravatar(Settings.capa(Enums.Capa.Gravatar)); this.capaGravatar(Settings.capa(Enums.Capa.Gravatar));
@ -58,43 +36,17 @@
this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings')); this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages')); this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
this.showImages(!!Settings.settingsGet('ShowImages')); this.showImages(!!Settings.settingsGet('ShowImages'));
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave')); this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
this.interfaceAnimation(!!Settings.settingsGet('InterfaceAnimation')); this.interfaceAnimation(!!Settings.settingsGet('InterfaceAnimation'));
this.mainMessagesPerPage(Settings.settingsGet('MPP'));
this.desktopNotifications(!!Settings.settingsGet('DesktopNotifications'));
this.useThreads(!!Settings.settingsGet('UseThreads')); this.useThreads(!!Settings.settingsGet('UseThreads'));
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder')); this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList')); this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
this.layout(Enums.Layout.SidePreview); require('Stores/Social').populate();
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview])) require('Stores/UserSettings').populate();
{ require('Stores/NotificationSettings').populate();
this.layout(mLayout);
}
this.facebookSupported(!!Settings.settingsGet('SupportedFacebookSocial'));
this.facebookEnable(!!Settings.settingsGet('AllowFacebookSocial'));
this.facebookAppID(Settings.settingsGet('FacebookAppID'));
this.facebookAppSecret(Settings.settingsGet('FacebookAppSecret'));
this.twitterEnable(!!Settings.settingsGet('AllowTwitterSocial'));
this.twitterConsumerKey(Settings.settingsGet('TwitterConsumerKey'));
this.twitterConsumerSecret(Settings.settingsGet('TwitterConsumerSecret'));
this.googleEnable(!!Settings.settingsGet('AllowGoogleSocial'));
this.googleEnable.auth(!!Settings.settingsGet('AllowGoogleSocialAuth'));
this.googleEnable.drive(!!Settings.settingsGet('AllowGoogleSocialDrive'));
this.googleEnable.preview(!!Settings.settingsGet('AllowGoogleSocialPreview'));
this.googleClientID(Settings.settingsGet('GoogleClientID'));
this.googleClientSecret(Settings.settingsGet('GoogleClientSecret'));
this.googleApiKey(Settings.settingsGet('GoogleApiKey'));
this.dropboxEnable(!!Settings.settingsGet('AllowDropboxSocial'));
this.dropboxApiKey(Settings.settingsGet('DropboxApiKey'));
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed')); this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
}; };

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {
@ -6,7 +5,7 @@
var var
window = require('window'), window = require('window'),
Utils = require('Common/Utils') Utils = require('Common/Utils')
; ;

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {
@ -16,6 +15,7 @@
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
@ -271,7 +271,8 @@
}, this); }, this);
this.messageListPageCount = ko.computed(function () { this.messageListPageCount = ko.computed(function () {
var iPage = window.Math.ceil(this.messageListCount() / this.messagesPerPage()); var iPage = window.Math.ceil(this.messageListCount() /
require('Stores/UserSettings').messagesPerPage());
return 0 >= iPage ? 1 : iPage; return 0 >= iPage ? 1 : iPage;
}, this); }, this);
@ -327,13 +328,13 @@
this.messageFullScreenMode(false); this.messageFullScreenMode(false);
this.hideMessageBodies(); this.hideMessageBodies();
if (Enums.Layout.NoPreview === this.layout() && if (Enums.Layout.NoPreview === require('Stores/UserSettings').layout() &&
-1 < window.location.hash.indexOf('message-preview')) -1 < window.location.hash.indexOf('message-preview'))
{ {
require('App/User').historyBack(); require('App/User').historyBack();
} }
} }
else if (Enums.Layout.NoPreview === this.layout()) else if (Enums.Layout.NoPreview === require('Stores/UserSettings').layout())
{ {
this.message.focused(true); this.message.focused(true);
} }
@ -347,7 +348,7 @@
} }
else if (Enums.KeyState.MessageView === Globals.keyScope()) else if (Enums.KeyState.MessageView === Globals.keyScope())
{ {
if (Enums.Layout.NoPreview === this.layout() && this.message()) if (Enums.Layout.NoPreview === require('Stores/UserSettings').layout() && this.message())
{ {
Globals.keyScope(Enums.KeyState.MessageView); Globals.keyScope(Enums.KeyState.MessageView);
} }
@ -430,22 +431,7 @@
return aList; return aList;
}, this); }, this);
// quota
this.userQuota = ko.observable(0);
this.userUsageSize = ko.observable(0);
this.userUsageProc = ko.computed(function () {
var
iQuota = this.userQuota(),
iUsed = this.userUsageSize()
;
return 0 < iQuota ? window.Math.ceil((iUsed / iQuota) * 100) : 0;
}, this);
// other // other
this.filterModules = ko.observable({});
this.composeInEdit = ko.observable(false); this.composeInEdit = ko.observable(false);
this.capaOpenPGP = ko.observable(false); this.capaOpenPGP = ko.observable(false);
this.openpgpkeys = ko.observableArray([]); this.openpgpkeys = ko.observableArray([]);
@ -460,21 +446,6 @@
return !!(oItem && oItem.isPrivate); return !!(oItem && oItem.isPrivate);
}); });
// google
this.googleActions = ko.observable(false);
this.googleLoggined = ko.observable(false);
this.googleUserName = ko.observable('');
// facebook
this.facebookActions = ko.observable(false);
this.facebookLoggined = ko.observable(false);
this.facebookUserName = ko.observable('');
// twitter
this.twitterActions = ko.observable(false);
this.twitterLoggined = ko.observable(false);
this.twitterUserName = ko.observable('');
this.customThemeType = ko.observable(Enums.CustomThemeType.Light); this.customThemeType = ko.observable(Enums.CustomThemeType.Light);
this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30); this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30);
@ -546,17 +517,17 @@
if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length) if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length)
{ {
var var
self = this,
iIndex = 0, iIndex = 0,
iLen = aNewMessages.length, iLen = aNewMessages.length,
fNotificationHelper = function (sImageSrc, sTitle, sText) fNotificationHelper = function (sImageSrc, sTitle, sText)
{ {
var var
NotificationClass = Utils.notificationClass(), NotificationSettingsStore = require('Stores/NotificationSettings'),
NotificationClass = NotificationSettingsStore.notificationClass(),
oNotification = null oNotification = null
; ;
if (NotificationClass && self.useDesktopNotifications()) if (NotificationClass && NotificationSettingsStore.enableDesktopNotification())
{ {
oNotification = new NotificationClass(sTitle, { oNotification = new NotificationClass(sTitle, {
'body': sText, 'body': sText,
@ -596,7 +567,7 @@
fNotificationHelper( fNotificationHelper(
Links.notificationMailIcon(), Links.notificationMailIcon(),
this.accountEmail(), this.accountEmail(),
Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', { Translator.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
'COUNT': iLen 'COUNT': iLen
}) })
); );

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () { (function () {

28
dev/Stores/Filter.js Normal file
View file

@ -0,0 +1,28 @@
(function () {
'use strict';
var
ko = require('ko')
;
/**
* @constructor
*/
function FilterStore()
{
this.capa = ko.observable('');
this.modules = ko.observable({});
this.collection = ko.observableArray([]);
this.collection.loading = ko.observable(false).extend({'throttle': 200});
this.collection.saving = ko.observable(false).extend({'throttle': 200});
this.raw = ko.observable('');
}
module.exports = new FilterStore();
}());

View file

@ -0,0 +1,152 @@
(function () {
'use strict';
var
window = require('window'),
ko = require('ko'),
Enums = require('Common/Enums'),
Settings = require('Storage/Settings')
;
/**
* @constructor
*/
function NotificationSettings()
{
var self = this;
this.allowDesktopNotification = ko.observable(false);
this.desktopNotificationPermisions = ko.computed(function () {
this.allowDesktopNotification();
var
NotificationClass = this.notificationClass(),
iResult = Enums.DesktopNotification.NotSupported
;
if (NotificationClass && NotificationClass.permission)
{
switch (NotificationClass.permission.toLowerCase())
{
case 'granted':
iResult = Enums.DesktopNotification.Allowed;
break;
case 'denied':
iResult = Enums.DesktopNotification.Denied;
break;
case 'default':
iResult = Enums.DesktopNotification.NotAllowed;
break;
}
}
else if (window.webkitNotifications && window.webkitNotifications.checkPermission)
{
iResult = window.webkitNotifications.checkPermission();
}
return iResult;
}, this);
this.enableDesktopNotification = ko.computed({
'owner': this,
'read': function () {
return this.allowDesktopNotification() &&
Enums.DesktopNotification.Allowed === this.desktopNotificationPermisions();
},
'write': function (bValue) {
if (bValue)
{
var
NotificationClass = this.notificationClass(),
iPermission = this.desktopNotificationPermisions()
;
if (NotificationClass && Enums.DesktopNotification.Allowed === iPermission)
{
this.allowDesktopNotification(true);
}
else if (NotificationClass && Enums.DesktopNotification.NotAllowed === iPermission)
{
NotificationClass.requestPermission(function () {
self.allowDesktopNotification.valueHasMutated();
if (Enums.DesktopNotification.Allowed === self.desktopNotificationPermisions())
{
if (self.allowDesktopNotification())
{
self.allowDesktopNotification.valueHasMutated();
}
else
{
self.allowDesktopNotification(true);
}
}
else
{
if (self.allowDesktopNotification())
{
self.allowDesktopNotification(false);
}
else
{
self.allowDesktopNotification.valueHasMutated();
}
}
});
}
else
{
this.allowDesktopNotification(false);
}
}
else
{
this.allowDesktopNotification(false);
}
}
});
if (!this.enableDesktopNotification.valueHasMutated)
{
this.enableDesktopNotification.valueHasMutated = function () {
self.allowDesktopNotification.valueHasMutated();
};
}
this.computedProperies();
}
NotificationSettings.prototype.computedProperies = function ()
{
this.isDesktopNotificationSupported = ko.computed(function () {
return Enums.DesktopNotification.NotSupported !== this.desktopNotificationPermisions();
}, this);
this.isDesktopNotificationDenied = ko.computed(function () {
return Enums.DesktopNotification.NotSupported === this.desktopNotificationPermisions() ||
Enums.DesktopNotification.Denied === this.desktopNotificationPermisions();
}, this);
};
NotificationSettings.prototype.populate = function ()
{
this.enableDesktopNotification(!!Settings.settingsGet('DesktopNotifications'));
};
/**
* @return {*|null}
*/
NotificationSettings.prototype.notificationClass = function ()
{
return window.Notification && window.Notification.requestPermission ? window.Notification : null;
};
module.exports = new NotificationSettings();
}());

43
dev/Stores/Quota.js Normal file
View file

@ -0,0 +1,43 @@
(function () {
'use strict';
var
window = require('window'),
ko = require('ko')
;
/**
* @constructor
*/
function QuotaStore()
{
this.quota = ko.observable(0);
this.usage = ko.observable(0);
this.percentage = ko.computed(function () {
var
iQuota = this.quota(),
iUsed = this.usage()
;
return 0 < iQuota ? window.Math.ceil((iUsed / iQuota) * 100) : 0;
}, this);
}
/**
* @param {number} iQuota
* @param {number} iUsage
*/
QuotaStore.prototype.populateData = function(iQuota, iUsage)
{
this.quota(iQuota * 1024);
this.usage(iUsage * 1024);
};
module.exports = new QuotaStore();
}());

110
dev/Stores/Social.js Normal file
View file

@ -0,0 +1,110 @@
(function () {
'use strict';
var
ko = require('ko')
;
/**
* @constructor
*/
function SocialStore()
{
// TODO
this.google = {};
this.twitter = {};
this.facebook = {};
this.dropbox = {};
// Google
this.google.enabled = ko.observable(false);
this.google.clientID = ko.observable('');
this.google.clientSecret = ko.observable('');
this.google.apiKey = ko.observable('');
this.google.loading = ko.observable(false);
this.google.userName = ko.observable('');
this.google.loggined = ko.computed(function () {
return '' !== this.google.userName();
}, this);
this.google.capa = {};
this.google.capa.auth = ko.observable(false);
this.google.capa.drive = ko.observable(false);
this.google.capa.preview = ko.observable(false);
this.google.require = {};
this.google.require.clientSettings = ko.computed(function () {
return this.google.enabled() && (this.google.capa.auth() || this.google.capa.drive());
}, this);
this.google.require.apiKeySettings = ko.computed(function () {
return this.google.enabled() && this.google.capa.drive();
}, this);
// Facebook
this.facebook.enabled = ko.observable(false);
this.facebook.appID = ko.observable('');
this.facebook.appSecret = ko.observable('');
this.facebook.loading = ko.observable(false);
this.facebook.userName = ko.observable('');
this.facebook.supported = ko.observable(false);
this.facebook.loggined = ko.computed(function () {
return '' !== this.facebook.userName();
}, this);
// Twitter
this.twitter.enabled = ko.observable(false);
this.twitter.consumerKey = ko.observable('');
this.twitter.consumerSecret = ko.observable('');
this.twitter.loading = ko.observable(false);
this.twitter.userName = ko.observable('');
this.twitter.loggined = ko.computed(function () {
return '' !== this.twitter.userName();
}, this);
// Dropbox
this.dropbox.enabled = ko.observable(false);
this.dropbox.apiKey = ko.observable('');
}
SocialStore.prototype.google = {};
SocialStore.prototype.twitter = {};
SocialStore.prototype.facebook = {};
SocialStore.prototype.dropbox = {};
SocialStore.prototype.populate = function ()
{
var Settings = require('Storage/Settings');
this.google.enabled(!!Settings.settingsGet('AllowGoogleSocial'));
this.google.clientID(Settings.settingsGet('GoogleClientID'));
this.google.clientSecret(Settings.settingsGet('GoogleClientSecret'));
this.google.apiKey(Settings.settingsGet('GoogleApiKey'));
this.google.capa.auth(!!Settings.settingsGet('AllowGoogleSocialAuth'));
this.google.capa.drive(!!Settings.settingsGet('AllowGoogleSocialDrive'));
this.google.capa.preview(!!Settings.settingsGet('AllowGoogleSocialPreview'));
this.facebook.enabled(!!Settings.settingsGet('AllowFacebookSocial'));
this.facebook.appID(Settings.settingsGet('FacebookAppID'));
this.facebook.appSecret(Settings.settingsGet('FacebookAppSecret'));
this.facebook.supported(!!Settings.settingsGet('SupportedFacebookSocial'));
this.twitter.enabled = ko.observable(!!Settings.settingsGet('AllowTwitterSocial'));
this.twitter.consumerKey = ko.observable(Settings.settingsGet('TwitterConsumerKey'));
this.twitter.consumerSecret = ko.observable(Settings.settingsGet('TwitterConsumerSecret'));
this.dropbox.enabled(!!Settings.settingsGet('AllowDropboxSocial'));
this.dropbox.apiKey(Settings.settingsGet('DropboxApiKey'));
};
module.exports = new SocialStore();
}());

View file

@ -0,0 +1,80 @@
(function () {
'use strict';
var
ko = require('ko'),
Consts = require('Common/Consts'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Settings = require('Storage/Settings')
;
/**
* @constructor
*/
function UserSettingsStore()
{
this.layout = ko.observable(Enums.Layout.SidePreview)
.extend({'limitedList': [
Enums.Layout.SidePreview, Enums.Layout.BottomPreview, Enums.Layout.NoPreview
]});
this.editorDefaultType = ko.observable(Enums.EditorDefaultType.Html)
.extend({'limitedList': [
Enums.EditorDefaultType.Html, Enums.EditorDefaultType.Plain,
Enums.EditorDefaultType.HtmlForced, Enums.EditorDefaultType.PlainForced
]});
this.languages = ko.observableArray([]);
this.language = ko.observable('')
.extend({'limitedList': this.languages});
this.themes = ko.observableArray([]);
this.themeBackgroundName = ko.observable('');
this.themeBackgroundHash = ko.observable('');
this.theme = ko.observable('')
.extend({'limitedList': this.themes});
this.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage)
.extend({'limitedList': Consts.Defaults.MessagesPerPageArray});
this.computedProperies();
}
UserSettingsStore.prototype.computedProperies = function ()
{
this.usePreviewPane = ko.computed(function () {
return Enums.Layout.NoPreview !== this.layout();
}, this);
};
UserSettingsStore.prototype.populate = function ()
{
var
aLanguages = Settings.settingsGet('Languages'),
aThemes = Settings.settingsGet('Themes')
;
this.layout(Utils.pInt(Settings.settingsGet('Layout')));
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
this.languages(Utils.isArray(aLanguages) ? aLanguages : []);
this.language(Settings.settingsGet('Language'));
this.themes(Utils.isArray(aThemes) ? aThemes : []);
this.theme(Settings.settingsGet('Theme'));
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
this.messagesPerPage(Settings.settingsGet('MPP'));
};
module.exports = new UserSettingsStore();
}());

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
@import "../../vendors/bootstrap/less/variables.less"; @import "../../vendors/bootstrap/less/variables.less";
@import "../../vendors/bootstrap/less/mixins.less"; @import "../../vendors/bootstrap/less/mixins.less";

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Remote = require('Storage/Admin/Remote'), Remote = require('Storage/Admin/Remote'),
@ -71,13 +72,13 @@
else if (oData.ErrorCode) else if (oData.ErrorCode)
{ {
this.submitRequest(false); this.submitRequest(false);
this.submitError(Utils.getNotification(oData.ErrorCode)); this.submitError(Translator.getNotification(oData.ErrorCode));
} }
} }
else else
{ {
this.submitRequest(false); this.submitRequest(false);
this.submitError(Utils.getNotification(Enums.Notification.UnknownError)); this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
} }
}, this), this.login(), this.password()); }, this), this.login(), this.password());

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'), Data = require('Storage/Admin/Data'),
@ -76,13 +77,13 @@
} }
else if (oData.ErrorCode) else if (oData.ErrorCode)
{ {
self.activateText(Utils.getNotification(oData.ErrorCode)); self.activateText(Translator.getNotification(oData.ErrorCode));
self.activateText.isError(true); self.activateText.isError(true);
self.key.focus(true); self.key.focus(true);
} }
else else
{ {
self.activateText(Utils.getNotification(Enums.Notification.UnknownError)); self.activateText(Translator.getNotification(Enums.Notification.UnknownError));
self.activateText.isError(true); self.activateText.isError(true);
self.key.focus(true); self.key.focus(true);
} }

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote'), Remote = require('Storage/User/Remote'),
@ -69,12 +70,12 @@
} }
else if (oData.ErrorCode) else if (oData.ErrorCode)
{ {
this.submitError(Utils.getNotification(oData.ErrorCode)); this.submitError(Translator.getNotification(oData.ErrorCode));
} }
} }
else else
{ {
this.submitError(Utils.getNotification(Enums.Notification.UnknownError)); this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
} }
}, this), this.email(), this.password(), this.isNew()); }, this), this.email(), this.password(), this.isNew());

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView') AbstractView = require('Knoin/AbstractView')
@ -46,8 +47,8 @@
AskPopupView.prototype.clearPopup = function () AskPopupView.prototype.clearPopup = function ()
{ {
this.askDesc(''); this.askDesc('');
this.yesButton(Utils.i18n('POPUPS_ASK/BUTTON_YES')); this.yesButton(Translator.i18n('POPUPS_ASK/BUTTON_YES'));
this.noButton(Utils.i18n('POPUPS_ASK/BUTTON_NO')); this.noButton(Translator.i18n('POPUPS_ASK/BUTTON_NO'));
this.yesFocus(false); this.yesFocus(false);
this.noFocus(false); this.noFocus(false);

View file

@ -19,6 +19,10 @@
Events = require('Common/Events'), Events = require('Common/Events'),
Links = require('Common/Links'), Links = require('Common/Links'),
HtmlEditor = require('Common/HtmlEditor'), HtmlEditor = require('Common/HtmlEditor'),
Translator = require('Common/Translator'),
SocialStore = require('Stores/Social'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
@ -61,6 +65,7 @@
this.bSkipNextHide = false; this.bSkipNextHide = false;
this.composeInEdit = Data.composeInEdit; this.composeInEdit = Data.composeInEdit;
this.editorDefaultType = UserSettingsStore.editorDefaultType;
this.capaOpenPGP = Data.capaOpenPGP; this.capaOpenPGP = Data.capaOpenPGP;
@ -419,7 +424,8 @@
this.triggerForResize(); this.triggerForResize();
}, this); }, this);
this.dropboxEnabled = ko.observable(!!Settings.settingsGet('DropboxApiKey')); this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
this.dropboxCommand = Utils.createCommand(this, function () { this.dropboxCommand = Utils.createCommand(this, function () {
@ -659,15 +665,15 @@
if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode) if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode)
{ {
this.sendSuccessButSaveError(true); this.sendSuccessButSaveError(true);
window.alert(Utils.trim(Utils.i18n('COMPOSE/SAVED_ERROR_ON_SEND'))); window.alert(Utils.trim(Translator.i18n('COMPOSE/SAVED_ERROR_ON_SEND')));
} }
else else
{ {
sMessage = Utils.getNotification(oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantSendMessage, sMessage = Translator.getNotification(oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantSendMessage,
oData && oData.ErrorMessage ? oData.ErrorMessage : ''); oData && oData.ErrorMessage ? oData.ErrorMessage : '');
this.sendError(true); this.sendError(true);
window.alert(sMessage || Utils.getNotification(Enums.Notification.CantSendMessage)); window.alert(sMessage || Translator.getNotification(Enums.Notification.CantSendMessage));
} }
} }
@ -704,7 +710,7 @@
this.savedTime(window.Math.round((new window.Date()).getTime() / 1000)); this.savedTime(window.Math.round((new window.Date()).getTime() / 1000));
this.savedOrSendingText( this.savedOrSendingText(
0 < this.savedTime() ? Utils.i18n('COMPOSE/SAVED_TIME', { 0 < this.savedTime() ? Translator.i18n('COMPOSE/SAVED_TIME', {
'TIME': moment.unix(this.savedTime() - 1).format('LT') 'TIME': moment.unix(this.savedTime() - 1).format('LT')
}) : '' }) : ''
); );
@ -719,7 +725,7 @@
if (!bResult) if (!bResult)
{ {
this.savedError(true); this.savedError(true);
this.savedOrSendingText(Utils.getNotification(Enums.Notification.CantSaveMessage)); this.savedOrSendingText(Translator.getNotification(Enums.Notification.CantSaveMessage));
} }
this.reloadDraftFolder(); this.reloadDraftFolder();
@ -848,7 +854,7 @@
if (Enums.ComposeType.Empty !== sType) if (Enums.ComposeType.Empty !== sType)
{ {
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('COMPOSE/DISCARD_UNSAVED_DATA'), function () { kn.showScreenPopup(PopupsAskViewModel, [Translator.i18n('COMPOSE/DISCARD_UNSAVED_DATA'), function () {
self.initOnShow(sType, oMessageOrArray, aToEmails, sCustomSubject, sCustomPlainText); self.initOnShow(sType, oMessageOrArray, aToEmails, sCustomSubject, sCustomPlainText);
}, null, null, null, false]); }, null, null, null, false]);
} }
@ -1052,7 +1058,7 @@
case Enums.ComposeType.Reply: case Enums.ComposeType.Reply:
case Enums.ComposeType.ReplyAll: case Enums.ComposeType.ReplyAll:
sFrom = oMessage.fromToLine(false, true); sFrom = oMessage.fromToLine(false, true);
sReplyTitle = Utils.i18n('COMPOSE/REPLY_MESSAGE_TITLE', { sReplyTitle = Translator.i18n('COMPOSE/REPLY_MESSAGE_TITLE', {
'DATETIME': sDate, 'DATETIME': sDate,
'EMAIL': sFrom 'EMAIL': sFrom
}); });
@ -1066,12 +1072,12 @@
sFrom = oMessage.fromToLine(false, true); sFrom = oMessage.fromToLine(false, true);
sTo = oMessage.toToLine(false, true); sTo = oMessage.toToLine(false, true);
sCc = oMessage.ccToLine(false, true); sCc = oMessage.ccToLine(false, true);
sText = '<br /><br /><br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') + sText = '<br /><br /><br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_FROM') + ': ' + sFrom + '<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_FROM') + ': ' + sFrom +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') + ': ' + sTo + '<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') + ': ' + sTo +
(0 < sCc.length ? '<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') + (0 < sCc.length ? '<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') + ': ' + Utils.encodeHtml(sDate) + '<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') + ': ' + Utils.encodeHtml(sDate) +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT') + ': ' + Utils.encodeHtml(sSubject) + '<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT') + ': ' + Utils.encodeHtml(sSubject) +
'<br /><br />' + sText; '<br /><br />' + sText;
break; break;
case Enums.ComposeType.ForwardAsAttachment: case Enums.ComposeType.ForwardAsAttachment:
@ -1087,8 +1093,8 @@
this.editor(function (oEditor) { this.editor(function (oEditor) {
oEditor.setHtml(sText, false); oEditor.setHtml(sText, false);
if (Enums.EditorDefaultType.PlainForced === Data.editorDefaultType() || if (Enums.EditorDefaultType.PlainForced === self.editorDefaultType() ||
(!oMessage.isHtml() && Enums.EditorDefaultType.HtmlForced !== Data.editorDefaultType())) (!oMessage.isHtml() && Enums.EditorDefaultType.HtmlForced !== self.editorDefaultType()))
{ {
oEditor.modeToggle(false); oEditor.modeToggle(false);
} }
@ -1107,8 +1113,8 @@
this.editor(function (oEditor) { this.editor(function (oEditor) {
oEditor.setHtml(sText, false); oEditor.setHtml(sText, false);
if (Enums.EditorDefaultType.Html !== Data.editorDefaultType() && if (Enums.EditorDefaultType.Html !== self.editorDefaultType() &&
Enums.EditorDefaultType.HtmlForced !== Data.editorDefaultType()) Enums.EditorDefaultType.HtmlForced !== self.editorDefaultType())
{ {
oEditor.modeToggle(false); oEditor.modeToggle(false);
} }
@ -1197,7 +1203,7 @@
} }
else else
{ {
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () { kn.showScreenPopup(PopupsAskViewModel, [Translator.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
if (self.modalVisibility()) if (self.modalVisibility())
{ {
Utils.delegateRun(self, 'closeCommand'); Utils.delegateRun(self, 'closeCommand');
@ -1251,7 +1257,7 @@
oScript = window.document.createElement('script'); oScript = window.document.createElement('script');
oScript.type = 'text/javascript'; oScript.type = 'text/javascript';
oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js'; oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js';
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', Settings.settingsGet('DropboxApiKey')); $(oScript).attr('id', 'dropboxjs').attr('data-app-key', self.dropboxApiKey());
window.document.body.appendChild(oScript); window.document.body.appendChild(oScript);
} }
@ -1538,7 +1544,7 @@
{ {
oAttachment oAttachment
.waiting(false).uploading(true).complete(true) .waiting(false).uploading(true).complete(true)
.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG')); .error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
return false; return false;
} }
@ -1585,11 +1591,11 @@
if (null !== mErrorCode) if (null !== mErrorCode)
{ {
sError = Utils.getUploadErrorDescByCode(mErrorCode); sError = Translator.getUploadErrorDescByCode(mErrorCode);
} }
else if (!oAttachmentJson) else if (!oAttachmentJson)
{ {
sError = Utils.i18n('UPLOAD/ERROR_UNKNOWN'); sError = Translator.i18n('UPLOAD/ERROR_UNKNOWN');
} }
if (oAttachment) if (oAttachment)
@ -1711,7 +1717,7 @@
if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize) if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
{ {
oAttachment.uploading(false).complete(true); oAttachment.uploading(false).complete(true);
oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG')); oAttachment.error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
return false; return false;
} }
@ -1731,7 +1737,7 @@
if (!bResult) if (!bResult)
{ {
oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded)); oAttachment.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
} }
}, [oDropboxFile['link']]); }, [oDropboxFile['link']]);
@ -1767,7 +1773,7 @@
if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize) if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
{ {
oAttachment.uploading(false).complete(true); oAttachment.uploading(false).complete(true);
oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG')); oAttachment.error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
return false; return false;
} }
@ -1788,7 +1794,7 @@
if (!bResult) if (!bResult)
{ {
oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded)); oAttachment.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
} }
}, oDriveFile['downloadUrl'], sAccessToken); }, oDriveFile['downloadUrl'], sAccessToken);
@ -1877,7 +1883,7 @@
.waiting(false) .waiting(false)
.uploading(false) .uploading(false)
.complete(true) .complete(true)
.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded)) .error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded))
; ;
} }
}, this); }, this);

View file

@ -10,6 +10,7 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
@ -58,7 +59,7 @@
if (bResult && this.sign() && '' === this.from()) if (bResult && this.sign() && '' === this.from())
{ {
this.notification(Utils.i18n('PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL')); this.notification(Translator.i18n('PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL'));
bResult = false; bResult = false;
} }
@ -67,7 +68,7 @@
oPrivateKey = Data.findPrivateKeyByEmail(this.from(), this.password()); oPrivateKey = Data.findPrivateKeyByEmail(this.from(), this.password());
if (!oPrivateKey) if (!oPrivateKey)
{ {
this.notification(Utils.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', { this.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
'EMAIL': this.from() 'EMAIL': this.from()
})); }));
@ -77,7 +78,7 @@
if (bResult && this.encrypt() && 0 === this.to().length) if (bResult && this.encrypt() && 0 === this.to().length)
{ {
this.notification(Utils.i18n('PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT')); this.notification(Translator.i18n('PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT'));
bResult = false; bResult = false;
} }
@ -88,7 +89,7 @@
var aKeys = Data.findPublicKeysByEmail(sEmail); var aKeys = Data.findPublicKeysByEmail(sEmail);
if (0 === aKeys.length && bResult) if (0 === aKeys.length && bResult)
{ {
self.notification(Utils.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', { self.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
'EMAIL': sEmail 'EMAIL': sEmail
})); }));
@ -131,7 +132,7 @@
} }
catch (e) catch (e)
{ {
self.notification(Utils.i18n('PGP_NOTIFICATIONS/PGP_ERROR', { self.notification(Translator.i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
'ERROR': '' + e 'ERROR': '' + e
})); }));

View file

@ -16,6 +16,7 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Selector = require('Common/Selector'), Selector = require('Common/Selector'),
Links = require('Common/Links'), Links = require('Common/Links'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'), Remote = require('Storage/User/Remote'),
@ -338,7 +339,7 @@
require('App/User').contactsSync(function (sResult, oData) { require('App/User').contactsSync(function (sResult, oData) {
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result) if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{ {
window.alert(Utils.getNotification( window.alert(Translator.getNotification(
oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.ContactsSyncError)); oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.ContactsSyncError));
} }
@ -488,7 +489,7 @@
if (!sId || !bResult || !oData || !oData.Result) if (!sId || !bResult || !oData || !oData.Result)
{ {
window.alert(Utils.i18n('CONTACTS/ERROR_IMPORT_FILE')); window.alert(Translator.i18n('CONTACTS/ERROR_IMPORT_FILE'));
} }
}, this)) }, this))

View file

@ -9,9 +9,12 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
FilterStore = require('Stores/Filter'),
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView') AbstractView = require('Knoin/AbstractView')
; ;
@ -26,10 +29,11 @@
this.isNew = ko.observable(true); this.isNew = ko.observable(true);
this.modules = FilterStore.modules;
this.fTrueCallback = null; this.fTrueCallback = null;
this.filter = ko.observable(null); this.filter = ko.observable(null);
this.modules = Data.filterModules;
this.allowMarkAsRead = ko.observable(false); this.allowMarkAsRead = ko.observable(false);
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender; this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
@ -71,11 +75,11 @@
return true; return true;
}); });
this.actionTypeOptions = []; this.actionTypeOptions = ko.observableArray([]);
this.fieldOptions = []; this.fieldOptions = ko.observableArray([]);
this.typeOptions = []; this.typeOptions = ko.observableArray([]);
this.populateOptions(); Translator.initOnStartOrLangChange(this.populateOptions, this);
this.modules.subscribe(this.populateOptions, this); this.modules.subscribe(this.populateOptions, this);
@ -87,9 +91,10 @@
FilterPopupView.prototype.populateOptions = function () FilterPopupView.prototype.populateOptions = function ()
{ {
this.actionTypeOptions = []; this.actionTypeOptions([]);
// this.actionTypeOptions.push({'id': Enums.FiltersAction.None, // this.actionTypeOptions.push({'id': Enums.FiltersAction.None,
// 'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_NONE')}); // 'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_NONE')});
var oModules = this.modules(); var oModules = this.modules();
if (oModules) if (oModules)
@ -102,44 +107,44 @@
if (oModules.moveto) if (oModules.moveto)
{ {
this.actionTypeOptions.push({'id': Enums.FiltersAction.MoveTo, this.actionTypeOptions.push({'id': Enums.FiltersAction.MoveTo,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')}); 'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')});
} }
if (oModules.redirect) if (oModules.redirect)
{ {
this.actionTypeOptions.push({'id': Enums.FiltersAction.Forward, this.actionTypeOptions.push({'id': Enums.FiltersAction.Forward,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')}); 'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')});
} }
if (oModules.reject) if (oModules.reject)
{ {
this.actionTypeOptions.push({'id': Enums.FiltersAction.Reject, this.actionTypeOptions.push({'id': Enums.FiltersAction.Reject,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_REJECT')}); 'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_REJECT')});
} }
if (oModules.vacation) if (oModules.vacation)
{ {
this.actionTypeOptions.push({'id': Enums.FiltersAction.Vacation, this.actionTypeOptions.push({'id': Enums.FiltersAction.Vacation,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')}); 'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')});
} }
} }
this.actionTypeOptions.push({'id': Enums.FiltersAction.Discard, this.actionTypeOptions.push({'id': Enums.FiltersAction.Discard,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD')}); 'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD')});
this.fieldOptions = [ this.fieldOptions([
{'id': Enums.FilterConditionField.From, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_FROM')}, {'id': Enums.FilterConditionField.From, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_FROM')},
{'id': Enums.FilterConditionField.Recipient, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS')}, {'id': Enums.FilterConditionField.Recipient, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS')},
{'id': Enums.FilterConditionField.Subject, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT')} {'id': Enums.FilterConditionField.Subject, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT')}
]; ]);
this.typeOptions = [ this.typeOptions([
{'id': Enums.FilterConditionType.Contains, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS')}, {'id': Enums.FilterConditionType.Contains, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS')},
{'id': Enums.FilterConditionType.NotContains, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS')}, {'id': Enums.FilterConditionType.NotContains, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS')},
{'id': Enums.FilterConditionType.EqualTo, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO')}, {'id': Enums.FilterConditionType.EqualTo, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO')},
{'id': Enums.FilterConditionType.NotEqualTo, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO')} {'id': Enums.FilterConditionType.NotEqualTo, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO')}
]; ]);
}; };

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
@ -41,7 +42,7 @@
}, this); }, this);
this.dangerDescHtml = ko.computed(function () { this.dangerDescHtml = ko.computed(function () {
return Utils.i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', { return Translator.i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', {
'FOLDER': this.folderNameForClear() 'FOLDER': this.folderNameForClear()
}); });
}, this); }, this);
@ -77,11 +78,11 @@
{ {
if (oData && oData.ErrorCode) if (oData && oData.ErrorCode)
{ {
self.clearingError(Utils.getNotification(oData.ErrorCode)); self.clearingError(Translator.getNotification(oData.ErrorCode));
} }
else else
{ {
self.clearingError(Utils.getNotification(Enums.Notification.MailServerError)); self.clearingError(Translator.getNotification(Enums.Notification.MailServerError));
} }
} }
}, oFolderToClear.fullNameRaw); }, oFolderToClear.fullNameRaw);

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Consts = require('Common/Consts'), Consts = require('Common/Consts'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'), Remote = require('Storage/User/Remote'),
@ -26,8 +27,8 @@
{ {
AbstractView.call(this, 'Popups', 'PopupsFolderCreate'); AbstractView.call(this, 'Popups', 'PopupsFolderCreate');
Utils.initOnStartOrLangChange(function () { Translator.initOnStartOrLangChange(function () {
this.sNoParentText = Utils.i18n('POPUPS_CREATE_FOLDER/SELECT_NO_PARENT'); this.sNoParentText = Translator.i18n('POPUPS_CREATE_FOLDER/SELECT_NO_PARENT');
}, this); }, this);
this.folderName = ko.observable(''); this.folderName = ko.observable('');
@ -84,7 +85,7 @@
else else
{ {
Data.folderList.error( Data.folderList.error(
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER')); oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER'));
} }
}, this.folderName(), sParentFolderName); }, this.folderName(), sParentFolderName);

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Consts = require('Common/Consts'), Consts = require('Common/Consts'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
@ -27,9 +28,9 @@
{ {
AbstractView.call(this, 'Popups', 'PopupsFolderSystem'); AbstractView.call(this, 'Popups', 'PopupsFolderSystem');
Utils.initOnStartOrLangChange(function () { Translator.initOnStartOrLangChange(function () {
this.sChooseOnText = Utils.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE'); this.sChooseOnText = Translator.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE');
this.sUnuseText = Utils.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME'); this.sUnuseText = Translator.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME');
}, this); }, this);
this.notification = ko.observable(''); this.notification = ko.observable('');
@ -112,19 +113,19 @@
switch (iNotificationType) switch (iNotificationType)
{ {
case Enums.SetSystemFoldersNotification.Sent: case Enums.SetSystemFoldersNotification.Sent:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT'); sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT');
break; break;
case Enums.SetSystemFoldersNotification.Draft: case Enums.SetSystemFoldersNotification.Draft:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS'); sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS');
break; break;
case Enums.SetSystemFoldersNotification.Spam: case Enums.SetSystemFoldersNotification.Spam:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM'); sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM');
break; break;
case Enums.SetSystemFoldersNotification.Trash: case Enums.SetSystemFoldersNotification.Trash:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH'); sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH');
break; break;
case Enums.SetSystemFoldersNotification.Archive: case Enums.SetSystemFoldersNotification.Archive:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE'); sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE');
break; break;
} }

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote'), Remote = require('Storage/User/Remote'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
@ -88,12 +89,12 @@
} }
else if (oData.ErrorCode) else if (oData.ErrorCode)
{ {
this.submitError(Utils.getNotification(oData.ErrorCode)); this.submitError(Translator.getNotification(oData.ErrorCode));
} }
} }
else else
{ {
this.submitError(Utils.getNotification(Enums.Notification.UnknownError)); this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
} }
}, this), this.id, this.email(), this.name(), this.replyTo(), this.bcc()); }, this), this.id, this.email(), this.name(), this.replyTo(), this.bcc());

View file

@ -8,7 +8,6 @@
ko = require('ko'), ko = require('ko'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Globals = require('Common/Globals'),
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView') AbstractView = require('Knoin/AbstractView')
@ -22,12 +21,12 @@
{ {
AbstractView.call(this, 'Popups', 'PopupsLanguages'); AbstractView.call(this, 'Popups', 'PopupsLanguages');
this.Data = Globals.__APP__.data(); // TODO this.UserSettingsStore = require('Stores/UserSettings');
this.exp = ko.observable(false); this.exp = ko.observable(false);
this.languages = ko.computed(function () { this.languages = ko.computed(function () {
return _.map(this.Data.languages(), function (sLanguage) { return _.map(this.UserSettingsStore.languages(), function (sLanguage) {
return { return {
'key': sLanguage, 'key': sLanguage,
'selected': ko.observable(false), 'selected': ko.observable(false),
@ -36,7 +35,7 @@
}); });
}, this); }, this);
this.Data.mainLanguage.subscribe(function () { this.UserSettingsStore.language.subscribe(function () {
this.resetMainLanguage(); this.resetMainLanguage();
}, this); }, this);
@ -54,7 +53,7 @@
LanguagesPopupView.prototype.resetMainLanguage = function () LanguagesPopupView.prototype.resetMainLanguage = function ()
{ {
var sCurrent = this.Data.mainLanguage(); var sCurrent = this.UserSettingsStore.language();
_.each(this.languages(), function (oItem) { _.each(this.languages(), function (oItem) {
oItem['selected'](oItem['key'] === sCurrent); oItem['selected'](oItem['key'] === sCurrent);
}); });
@ -74,7 +73,7 @@
LanguagesPopupView.prototype.changeLanguage = function (sLang) LanguagesPopupView.prototype.changeLanguage = function (sLang)
{ {
this.Data.mainLanguage(sLang); this.UserSettingsStore.language(sLang);
this.cancelCommand(); this.cancelCommand();
}; };

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/Admin/Remote'), Remote = require('Storage/Admin/Remote'),
@ -99,11 +100,11 @@
this.saveError(''); this.saveError('');
if (oData && oData.ErrorCode) if (oData && oData.ErrorCode)
{ {
this.saveError(Utils.getNotification(oData.ErrorCode)); this.saveError(Translator.getNotification(oData.ErrorCode));
} }
else else
{ {
this.saveError(Utils.getNotification(Enums.Notification.CantSavePluginSettings)); this.saveError(Translator.getNotification(Enums.Notification.CantSavePluginSettings));
} }
} }
}; };
@ -146,7 +147,7 @@
if (!kn.isPopupVisible(PopupsAskViewModel)) if (!kn.isPopupVisible(PopupsAskViewModel))
{ {
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () { kn.showScreenPopup(PopupsAskViewModel, [Translator.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
if (self.modalVisibility()) if (self.modalVisibility())
{ {
Utils.delegateRun(self, 'cancelCommand'); Utils.delegateRun(self, 'cancelCommand');

View file

@ -13,8 +13,12 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),
Translator = require('Common/Translator'),
Plugins = require('Common/Plugins'), Plugins = require('Common/Plugins'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'), Remote = require('Storage/User/Remote'),
@ -87,11 +91,12 @@
this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin; this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
this.langRequest = ko.observable(false); this.langRequest = ko.observable(false);
this.mainLanguage = Data.mainLanguage; this.language = UserSettingsStore.language;
this.bSendLanguage = false; this.bSendLanguage = false;
this.mainLanguageFullName = ko.computed(function () { this.languageFullName = ko.computed(function () {
return Utils.convertLangName(this.mainLanguage()); return Utils.convertLangName(this.language());
}, this); }, this);
this.signMeType = ko.observable(Enums.LoginSignMeType.Unused); this.signMeType = ko.observable(Enums.LoginSignMeType.Unused);
@ -133,7 +138,7 @@
Plugins.runHook('user-login-submit', [fSubmitResult]); Plugins.runHook('user-login-submit', [fSubmitResult]);
if (0 < iPluginResultCode) if (0 < iPluginResultCode)
{ {
this.submitError(Utils.getNotification(iPluginResultCode)); this.submitError(Translator.getNotification(iPluginResultCode));
return false; return false;
} }
else if ('' !== sPluginResultMessage) else if ('' !== sPluginResultMessage)
@ -180,11 +185,11 @@
oData.ErrorCode = Enums.Notification.AuthError; oData.ErrorCode = Enums.Notification.AuthError;
} }
this.submitError(Utils.getNotification(oData.ErrorCode)); this.submitError(Translator.getNotification(oData.ErrorCode));
if ('' === this.submitError()) if ('' === this.submitError())
{ {
this.submitError(Utils.getNotification(Enums.Notification.UnknownError)); this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
} }
else else
{ {
@ -202,11 +207,11 @@
else else
{ {
this.submitRequest(false); this.submitRequest(false);
this.submitError(Utils.getNotification(Enums.Notification.UnknownError)); this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
} }
}, this), this.email(), '', sPassword, !!this.signMe(), }, this), this.email(), '', sPassword, !!this.signMe(),
this.bSendLanguage ? this.mainLanguage() : '', this.bSendLanguage ? this.language() : '',
this.additionalCode.visibility() ? this.additionalCode() : '', this.additionalCode.visibility() ? this.additionalCode() : '',
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
); );
@ -302,7 +307,7 @@
if (Settings.settingsGet('UserLanguage')) if (Settings.settingsGet('UserLanguage'))
{ {
$.cookie('rllang', Data.language(), {'expires': 30}); $.cookie('rllang', UserSettingsStore.language(), {'expires': 30});
} }
}, this), 100); }, this), 100);
@ -328,7 +333,7 @@
} }
else else
{ {
self.submitError(Utils.getNotification(iErrorCode)); self.submitError(Translator.getNotification(iErrorCode));
} }
} }
; ;
@ -371,11 +376,11 @@
} }
_.delay(function () { _.delay(function () {
Data.language.subscribe(function (sValue) { UserSettingsStore.language.subscribe(function (sValue) {
self.langRequest(true); self.langRequest(true);
Utils.reloadLanguage(sValue, function() { Translator.reload(sValue, function() {
self.langRequest(false); self.langRequest(false);
self.bSendLanguage = true; self.bSendLanguage = true;
$.cookie('rllang', sValue, {'expires': 30}); $.cookie('rllang', sValue, {'expires': 30});

View file

@ -15,6 +15,8 @@
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Links = require('Common/Links'), Links = require('Common/Links'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
@ -88,7 +90,7 @@
if (oFolder) if (oFolder)
{ {
if (Enums.Layout.NoPreview === Data.layout()) if (Enums.Layout.NoPreview === UserSettingsStore.layout())
{ {
Data.message(null); Data.message(null);
} }

View file

@ -18,6 +18,10 @@
Links = require('Common/Links'), Links = require('Common/Links'),
Events = require('Common/Events'), Events = require('Common/Events'),
Selector = require('Common/Selector'), Selector = require('Common/Selector'),
Translator = require('Common/Translator'),
QuotaStore = require('Stores/Quota'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
@ -63,13 +67,13 @@
this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails; this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListCompleteLoadingThrottle = Data.messageListCompleteLoadingThrottle; this.messageListCompleteLoadingThrottle = Data.messageListCompleteLoadingThrottle;
Utils.initOnStartOrLangChange(function () { Translator.initOnStartOrLangChange(function () {
this.emptySubjectValue = Utils.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT'); this.emptySubjectValue = Translator.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT');
}, this); }, this);
this.userQuota = Data.userQuota; this.userQuota = QuotaStore.quota;
this.userUsageSize = Data.userUsageSize; this.userUsageSize = QuotaStore.usage;
this.userUsageProc = Data.userUsageProc; this.userUsageProc = QuotaStore.percentage;
this.moveDropdownTrigger = ko.observable(false); this.moveDropdownTrigger = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false); this.moreDropdownTrigger = ko.observable(false);
@ -81,13 +85,13 @@
this.dragOverBodyArea = ko.observable(null); this.dragOverBodyArea = ko.observable(null);
this.messageListItemTemplate = ko.computed(function () { this.messageListItemTemplate = ko.computed(function () {
return Enums.Layout.SidePreview === Data.layout() ? return Enums.Layout.SidePreview === UserSettingsStore.layout() ?
'MailMessageListItem' : 'MailMessageListItemNoPreviewPane'; 'MailMessageListItem' : 'MailMessageListItemNoPreviewPane';
}); });
this.messageListSearchDesc = ko.computed(function () { this.messageListSearchDesc = ko.computed(function () {
var sValue = Data.messageListEndSearch(); var sValue = Data.messageListEndSearch();
return '' === sValue ? '' : Utils.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue}); return '' === sValue ? '' : Translator.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue});
}); });
this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(Data.messageListPage, Data.messageListPageCount)); this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(Data.messageListPage, Data.messageListPageCount));
@ -227,7 +231,7 @@
Data.message(Data.staticMessageList.populateByMessageListItem(oMessage)); Data.message(Data.staticMessageList.populateByMessageListItem(oMessage));
this.populateMessageBody(Data.message()); this.populateMessageBody(Data.message());
if (Enums.Layout.NoPreview === Data.layout()) if (Enums.Layout.NoPreview === UserSettingsStore.layout())
{ {
kn.setHash(Links.messagePreview(), true); kn.setHash(Links.messagePreview(), true);
Data.message.focused(true); Data.message.focused(true);
@ -247,11 +251,11 @@
this.selector.scrollToTop(); this.selector.scrollToTop();
}, this); }, this);
Data.layout.subscribe(function (mValue) { UserSettingsStore.layout.subscribe(function (mValue) {
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue); this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
}, this); }, this);
Data.layout.valueHasMutated(); UserSettingsStore.layout.valueHasMutated();
Events Events
.sub('mailbox.message-list.selector.go-down', function () { .sub('mailbox.message-list.selector.go-down', function () {
@ -360,8 +364,8 @@
{ {
Data.message(null); Data.message(null);
Data.messageError((oData && oData.ErrorCode ? Data.messageError((oData && oData.ErrorCode ?
Utils.getNotification(oData.ErrorCode) : Translator.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.UnknownError))); Translator.getNotification(Enums.Notification.UnknownError)));
} }
}; };
@ -869,7 +873,7 @@
MessageListMailBoxUserView.prototype.quotaTooltip = function () MessageListMailBoxUserView.prototype.quotaTooltip = function ()
{ {
return Utils.i18n('MESSAGE_LIST/QUOTA_SIZE', { return Translator.i18n('MESSAGE_LIST/QUOTA_SIZE', {
'SIZE': Utils.friendlySize(this.userUsageSize()), 'SIZE': Utils.friendlySize(this.userUsageSize()),
'PROC': this.userUsageProc(), 'PROC': this.userUsageProc(),
'LIMIT': Utils.friendlySize(this.userQuota()) 'LIMIT': Utils.friendlySize(this.userQuota())

View file

@ -17,6 +17,9 @@
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Events = require('Common/Events'), Events = require('Common/Events'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
Local = require('Storage/Local'), Local = require('Storage/Local'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
@ -61,8 +64,8 @@
this.messagesBodiesDom = Data.messagesBodiesDom; this.messagesBodiesDom = Data.messagesBodiesDom;
this.useThreads = Data.useThreads; this.useThreads = Data.useThreads;
this.replySameFolder = Data.replySameFolder; this.replySameFolder = Data.replySameFolder;
this.layout = Data.layout; this.layout = UserSettingsStore.layout;
this.usePreviewPane = Data.usePreviewPane; this.usePreviewPane = UserSettingsStore.usePreviewPane;
this.isMessageSelected = Data.isMessageSelected; this.isMessageSelected = Data.isMessageSelected;
this.messageActiveDom = Data.messageActiveDom; this.messageActiveDom = Data.messageActiveDom;
this.messageError = Data.messageError; this.messageError = Data.messageError;
@ -329,19 +332,19 @@
switch (this.viewPgpSignedVerifyStatus()) switch (this.viewPgpSignedVerifyStatus())
{ {
case Enums.SignedVerifyStatus.UnknownPublicKeys: case Enums.SignedVerifyStatus.UnknownPublicKeys:
sResult = Utils.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'); sResult = Translator.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND');
break; break;
case Enums.SignedVerifyStatus.UnknownPrivateKey: case Enums.SignedVerifyStatus.UnknownPrivateKey:
sResult = Utils.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'); sResult = Translator.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND');
break; break;
case Enums.SignedVerifyStatus.Unverified: case Enums.SignedVerifyStatus.Unverified:
sResult = Utils.i18n('PGP_NOTIFICATIONS/UNVERIFIRED_SIGNATURE'); sResult = Translator.i18n('PGP_NOTIFICATIONS/UNVERIFIRED_SIGNATURE');
break; break;
case Enums.SignedVerifyStatus.Error: case Enums.SignedVerifyStatus.Error:
sResult = Utils.i18n('PGP_NOTIFICATIONS/DECRYPTION_ERROR'); sResult = Translator.i18n('PGP_NOTIFICATIONS/DECRYPTION_ERROR');
break; break;
case Enums.SignedVerifyStatus.Success: case Enums.SignedVerifyStatus.Success:
sResult = Utils.i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', { sResult = Translator.i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', {
'USER': this.viewPgpSignedVerifyUser() 'USER': this.viewPgpSignedVerifyUser()
}); });
break; break;
@ -382,7 +385,7 @@
{ {
var var
self = this, self = this,
sErrorMessage = Utils.i18n('PREVIEW_POPUP/IMAGE_ERROR'), sErrorMessage = Translator.i18n('PREVIEW_POPUP/IMAGE_ERROR'),
fCheckHeaderHeight = function () { fCheckHeaderHeight = function () {
if (self.oHeaderDom) if (self.oHeaderDom)
{ {
@ -561,7 +564,7 @@
{ {
this.fullScreenMode(false); this.fullScreenMode(false);
} }
else if (Enums.Layout.NoPreview === Data.layout()) else if (Enums.Layout.NoPreview === this.layout())
{ {
this.message(null); this.message(null);
} }
@ -590,7 +593,7 @@
}); });
key('enter', Enums.KeyState.MessageList, function () { key('enter', Enums.KeyState.MessageList, function () {
if (Enums.Layout.NoPreview !== Data.layout() && self.message()) if (Enums.Layout.NoPreview !== self.layout() && self.message())
{ {
self.toggleFullScreen(); self.toggleFullScreen();
return false; return false;
@ -681,7 +684,7 @@
// change focused state // change focused state
key('tab, shift+tab, left', Enums.KeyState.MessageView, function (event, handler) { key('tab, shift+tab, left', Enums.KeyState.MessageView, function (event, handler) {
if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== Data.layout()) if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== self.layout())
{ {
if (event && handler && 'left' === handler.shortcut) if (event && handler && 'left' === handler.shortcut)
{ {
@ -697,7 +700,7 @@
self.message.focused(false); self.message.focused(false);
} }
} }
else if (self.message() && Enums.Layout.NoPreview === Data.layout() && event && handler && 'left' === handler.shortcut) else if (self.message() && Enums.Layout.NoPreview === self.layout() && event && handler && 'left' === handler.shortcut)
{ {
return true; return true;
} }
@ -856,8 +859,8 @@
{ {
Remote.sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid, Remote.sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
oMessage.readReceipt(), oMessage.readReceipt(),
Utils.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}), Translator.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}),
Utils.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': Data.accountEmail()})); Translator.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': Data.accountEmail()}));
oMessage.isReadReceipt(true); oMessage.isReadReceipt(true);

3
dev/bootstrap.js vendored
View file

@ -14,6 +14,7 @@
Plugins = require('Common/Plugins'), Plugins = require('Common/Plugins'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Translator = require('Common/Translator'),
EmailModel = require('Model/Email') EmailModel = require('Model/Email')
; ;
@ -37,12 +38,12 @@
// export // export
window['rl'] = window['rl'] || {}; window['rl'] = window['rl'] || {};
window['rl']['i18n'] = _.bind(Translator.i18n, Translator);
window['rl']['addHook'] = _.bind(Plugins.addHook, Plugins); window['rl']['addHook'] = _.bind(Plugins.addHook, Plugins);
window['rl']['settingsGet'] = _.bind(Plugins.mainSettingsGet, Plugins); window['rl']['settingsGet'] = _.bind(Plugins.mainSettingsGet, Plugins);
window['rl']['remoteRequest'] = _.bind(Plugins.remoteRequest, Plugins); window['rl']['remoteRequest'] = _.bind(Plugins.remoteRequest, Plugins);
window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins); window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins);
window['rl']['createCommand'] = Utils.createCommand; window['rl']['createCommand'] = Utils.createCommand;
window['rl']['i18n'] = Utils.i18n;
window['rl']['EmailModel'] = EmailModel; window['rl']['EmailModel'] = EmailModel;
window['rl']['Enums'] = Enums; window['rl']['Enums'] = Enums;

View file

@ -1233,6 +1233,7 @@ class Actions
$aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false); $aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false);
$aResult['DropboxApiKey'] = \trim($oConfig->Get('social', 'dropbox_api_key', '')); $aResult['DropboxApiKey'] = \trim($oConfig->Get('social', 'dropbox_api_key', ''));
if (!$aResult['AllowDropboxSocial']) if (!$aResult['AllowDropboxSocial'])
{ {
$aResult['DropboxApiKey'] = ''; $aResult['DropboxApiKey'] = '';
@ -1288,7 +1289,6 @@ class Actions
$aResult['TwitterConsumerKey'] = (string) $oConfig->Get('social', 'twitter_consumer_key', ''); $aResult['TwitterConsumerKey'] = (string) $oConfig->Get('social', 'twitter_consumer_key', '');
$aResult['TwitterConsumerSecret'] = (string) $oConfig->Get('social', 'twitter_consumer_secret', ''); $aResult['TwitterConsumerSecret'] = (string) $oConfig->Get('social', 'twitter_consumer_secret', '');
$aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false); $aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false);
$aResult['DropboxApiKey'] = (string) $oConfig->Get('social', 'dropbox_api_key', ''); $aResult['DropboxApiKey'] = (string) $oConfig->Get('social', 'dropbox_api_key', '');

View file

@ -20,9 +20,9 @@
<div class="controls"> <div class="controls">
<div class="flag-selector"> <div class="flag-selector">
<span class="flag-wrapper"> <span class="flag-wrapper">
<span data-bind="css: 'flag flag-' + mainLanguage()" style=""></span> <span data-bind="css: 'flag flag-' + language()" style=""></span>
</span> </span>
<span class="flag-name" data-bind="text: mainLanguageFullName, click: selectLanguage"></span> <span class="flag-name" data-bind="text: languageFullName, click: selectLanguage"></span>
&nbsp;&nbsp; &nbsp;&nbsp;
<div data-bind="component: { <div data-bind="component: {
name: 'SaveTrigger', name: 'SaveTrigger',
@ -40,7 +40,7 @@
name: 'Select', name: 'Select',
params: { params: {
options: themesOptions, options: themesOptions,
value: mainTheme, value: theme,
trigger: themeTrigger, trigger: themeTrigger,
optionsText: 'optText', optionsText: 'optText',
optionsValue: 'optValue', optionsValue: 'optValue',

View file

@ -21,22 +21,22 @@
<div data-bind="component: { <div data-bind="component: {
name: 'Checkbox', name: 'Checkbox',
params: { params: {
value: googleEnable.auth, value: googleEnableAuth,
label: 'Authentication' label: 'Authentication'
} }
}"></div> }"></div>
<div data-bind="component: { <div data-bind="component: {
name: 'Checkbox', name: 'Checkbox',
params: { params: {
value: googleEnable.drive, value: googleEnableDrive,
label: 'Google Drive Integration (Compose view)' label: 'Google Drive Integration (Compose view)'
} }
}"></div> }"></div>
<div data-bind="component: { <div data-bind="component: {
name: 'Checkbox', name: 'Checkbox',
params: { params: {
value: googleEnable.preview, value: googleEnablePreview,
label: 'Google Viewer Integration (Preview Microsoft Word, Excel and PowerPoint files)' label: 'Google Viewer Integration (Preview for Microsoft Word, Excel and PowerPoint files)'
} }
}"></div> }"></div>
</blockquote> </blockquote>
@ -54,7 +54,7 @@
name: 'xx', name: 'xx',
value: googleClientID, value: googleClientID,
trigger: googleTrigger1, trigger: googleTrigger1,
enable: googleEnable.requireClientSettings, enable: googleEnableRequireClientSettings,
size: 5 size: 5
} }
}"></div> }"></div>
@ -70,7 +70,7 @@
params: { params: {
value: googleClientSecret, value: googleClientSecret,
trigger: googleTrigger2, trigger: googleTrigger2,
enable: googleEnable.requireClientSettings, enable: googleEnableRequireClientSettings,
size: 5 size: 5
} }
}"></div> }"></div>
@ -88,7 +88,7 @@
value: googleApiKey, value: googleApiKey,
trigger: googleTrigger3, trigger: googleTrigger3,
size: 5, size: 5,
enable: googleEnable.requireApiKey enable: googleEnableRequireApiKey
} }
}"></div> }"></div>
<blockquote style="margin-top: 10px; margin-bottom: 0"> <blockquote style="margin-top: 10px; margin-bottom: 0">

View file

@ -106,7 +106,7 @@
<label class="flag-selector"> <label class="flag-selector">
<i data-bind="css: langRequest() ? 'icon-spinner animated' : 'icon-world'"></i> <i data-bind="css: langRequest() ? 'icon-spinner animated' : 'icon-world'"></i>
&nbsp; &nbsp;
<span class="flag-name" data-bind="text: mainLanguageFullName, click: selectLanguage"></span> <span class="flag-name" data-bind="text: languageFullName, click: selectLanguage"></span>
</label> </label>
</div> </div>
</div> </div>

View file

@ -10,9 +10,9 @@
<div class="controls"> <div class="controls">
<div class="flag-selector"> <div class="flag-selector">
<span class="flag-wrapper"> <span class="flag-wrapper">
<span data-bind="css: 'flag flag-' + mainLanguage()" style=""></span> <span data-bind="css: 'flag flag-' + language()" style=""></span>
</span> </span>
<span class="flag-name" data-bind="text: mainLanguageFullName, click: selectLanguage"></span> <span class="flag-name" data-bind="text: languageFullName, click: selectLanguage"></span>
&nbsp;&nbsp; &nbsp;&nbsp;
<div data-bind="component: { <div data-bind="component: {
name: 'SaveTrigger', name: 'SaveTrigger',
@ -66,8 +66,8 @@
name: 'Select', name: 'Select',
params: { params: {
label: 'SETTINGS_GENERAL/LABEL_MESSAGE_PER_PAGE', label: 'SETTINGS_GENERAL/LABEL_MESSAGE_PER_PAGE',
options: mainMessagesPerPageArray, options: messagesPerPageArray,
value: mainMessagesPerPage, value: messagesPerPage,
trigger: mppTrigger, trigger: mppTrigger,
size: 2, size: 2,
width: 70 width: 70
@ -108,24 +108,24 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-horizontal" data-bind="visible: isDesktopNotificationsSupported()"> <div class="form-horizontal" data-bind="visible: isDesktopNotificationSupported">
<div class="legend"> <div class="legend">
<span class="i18n i18n-animation" data-i18n-text="SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION"></span> <span class="i18n i18n-animation" data-i18n-text="SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION"></span>
</div> </div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<div data-bind="visible: isDesktopNotificationsSupported"> <div data-bind="visible: isDesktopNotificationSupported">
<div data-bind="component: { <div data-bind="component: {
name: 'Checkbox', name: 'Checkbox',
params: { params: {
label: 'SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION_DESC', label: 'SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION_DESC',
value: useDesktopNotifications, value: enableDesktopNotification,
disable: isDesktopNotificationsDenied, disable: isDesktopNotificationDenied,
inline: true inline: true
} }
}"></div> }"></div>
&nbsp; &nbsp;
<span data-bind="visible: isDesktopNotificationsDenied"> <span data-bind="visible: isDesktopNotificationDenied">
<span class="i18n" style="color: #999" data-i18n-text="SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION_DESC_DENIED"></span> <span class="i18n" style="color: #999" data-i18n-text="SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION_DESC_DENIED"></span>
</span> </span>
</div> </div>

View file

@ -1,5 +1,5 @@
<div class="b-settings-social g-ui-user-select-none"> <div class="b-settings-social g-ui-user-select-none">
<div class="form-horizontal" data-bind="visible: googleEnable() && googleEnable.auth()"> <div class="form-horizontal" data-bind="visible: googleEnable() && googleEnableAuth()">
<div class="legend"> <div class="legend">
<span class="i18n" data-i18n-text="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span> <span class="i18n" data-i18n-text="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span>
</div> </div>

View file

@ -10,7 +10,7 @@
</div> </div>
</div> </div>
<div class="b-themes-list" data-bind="foreach: themesObjects"> <div class="b-themes-list" data-bind="foreach: themesObjects">
<div class="e-item" data-bind="click: function () { $root.mainTheme(name); }, css: { 'selected': selected }"> <div class="e-item" data-bind="click: function () { $root.theme(name); }, css: { 'selected': selected }">
<div class="e-name" data-bind="text: nameDisplay"></div> <div class="e-name" data-bind="text: nameDisplay"></div>
<img class="e-image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-bind="attr: { 'src': themePreviewSrc }" /> <img class="e-image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-bind="attr: { 'src': themePreviewSrc }" />
</div> </div>

View file

@ -1,134 +1,134 @@
/* /*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
*/ */
body body
{ {
/* Font */ /* Font */
font-family: sans-serif, Arial, Verdana, "Trebuchet MS"; font-family: sans-serif, Arial, Verdana, "Trebuchet MS";
font-size: 12px; font-size: 12px;
/* Text color */ /* Text color */
color: #333; color: #333;
/* Remove the background color to make it transparent */ /* Remove the background color to make it transparent */
background-color: #fff; background-color: #fff;
margin: 20px; margin: 20px;
} }
.cke_editable .cke_editable
{ {
font-size: 13px; font-size: 13px;
line-height: 1.6; line-height: 1.6;
} }
blockquote blockquote
{ {
font-style: italic; font-style: italic;
font-family: Georgia, Times, "Times New Roman", serif; font-family: Georgia, Times, "Times New Roman", serif;
padding: 2px 0; padding: 2px 0;
border-style: solid; border-style: solid;
border-color: #ccc; border-color: #ccc;
border-width: 0; border-width: 0;
} }
.cke_contents_ltr blockquote .cke_contents_ltr blockquote
{ {
padding-left: 20px; padding-left: 20px;
padding-right: 8px; padding-right: 8px;
border-left-width: 5px; border-left-width: 5px;
} }
.cke_contents_rtl blockquote .cke_contents_rtl blockquote
{ {
padding-left: 8px; padding-left: 8px;
padding-right: 20px; padding-right: 20px;
border-right-width: 5px; border-right-width: 5px;
} }
a a
{ {
color: #0782C1; color: #0782C1;
} }
ol,ul,dl ol,ul,dl
{ {
/* IE7: reset rtl list margin. (#7334) */ /* IE7: reset rtl list margin. (#7334) */
*margin-right: 0px; *margin-right: 0px;
/* preserved spaces for list items with text direction other than the list. (#6249,#8049)*/ /* preserved spaces for list items with text direction other than the list. (#6249,#8049)*/
padding: 0 40px; padding: 0 40px;
} }
h1,h2,h3,h4,h5,h6 h1,h2,h3,h4,h5,h6
{ {
font-weight: normal; font-weight: normal;
line-height: 1.2; line-height: 1.2;
} }
hr hr
{ {
border: 0px; border: 0px;
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
} }
img.right img.right
{ {
border: 1px solid #ccc; border: 1px solid #ccc;
float: right; float: right;
margin-left: 15px; margin-left: 15px;
padding: 5px; padding: 5px;
} }
img.left img.left
{ {
border: 1px solid #ccc; border: 1px solid #ccc;
float: left; float: left;
margin-right: 15px; margin-right: 15px;
padding: 5px; padding: 5px;
} }
pre pre
{ {
white-space: pre-wrap; /* CSS 2.1 */ white-space: pre-wrap; /* CSS 2.1 */
word-wrap: break-word; /* IE7 */ word-wrap: break-word; /* IE7 */
-moz-tab-size: 4; -moz-tab-size: 4;
-o-tab-size: 4; -o-tab-size: 4;
-webkit-tab-size: 4; -webkit-tab-size: 4;
tab-size: 4; tab-size: 4;
} }
.marker .marker
{ {
background-color: Yellow; background-color: Yellow;
} }
span[lang] span[lang]
{ {
font-style: italic; font-style: italic;
} }
figure figure
{ {
text-align: center; text-align: center;
border: solid 1px #ccc; border: solid 1px #ccc;
border-radius: 2px; border-radius: 2px;
background: rgba(0,0,0,0.05); background: rgba(0,0,0,0.05);
padding: 10px; padding: 10px;
margin: 10px 20px; margin: 10px 20px;
display: inline-block; display: inline-block;
} }
figure > figcaption figure > figcaption
{ {
text-align: center; text-align: center;
display: block; /* For IE8 */ display: block; /* For IE8 */
} }
a > img { a > img {
padding: 1px; padding: 1px;
margin: 1px; margin: 1px;
border: none; border: none;
outline: 1px solid #0782C1; outline: 1px solid #0782C1;
} }

File diff suppressed because it is too large Load diff

View file

@ -1,77 +1,77 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en"> <html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>OnChange event plugin</title> <title>OnChange event plugin</title>
<link href="styles.css" rel="stylesheet" type="text/css"> <link href="styles.css" rel="stylesheet" type="text/css">
</head> </head>
<body> <body>
<h1>On Change event Plugin for CKEditor</h1> <h1>On Change event Plugin for CKEditor</h1>
<h2>Introduction</h2> <h2>Introduction</h2>
<p>This is a plugin that tries to fire a 'change' event whenever the content of a <a href="http://www.ckeditor.com">CKEditor</a> instance is changed.</p> <p>This is a plugin that tries to fire a 'change' event whenever the content of a <a href="http://www.ckeditor.com">CKEditor</a> instance is changed.</p>
<h3 id="contact">Author:</h3> <h3 id="contact">Author:</h3>
<p><a href="mailto:amla70@gmail.com">Alfonso Mart&iacute;nez de Lizarrondo</a></p> <p><a href="mailto:amla70@gmail.com">Alfonso Mart&iacute;nez de Lizarrondo</a></p>
<h3>Sponsored by:</h3> <h3>Sponsored by:</h3>
<p>Falcana</p> <p>Falcana</p>
<h3>Version history: </h3> <h3>Version history: </h3>
<ol> <ol>
<li>1.0: 21-January-2011. First version.</li> <li>1.0: 21-January-2011. First version.</li>
<li>1.1: 3-September-2011. Fixed issues with the UndoManager events. Detect changes in Source mode.</li> <li>1.1: 3-September-2011. Fixed issues with the UndoManager events. Detect changes in Source mode.</li>
<li>1.2: 18-September-2011. Avoid too many events in CKEditor 3.6.2. Filter keyboard to skip control and movement keys.</li> <li>1.2: 18-September-2011. Avoid too many events in CKEditor 3.6.2. Filter keyboard to skip control and movement keys.</li>
<li>1.3: 22-December-2011 Avoid firing the event after the editor has been destroyed.</li> <li>1.3: 22-December-2011 Avoid firing the event after the editor has been destroyed.</li>
<li>1.4: 7-September-2012 Don't fire events if the editor is readonly, thanks to Ulrich Gabor. Included code to use Mutation Observers.</li> <li>1.4: 7-September-2012 Don't fire events if the editor is readonly, thanks to Ulrich Gabor. Included code to use Mutation Observers.</li>
<li>1.5: 20-October-2012 Detect Cut and Paste for IE in source mode thanks to Jacki.</li> <li>1.5: 20-October-2012 Detect Cut and Paste for IE in source mode thanks to Jacki.</li>
<li>1.6: 18-November-2012 Detect multibyte characters thanks to Wouter.</li> <li>1.6: 18-November-2012 Detect multibyte characters thanks to Wouter.</li>
<li>1.7: 6-December-2012 Compatibility with Source mode in CKEditor 4.</li> <li>1.7: 6-December-2012 Compatibility with Source mode in CKEditor 4.</li>
<li>1.8: 8-June-2013 Use setInterval fix by Roman Minkin.</li> <li>1.8: 8-June-2013 Use setInterval fix by Roman Minkin.</li>
</ol> </ol>
<h2>Installation</h2> <h2>Installation</h2>
<h3>1. Copying the files</h3> <h3>1. Copying the files</h3>
<p>Extract the contents of the zip in you plugins directory, so it ends up like <p>Extract the contents of the zip in you plugins directory, so it ends up like
this<br> this<br>
<!--<img src="installation.png" alt="Screenshot of installation" width="311" height="346" longdesc="#install">--> <!--<img src="installation.png" alt="Screenshot of installation" width="311" height="346" longdesc="#install">-->
</p> </p>
<pre id="--install"> <pre id="--install">
ckeditor\ ckeditor\
... ...
images\ images\
lang\ lang\
plugins\ plugins\
... ...
onchange\ onchange\
plugin.js plugin.js
docs\ docs\
install.html install.html
... ...
skins\ skins\
themes\ themes\
</pre> </pre>
<h3>2. Adding it to CKEditor</h3> <h3>2. Adding it to CKEditor</h3>
<p>Now add the plugin in your <em>config.js</em> or custom js configuration <p>Now add the plugin in your <em>config.js</em> or custom js configuration
file: file:
<code>config.extraPlugins='onchange'; </code> <code>config.extraPlugins='onchange'; </code>
</p> </p>
<h3>3. Configuration</h3> <h3>3. Configuration</h3>
<p>You can limit the minimum time between changes to avoid getting too many events fired: <p>You can limit the minimum time between changes to avoid getting too many events fired:
<code>config.minimumChangeMilliseconds = 100; // 100 milliseconds (default value) <code>config.minimumChangeMilliseconds = 100; // 100 milliseconds (default value)
</code>.</p> </code>.</p>
<h3>4. Use it</h3> <h3>4. Use it</h3>
<p>Write your listener for the new 'change' event and perform whatever action you need there. <p>Write your listener for the new 'change' event and perform whatever action you need there.
<code>editor.on( 'change', function(e) { console.log(e) }); <code>editor.on( 'change', function(e) { console.log(e) });
</code>.</p> </code>.</p>
<!-- <!--
<h2>Final notes</h2> <h2>Final notes</h2>
--> -->
<h2>Disclaimers</h2> <h2>Disclaimers</h2>
<p>CKEditor is &copy; CKSource.com</p> <p>CKEditor is &copy; CKSource.com</p>
</body> </body>
</html> </html>

View file

@ -1,59 +1,59 @@
body { body {
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
font-size: 90%; font-size: 90%;
} }
h1 { h1 {
text-align:center; text-align:center;
font-size:180%; font-size:180%;
} }
h2 { h2 {
border-bottom:2px solid #CCC; border-bottom:2px solid #CCC;
margin:1em 0 0.4em 0; margin:1em 0 0.4em 0;
} }
h3 { h3 {
margin-bottom:0.4em; margin-bottom:0.4em;
} }
p { p {
margin:0 0 1em 1em; margin:0 0 1em 1em;
text-align:justify; text-align:justify;
} }
ol { ol {
margin:0 0 1.2em 1em; margin:0 0 1.2em 1em;
padding:0; padding:0;
list-style-type:none; list-style-type:none;
} }
ol li { ol li {
margin:0.2em 0; margin:0.2em 0;
} }
pre, code { pre, code {
font-size:100%; font-size:100%;
font-family:"Courier New", Courier, mono; font-family:"Courier New", Courier, mono;
background-color: #CCCCCC; background-color: #CCCCCC;
border:1px solid #999; border:1px solid #999;
padding:0.2em 1em; padding:0.2em 1em;
margin: 0.4em 0; margin: 0.4em 0;
display:block; display:block;
white-space: pre; white-space: pre;
overflow: auto; overflow: auto;
} }
form { form {
margin:0 0 0 1em; margin:0 0 0 1em;
} }
span.key { span.key {
color: #006600; color: #006600;
} }
#install { #install {
display:none display:none
} }
#languages ul { #languages ul {
display:inline; display:inline;
list-style-type:none; list-style-type:none;
margin:0; margin:0;
padding:0; padding:0;
} }
#languages li { #languages li {
display:inline; display:inline;
margin:0; margin:0;
padding:0; padding:0;
vertical-align:bottom; vertical-align:bottom;
} }

View file

@ -1,82 +1,82 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Ajax &mdash; CKEditor Sample</title> <title>Ajax &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" href="sample.css">
<script> <script>
var editor, html = ''; var editor, html = '';
function createEditor() { function createEditor() {
if ( editor ) if ( editor )
return; return;
// Create a new editor inside the <div id="editor">, setting its value to html // Create a new editor inside the <div id="editor">, setting its value to html
var config = {}; var config = {};
editor = CKEDITOR.appendTo( 'editor', config, html ); editor = CKEDITOR.appendTo( 'editor', config, html );
} }
function removeEditor() { function removeEditor() {
if ( !editor ) if ( !editor )
return; return;
// Retrieve the editor contents. In an Ajax application, this data would be // Retrieve the editor contents. In an Ajax application, this data would be
// sent to the server or used in any other way. // sent to the server or used in any other way.
document.getElementById( 'editorcontents' ).innerHTML = html = editor.getData(); document.getElementById( 'editorcontents' ).innerHTML = html = editor.getData();
document.getElementById( 'contents' ).style.display = ''; document.getElementById( 'contents' ).style.display = '';
// Destroy the editor. // Destroy the editor.
editor.destroy(); editor.destroy();
editor = null; editor = null;
} }
</script> </script>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Create and Destroy Editor Instances for Ajax Applications <a href="index.html">CKEditor Samples</a> &raquo; Create and Destroy Editor Instances for Ajax Applications
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to create and destroy CKEditor instances on the fly. After the removal of CKEditor the content created inside the editing This sample shows how to create and destroy CKEditor instances on the fly. After the removal of CKEditor the content created inside the editing
area will be displayed in a <code>&lt;div&gt;</code> element. area will be displayed in a <code>&lt;div&gt;</code> element.
</p> </p>
<p> <p>
For details of how to create this setup check the source code of this sample page For details of how to create this setup check the source code of this sample page
for JavaScript code responsible for the creation and destruction of a CKEditor instance. for JavaScript code responsible for the creation and destruction of a CKEditor instance.
</p> </p>
</div> </div>
<p>Click the buttons to create and remove a CKEditor instance.</p> <p>Click the buttons to create and remove a CKEditor instance.</p>
<p> <p>
<input onclick="createEditor();" type="button" value="Create Editor"> <input onclick="createEditor();" type="button" value="Create Editor">
<input onclick="removeEditor();" type="button" value="Remove Editor"> <input onclick="removeEditor();" type="button" value="Remove Editor">
</p> </p>
<!-- This div will hold the editor. --> <!-- This div will hold the editor. -->
<div id="editor"> <div id="editor">
</div> </div>
<div id="contents" style="display: none"> <div id="contents" style="display: none">
<p> <p>
Edited Contents: Edited Contents:
</p> </p>
<!-- This div will be used to display the editor contents. --> <!-- This div will be used to display the editor contents. -->
<div id="editorcontents"> <div id="editorcontents">
</div> </div>
</div> </div>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,207 +1,207 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>API Usage &mdash; CKEditor Sample</title> <title>API Usage &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<link href="sample.css" rel="stylesheet"> <link href="sample.css" rel="stylesheet">
<script> <script>
// The instanceReady event is fired, when an instance of CKEditor has finished // The instanceReady event is fired, when an instance of CKEditor has finished
// its initialization. // its initialization.
CKEDITOR.on( 'instanceReady', function( ev ) { CKEDITOR.on( 'instanceReady', function( ev ) {
// Show the editor name and description in the browser status bar. // Show the editor name and description in the browser status bar.
document.getElementById( 'eMessage' ).innerHTML = 'Instance <code>' + ev.editor.name + '<\/code> loaded.'; document.getElementById( 'eMessage' ).innerHTML = 'Instance <code>' + ev.editor.name + '<\/code> loaded.';
// Show this sample buttons. // Show this sample buttons.
document.getElementById( 'eButtons' ).style.display = 'block'; document.getElementById( 'eButtons' ).style.display = 'block';
}); });
function InsertHTML() { function InsertHTML() {
// Get the editor instance that we want to interact with. // Get the editor instance that we want to interact with.
var editor = CKEDITOR.instances.editor1; var editor = CKEDITOR.instances.editor1;
var value = document.getElementById( 'htmlArea' ).value; var value = document.getElementById( 'htmlArea' ).value;
// Check the active editing mode. // Check the active editing mode.
if ( editor.mode == 'wysiwyg' ) if ( editor.mode == 'wysiwyg' )
{ {
// Insert HTML code. // Insert HTML code.
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertHtml // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertHtml
editor.insertHtml( value ); editor.insertHtml( value );
} }
else else
alert( 'You must be in WYSIWYG mode!' ); alert( 'You must be in WYSIWYG mode!' );
} }
function InsertText() { function InsertText() {
// Get the editor instance that we want to interact with. // Get the editor instance that we want to interact with.
var editor = CKEDITOR.instances.editor1; var editor = CKEDITOR.instances.editor1;
var value = document.getElementById( 'txtArea' ).value; var value = document.getElementById( 'txtArea' ).value;
// Check the active editing mode. // Check the active editing mode.
if ( editor.mode == 'wysiwyg' ) if ( editor.mode == 'wysiwyg' )
{ {
// Insert as plain text. // Insert as plain text.
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertText // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertText
editor.insertText( value ); editor.insertText( value );
} }
else else
alert( 'You must be in WYSIWYG mode!' ); alert( 'You must be in WYSIWYG mode!' );
} }
function SetContents() { function SetContents() {
// Get the editor instance that we want to interact with. // Get the editor instance that we want to interact with.
var editor = CKEDITOR.instances.editor1; var editor = CKEDITOR.instances.editor1;
var value = document.getElementById( 'htmlArea' ).value; var value = document.getElementById( 'htmlArea' ).value;
// Set editor contents (replace current contents). // Set editor contents (replace current contents).
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData
editor.setData( value ); editor.setData( value );
} }
function GetContents() { function GetContents() {
// Get the editor instance that you want to interact with. // Get the editor instance that you want to interact with.
var editor = CKEDITOR.instances.editor1; var editor = CKEDITOR.instances.editor1;
// Get editor contents // Get editor contents
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getData // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getData
alert( editor.getData() ); alert( editor.getData() );
} }
function ExecuteCommand( commandName ) { function ExecuteCommand( commandName ) {
// Get the editor instance that we want to interact with. // Get the editor instance that we want to interact with.
var editor = CKEDITOR.instances.editor1; var editor = CKEDITOR.instances.editor1;
// Check the active editing mode. // Check the active editing mode.
if ( editor.mode == 'wysiwyg' ) if ( editor.mode == 'wysiwyg' )
{ {
// Execute the command. // Execute the command.
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-execCommand // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-execCommand
editor.execCommand( commandName ); editor.execCommand( commandName );
} }
else else
alert( 'You must be in WYSIWYG mode!' ); alert( 'You must be in WYSIWYG mode!' );
} }
function CheckDirty() { function CheckDirty() {
// Get the editor instance that we want to interact with. // Get the editor instance that we want to interact with.
var editor = CKEDITOR.instances.editor1; var editor = CKEDITOR.instances.editor1;
// Checks whether the current editor contents present changes when compared // Checks whether the current editor contents present changes when compared
// to the contents loaded into the editor at startup // to the contents loaded into the editor at startup
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-checkDirty // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-checkDirty
alert( editor.checkDirty() ); alert( editor.checkDirty() );
} }
function ResetDirty() { function ResetDirty() {
// Get the editor instance that we want to interact with. // Get the editor instance that we want to interact with.
var editor = CKEDITOR.instances.editor1; var editor = CKEDITOR.instances.editor1;
// Resets the "dirty state" of the editor (see CheckDirty()) // Resets the "dirty state" of the editor (see CheckDirty())
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-resetDirty // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-resetDirty
editor.resetDirty(); editor.resetDirty();
alert( 'The "IsDirty" status has been reset' ); alert( 'The "IsDirty" status has been reset' );
} }
function Focus() { function Focus() {
CKEDITOR.instances.editor1.focus(); CKEDITOR.instances.editor1.focus();
} }
function onFocus() { function onFocus() {
document.getElementById( 'eMessage' ).innerHTML = '<b>' + this.name + ' is focused </b>'; document.getElementById( 'eMessage' ).innerHTML = '<b>' + this.name + ' is focused </b>';
} }
function onBlur() { function onBlur() {
document.getElementById( 'eMessage' ).innerHTML = this.name + ' lost focus'; document.getElementById( 'eMessage' ).innerHTML = this.name + ' lost focus';
} }
</script> </script>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Using CKEditor JavaScript API <a href="index.html">CKEditor Samples</a> &raquo; Using CKEditor JavaScript API
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to use the This sample shows how to use the
<a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.editor">CKEditor JavaScript API</a> <a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.editor">CKEditor JavaScript API</a>
to interact with the editor at runtime. to interact with the editor at runtime.
</p> </p>
<p> <p>
For details on how to create this setup check the source code of this sample page. For details on how to create this setup check the source code of this sample page.
</p> </p>
</div> </div>
<!-- This <div> holds alert messages to be display in the sample page. --> <!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts"> <div id="alerts">
<noscript> <noscript>
<p> <p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface. be able to edit it normally, without a rich editor interface.
</p> </p>
</noscript> </noscript>
</div> </div>
<form action="../../../samples/sample_posteddata.php" method="post"> <form action="../../../samples/sample_posteddata.php" method="post">
<textarea cols="100" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea cols="100" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script> <script>
// Replace the <textarea id="editor1"> with an CKEditor instance. // Replace the <textarea id="editor1"> with an CKEditor instance.
CKEDITOR.replace( 'editor1', { CKEDITOR.replace( 'editor1', {
on: { on: {
focus: onFocus, focus: onFocus,
blur: onBlur, blur: onBlur,
// Check for availability of corresponding plugins. // Check for availability of corresponding plugins.
pluginsLoaded: function( evt ) { pluginsLoaded: function( evt ) {
var doc = CKEDITOR.document, ed = evt.editor; var doc = CKEDITOR.document, ed = evt.editor;
if ( !ed.getCommand( 'bold' ) ) if ( !ed.getCommand( 'bold' ) )
doc.getById( 'exec-bold' ).hide(); doc.getById( 'exec-bold' ).hide();
if ( !ed.getCommand( 'link' ) ) if ( !ed.getCommand( 'link' ) )
doc.getById( 'exec-link' ).hide(); doc.getById( 'exec-link' ).hide();
} }
} }
}); });
</script> </script>
<p id="eMessage"> <p id="eMessage">
</p> </p>
<div id="eButtons" style="display: none"> <div id="eButtons" style="display: none">
<input id="exec-bold" onclick="ExecuteCommand('bold');" type="button" value="Execute &quot;bold&quot; Command"> <input id="exec-bold" onclick="ExecuteCommand('bold');" type="button" value="Execute &quot;bold&quot; Command">
<input id="exec-link" onclick="ExecuteCommand('link');" type="button" value="Execute &quot;link&quot; Command"> <input id="exec-link" onclick="ExecuteCommand('link');" type="button" value="Execute &quot;link&quot; Command">
<input onclick="Focus();" type="button" value="Focus"> <input onclick="Focus();" type="button" value="Focus">
<br><br> <br><br>
<input onclick="InsertHTML();" type="button" value="Insert HTML"> <input onclick="InsertHTML();" type="button" value="Insert HTML">
<input onclick="SetContents();" type="button" value="Set Editor Contents"> <input onclick="SetContents();" type="button" value="Set Editor Contents">
<input onclick="GetContents();" type="button" value="Get Editor Contents (HTML)"> <input onclick="GetContents();" type="button" value="Get Editor Contents (HTML)">
<br> <br>
<textarea cols="100" id="htmlArea" rows="3">&lt;h2&gt;Test&lt;/h2&gt;&lt;p&gt;This is some &lt;a href="/Test1.html"&gt;sample&lt;/a&gt; HTML code.&lt;/p&gt;</textarea> <textarea cols="100" id="htmlArea" rows="3">&lt;h2&gt;Test&lt;/h2&gt;&lt;p&gt;This is some &lt;a href="/Test1.html"&gt;sample&lt;/a&gt; HTML code.&lt;/p&gt;</textarea>
<br> <br>
<br> <br>
<input onclick="InsertText();" type="button" value="Insert Text"> <input onclick="InsertText();" type="button" value="Insert Text">
<br> <br>
<textarea cols="100" id="txtArea" rows="3"> First line with some leading whitespaces. <textarea cols="100" id="txtArea" rows="3"> First line with some leading whitespaces.
Second line of text preceded by two line breaks.</textarea> Second line of text preceded by two line breaks.</textarea>
<br> <br>
<br> <br>
<input onclick="CheckDirty();" type="button" value="checkDirty()"> <input onclick="CheckDirty();" type="button" value="checkDirty()">
<input onclick="ResetDirty();" type="button" value="resetDirty()"> <input onclick="ResetDirty();" type="button" value="resetDirty()">
</div> </div>
</form> </form>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,204 +1,204 @@
/* /*
* Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. * Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license * For licensing, see LICENSE.md or http://ckeditor.com/license
* *
* Styles used by the XHTML 1.1 sample page (xhtml.html). * Styles used by the XHTML 1.1 sample page (xhtml.html).
*/ */
/** /**
* Basic definitions for the editing area. * Basic definitions for the editing area.
*/ */
body body
{ {
font-family: Arial, Verdana, sans-serif; font-family: Arial, Verdana, sans-serif;
font-size: 80%; font-size: 80%;
color: #000000; color: #000000;
background-color: #ffffff; background-color: #ffffff;
padding: 5px; padding: 5px;
margin: 0px; margin: 0px;
} }
/** /**
* Core styles. * Core styles.
*/ */
.Bold .Bold
{ {
font-weight: bold; font-weight: bold;
} }
.Italic .Italic
{ {
font-style: italic; font-style: italic;
} }
.Underline .Underline
{ {
text-decoration: underline; text-decoration: underline;
} }
.StrikeThrough .StrikeThrough
{ {
text-decoration: line-through; text-decoration: line-through;
} }
.Subscript .Subscript
{ {
vertical-align: sub; vertical-align: sub;
font-size: smaller; font-size: smaller;
} }
.Superscript .Superscript
{ {
vertical-align: super; vertical-align: super;
font-size: smaller; font-size: smaller;
} }
/** /**
* Font faces. * Font faces.
*/ */
.FontComic .FontComic
{ {
font-family: 'Comic Sans MS'; font-family: 'Comic Sans MS';
} }
.FontCourier .FontCourier
{ {
font-family: 'Courier New'; font-family: 'Courier New';
} }
.FontTimes .FontTimes
{ {
font-family: 'Times New Roman'; font-family: 'Times New Roman';
} }
/** /**
* Font sizes. * Font sizes.
*/ */
.FontSmaller .FontSmaller
{ {
font-size: smaller; font-size: smaller;
} }
.FontLarger .FontLarger
{ {
font-size: larger; font-size: larger;
} }
.FontSmall .FontSmall
{ {
font-size: 8pt; font-size: 8pt;
} }
.FontBig .FontBig
{ {
font-size: 14pt; font-size: 14pt;
} }
.FontDouble .FontDouble
{ {
font-size: 200%; font-size: 200%;
} }
/** /**
* Font colors. * Font colors.
*/ */
.FontColor1 .FontColor1
{ {
color: #ff9900; color: #ff9900;
} }
.FontColor2 .FontColor2
{ {
color: #0066cc; color: #0066cc;
} }
.FontColor3 .FontColor3
{ {
color: #ff0000; color: #ff0000;
} }
.FontColor1BG .FontColor1BG
{ {
background-color: #ff9900; background-color: #ff9900;
} }
.FontColor2BG .FontColor2BG
{ {
background-color: #0066cc; background-color: #0066cc;
} }
.FontColor3BG .FontColor3BG
{ {
background-color: #ff0000; background-color: #ff0000;
} }
/** /**
* Indentation. * Indentation.
*/ */
.Indent1 .Indent1
{ {
margin-left: 40px; margin-left: 40px;
} }
.Indent2 .Indent2
{ {
margin-left: 80px; margin-left: 80px;
} }
.Indent3 .Indent3
{ {
margin-left: 120px; margin-left: 120px;
} }
/** /**
* Alignment. * Alignment.
*/ */
.JustifyLeft .JustifyLeft
{ {
text-align: left; text-align: left;
} }
.JustifyRight .JustifyRight
{ {
text-align: right; text-align: right;
} }
.JustifyCenter .JustifyCenter
{ {
text-align: center; text-align: center;
} }
.JustifyFull .JustifyFull
{ {
text-align: justify; text-align: justify;
} }
/** /**
* Other. * Other.
*/ */
code code
{ {
font-family: courier, monospace; font-family: courier, monospace;
background-color: #eeeeee; background-color: #eeeeee;
padding-left: 1px; padding-left: 1px;
padding-right: 1px; padding-right: 1px;
border: #c0c0c0 1px solid; border: #c0c0c0 1px solid;
} }
kbd kbd
{ {
padding: 0px 1px 0px 1px; padding: 0px 1px 0px 1px;
border-width: 1px 2px 2px 1px; border-width: 1px 2px 2px 1px;
border-style: solid; border-style: solid;
} }
blockquote blockquote
{ {
color: #808080; color: #808080;
} }

View file

@ -1,59 +1,59 @@
<!DOCTYPE html> <!DOCTYPE html>
<?php <?php
/* /*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
*/ */
?> ?>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Sample &mdash; CKEditor</title> <title>Sample &mdash; CKEditor</title>
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" href="sample.css">
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
CKEditor &mdash; Posted Data CKEditor &mdash; Posted Data
</h1> </h1>
<table border="1" cellspacing="0" id="outputSample"> <table border="1" cellspacing="0" id="outputSample">
<colgroup><col width="120"></colgroup> <colgroup><col width="120"></colgroup>
<thead> <thead>
<tr> <tr>
<th>Field&nbsp;Name</th> <th>Field&nbsp;Name</th>
<th>Value</th> <th>Value</th>
</tr> </tr>
</thead> </thead>
<?php <?php
if (!empty($_POST)) if (!empty($_POST))
{ {
foreach ( $_POST as $key => $value ) foreach ( $_POST as $key => $value )
{ {
if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
continue; continue;
if ( get_magic_quotes_gpc() ) if ( get_magic_quotes_gpc() )
$value = htmlspecialchars( stripslashes((string)$value) ); $value = htmlspecialchars( stripslashes((string)$value) );
else else
$value = htmlspecialchars( (string)$value ); $value = htmlspecialchars( (string)$value );
?> ?>
<tr> <tr>
<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th> <th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
<td><pre class="samples"><?php echo $value; ?></pre></td> <td><pre class="samples"><?php echo $value; ?></pre></td>
</tr> </tr>
<?php <?php
} }
} }
?> ?>
</table> </table>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long

View file

@ -1,141 +1,141 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Replace DIV &mdash; CKEditor Sample</title> <title>Replace DIV &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<link href="sample.css" rel="stylesheet"> <link href="sample.css" rel="stylesheet">
<style> <style>
div.editable div.editable
{ {
border: solid 2px transparent; border: solid 2px transparent;
padding-left: 15px; padding-left: 15px;
padding-right: 15px; padding-right: 15px;
} }
div.editable:hover div.editable:hover
{ {
border-color: black; border-color: black;
} }
</style> </style>
<script> <script>
// Uncomment the following code to test the "Timeout Loading Method". // Uncomment the following code to test the "Timeout Loading Method".
// CKEDITOR.loadFullCoreTimeout = 5; // CKEDITOR.loadFullCoreTimeout = 5;
window.onload = function() { window.onload = function() {
// Listen to the double click event. // Listen to the double click event.
if ( window.addEventListener ) if ( window.addEventListener )
document.body.addEventListener( 'dblclick', onDoubleClick, false ); document.body.addEventListener( 'dblclick', onDoubleClick, false );
else if ( window.attachEvent ) else if ( window.attachEvent )
document.body.attachEvent( 'ondblclick', onDoubleClick ); document.body.attachEvent( 'ondblclick', onDoubleClick );
}; };
function onDoubleClick( ev ) { function onDoubleClick( ev ) {
// Get the element which fired the event. This is not necessarily the // Get the element which fired the event. This is not necessarily the
// element to which the event has been attached. // element to which the event has been attached.
var element = ev.target || ev.srcElement; var element = ev.target || ev.srcElement;
// Find out the div that holds this element. // Find out the div that holds this element.
var name; var name;
do { do {
element = element.parentNode; element = element.parentNode;
} }
while ( element && ( name = element.nodeName.toLowerCase() ) && while ( element && ( name = element.nodeName.toLowerCase() ) &&
( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' ); ( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' );
if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 ) if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 )
replaceDiv( element ); replaceDiv( element );
} }
var editor; var editor;
function replaceDiv( div ) { function replaceDiv( div ) {
if ( editor ) if ( editor )
editor.destroy(); editor.destroy();
editor = CKEDITOR.replace( div ); editor = CKEDITOR.replace( div );
} }
</script> </script>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Replace DIV with CKEditor on the Fly <a href="index.html">CKEditor Samples</a> &raquo; Replace DIV with CKEditor on the Fly
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to automatically replace <code>&lt;div&gt;</code> elements This sample shows how to automatically replace <code>&lt;div&gt;</code> elements
with a CKEditor instance on the fly, following user's doubleclick. The content with a CKEditor instance on the fly, following user's doubleclick. The content
that was previously placed inside the <code>&lt;div&gt;</code> element will now that was previously placed inside the <code>&lt;div&gt;</code> element will now
be moved into CKEditor editing area. be moved into CKEditor editing area.
</p> </p>
<p> <p>
For details on how to create this setup check the source code of this sample page. For details on how to create this setup check the source code of this sample page.
</p> </p>
</div> </div>
<p> <p>
Double-click any of the following <code>&lt;div&gt;</code> elements to transform them into Double-click any of the following <code>&lt;div&gt;</code> elements to transform them into
editor instances. editor instances.
</p> </p>
<div class="editable"> <div class="editable">
<h3> <h3>
Part 1 Part 1
</h3> </h3>
<p> <p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p> </p>
</div> </div>
<div class="editable"> <div class="editable">
<h3> <h3>
Part 2 Part 2
</h3> </h3>
<p> <p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p> </p>
<p> <p>
Donec velit. Mauris massa. Vestibulum non nulla. Nam suscipit arcu nec elit. Phasellus Donec velit. Mauris massa. Vestibulum non nulla. Nam suscipit arcu nec elit. Phasellus
sollicitudin iaculis ante. Ut non mauris et sapien tincidunt adipiscing. Vestibulum sollicitudin iaculis ante. Ut non mauris et sapien tincidunt adipiscing. Vestibulum
vitae leo. Suspendisse nec mi tristique nulla laoreet vulputate. vitae leo. Suspendisse nec mi tristique nulla laoreet vulputate.
</p> </p>
</div> </div>
<div class="editable"> <div class="editable">
<h3> <h3>
Part 3 Part 3
</h3> </h3>
<p> <p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p> </p>
</div> </div>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,311 +1,311 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Massive inline editing &mdash; CKEditor Sample</title> <title>Massive inline editing &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<script> <script>
// This code is generally not necessary, but it is here to demonstrate // This code is generally not necessary, but it is here to demonstrate
// how to customize specific editor instances on the fly. This fits well // how to customize specific editor instances on the fly. This fits well
// this demo because we have editable elements (like headers) that // this demo because we have editable elements (like headers) that
// require less features. // require less features.
// The "instanceCreated" event is fired for every editor instance created. // The "instanceCreated" event is fired for every editor instance created.
CKEDITOR.on( 'instanceCreated', function( event ) { CKEDITOR.on( 'instanceCreated', function( event ) {
var editor = event.editor, var editor = event.editor,
element = editor.element; element = editor.element;
// Customize editors for headers and tag list. // Customize editors for headers and tag list.
// These editors don't need features like smileys, templates, iframes etc. // These editors don't need features like smileys, templates, iframes etc.
if ( element.is( 'h1', 'h2', 'h3' ) || element.getAttribute( 'id' ) == 'taglist' ) { if ( element.is( 'h1', 'h2', 'h3' ) || element.getAttribute( 'id' ) == 'taglist' ) {
// Customize the editor configurations on "configLoaded" event, // Customize the editor configurations on "configLoaded" event,
// which is fired after the configuration file loading and // which is fired after the configuration file loading and
// execution. This makes it possible to change the // execution. This makes it possible to change the
// configurations before the editor initialization takes place. // configurations before the editor initialization takes place.
editor.on( 'configLoaded', function() { editor.on( 'configLoaded', function() {
// Remove unnecessary plugins to make the editor simpler. // Remove unnecessary plugins to make the editor simpler.
editor.config.removePlugins = 'colorbutton,find,flash,font,' + editor.config.removePlugins = 'colorbutton,find,flash,font,' +
'forms,iframe,image,newpage,removeformat,' + 'forms,iframe,image,newpage,removeformat,' +
'smiley,specialchar,stylescombo,templates'; 'smiley,specialchar,stylescombo,templates';
// Rearrange the layout of the toolbar. // Rearrange the layout of the toolbar.
editor.config.toolbarGroups = [ editor.config.toolbarGroups = [
{ name: 'editing', groups: [ 'basicstyles', 'links' ] }, { name: 'editing', groups: [ 'basicstyles', 'links' ] },
{ name: 'undo' }, { name: 'undo' },
{ name: 'clipboard', groups: [ 'selection', 'clipboard' ] }, { name: 'clipboard', groups: [ 'selection', 'clipboard' ] },
{ name: 'about' } { name: 'about' }
]; ];
}); });
} }
}); });
</script> </script>
<link href="sample.css" rel="stylesheet"> <link href="sample.css" rel="stylesheet">
<style> <style>
/* The following styles are just to make the page look nice. */ /* The following styles are just to make the page look nice. */
/* Workaround to show Arial Black in Firefox. */ /* Workaround to show Arial Black in Firefox. */
@font-face @font-face
{ {
font-family: 'arial-black'; font-family: 'arial-black';
src: local('Arial Black'); src: local('Arial Black');
} }
*[contenteditable="true"] *[contenteditable="true"]
{ {
padding: 10px; padding: 10px;
} }
#container #container
{ {
width: 960px; width: 960px;
margin: 30px auto 0; margin: 30px auto 0;
} }
#header #header
{ {
overflow: hidden; overflow: hidden;
padding: 0 0 30px; padding: 0 0 30px;
border-bottom: 5px solid #05B2D2; border-bottom: 5px solid #05B2D2;
position: relative; position: relative;
} }
#headerLeft, #headerLeft,
#headerRight #headerRight
{ {
width: 49%; width: 49%;
overflow: hidden; overflow: hidden;
} }
#headerLeft #headerLeft
{ {
float: left; float: left;
padding: 10px 1px 1px; padding: 10px 1px 1px;
} }
#headerLeft h2, #headerLeft h2,
#headerLeft h3 #headerLeft h3
{ {
text-align: right; text-align: right;
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
font-weight: normal; font-weight: normal;
} }
#headerLeft h2 #headerLeft h2
{ {
font-family: "Arial Black",arial-black; font-family: "Arial Black",arial-black;
font-size: 4.6em; font-size: 4.6em;
line-height: 1.1; line-height: 1.1;
text-transform: uppercase; text-transform: uppercase;
} }
#headerLeft h3 #headerLeft h3
{ {
font-size: 2.3em; font-size: 2.3em;
line-height: 1.1; line-height: 1.1;
margin: .2em 0 0; margin: .2em 0 0;
color: #666; color: #666;
} }
#headerRight #headerRight
{ {
float: right; float: right;
padding: 1px; padding: 1px;
} }
#headerRight p #headerRight p
{ {
line-height: 1.8; line-height: 1.8;
text-align: justify; text-align: justify;
margin: 0; margin: 0;
} }
#headerRight p + p #headerRight p + p
{ {
margin-top: 20px; margin-top: 20px;
} }
#headerRight > div #headerRight > div
{ {
padding: 20px; padding: 20px;
margin: 0 0 0 30px; margin: 0 0 0 30px;
font-size: 1.4em; font-size: 1.4em;
color: #666; color: #666;
} }
#columns #columns
{ {
color: #333; color: #333;
overflow: hidden; overflow: hidden;
padding: 20px 0; padding: 20px 0;
} }
#columns > div #columns > div
{ {
float: left; float: left;
width: 33.3%; width: 33.3%;
} }
#columns #column1 > div #columns #column1 > div
{ {
margin-left: 1px; margin-left: 1px;
} }
#columns #column3 > div #columns #column3 > div
{ {
margin-right: 1px; margin-right: 1px;
} }
#columns > div > div #columns > div > div
{ {
margin: 0px 10px; margin: 0px 10px;
padding: 10px 20px; padding: 10px 20px;
} }
#columns blockquote #columns blockquote
{ {
margin-left: 15px; margin-left: 15px;
} }
#tagLine #tagLine
{ {
border-top: 5px solid #05B2D2; border-top: 5px solid #05B2D2;
padding-top: 20px; padding-top: 20px;
} }
#taglist { #taglist {
display: inline-block; display: inline-block;
margin-left: 20px; margin-left: 20px;
font-weight: bold; font-weight: bold;
margin: 0 0 0 20px; margin: 0 0 0 20px;
} }
</style> </style>
</head> </head>
<body> <body>
<div> <div>
<h1 class="samples"><a href="index.html">CKEditor Samples</a> &raquo; Massive inline editing</h1> <h1 class="samples"><a href="index.html">CKEditor Samples</a> &raquo; Massive inline editing</h1>
<div class="description"> <div class="description">
<p>This sample page demonstrates the inline editing feature - CKEditor instances will be created automatically from page elements with <strong>contentEditable</strong> attribute set to value <strong>true</strong>:</p> <p>This sample page demonstrates the inline editing feature - CKEditor instances will be created automatically from page elements with <strong>contentEditable</strong> attribute set to value <strong>true</strong>:</p>
<pre class="samples">&lt;div <strong>contenteditable="true</strong>" &gt; ... &lt;/div&gt;</pre> <pre class="samples">&lt;div <strong>contenteditable="true</strong>" &gt; ... &lt;/div&gt;</pre>
<p>Click inside of any element below to start editing.</p> <p>Click inside of any element below to start editing.</p>
</div> </div>
</div> </div>
<div id="container"> <div id="container">
<div id="header"> <div id="header">
<div id="headerLeft"> <div id="headerLeft">
<h2 id="sampleTitle" contenteditable="true"> <h2 id="sampleTitle" contenteditable="true">
CKEditor<br> Goes Inline! CKEditor<br> Goes Inline!
</h2> </h2>
<h3 contenteditable="true"> <h3 contenteditable="true">
Lorem ipsum dolor sit amet dolor duis blandit vestibulum faucibus a, tortor. Lorem ipsum dolor sit amet dolor duis blandit vestibulum faucibus a, tortor.
</h3> </h3>
</div> </div>
<div id="headerRight"> <div id="headerRight">
<div contenteditable="true"> <div contenteditable="true">
<p> <p>
Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies.
</p> </p>
<p> <p>
Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna. Vestibulum dapibus, mauris nec malesuada fames ac. Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna. Vestibulum dapibus, mauris nec malesuada fames ac.
</p> </p>
</div> </div>
</div> </div>
</div> </div>
<div id="columns"> <div id="columns">
<div id="column1"> <div id="column1">
<div contenteditable="true"> <div contenteditable="true">
<h3> <h3>
Fusce vitae porttitor Fusce vitae porttitor
</h3> </h3>
<p> <p>
<strong> <strong>
Lorem ipsum dolor sit amet dolor. Duis blandit vestibulum faucibus a, tortor. Lorem ipsum dolor sit amet dolor. Duis blandit vestibulum faucibus a, tortor.
</strong> </strong>
</p> </p>
<p> <p>
Proin nunc justo felis mollis tincidunt, risus risus pede, posuere cubilia Curae, Nullam euismod, enim. Etiam nibh ultricies dolor ac dignissim erat volutpat. Vivamus fermentum <a href="http://ckeditor.com/">nisl nulla sem in</a> metus. Maecenas wisi. Donec nec erat volutpat. Proin nunc justo felis mollis tincidunt, risus risus pede, posuere cubilia Curae, Nullam euismod, enim. Etiam nibh ultricies dolor ac dignissim erat volutpat. Vivamus fermentum <a href="http://ckeditor.com/">nisl nulla sem in</a> metus. Maecenas wisi. Donec nec erat volutpat.
</p> </p>
<blockquote> <blockquote>
<p> <p>
Fusce vitae porttitor a, euismod convallis nisl, blandit risus tortor, pretium. Fusce vitae porttitor a, euismod convallis nisl, blandit risus tortor, pretium.
Vehicula vitae, imperdiet vel, ornare enim vel sodales rutrum Vehicula vitae, imperdiet vel, ornare enim vel sodales rutrum
</p> </p>
</blockquote> </blockquote>
<blockquote> <blockquote>
<p> <p>
Libero nunc, rhoncus ante ipsum non ipsum. Nunc eleifend pede turpis id sollicitudin fringilla. Phasellus ultrices, velit ac arcu. Libero nunc, rhoncus ante ipsum non ipsum. Nunc eleifend pede turpis id sollicitudin fringilla. Phasellus ultrices, velit ac arcu.
</p> </p>
</blockquote> </blockquote>
<p>Pellentesque nunc. Donec suscipit erat. Pellentesque habitant morbi tristique ullamcorper.</p> <p>Pellentesque nunc. Donec suscipit erat. Pellentesque habitant morbi tristique ullamcorper.</p>
<p><s>Mauris mattis feugiat lectus nec mauris. Nullam vitae ante.</s></p> <p><s>Mauris mattis feugiat lectus nec mauris. Nullam vitae ante.</s></p>
</div> </div>
</div> </div>
<div id="column2"> <div id="column2">
<div contenteditable="true"> <div contenteditable="true">
<h3> <h3>
Integer condimentum sit amet Integer condimentum sit amet
</h3> </h3>
<p> <p>
<strong>Aenean nonummy a, mattis varius. Cras aliquet.</strong> <strong>Aenean nonummy a, mattis varius. Cras aliquet.</strong>
Praesent <a href="http://ckeditor.com/">magna non mattis ac, rhoncus nunc</a>, rhoncus eget, cursus pulvinar mollis.</p> Praesent <a href="http://ckeditor.com/">magna non mattis ac, rhoncus nunc</a>, rhoncus eget, cursus pulvinar mollis.</p>
<p>Proin id nibh. Sed eu libero posuere sed, lectus. Phasellus dui gravida gravida feugiat mattis ac, felis.</p> <p>Proin id nibh. Sed eu libero posuere sed, lectus. Phasellus dui gravida gravida feugiat mattis ac, felis.</p>
<p>Integer condimentum sit amet, tempor elit odio, a dolor non ante at sapien. Sed ac lectus. Nulla ligula quis eleifend mi, id leo velit pede cursus arcu id nulla ac lectus. Phasellus vestibulum. Nunc viverra enim quis diam.</p> <p>Integer condimentum sit amet, tempor elit odio, a dolor non ante at sapien. Sed ac lectus. Nulla ligula quis eleifend mi, id leo velit pede cursus arcu id nulla ac lectus. Phasellus vestibulum. Nunc viverra enim quis diam.</p>
</div> </div>
<div contenteditable="true"> <div contenteditable="true">
<h3> <h3>
Praesent wisi accumsan sit amet nibh Praesent wisi accumsan sit amet nibh
</h3> </h3>
<p>Donec ullamcorper, risus tortor, pretium porttitor. Morbi quam quis lectus non leo.</p> <p>Donec ullamcorper, risus tortor, pretium porttitor. Morbi quam quis lectus non leo.</p>
<p style="margin-left: 40px; ">Integer faucibus scelerisque. Proin faucibus at, aliquet vulputate, odio at eros. Fusce <a href="http://ckeditor.com/">gravida, erat vitae augue</a>. Fusce urna fringilla gravida.</p> <p style="margin-left: 40px; ">Integer faucibus scelerisque. Proin faucibus at, aliquet vulputate, odio at eros. Fusce <a href="http://ckeditor.com/">gravida, erat vitae augue</a>. Fusce urna fringilla gravida.</p>
<p>In hac habitasse platea dictumst. Praesent wisi accumsan sit amet nibh. Maecenas orci luctus a, lacinia quam sem, posuere commodo, odio condimentum tempor, pede semper risus. Suspendisse pede. In hac habitasse platea dictumst. Nam sed laoreet sit amet erat. Integer.</p> <p>In hac habitasse platea dictumst. Praesent wisi accumsan sit amet nibh. Maecenas orci luctus a, lacinia quam sem, posuere commodo, odio condimentum tempor, pede semper risus. Suspendisse pede. In hac habitasse platea dictumst. Nam sed laoreet sit amet erat. Integer.</p>
</div> </div>
</div> </div>
<div id="column3"> <div id="column3">
<div contenteditable="true"> <div contenteditable="true">
<p> <p>
<img src="assets/inlineall/logo.png" alt="CKEditor logo" style="float:left"> <img src="assets/inlineall/logo.png" alt="CKEditor logo" style="float:left">
</p> </p>
<p>Quisque justo neque, mattis sed, fermentum ultrices <strong>posuere cubilia Curae</strong>, Vestibulum elit metus, quis placerat ut, lectus. Ut sagittis, nunc libero, egestas consequat lobortis velit rutrum ut, faucibus turpis. Fusce porttitor, nulla quis turpis. Nullam laoreet vel, consectetuer tellus suscipit ultricies, hendrerit wisi. Donec odio nec velit ac nunc sit amet, accumsan cursus aliquet. Vestibulum ante sit amet sagittis mi.</p> <p>Quisque justo neque, mattis sed, fermentum ultrices <strong>posuere cubilia Curae</strong>, Vestibulum elit metus, quis placerat ut, lectus. Ut sagittis, nunc libero, egestas consequat lobortis velit rutrum ut, faucibus turpis. Fusce porttitor, nulla quis turpis. Nullam laoreet vel, consectetuer tellus suscipit ultricies, hendrerit wisi. Donec odio nec velit ac nunc sit amet, accumsan cursus aliquet. Vestibulum ante sit amet sagittis mi.</p>
<h3> <h3>
Nullam laoreet vel consectetuer tellus suscipit Nullam laoreet vel consectetuer tellus suscipit
</h3> </h3>
<ul> <ul>
<li>Ut sagittis, nunc libero, egestas consequat lobortis velit rutrum ut, faucibus turpis.</li> <li>Ut sagittis, nunc libero, egestas consequat lobortis velit rutrum ut, faucibus turpis.</li>
<li>Fusce porttitor, nulla quis turpis. Nullam laoreet vel, consectetuer tellus suscipit ultricies, hendrerit wisi.</li> <li>Fusce porttitor, nulla quis turpis. Nullam laoreet vel, consectetuer tellus suscipit ultricies, hendrerit wisi.</li>
<li>Mauris eget tellus. Donec non felis. Nam eget dolor. Vestibulum enim. Donec.</li> <li>Mauris eget tellus. Donec non felis. Nam eget dolor. Vestibulum enim. Donec.</li>
</ul> </ul>
<p>Quisque justo neque, mattis sed, <a href="http://ckeditor.com/">fermentum ultrices posuere cubilia</a> Curae, Vestibulum elit metus, quis placerat ut, lectus.</p> <p>Quisque justo neque, mattis sed, <a href="http://ckeditor.com/">fermentum ultrices posuere cubilia</a> Curae, Vestibulum elit metus, quis placerat ut, lectus.</p>
<p>Nullam laoreet vel, consectetuer tellus suscipit ultricies, hendrerit wisi. Ut sagittis, nunc libero, egestas consequat lobortis velit rutrum ut, faucibus turpis. Fusce porttitor, nulla quis turpis.</p> <p>Nullam laoreet vel, consectetuer tellus suscipit ultricies, hendrerit wisi. Ut sagittis, nunc libero, egestas consequat lobortis velit rutrum ut, faucibus turpis. Fusce porttitor, nulla quis turpis.</p>
<p>Donec odio nec velit ac nunc sit amet, accumsan cursus aliquet. Vestibulum ante sit amet sagittis mi. Sed in nonummy faucibus turpis. Mauris eget tellus. Donec non felis. Nam eget dolor. Vestibulum enim. Donec.</p> <p>Donec odio nec velit ac nunc sit amet, accumsan cursus aliquet. Vestibulum ante sit amet sagittis mi. Sed in nonummy faucibus turpis. Mauris eget tellus. Donec non felis. Nam eget dolor. Vestibulum enim. Donec.</p>
</div> </div>
</div> </div>
</div> </div>
<div id="tagLine"> <div id="tagLine">
Tags of this article: Tags of this article:
<p id="taglist" contenteditable="true"> <p id="taglist" contenteditable="true">
inline, editing, floating, CKEditor inline, editing, floating, CKEditor
</p> </p>
</div> </div>
</div> </div>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/"> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">
http://ckeditor.com</a> http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a>
- Frederico Knabben. All rights reserved. - Frederico Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,121 +1,121 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Inline Editing by Code &mdash; CKEditor Sample</title> <title>Inline Editing by Code &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<link href="sample.css" rel="stylesheet"> <link href="sample.css" rel="stylesheet">
<style> <style>
#editable #editable
{ {
padding: 10px; padding: 10px;
float: left; float: left;
} }
</style> </style>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Inline Editing by Code <a href="index.html">CKEditor Samples</a> &raquo; Inline Editing by Code
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to create an inline editor instance of CKEditor. It is created This sample shows how to create an inline editor instance of CKEditor. It is created
with a JavaScript call using the following code: with a JavaScript call using the following code:
</p> </p>
<pre class="samples"> <pre class="samples">
// This property tells CKEditor to not activate every element with contenteditable=true element. // This property tells CKEditor to not activate every element with contenteditable=true element.
CKEDITOR.disableAutoInline = true; CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline( document.getElementById( 'editable' ) ); var editor = CKEDITOR.inline( document.getElementById( 'editable' ) );
</pre> </pre>
<p> <p>
Note that <code>editable</code> in the code above is the <code>id</code> Note that <code>editable</code> in the code above is the <code>id</code>
attribute of the <code>&lt;div&gt;</code> element to be converted into an inline instance. attribute of the <code>&lt;div&gt;</code> element to be converted into an inline instance.
</p> </p>
</div> </div>
<div id="editable" contenteditable="true"> <div id="editable" contenteditable="true">
<h1><img alt="Saturn V carrying Apollo 11" class="right" src="assets/sample.jpg" /> Apollo 11</h1> <h1><img alt="Saturn V carrying Apollo 11" class="right" src="assets/sample.jpg" /> Apollo 11</h1>
<p><b>Apollo 11</b> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong" title="Neil Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin" title="Buzz Aldrin">Buzz Aldrin</a>, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p> <p><b>Apollo 11</b> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong" title="Neil Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin" title="Buzz Aldrin">Buzz Aldrin</a>, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p>
<p>Armstrong spent about <s>three and a half</s> two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5&nbsp;kg) of lunar material for return to Earth. A third member of the mission, <a href="http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)" title="Michael Collins (astronaut)">Michael Collins</a>, piloted the <a href="http://en.wikipedia.org/wiki/Apollo_Command/Service_Module" title="Apollo Command/Service Module">command</a> spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth.</p> <p>Armstrong spent about <s>three and a half</s> two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5&nbsp;kg) of lunar material for return to Earth. A third member of the mission, <a href="http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)" title="Michael Collins (astronaut)">Michael Collins</a>, piloted the <a href="http://en.wikipedia.org/wiki/Apollo_Command/Service_Module" title="Apollo Command/Service Module">command</a> spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth.</p>
<h2>Broadcasting and <em>quotes</em> <a id="quotes" name="quotes"></a></h2> <h2>Broadcasting and <em>quotes</em> <a id="quotes" name="quotes"></a></h2>
<p>Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:</p> <p>Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:</p>
<blockquote> <blockquote>
<p>One small step for [a] man, one giant leap for mankind.</p> <p>One small step for [a] man, one giant leap for mankind.</p>
</blockquote> </blockquote>
<p>Apollo 11 effectively ended the <a href="http://en.wikipedia.org/wiki/Space_Race" title="Space Race">Space Race</a> and fulfilled a national goal proposed in 1961 by the late U.S. President <a href="http://en.wikipedia.org/wiki/John_F._Kennedy" title="John F. Kennedy">John F. Kennedy</a> in a speech before the United States Congress:</p> <p>Apollo 11 effectively ended the <a href="http://en.wikipedia.org/wiki/Space_Race" title="Space Race">Space Race</a> and fulfilled a national goal proposed in 1961 by the late U.S. President <a href="http://en.wikipedia.org/wiki/John_F._Kennedy" title="John F. Kennedy">John F. Kennedy</a> in a speech before the United States Congress:</p>
<blockquote> <blockquote>
<p>[...] before this decade is out, of landing a man on the Moon and returning him safely to the Earth.</p> <p>[...] before this decade is out, of landing a man on the Moon and returning him safely to the Earth.</p>
</blockquote> </blockquote>
<h2>Technical details <a id="tech-details" name="tech-details"></a></h2> <h2>Technical details <a id="tech-details" name="tech-details"></a></h2>
<table align="right" border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse:collapse;margin:10px 0 10px 15px;"> <table align="right" border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse:collapse;margin:10px 0 10px 15px;">
<caption><strong>Mission crew</strong></caption> <caption><strong>Mission crew</strong></caption>
<thead> <thead>
<tr> <tr>
<th scope="col">Position</th> <th scope="col">Position</th>
<th scope="col">Astronaut</th> <th scope="col">Astronaut</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>Commander</td> <td>Commander</td>
<td>Neil A. Armstrong</td> <td>Neil A. Armstrong</td>
</tr> </tr>
<tr> <tr>
<td>Command Module Pilot</td> <td>Command Module Pilot</td>
<td>Michael Collins</td> <td>Michael Collins</td>
</tr> </tr>
<tr> <tr>
<td>Lunar Module Pilot</td> <td>Lunar Module Pilot</td>
<td>Edwin &quot;Buzz&quot; E. Aldrin, Jr.</td> <td>Edwin &quot;Buzz&quot; E. Aldrin, Jr.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>Launched by a <strong>Saturn V</strong> rocket from <a href="http://en.wikipedia.org/wiki/Kennedy_Space_Center" title="Kennedy Space Center">Kennedy Space Center</a> in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of <a href="http://en.wikipedia.org/wiki/NASA" title="NASA">NASA</a>&#39;s Apollo program. The Apollo spacecraft had three parts:</p> <p>Launched by a <strong>Saturn V</strong> rocket from <a href="http://en.wikipedia.org/wiki/Kennedy_Space_Center" title="Kennedy Space Center">Kennedy Space Center</a> in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of <a href="http://en.wikipedia.org/wiki/NASA" title="NASA">NASA</a>&#39;s Apollo program. The Apollo spacecraft had three parts:</p>
<ol> <ol>
<li><strong>Command Module</strong> with a cabin for the three astronauts which was the only part which landed back on Earth</li> <li><strong>Command Module</strong> with a cabin for the three astronauts which was the only part which landed back on Earth</li>
<li><strong>Service Module</strong> which supported the Command Module with propulsion, electrical power, oxygen and water</li> <li><strong>Service Module</strong> which supported the Command Module with propulsion, electrical power, oxygen and water</li>
<li><strong>Lunar Module</strong> for landing on the Moon.</li> <li><strong>Lunar Module</strong> for landing on the Moon.</li>
</ol> </ol>
<p>After being sent to the Moon by the Saturn V&#39;s upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the <a href="http://en.wikipedia.org/wiki/Mare_Tranquillitatis" title="Mare Tranquillitatis">Sea of Tranquility</a>. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the <a href="http://en.wikipedia.org/wiki/Pacific_Ocean" title="Pacific Ocean">Pacific Ocean</a> on July 24.</p> <p>After being sent to the Moon by the Saturn V&#39;s upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the <a href="http://en.wikipedia.org/wiki/Mare_Tranquillitatis" title="Mare Tranquillitatis">Sea of Tranquility</a>. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the <a href="http://en.wikipedia.org/wiki/Pacific_Ocean" title="Pacific Ocean">Pacific Ocean</a> on July 24.</p>
<hr /> <hr />
<p style="text-align: right;"><small>Source: <a href="http://en.wikipedia.org/wiki/Apollo_11">Wikipedia.org</a></small></p> <p style="text-align: right;"><small>Source: <a href="http://en.wikipedia.org/wiki/Apollo_11">Wikipedia.org</a></small></p>
</div> </div>
<script> <script>
// We need to turn off the automatic editor creation first. // We need to turn off the automatic editor creation first.
CKEDITOR.disableAutoInline = true; CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline( 'editable' ); var editor = CKEDITOR.inline( 'editable' );
</script> </script>
<div id="footer"> <div id="footer">
<hr> <hr>
<p contenteditable="true"> <p contenteditable="true">
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/"> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">
http://ckeditor.com</a> http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a>
- Frederico Knabben. All rights reserved. - Frederico Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,100 +1,100 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery Adapter &mdash; CKEditor Sample</title> <title>jQuery Adapter &mdash; CKEditor Sample</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<script src="../adapters/jquery.js"></script> <script src="../adapters/jquery.js"></script>
<link href="sample.css" rel="stylesheet"> <link href="sample.css" rel="stylesheet">
<style> <style>
#editable #editable
{ {
padding: 10px; padding: 10px;
float: left; float: left;
} }
</style> </style>
<script> <script>
CKEDITOR.disableAutoInline = true; CKEDITOR.disableAutoInline = true;
$( document ).ready( function() { $( document ).ready( function() {
$( '#editor1' ).ckeditor(); // Use CKEDITOR.replace() if element is <textarea>. $( '#editor1' ).ckeditor(); // Use CKEDITOR.replace() if element is <textarea>.
$( '#editable' ).ckeditor(); // Use CKEDITOR.inline(). $( '#editable' ).ckeditor(); // Use CKEDITOR.inline().
} ); } );
function setValue() { function setValue() {
$( '#editor1' ).val( $( 'input#val' ).val() ); $( '#editor1' ).val( $( 'input#val' ).val() );
} }
</script> </script>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html" id="a-test">CKEditor Samples</a> &raquo; Create Editors with jQuery <a href="index.html" id="a-test">CKEditor Samples</a> &raquo; Create Editors with jQuery
</h1> </h1>
<form action="sample_posteddata.php" method="post"> <form action="sample_posteddata.php" method="post">
<div class="description"> <div class="description">
<p> <p>
This sample shows how to use the <a href="http://docs.ckeditor.com/#!/guide/dev_jquery">jQuery adapter</a>. This sample shows how to use the <a href="http://docs.ckeditor.com/#!/guide/dev_jquery">jQuery adapter</a>.
Note that you have to include both CKEditor and jQuery scripts before including the adapter. Note that you have to include both CKEditor and jQuery scripts before including the adapter.
</p> </p>
<pre class="samples"> <pre class="samples">
&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="/ckeditor/ckeditor.js"&gt;&lt;/script&gt; &lt;script src="/ckeditor/ckeditor.js"&gt;&lt;/script&gt;
&lt;script src="/ckeditor/adapters/jquery.js"&gt;&lt;/script&gt; &lt;script src="/ckeditor/adapters/jquery.js"&gt;&lt;/script&gt;
</pre> </pre>
<p>Then you can replace HTML elements with a CKEditor instance using the <code>ckeditor()</code> method.</p> <p>Then you can replace HTML elements with a CKEditor instance using the <code>ckeditor()</code> method.</p>
<pre class="samples"> <pre class="samples">
$( document ).ready( function() { $( document ).ready( function() {
$( 'textarea#editor1' ).ckeditor(); $( 'textarea#editor1' ).ckeditor();
} ); } );
</pre> </pre>
</div> </div>
<h2 class="samples">Inline Example</h2> <h2 class="samples">Inline Example</h2>
<div id="editable" contenteditable="true"> <div id="editable" contenteditable="true">
<p><img alt="Saturn V carrying Apollo 11" class="right" src="assets/sample.jpg"/><b>Apollo 11</b> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong" title="Neil Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin" title="Buzz Aldrin">Buzz Aldrin</a>, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p> <p><img alt="Saturn V carrying Apollo 11" class="right" src="assets/sample.jpg"/><b>Apollo 11</b> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong" title="Neil Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin" title="Buzz Aldrin">Buzz Aldrin</a>, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p>
<p>Armstrong spent about <s>three and a half</s> two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5&nbsp;kg) of lunar material for return to Earth. A third member of the mission, <a href="http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)" title="Michael Collins (astronaut)">Michael Collins</a>, piloted the <a href="http://en.wikipedia.org/wiki/Apollo_Command/Service_Module" title="Apollo Command/Service Module">command</a> spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth. <p>Armstrong spent about <s>three and a half</s> two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5&nbsp;kg) of lunar material for return to Earth. A third member of the mission, <a href="http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)" title="Michael Collins (astronaut)">Michael Collins</a>, piloted the <a href="http://en.wikipedia.org/wiki/Apollo_Command/Service_Module" title="Apollo Command/Service Module">command</a> spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth.
<p>Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:</p> <p>Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:</p>
<blockquote><p>One small step for [a] man, one giant leap for mankind.</p></blockquote> <p>Apollo 11 effectively ended the <a href="http://en.wikipedia.org/wiki/Space_Race" title="Space Race">Space Race</a> and fulfilled a national goal proposed in 1961 by the late U.S. President <a href="http://en.wikipedia.org/wiki/John_F._Kennedy" title="John F. Kennedy">John F. Kennedy</a> in a speech before the United States Congress:</p> <blockquote><p>[...] before this decade is out, of landing a man on the Moon and returning him safely to the Earth.</p></blockquote> <blockquote><p>One small step for [a] man, one giant leap for mankind.</p></blockquote> <p>Apollo 11 effectively ended the <a href="http://en.wikipedia.org/wiki/Space_Race" title="Space Race">Space Race</a> and fulfilled a national goal proposed in 1961 by the late U.S. President <a href="http://en.wikipedia.org/wiki/John_F._Kennedy" title="John F. Kennedy">John F. Kennedy</a> in a speech before the United States Congress:</p> <blockquote><p>[...] before this decade is out, of landing a man on the Moon and returning him safely to the Earth.</p></blockquote>
</div> </div>
<br style="clear: both"> <br style="clear: both">
<h2 class="samples">Classic (iframe-based) Example</h2> <h2 class="samples">Classic (iframe-based) Example</h2>
<textarea cols="80" id="editor1" name="editor1" rows="10"> <textarea cols="80" id="editor1" name="editor1" rows="10">
&lt;h2&gt;Technical details &lt;a id=&quot;tech-details&quot; name=&quot;tech-details&quot;&gt;&lt;/a&gt;&lt;/h2&gt; &lt;table align=&quot;right&quot; border=&quot;1&quot; bordercolor=&quot;#ccc&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse:collapse;margin:10px 0 10px 15px;&quot;&gt; &lt;caption&gt;&lt;strong&gt;Mission crew&lt;/strong&gt;&lt;/caption&gt; &lt;thead&gt; &lt;tr&gt; &lt;th scope=&quot;col&quot;&gt;Position&lt;/th&gt; &lt;th scope=&quot;col&quot;&gt;Astronaut&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Commander&lt;/td&gt; &lt;td&gt;Neil A. Armstrong&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Command Module Pilot&lt;/td&gt; &lt;td&gt;Michael Collins&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Lunar Module Pilot&lt;/td&gt; &lt;td&gt;Edwin &amp;quot;Buzz&amp;quot; E. Aldrin, Jr.&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;p&gt;Launched by a &lt;strong&gt;Saturn V&lt;/strong&gt; rocket from &lt;a href=&quot;http://en.wikipedia.org/wiki/Kennedy_Space_Center&quot; title=&quot;Kennedy Space Center&quot;&gt;Kennedy Space Center&lt;/a&gt; in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of &lt;a href=&quot;http://en.wikipedia.org/wiki/NASA&quot; title=&quot;NASA&quot;&gt;NASA&lt;/a&gt;&amp;#39;s Apollo program. The Apollo spacecraft had three parts:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;strong&gt;Command Module&lt;/strong&gt; with a cabin for the three astronauts which was the only part which landed back on Earth&lt;/li&gt; &lt;li&gt;&lt;strong&gt;Service Module&lt;/strong&gt; which supported the Command Module with propulsion, electrical power, oxygen and water&lt;/li&gt; &lt;li&gt;&lt;strong&gt;Lunar Module&lt;/strong&gt; for landing on the Moon.&lt;/li&gt; &lt;/ol&gt; &lt;p&gt;After being sent to the Moon by the Saturn V&amp;#39;s upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mare_Tranquillitatis&quot; title=&quot;Mare Tranquillitatis&quot;&gt;Sea of Tranquility&lt;/a&gt;. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pacific_Ocean&quot; title=&quot;Pacific Ocean&quot;&gt;Pacific Ocean&lt;/a&gt; on July 24.&lt;/p&gt; &lt;hr/&gt; &lt;p style=&quot;text-align: right;&quot;&gt;&lt;small&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Apollo_11&quot;&gt;Wikipedia.org&lt;/a&gt;&lt;/small&gt;&lt;/p&gt; &lt;h2&gt;Technical details &lt;a id=&quot;tech-details&quot; name=&quot;tech-details&quot;&gt;&lt;/a&gt;&lt;/h2&gt; &lt;table align=&quot;right&quot; border=&quot;1&quot; bordercolor=&quot;#ccc&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse:collapse;margin:10px 0 10px 15px;&quot;&gt; &lt;caption&gt;&lt;strong&gt;Mission crew&lt;/strong&gt;&lt;/caption&gt; &lt;thead&gt; &lt;tr&gt; &lt;th scope=&quot;col&quot;&gt;Position&lt;/th&gt; &lt;th scope=&quot;col&quot;&gt;Astronaut&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Commander&lt;/td&gt; &lt;td&gt;Neil A. Armstrong&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Command Module Pilot&lt;/td&gt; &lt;td&gt;Michael Collins&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Lunar Module Pilot&lt;/td&gt; &lt;td&gt;Edwin &amp;quot;Buzz&amp;quot; E. Aldrin, Jr.&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;p&gt;Launched by a &lt;strong&gt;Saturn V&lt;/strong&gt; rocket from &lt;a href=&quot;http://en.wikipedia.org/wiki/Kennedy_Space_Center&quot; title=&quot;Kennedy Space Center&quot;&gt;Kennedy Space Center&lt;/a&gt; in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of &lt;a href=&quot;http://en.wikipedia.org/wiki/NASA&quot; title=&quot;NASA&quot;&gt;NASA&lt;/a&gt;&amp;#39;s Apollo program. The Apollo spacecraft had three parts:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;strong&gt;Command Module&lt;/strong&gt; with a cabin for the three astronauts which was the only part which landed back on Earth&lt;/li&gt; &lt;li&gt;&lt;strong&gt;Service Module&lt;/strong&gt; which supported the Command Module with propulsion, electrical power, oxygen and water&lt;/li&gt; &lt;li&gt;&lt;strong&gt;Lunar Module&lt;/strong&gt; for landing on the Moon.&lt;/li&gt; &lt;/ol&gt; &lt;p&gt;After being sent to the Moon by the Saturn V&amp;#39;s upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mare_Tranquillitatis&quot; title=&quot;Mare Tranquillitatis&quot;&gt;Sea of Tranquility&lt;/a&gt;. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pacific_Ocean&quot; title=&quot;Pacific Ocean&quot;&gt;Pacific Ocean&lt;/a&gt; on July 24.&lt;/p&gt; &lt;hr/&gt; &lt;p style=&quot;text-align: right;&quot;&gt;&lt;small&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Apollo_11&quot;&gt;Wikipedia.org&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
</textarea> </textarea>
<p style="overflow: hidden"> <p style="overflow: hidden">
<input style="float: left" type="submit" value="Submit"> <input style="float: left" type="submit" value="Submit">
<span style="float: right"> <span style="float: right">
<input type="text" id="val" value="I'm using jQuery val()!" size="30"> <input type="text" id="val" value="I'm using jQuery val()!" size="30">
<input onclick="setValue();" type="button" value="Set value"> <input onclick="setValue();" type="button" value="Set value">
</span> </span>
</p> </p>
</form> </form>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,187 +1,187 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Using API to Customize Dialog Windows &mdash; CKEditor Sample</title> <title>Using API to Customize Dialog Windows &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script> <script src="../../../ckeditor.js"></script>
<link rel="stylesheet" href="../../../samples/sample.css"> <link rel="stylesheet" href="../../../samples/sample.css">
<meta name="ckeditor-sample-name" content="Using the JavaScript API to customize dialog windows"> <meta name="ckeditor-sample-name" content="Using the JavaScript API to customize dialog windows">
<meta name="ckeditor-sample-group" content="Advanced Samples"> <meta name="ckeditor-sample-group" content="Advanced Samples">
<meta name="ckeditor-sample-description" content="Using the dialog windows API to customize dialog windows without changing the original editor code."> <meta name="ckeditor-sample-description" content="Using the dialog windows API to customize dialog windows without changing the original editor code.">
<style> <style>
.cke_button__mybutton_icon .cke_button__mybutton_icon
{ {
display: none !important; display: none !important;
} }
.cke_button__mybutton_label .cke_button__mybutton_label
{ {
display: inline !important; display: inline !important;
} }
</style> </style>
<script> <script>
CKEDITOR.on( 'instanceCreated', function( ev ){ CKEDITOR.on( 'instanceCreated', function( ev ){
var editor = ev.editor; var editor = ev.editor;
// Listen for the "pluginsLoaded" event, so we are sure that the // Listen for the "pluginsLoaded" event, so we are sure that the
// "dialog" plugin has been loaded and we are able to do our // "dialog" plugin has been loaded and we are able to do our
// customizations. // customizations.
editor.on( 'pluginsLoaded', function() { editor.on( 'pluginsLoaded', function() {
// If our custom dialog has not been registered, do that now. // If our custom dialog has not been registered, do that now.
if ( !CKEDITOR.dialog.exists( 'myDialog' ) ) { if ( !CKEDITOR.dialog.exists( 'myDialog' ) ) {
// We need to do the following trick to find out the dialog // We need to do the following trick to find out the dialog
// definition file URL path. In the real world, you would simply // definition file URL path. In the real world, you would simply
// point to an absolute path directly, like "/mydir/mydialog.js". // point to an absolute path directly, like "/mydir/mydialog.js".
var href = document.location.href.split( '/' ); var href = document.location.href.split( '/' );
href.pop(); href.pop();
href.push( 'assets/my_dialog.js' ); href.push( 'assets/my_dialog.js' );
href = href.join( '/' ); href = href.join( '/' );
// Finally, register the dialog. // Finally, register the dialog.
CKEDITOR.dialog.add( 'myDialog', href ); CKEDITOR.dialog.add( 'myDialog', href );
} }
// Register the command used to open the dialog. // Register the command used to open the dialog.
editor.addCommand( 'myDialogCmd', new CKEDITOR.dialogCommand( 'myDialog' ) ); editor.addCommand( 'myDialogCmd', new CKEDITOR.dialogCommand( 'myDialog' ) );
// Add the a custom toolbar buttons, which fires the above // Add the a custom toolbar buttons, which fires the above
// command.. // command..
editor.ui.add( 'MyButton', CKEDITOR.UI_BUTTON, { editor.ui.add( 'MyButton', CKEDITOR.UI_BUTTON, {
label: 'My Dialog', label: 'My Dialog',
command: 'myDialogCmd' command: 'myDialogCmd'
}); });
}); });
}); });
// When opening a dialog, its "definition" is created for it, for // When opening a dialog, its "definition" is created for it, for
// each editor instance. The "dialogDefinition" event is then // each editor instance. The "dialogDefinition" event is then
// fired. We should use this event to make customizations to the // fired. We should use this event to make customizations to the
// definition of existing dialogs. // definition of existing dialogs.
CKEDITOR.on( 'dialogDefinition', function( ev ) { CKEDITOR.on( 'dialogDefinition', function( ev ) {
// Take the dialog name and its definition from the event data. // Take the dialog name and its definition from the event data.
var dialogName = ev.data.name; var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition; var dialogDefinition = ev.data.definition;
// Check if the definition is from the dialog we're // Check if the definition is from the dialog we're
// interested on (the "Link" dialog). // interested on (the "Link" dialog).
if ( dialogName == 'myDialog' && ev.editor.name == 'editor2' ) { if ( dialogName == 'myDialog' && ev.editor.name == 'editor2' ) {
// Get a reference to the "Link Info" tab. // Get a reference to the "Link Info" tab.
var infoTab = dialogDefinition.getContents( 'tab1' ); var infoTab = dialogDefinition.getContents( 'tab1' );
// Add a new text field to the "tab1" tab page. // Add a new text field to the "tab1" tab page.
infoTab.add( { infoTab.add( {
type: 'text', type: 'text',
label: 'My Custom Field', label: 'My Custom Field',
id: 'customField', id: 'customField',
'default': 'Sample!', 'default': 'Sample!',
validate: function() { validate: function() {
if ( ( /\d/ ).test( this.getValue() ) ) if ( ( /\d/ ).test( this.getValue() ) )
return 'My Custom Field must not contain digits'; return 'My Custom Field must not contain digits';
} }
}); });
// Remove the "select1" field from the "tab1" tab. // Remove the "select1" field from the "tab1" tab.
infoTab.remove( 'select1' ); infoTab.remove( 'select1' );
// Set the default value for "input1" field. // Set the default value for "input1" field.
var input1 = infoTab.get( 'input1' ); var input1 = infoTab.get( 'input1' );
input1[ 'default' ] = 'www.example.com'; input1[ 'default' ] = 'www.example.com';
// Remove the "tab2" tab page. // Remove the "tab2" tab page.
dialogDefinition.removeContents( 'tab2' ); dialogDefinition.removeContents( 'tab2' );
// Add a new tab to the "Link" dialog. // Add a new tab to the "Link" dialog.
dialogDefinition.addContents( { dialogDefinition.addContents( {
id: 'customTab', id: 'customTab',
label: 'My Tab', label: 'My Tab',
accessKey: 'M', accessKey: 'M',
elements: [ elements: [
{ {
id: 'myField1', id: 'myField1',
type: 'text', type: 'text',
label: 'My Text Field' label: 'My Text Field'
}, },
{ {
id: 'myField2', id: 'myField2',
type: 'text', type: 'text',
label: 'Another Text Field' label: 'Another Text Field'
} }
] ]
}); });
// Provide the focus handler to start initial focus in "customField" field. // Provide the focus handler to start initial focus in "customField" field.
dialogDefinition.onFocus = function() { dialogDefinition.onFocus = function() {
var urlField = this.getContentElement( 'tab1', 'customField' ); var urlField = this.getContentElement( 'tab1', 'customField' );
urlField.select(); urlField.select();
}; };
} }
}); });
var config = { var config = {
extraPlugins: 'dialog', extraPlugins: 'dialog',
toolbar: [ [ 'MyButton' ] ] toolbar: [ [ 'MyButton' ] ]
}; };
</script> </script>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Using CKEditor Dialog API <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Using CKEditor Dialog API
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to use the This sample shows how to use the
<a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.dialog">CKEditor Dialog API</a> <a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.dialog">CKEditor Dialog API</a>
to customize CKEditor dialog windows without changing the original editor code. to customize CKEditor dialog windows without changing the original editor code.
The following customizations are being done in the example below: The following customizations are being done in the example below:
</p> </p>
<p> <p>
For details on how to create this setup check the source code of this sample page. For details on how to create this setup check the source code of this sample page.
</p> </p>
</div> </div>
<p>A custom dialog is added to the editors using the <code>pluginsLoaded</code> event, from an external <a target="_blank" href="assets/my_dialog.js">dialog definition file</a>:</p> <p>A custom dialog is added to the editors using the <code>pluginsLoaded</code> event, from an external <a target="_blank" href="assets/my_dialog.js">dialog definition file</a>:</p>
<ol> <ol>
<li><strong>Creating a custom dialog window</strong> &ndash; "My Dialog" dialog window opened with the "My Dialog" toolbar button.</li> <li><strong>Creating a custom dialog window</strong> &ndash; "My Dialog" dialog window opened with the "My Dialog" toolbar button.</li>
<li><strong>Creating a custom button</strong> &ndash; Add button to open the dialog with "My Dialog" toolbar button.</li> <li><strong>Creating a custom button</strong> &ndash; Add button to open the dialog with "My Dialog" toolbar button.</li>
</ol> </ol>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script> <script>
// Replace the <textarea id="editor1"> with an CKEditor instance. // Replace the <textarea id="editor1"> with an CKEditor instance.
CKEDITOR.replace( 'editor1', config ); CKEDITOR.replace( 'editor1', config );
</script> </script>
<p>The below editor modify the dialog definition of the above added dialog using the <code>dialogDefinition</code> event:</p> <p>The below editor modify the dialog definition of the above added dialog using the <code>dialogDefinition</code> event:</p>
<ol> <ol>
<li><strong>Adding dialog tab</strong> &ndash; Add new tab "My Tab" to dialog window.</li> <li><strong>Adding dialog tab</strong> &ndash; Add new tab "My Tab" to dialog window.</li>
<li><strong>Removing a dialog window tab</strong> &ndash; Remove "Second Tab" page from the dialog window.</li> <li><strong>Removing a dialog window tab</strong> &ndash; Remove "Second Tab" page from the dialog window.</li>
<li><strong>Adding dialog window fields</strong> &ndash; Add "My Custom Field" to the dialog window.</li> <li><strong>Adding dialog window fields</strong> &ndash; Add "My Custom Field" to the dialog window.</li>
<li><strong>Removing dialog window field</strong> &ndash; Remove "Select Field" selection field from the dialog window.</li> <li><strong>Removing dialog window field</strong> &ndash; Remove "Select Field" selection field from the dialog window.</li>
<li><strong>Setting default values for dialog window fields</strong> &ndash; Set default value of "Text Field" text field. </li> <li><strong>Setting default values for dialog window fields</strong> &ndash; Set default value of "Text Field" text field. </li>
<li><strong>Setup initial focus for dialog window</strong> &ndash; Put initial focus on "My Custom Field" text field. </li> <li><strong>Setup initial focus for dialog window</strong> &ndash; Put initial focus on "My Custom Field" text field. </li>
</ol> </ol>
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script> <script>
// Replace the <textarea id="editor1"> with an CKEditor instance. // Replace the <textarea id="editor1"> with an CKEditor instance.
CKEDITOR.replace( 'editor2', config ); CKEDITOR.replace( 'editor2', config );
</script> </script>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long

View file

@ -1,103 +1,103 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>ENTER Key Configuration &mdash; CKEditor Sample</title> <title>ENTER Key Configuration &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script> <script src="../../../ckeditor.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet"> <link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-name" content="Using the &quot;Enter&quot; key in CKEditor"> <meta name="ckeditor-sample-name" content="Using the &quot;Enter&quot; key in CKEditor">
<meta name="ckeditor-sample-group" content="Advanced Samples"> <meta name="ckeditor-sample-group" content="Advanced Samples">
<meta name="ckeditor-sample-description" content="Configuring the behavior of &lt;em&gt;Enter&lt;/em&gt; and &lt;em&gt;Shift+Enter&lt;/em&gt; keys."> <meta name="ckeditor-sample-description" content="Configuring the behavior of &lt;em&gt;Enter&lt;/em&gt; and &lt;em&gt;Shift+Enter&lt;/em&gt; keys.">
<script> <script>
var editor; var editor;
function changeEnter() { function changeEnter() {
// If we already have an editor, let's destroy it first. // If we already have an editor, let's destroy it first.
if ( editor ) if ( editor )
editor.destroy( true ); editor.destroy( true );
// Create the editor again, with the appropriate settings. // Create the editor again, with the appropriate settings.
editor = CKEDITOR.replace( 'editor1', { editor = CKEDITOR.replace( 'editor1', {
extraPlugins: 'enterkey', extraPlugins: 'enterkey',
enterMode: Number( document.getElementById( 'xEnter' ).value ), enterMode: Number( document.getElementById( 'xEnter' ).value ),
shiftEnterMode: Number( document.getElementById( 'xShiftEnter' ).value ) shiftEnterMode: Number( document.getElementById( 'xShiftEnter' ).value )
}); });
} }
window.onload = changeEnter; window.onload = changeEnter;
</script> </script>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; ENTER Key Configuration <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; ENTER Key Configuration
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to configure the <em>Enter</em> and <em>Shift+Enter</em> keys This sample shows how to configure the <em>Enter</em> and <em>Shift+Enter</em> keys
to perform actions specified in the to perform actions specified in the
<a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode"><code>enterMode</code></a> <a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode"><code>enterMode</code></a>
and <a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-shiftEnterMode"><code>shiftEnterMode</code></a> and <a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-shiftEnterMode"><code>shiftEnterMode</code></a>
parameters, respectively. parameters, respectively.
You can choose from the following options: You can choose from the following options:
</p> </p>
<ul class="samples"> <ul class="samples">
<li><strong><code>ENTER_P</code></strong> &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li> <li><strong><code>ENTER_P</code></strong> &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li>
<li><strong><code>ENTER_BR</code></strong> &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li> <li><strong><code>ENTER_BR</code></strong> &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li>
<li><strong><code>ENTER_DIV</code></strong> &ndash; new <code>&lt;div&gt;</code> blocks are created.</li> <li><strong><code>ENTER_DIV</code></strong> &ndash; new <code>&lt;div&gt;</code> blocks are created.</li>
</ul> </ul>
<p> <p>
The sample code below shows how to configure CKEditor to create a <code>&lt;div&gt;</code> block when <em>Enter</em> key is pressed. The sample code below shows how to configure CKEditor to create a <code>&lt;div&gt;</code> block when <em>Enter</em> key is pressed.
</p> </p>
<pre class="samples"> <pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', { CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>enterMode: CKEDITOR.ENTER_DIV</strong> <strong>enterMode: CKEDITOR.ENTER_DIV</strong>
});</pre> });</pre>
<p> <p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced. the <code>&lt;textarea&gt;</code> element to be replaced.
</p> </p>
</div> </div>
<div style="float: left; margin-right: 20px"> <div style="float: left; margin-right: 20px">
When <em>Enter</em> is pressed:<br> When <em>Enter</em> is pressed:<br>
<select id="xEnter" onchange="changeEnter();"> <select id="xEnter" onchange="changeEnter();">
<option selected="selected" value="1">Create a new &lt;P&gt; (recommended)</option> <option selected="selected" value="1">Create a new &lt;P&gt; (recommended)</option>
<option value="3">Create a new &lt;DIV&gt;</option> <option value="3">Create a new &lt;DIV&gt;</option>
<option value="2">Break the line with a &lt;BR&gt;</option> <option value="2">Break the line with a &lt;BR&gt;</option>
</select> </select>
</div> </div>
<div style="float: left"> <div style="float: left">
When <em>Shift+Enter</em> is pressed:<br> When <em>Shift+Enter</em> is pressed:<br>
<select id="xShiftEnter" onchange="changeEnter();"> <select id="xShiftEnter" onchange="changeEnter();">
<option value="1">Create a new &lt;P&gt;</option> <option value="1">Create a new &lt;P&gt;</option>
<option value="3">Create a new &lt;DIV&gt;</option> <option value="3">Create a new &lt;DIV&gt;</option>
<option selected="selected" value="2">Break the line with a &lt;BR&gt; (recommended)</option> <option selected="selected" value="2">Break the line with a &lt;BR&gt; (recommended)</option>
</select> </select>
</div> </div>
<br style="clear: both"> <br style="clear: both">
<form action="../../../samples/sample_posteddata.php" method="post"> <form action="../../../samples/sample_posteddata.php" method="post">
<p> <p>
<br> <br>
<textarea cols="80" id="editor1" name="editor1" rows="10">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.</textarea> <textarea cols="80" id="editor1" name="editor1" rows="10">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.</textarea>
</p> </p>
<p> <p>
<input type="submit" value="Submit"> <input type="submit" value="Submit">
</p> </p>
</form> </form>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,280 +1,280 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Output for Flash &mdash; CKEditor Sample</title> <title>Output for Flash &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script> <script src="../../../ckeditor.js"></script>
<script src="../../../samples/sample.js"></script> <script src="../../../samples/sample.js"></script>
<script src="assets/outputforflash/swfobject.js"></script> <script src="assets/outputforflash/swfobject.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet"> <link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-required-plugins" content="sourcearea"> <meta name="ckeditor-sample-required-plugins" content="sourcearea">
<meta name="ckeditor-sample-name" content="Output for Flash"> <meta name="ckeditor-sample-name" content="Output for Flash">
<meta name="ckeditor-sample-group" content="Advanced Samples"> <meta name="ckeditor-sample-group" content="Advanced Samples">
<meta name="ckeditor-sample-description" content="Configuring CKEditor to produce HTML code that can be used with Adobe Flash."> <meta name="ckeditor-sample-description" content="Configuring CKEditor to produce HTML code that can be used with Adobe Flash.">
<style> <style>
.alert .alert
{ {
background: #ffa84c; background: #ffa84c;
padding: 10px 15px; padding: 10px 15px;
font-weight: bold; font-weight: bold;
display: block; display: block;
margin-bottom: 20px; margin-bottom: 20px;
} }
</style> </style>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Producing Flash Compliant HTML Output <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Producing Flash Compliant HTML Output
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to configure CKEditor to output This sample shows how to configure CKEditor to output
HTML code that can be used with HTML code that can be used with
<a class="samples" href="http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00000922.html"> <a class="samples" href="http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00000922.html">
Adobe Flash</a>. Adobe Flash</a>.
The code will contain a subset of standard HTML elements like <code>&lt;b&gt;</code>, The code will contain a subset of standard HTML elements like <code>&lt;b&gt;</code>,
<code>&lt;i&gt;</code>, and <code>&lt;p&gt;</code> as well as HTML attributes. <code>&lt;i&gt;</code>, and <code>&lt;p&gt;</code> as well as HTML attributes.
</p> </p>
<p> <p>
To add a CKEditor instance outputting Flash compliant HTML code, load the editor using a standard To add a CKEditor instance outputting Flash compliant HTML code, load the editor using a standard
JavaScript call, and define CKEditor features to use HTML elements and attributes. JavaScript call, and define CKEditor features to use HTML elements and attributes.
</p> </p>
<p> <p>
For details on how to create this setup check the source code of this sample page. For details on how to create this setup check the source code of this sample page.
</p> </p>
</div> </div>
<p> <p>
To see how it works, create some content in the editing area of CKEditor on the left To see how it works, create some content in the editing area of CKEditor on the left
and send it to the Flash object on the right side of the page by using the and send it to the Flash object on the right side of the page by using the
<strong>Send to Flash</strong> button. <strong>Send to Flash</strong> button.
</p> </p>
<table style="width: 100%; border-spacing: 0; border-collapse:collapse;"> <table style="width: 100%; border-spacing: 0; border-collapse:collapse;">
<tr> <tr>
<td style="width: 100%"> <td style="width: 100%">
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;&lt;b&gt;&lt;font size=&quot;18&quot; style=&quot;font-size:18px;&quot;&gt;Flash and HTML&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It is possible to have &lt;a href=&quot;http://ckeditor.com&quot;&gt;CKEditor&lt;/a&gt; creating content that will be later loaded inside &lt;b&gt;Flash&lt;/b&gt; objects and animations.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Flash has a few limitations when dealing with HTML:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;It has limited support on tags.&lt;/li&gt;&lt;li&gt;There is no margin between block elements, like paragraphs.&lt;/li&gt;&lt;/ul&gt;</textarea> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;&lt;b&gt;&lt;font size=&quot;18&quot; style=&quot;font-size:18px;&quot;&gt;Flash and HTML&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It is possible to have &lt;a href=&quot;http://ckeditor.com&quot;&gt;CKEditor&lt;/a&gt; creating content that will be later loaded inside &lt;b&gt;Flash&lt;/b&gt; objects and animations.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Flash has a few limitations when dealing with HTML:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;It has limited support on tags.&lt;/li&gt;&lt;li&gt;There is no margin between block elements, like paragraphs.&lt;/li&gt;&lt;/ul&gt;</textarea>
<script> <script>
if ( document.location.protocol == 'file:' ) if ( document.location.protocol == 'file:' )
alert( 'Warning: This samples does not work when loaded from local filesystem' + alert( 'Warning: This samples does not work when loaded from local filesystem' +
'due to security restrictions implemented in Flash.' + 'due to security restrictions implemented in Flash.' +
'\n\nPlease load the sample from a web server instead.' ); '\n\nPlease load the sample from a web server instead.' );
var editor = CKEDITOR.replace( 'editor1', { var editor = CKEDITOR.replace( 'editor1', {
/* /*
* Ensure that htmlwriter plugin, which is required for this sample, is loaded. * Ensure that htmlwriter plugin, which is required for this sample, is loaded.
*/ */
extraPlugins: 'htmlwriter', extraPlugins: 'htmlwriter',
height: 290, height: 290,
width: '100%', width: '100%',
toolbar: [ toolbar: [
[ 'Source', '-', 'Bold', 'Italic', 'Underline', '-', 'BulletedList', '-', 'Link', 'Unlink' ], [ 'Source', '-', 'Bold', 'Italic', 'Underline', '-', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ], [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ],
'/', '/',
[ 'Font', 'FontSize' ], [ 'Font', 'FontSize' ],
[ 'TextColor', '-', 'About' ] [ 'TextColor', '-', 'About' ]
], ],
/* /*
* Style sheet for the contents * Style sheet for the contents
*/ */
contentsCss: 'body {color:#000; background-color#FFF; font-family: Arial; font-size:80%;} p, ol, ul {margin-top: 0px; margin-bottom: 0px;}', contentsCss: 'body {color:#000; background-color#FFF; font-family: Arial; font-size:80%;} p, ol, ul {margin-top: 0px; margin-bottom: 0px;}',
/* /*
* Quirks doctype * Quirks doctype
*/ */
docType: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', docType: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
/* /*
* Core styles. * Core styles.
*/ */
coreStyles_bold: { element: 'b' }, coreStyles_bold: { element: 'b' },
coreStyles_italic: { element: 'i' }, coreStyles_italic: { element: 'i' },
coreStyles_underline: { element: 'u' }, coreStyles_underline: { element: 'u' },
/* /*
* Font face. * Font face.
*/ */
// Define the way font elements will be applied to the document. The "font" // Define the way font elements will be applied to the document. The "font"
// element will be used. // element will be used.
font_style: { font_style: {
element: 'font', element: 'font',
attributes: { 'face': '#(family)' } attributes: { 'face': '#(family)' }
}, },
/* /*
* Font sizes. * Font sizes.
*/ */
// The CSS part of the font sizes isn't used by Flash, it is there to get the // The CSS part of the font sizes isn't used by Flash, it is there to get the
// font rendered correctly in CKEditor. // font rendered correctly in CKEditor.
fontSize_sizes: '8px/8;9px/9;10px/10;11px/11;12px/12;14px/14;16px/16;18px/18;20px/20;22px/22;24px/24;26px/26;28px/28;36px/36;48px/48;72px/72', fontSize_sizes: '8px/8;9px/9;10px/10;11px/11;12px/12;14px/14;16px/16;18px/18;20px/20;22px/22;24px/24;26px/26;28px/28;36px/36;48px/48;72px/72',
fontSize_style: { fontSize_style: {
element: 'font', element: 'font',
attributes: { 'size': '#(size)' }, attributes: { 'size': '#(size)' },
styles: { 'font-size': '#(size)px' } styles: { 'font-size': '#(size)px' }
} , } ,
/* /*
* Font colors. * Font colors.
*/ */
colorButton_enableMore: true, colorButton_enableMore: true,
colorButton_foreStyle: { colorButton_foreStyle: {
element: 'font', element: 'font',
attributes: { 'color': '#(color)' } attributes: { 'color': '#(color)' }
}, },
colorButton_backStyle: { colorButton_backStyle: {
element: 'font', element: 'font',
styles: { 'background-color': '#(color)' } styles: { 'background-color': '#(color)' }
}, },
on: { 'instanceReady': configureFlashOutput } on: { 'instanceReady': configureFlashOutput }
}); });
/* /*
* Adjust the behavior of the dataProcessor to match the * Adjust the behavior of the dataProcessor to match the
* requirements of Flash * requirements of Flash
*/ */
function configureFlashOutput( ev ) { function configureFlashOutput( ev ) {
var editor = ev.editor, var editor = ev.editor,
dataProcessor = editor.dataProcessor, dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter; htmlFilter = dataProcessor && dataProcessor.htmlFilter;
// Out self closing tags the HTML4 way, like <br>. // Out self closing tags the HTML4 way, like <br>.
dataProcessor.writer.selfClosingEnd = '>'; dataProcessor.writer.selfClosingEnd = '>';
// Make output formatting match Flash expectations // Make output formatting match Flash expectations
var dtd = CKEDITOR.dtd; var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) {
dataProcessor.writer.setRules( e, { dataProcessor.writer.setRules( e, {
indent: false, indent: false,
breakBeforeOpen: false, breakBeforeOpen: false,
breakAfterOpen: false, breakAfterOpen: false,
breakBeforeClose: false, breakBeforeClose: false,
breakAfterClose: false breakAfterClose: false
}); });
} }
dataProcessor.writer.setRules( 'br', { dataProcessor.writer.setRules( 'br', {
indent: false, indent: false,
breakBeforeOpen: false, breakBeforeOpen: false,
breakAfterOpen: false, breakAfterOpen: false,
breakBeforeClose: false, breakBeforeClose: false,
breakAfterClose: false breakAfterClose: false
}); });
// Output properties as attributes, not styles. // Output properties as attributes, not styles.
htmlFilter.addRules( { htmlFilter.addRules( {
elements: { elements: {
$: function( element ) { $: function( element ) {
var style, match, width, height, align; var style, match, width, height, align;
// Output dimensions of images as width and height // Output dimensions of images as width and height
if ( element.name == 'img' ) { if ( element.name == 'img' ) {
style = element.attributes.style; style = element.attributes.style;
if ( style ) { if ( style ) {
// Get the width from the style. // Get the width from the style.
match = ( /(?:^|\s)width\s*:\s*(\d+)px/i ).exec( style ); match = ( /(?:^|\s)width\s*:\s*(\d+)px/i ).exec( style );
width = match && match[1]; width = match && match[1];
// Get the height from the style. // Get the height from the style.
match = ( /(?:^|\s)height\s*:\s*(\d+)px/i ).exec( style ); match = ( /(?:^|\s)height\s*:\s*(\d+)px/i ).exec( style );
height = match && match[1]; height = match && match[1];
if ( width ) { if ( width ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' ); element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' );
element.attributes.width = width; element.attributes.width = width;
} }
if ( height ) { if ( height ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' ); element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' );
element.attributes.height = height; element.attributes.height = height;
} }
} }
} }
// Output alignment of paragraphs using align // Output alignment of paragraphs using align
if ( element.name == 'p' ) { if ( element.name == 'p' ) {
style = element.attributes.style; style = element.attributes.style;
if ( style ) { if ( style ) {
// Get the align from the style. // Get the align from the style.
match = ( /(?:^|\s)text-align\s*:\s*(\w*);?/i ).exec( style ); match = ( /(?:^|\s)text-align\s*:\s*(\w*);?/i ).exec( style );
align = match && match[1]; align = match && match[1];
if ( align ) { if ( align ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' ); element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' );
element.attributes.align = align; element.attributes.align = align;
} }
} }
} }
if ( element.attributes.style === '' ) if ( element.attributes.style === '' )
delete element.attributes.style; delete element.attributes.style;
return element; return element;
} }
} }
}); });
} }
function sendToFlash() { function sendToFlash() {
var html = CKEDITOR.instances.editor1.getData() ; var html = CKEDITOR.instances.editor1.getData() ;
// Quick fix for link color. // Quick fix for link color.
html = html.replace( /<a /g, '<font color="#0000FF"><u><a ' ) html = html.replace( /<a /g, '<font color="#0000FF"><u><a ' )
html = html.replace( /<\/a>/g, '</a></u></font>' ) html = html.replace( /<\/a>/g, '</a></u></font>' )
var flash = document.getElementById( 'ckFlashContainer' ) ; var flash = document.getElementById( 'ckFlashContainer' ) ;
flash.setData( html ) ; flash.setData( html ) ;
} }
CKEDITOR.domReady( function() { CKEDITOR.domReady( function() {
if ( !swfobject.hasFlashPlayerVersion( '8' ) ) { if ( !swfobject.hasFlashPlayerVersion( '8' ) ) {
CKEDITOR.dom.element.createFromHtml( '<span class="alert">' + CKEDITOR.dom.element.createFromHtml( '<span class="alert">' +
'At least Adobe Flash Player 8 is required to run this sample. ' + 'At least Adobe Flash Player 8 is required to run this sample. ' +
'You can download it from <a href="http://get.adobe.com/flashplayer">Adobe\'s website</a>.' + 'You can download it from <a href="http://get.adobe.com/flashplayer">Adobe\'s website</a>.' +
'</span>' ).insertBefore( editor.element ); '</span>' ).insertBefore( editor.element );
} }
swfobject.embedSWF( swfobject.embedSWF(
'assets/outputforflash/outputforflash.swf', 'assets/outputforflash/outputforflash.swf',
'ckFlashContainer', 'ckFlashContainer',
'550', '550',
'400', '400',
'8', '8',
{ wmode: 'transparent' } { wmode: 'transparent' }
); );
}); });
</script> </script>
<p> <p>
<input type="button" value="Send to Flash" onclick="sendToFlash();"> <input type="button" value="Send to Flash" onclick="sendToFlash();">
</p> </p>
</td> </td>
<td style="vertical-align: top; padding-left: 20px"> <td style="vertical-align: top; padding-left: 20px">
<div id="ckFlashContainer"></div> <div id="ckFlashContainer"></div>
</td> </td>
</tr> </tr>
</table> </table>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,221 +1,221 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>HTML Compliant Output &mdash; CKEditor Sample</title> <title>HTML Compliant Output &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script> <script src="../../../ckeditor.js"></script>
<script src="../../../samples/sample.js"></script> <script src="../../../samples/sample.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet"> <link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-required-plugins" content="sourcearea"> <meta name="ckeditor-sample-required-plugins" content="sourcearea">
<meta name="ckeditor-sample-name" content="Output HTML"> <meta name="ckeditor-sample-name" content="Output HTML">
<meta name="ckeditor-sample-group" content="Advanced Samples"> <meta name="ckeditor-sample-group" content="Advanced Samples">
<meta name="ckeditor-sample-description" content="Configuring CKEditor to produce legacy HTML 4 code."> <meta name="ckeditor-sample-description" content="Configuring CKEditor to produce legacy HTML 4 code.">
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Producing HTML Compliant Output <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Producing HTML Compliant Output
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to configure CKEditor to output valid This sample shows how to configure CKEditor to output valid
<a class="samples" href="http://www.w3.org/TR/html401/">HTML 4.01</a> code. <a class="samples" href="http://www.w3.org/TR/html401/">HTML 4.01</a> code.
Traditional HTML elements like <code>&lt;b&gt;</code>, Traditional HTML elements like <code>&lt;b&gt;</code>,
<code>&lt;i&gt;</code>, and <code>&lt;font&gt;</code> are used in place of <code>&lt;i&gt;</code>, and <code>&lt;font&gt;</code> are used in place of
<code>&lt;strong&gt;</code>, <code>&lt;em&gt;</code>, and CSS styles. <code>&lt;strong&gt;</code>, <code>&lt;em&gt;</code>, and CSS styles.
</p> </p>
<p> <p>
To add a CKEditor instance outputting legacy HTML 4.01 code, load the editor using a standard To add a CKEditor instance outputting legacy HTML 4.01 code, load the editor using a standard
JavaScript call, and define CKEditor features to use the HTML compliant elements and attributes. JavaScript call, and define CKEditor features to use the HTML compliant elements and attributes.
</p> </p>
<p> <p>
A snippet of the configuration code can be seen below; check the source of this page for A snippet of the configuration code can be seen below; check the source of this page for
full definition: full definition:
</p> </p>
<pre class="samples"> <pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', { CKEDITOR.replace( '<em>textarea_id</em>', {
coreStyles_bold: { element: 'b' }, coreStyles_bold: { element: 'b' },
coreStyles_italic: { element: 'i' }, coreStyles_italic: { element: 'i' },
fontSize_style: { fontSize_style: {
element: 'font', element: 'font',
attributes: { 'size': '#(size)' } attributes: { 'size': '#(size)' }
} }
... ...
});</pre> });</pre>
</div> </div>
<form action="../../../samples/sample_posteddata.php" method="post"> <form action="../../../samples/sample_posteddata.php" method="post">
<p> <p>
<label for="editor1"> <label for="editor1">
Editor 1: Editor 1:
</label> </label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;b&gt;sample text&lt;/b&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;b&gt;sample text&lt;/b&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script> <script>
CKEDITOR.replace( 'editor1', { CKEDITOR.replace( 'editor1', {
/* /*
* Ensure that htmlwriter plugin, which is required for this sample, is loaded. * Ensure that htmlwriter plugin, which is required for this sample, is loaded.
*/ */
extraPlugins: 'htmlwriter', extraPlugins: 'htmlwriter',
/* /*
* Style sheet for the contents * Style sheet for the contents
*/ */
contentsCss: 'body {color:#000; background-color#:FFF;}', contentsCss: 'body {color:#000; background-color#:FFF;}',
/* /*
* Simple HTML5 doctype * Simple HTML5 doctype
*/ */
docType: '<!DOCTYPE HTML>', docType: '<!DOCTYPE HTML>',
/* /*
* Allowed content rules which beside limiting allowed HTML * Allowed content rules which beside limiting allowed HTML
* will also take care of transforming styles to attributes * will also take care of transforming styles to attributes
* (currently only for img - see transformation rules defined below). * (currently only for img - see transformation rules defined below).
* *
* Read more: http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter * Read more: http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
*/ */
allowedContent: allowedContent:
'h1 h2 h3 p pre[align]; ' + 'h1 h2 h3 p pre[align]; ' +
'blockquote code kbd samp var del ins cite q b i u strike ul ol li hr table tbody tr td th caption; ' + 'blockquote code kbd samp var del ins cite q b i u strike ul ol li hr table tbody tr td th caption; ' +
'img[!src,alt,align,width,height]; font[!face]; font[!family]; font[!color]; font[!size]; font{!background-color}; a[!href]; a[!name]', 'img[!src,alt,align,width,height]; font[!face]; font[!family]; font[!color]; font[!size]; font{!background-color}; a[!href]; a[!name]',
/* /*
* Core styles. * Core styles.
*/ */
coreStyles_bold: { element: 'b' }, coreStyles_bold: { element: 'b' },
coreStyles_italic: { element: 'i' }, coreStyles_italic: { element: 'i' },
coreStyles_underline: { element: 'u' }, coreStyles_underline: { element: 'u' },
coreStyles_strike: { element: 'strike' }, coreStyles_strike: { element: 'strike' },
/* /*
* Font face. * Font face.
*/ */
// Define the way font elements will be applied to the document. // Define the way font elements will be applied to the document.
// The "font" element will be used. // The "font" element will be used.
font_style: { font_style: {
element: 'font', element: 'font',
attributes: { 'face': '#(family)' } attributes: { 'face': '#(family)' }
}, },
/* /*
* Font sizes. * Font sizes.
*/ */
fontSize_sizes: 'xx-small/1;x-small/2;small/3;medium/4;large/5;x-large/6;xx-large/7', fontSize_sizes: 'xx-small/1;x-small/2;small/3;medium/4;large/5;x-large/6;xx-large/7',
fontSize_style: { fontSize_style: {
element: 'font', element: 'font',
attributes: { 'size': '#(size)' } attributes: { 'size': '#(size)' }
}, },
/* /*
* Font colors. * Font colors.
*/ */
colorButton_foreStyle: { colorButton_foreStyle: {
element: 'font', element: 'font',
attributes: { 'color': '#(color)' } attributes: { 'color': '#(color)' }
}, },
colorButton_backStyle: { colorButton_backStyle: {
element: 'font', element: 'font',
styles: { 'background-color': '#(color)' } styles: { 'background-color': '#(color)' }
}, },
/* /*
* Styles combo. * Styles combo.
*/ */
stylesSet: [ stylesSet: [
{ name: 'Computer Code', element: 'code' }, { name: 'Computer Code', element: 'code' },
{ name: 'Keyboard Phrase', element: 'kbd' }, { name: 'Keyboard Phrase', element: 'kbd' },
{ name: 'Sample Text', element: 'samp' }, { name: 'Sample Text', element: 'samp' },
{ name: 'Variable', element: 'var' }, { name: 'Variable', element: 'var' },
{ name: 'Deleted Text', element: 'del' }, { name: 'Deleted Text', element: 'del' },
{ name: 'Inserted Text', element: 'ins' }, { name: 'Inserted Text', element: 'ins' },
{ name: 'Cited Work', element: 'cite' }, { name: 'Cited Work', element: 'cite' },
{ name: 'Inline Quotation', element: 'q' } { name: 'Inline Quotation', element: 'q' }
], ],
on: { on: {
pluginsLoaded: configureTransformations, pluginsLoaded: configureTransformations,
loaded: configureHtmlWriter loaded: configureHtmlWriter
} }
}); });
/* /*
* Add missing content transformations. * Add missing content transformations.
*/ */
function configureTransformations( evt ) { function configureTransformations( evt ) {
var editor = evt.editor; var editor = evt.editor;
editor.dataProcessor.htmlFilter.addRules( { editor.dataProcessor.htmlFilter.addRules( {
attributes: { attributes: {
style: function( value, element ) { style: function( value, element ) {
// Return #RGB for background and border colors // Return #RGB for background and border colors
return CKEDITOR.tools.convertRgbToHex( value ); return CKEDITOR.tools.convertRgbToHex( value );
} }
} }
} ); } );
// Default automatic content transformations do not yet take care of // Default automatic content transformations do not yet take care of
// align attributes on blocks, so we need to add our own transformation rules. // align attributes on blocks, so we need to add our own transformation rules.
function alignToAttribute( element ) { function alignToAttribute( element ) {
if ( element.styles[ 'text-align' ] ) { if ( element.styles[ 'text-align' ] ) {
element.attributes.align = element.styles[ 'text-align' ]; element.attributes.align = element.styles[ 'text-align' ];
delete element.styles[ 'text-align' ]; delete element.styles[ 'text-align' ];
} }
} }
editor.filter.addTransformations( [ editor.filter.addTransformations( [
[ { element: 'p', right: alignToAttribute } ], [ { element: 'p', right: alignToAttribute } ],
[ { element: 'h1', right: alignToAttribute } ], [ { element: 'h1', right: alignToAttribute } ],
[ { element: 'h2', right: alignToAttribute } ], [ { element: 'h2', right: alignToAttribute } ],
[ { element: 'h3', right: alignToAttribute } ], [ { element: 'h3', right: alignToAttribute } ],
[ { element: 'pre', right: alignToAttribute } ] [ { element: 'pre', right: alignToAttribute } ]
] ); ] );
} }
/* /*
* Adjust the behavior of htmlWriter to make it output HTML like FCKeditor. * Adjust the behavior of htmlWriter to make it output HTML like FCKeditor.
*/ */
function configureHtmlWriter( evt ) { function configureHtmlWriter( evt ) {
var editor = evt.editor, var editor = evt.editor,
dataProcessor = editor.dataProcessor; dataProcessor = editor.dataProcessor;
// Out self closing tags the HTML4 way, like <br>. // Out self closing tags the HTML4 way, like <br>.
dataProcessor.writer.selfClosingEnd = '>'; dataProcessor.writer.selfClosingEnd = '>';
// Make output formatting behave similar to FCKeditor. // Make output formatting behave similar to FCKeditor.
var dtd = CKEDITOR.dtd; var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) { for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) {
dataProcessor.writer.setRules( e, { dataProcessor.writer.setRules( e, {
indent: true, indent: true,
breakBeforeOpen: true, breakBeforeOpen: true,
breakAfterOpen: false, breakAfterOpen: false,
breakBeforeClose: !dtd[ e ][ '#' ], breakBeforeClose: !dtd[ e ][ '#' ],
breakAfterClose: true breakAfterClose: true
}); });
} }
} }
</script> </script>
</p> </p>
<p> <p>
<input type="submit" value="Submit"> <input type="submit" value="Submit">
</p> </p>
</form> </form>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,65 +1,65 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>New Image plugin &mdash; CKEditor Sample</title> <title>New Image plugin &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script> <script src="../../../ckeditor.js"></script>
<script> <script>
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
CKEDITOR.tools.enableHtml5Elements( document ); CKEDITOR.tools.enableHtml5Elements( document );
</script> </script>
<link href="../../../samples/sample.css" rel="stylesheet"> <link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-name" content="New Image plugin"> <meta name="ckeditor-sample-name" content="New Image plugin">
<meta name="ckeditor-sample-group" content="Plugins"> <meta name="ckeditor-sample-group" content="Plugins">
<meta name="ckeditor-sample-description" content="Using the new Image plugin to insert captioned images and adjust their dimensions."> <meta name="ckeditor-sample-description" content="Using the new Image plugin to insert captioned images and adjust their dimensions.">
<meta name="ckeditor-sample-isnew" content="1"> <meta name="ckeditor-sample-isnew" content="1">
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; New Image plugin <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; New Image plugin
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This editor is using the new <strong>Image</strong> (<code>image2</code>) plugin, which implements a dynamic <em>click-and-drag</em> resizing This editor is using the new <strong>Image</strong> (<code>image2</code>) plugin, which implements a dynamic <em>click-and-drag</em> resizing
and easy captioning of the images. and easy captioning of the images.
</p> </p>
<p> <p>
To use the new plugin, extend <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraPlugins">config.extraPlugins</a></code>: To use the new plugin, extend <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraPlugins">config.extraPlugins</a></code>:
</p> </p>
<pre class="samples"> <pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', { CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>extraPlugins: 'image2'</strong> <strong>extraPlugins: 'image2'</strong>
} ); } );
</pre> </pre>
</div> </div>
<textarea id="editor1" cols="10" rows="10"> <textarea id="editor1" cols="10" rows="10">
&lt;h1&gt;Apollo 11&lt;/h1&gt;&lt;figure class=&quot;image&quot; style=&quot;float: right&quot;&gt;&lt;img alt=&quot;Saturn V&quot; src=&quot;assets/image1.jpg&quot; width=&quot;200&quot; /&gt;&lt;figcaption&gt;Roll out of Saturn V on launch pad&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;strong&gt;Apollo 11&lt;/strong&gt; was the spaceflight that landed the first humans, Americans &lt;a href=&quot;http://en.wikipedia.org/wiki/Neil_Armstrong&quot; title=&quot;Neil Armstrong&quot;&gt;Neil Armstrong&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Buzz_Aldrin&quot; title=&quot;Buzz Aldrin&quot;&gt;Buzz Aldrin&lt;/a&gt;, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.&lt;/p&gt;&lt;p&gt;Armstrong spent about &lt;s&gt;three and a half&lt;/s&gt; two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5&amp;nbsp;kg) of lunar material for return to Earth. A third member of the mission, &lt;a href=&quot;http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)&quot; title=&quot;Michael Collins (astronaut)&quot;&gt;Michael Collins&lt;/a&gt;, piloted the &lt;a href=&quot;http://en.wikipedia.org/wiki/Apollo_Command/Service_Module&quot; title=&quot;Apollo Command/Service Module&quot;&gt;command&lt;/a&gt; spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth.&lt;/p&gt;&lt;h2&gt;Broadcasting and &lt;em&gt;quotes&lt;/em&gt; &lt;a id=&quot;quotes&quot; name=&quot;quotes&quot;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;One small step for [a] man, one giant leap for mankind.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Apollo 11 effectively ended the &lt;a href=&quot;http://en.wikipedia.org/wiki/Space_Race&quot; title=&quot;Space Race&quot;&gt;Space Race&lt;/a&gt; and fulfilled a national goal proposed in 1961 by the late U.S. President &lt;a href=&quot;http://en.wikipedia.org/wiki/John_F._Kennedy&quot; title=&quot;John F. Kennedy&quot;&gt;John F. Kennedy&lt;/a&gt; in a speech before the United States Congress:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;[...] before this decade is out, of landing a man on the Moon and returning him safely to the Earth.&lt;/p&gt;&lt;/blockquote&gt;&lt;figure class=&quot;image&quot; style=&quot;float: right&quot;&gt;&lt;img alt=&quot;The Eagle&quot; src=&quot;assets/image2.jpg&quot; style=&quot;width: 200px&quot; /&gt;&lt;figcaption&gt;The Eagle in lunar orbit&lt;/figcaption&gt;&lt;/figure&gt;&lt;h2&gt;Technical details &lt;a id=&quot;tech-details&quot; name=&quot;tech-details&quot;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Launched by a &lt;strong&gt;Saturn V&lt;/strong&gt; rocket from &lt;a href=&quot;http://en.wikipedia.org/wiki/Kennedy_Space_Center&quot; title=&quot;Kennedy Space Center&quot;&gt;Kennedy Space Center&lt;/a&gt; in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of &lt;a href=&quot;http://en.wikipedia.org/wiki/NASA&quot; title=&quot;NASA&quot;&gt;NASA&lt;/a&gt;&amp;#39;s Apollo program. The Apollo spacecraft had three parts:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Command Module&lt;/strong&gt; with a cabin for the three astronauts which was the only part which landed back on Earth&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Service Module&lt;/strong&gt; which supported the Command Module with propulsion, electrical power, oxygen and water&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Lunar Module&lt;/strong&gt; for landing on the Moon.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;After being sent to the Moon by the Saturn V&amp;#39;s upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mare_Tranquillitatis&quot; title=&quot;Mare Tranquillitatis&quot;&gt;Sea of Tranquility&lt;/a&gt;. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pacific_Ocean&quot; title=&quot;Pacific Ocean&quot;&gt;Pacific Ocean&lt;/a&gt; on July 24.&lt;/p&gt;&lt;hr /&gt;&lt;p style=&quot;text-align:right&quot;&gt;&lt;small&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Apollo_11&quot;&gt;Wikipedia.org&lt;/a&gt;&lt;/small&gt;&lt;/p&gt; &lt;h1&gt;Apollo 11&lt;/h1&gt;&lt;figure class=&quot;image&quot; style=&quot;float: right&quot;&gt;&lt;img alt=&quot;Saturn V&quot; src=&quot;assets/image1.jpg&quot; width=&quot;200&quot; /&gt;&lt;figcaption&gt;Roll out of Saturn V on launch pad&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;&lt;strong&gt;Apollo 11&lt;/strong&gt; was the spaceflight that landed the first humans, Americans &lt;a href=&quot;http://en.wikipedia.org/wiki/Neil_Armstrong&quot; title=&quot;Neil Armstrong&quot;&gt;Neil Armstrong&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Buzz_Aldrin&quot; title=&quot;Buzz Aldrin&quot;&gt;Buzz Aldrin&lt;/a&gt;, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.&lt;/p&gt;&lt;p&gt;Armstrong spent about &lt;s&gt;three and a half&lt;/s&gt; two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5&amp;nbsp;kg) of lunar material for return to Earth. A third member of the mission, &lt;a href=&quot;http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)&quot; title=&quot;Michael Collins (astronaut)&quot;&gt;Michael Collins&lt;/a&gt;, piloted the &lt;a href=&quot;http://en.wikipedia.org/wiki/Apollo_Command/Service_Module&quot; title=&quot;Apollo Command/Service Module&quot;&gt;command&lt;/a&gt; spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth.&lt;/p&gt;&lt;h2&gt;Broadcasting and &lt;em&gt;quotes&lt;/em&gt; &lt;a id=&quot;quotes&quot; name=&quot;quotes&quot;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;One small step for [a] man, one giant leap for mankind.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Apollo 11 effectively ended the &lt;a href=&quot;http://en.wikipedia.org/wiki/Space_Race&quot; title=&quot;Space Race&quot;&gt;Space Race&lt;/a&gt; and fulfilled a national goal proposed in 1961 by the late U.S. President &lt;a href=&quot;http://en.wikipedia.org/wiki/John_F._Kennedy&quot; title=&quot;John F. Kennedy&quot;&gt;John F. Kennedy&lt;/a&gt; in a speech before the United States Congress:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;[...] before this decade is out, of landing a man on the Moon and returning him safely to the Earth.&lt;/p&gt;&lt;/blockquote&gt;&lt;figure class=&quot;image&quot; style=&quot;float: right&quot;&gt;&lt;img alt=&quot;The Eagle&quot; src=&quot;assets/image2.jpg&quot; style=&quot;width: 200px&quot; /&gt;&lt;figcaption&gt;The Eagle in lunar orbit&lt;/figcaption&gt;&lt;/figure&gt;&lt;h2&gt;Technical details &lt;a id=&quot;tech-details&quot; name=&quot;tech-details&quot;&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Launched by a &lt;strong&gt;Saturn V&lt;/strong&gt; rocket from &lt;a href=&quot;http://en.wikipedia.org/wiki/Kennedy_Space_Center&quot; title=&quot;Kennedy Space Center&quot;&gt;Kennedy Space Center&lt;/a&gt; in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of &lt;a href=&quot;http://en.wikipedia.org/wiki/NASA&quot; title=&quot;NASA&quot;&gt;NASA&lt;/a&gt;&amp;#39;s Apollo program. The Apollo spacecraft had three parts:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Command Module&lt;/strong&gt; with a cabin for the three astronauts which was the only part which landed back on Earth&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Service Module&lt;/strong&gt; which supported the Command Module with propulsion, electrical power, oxygen and water&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Lunar Module&lt;/strong&gt; for landing on the Moon.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;After being sent to the Moon by the Saturn V&amp;#39;s upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mare_Tranquillitatis&quot; title=&quot;Mare Tranquillitatis&quot;&gt;Sea of Tranquility&lt;/a&gt;. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pacific_Ocean&quot; title=&quot;Pacific Ocean&quot;&gt;Pacific Ocean&lt;/a&gt; on July 24.&lt;/p&gt;&lt;hr /&gt;&lt;p style=&quot;text-align:right&quot;&gt;&lt;small&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Apollo_11&quot;&gt;Wikipedia.org&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
</textarea> </textarea>
<script> <script>
CKEDITOR.replace( 'editor1', { CKEDITOR.replace( 'editor1', {
extraPlugins: 'image2', extraPlugins: 'image2',
height: 450 height: 450
} ); } );
</script> </script>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,119 +1,119 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Shared-Space Plugin &mdash; CKEditor Sample</title> <title>Shared-Space Plugin &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script> <script src="../../../ckeditor.js"></script>
<link rel="stylesheet" href="../../../samples/sample.css"> <link rel="stylesheet" href="../../../samples/sample.css">
<meta name="ckeditor-sample-name" content="Shared-Space plugin"> <meta name="ckeditor-sample-name" content="Shared-Space plugin">
<meta name="ckeditor-sample-group" content="Plugins"> <meta name="ckeditor-sample-group" content="Plugins">
<meta name="ckeditor-sample-description" content="Having the toolbar and the bottom bar spaces shared by different editor instances."> <meta name="ckeditor-sample-description" content="Having the toolbar and the bottom bar spaces shared by different editor instances.">
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Sharing Toolbar and Bottom-bar Spaces <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Sharing Toolbar and Bottom-bar Spaces
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows several editor instances that share the very same spaces for both the toolbar and the bottom bar. This sample shows several editor instances that share the very same spaces for both the toolbar and the bottom bar.
</p> </p>
</div> </div>
<div id="top"> <div id="top">
<!-- This div will handle all toolbars --> <!-- This div will handle all toolbars -->
</div> </div>
<div style="height: 300px; overflow: auto; border: 1px solid #afafaf; padding: 20px; margin: 20px;"> <div style="height: 300px; overflow: auto; border: 1px solid #afafaf; padding: 20px; margin: 20px;">
<div id="framed1" style="width: 49%; float: left; margin-bottom: 20px;"></div> <div id="framed1" style="width: 49%; float: left; margin-bottom: 20px;"></div>
<div id="framed2" style="width: 49%; float: right; margin-bottom: 20px;"></div> <div id="framed2" style="width: 49%; float: right; margin-bottom: 20px;"></div>
<hr style="clear: both; margin: 20px 0;"> <hr style="clear: both; margin: 20px 0;">
<div contenteditable="true" id="inline1" style="width: 49%; float: left;"> <div contenteditable="true" id="inline1" style="width: 49%; float: left;">
<h3> <h3>
Integer condimentum sit amet Integer condimentum sit amet
</h3> </h3>
<p> <p>
<strong>Aenean nonummy a, mattis varius. Cras aliquet.</strong> <strong>Aenean nonummy a, mattis varius. Cras aliquet.</strong>
Praesent <a href="http://ckeditor.com/">magna non mattis ac, rhoncus nunc</a>, rhoncus eget, cursus pulvinar mollis.</p> Praesent <a href="http://ckeditor.com/">magna non mattis ac, rhoncus nunc</a>, rhoncus eget, cursus pulvinar mollis.</p>
<p>Proin id nibh. Sed eu libero posuere sed, lectus. Phasellus dui gravida gravida feugiat mattis ac, felis.</p> <p>Proin id nibh. Sed eu libero posuere sed, lectus. Phasellus dui gravida gravida feugiat mattis ac, felis.</p>
<p>Integer condimentum sit amet, tempor elit odio, a dolor non ante at sapien. Sed ac lectus. Nulla ligula quis eleifend mi, id leo velit pede cursus arcu id nulla ac lectus. Phasellus vestibulum. Nunc viverra enim quis diam.</p> <p>Integer condimentum sit amet, tempor elit odio, a dolor non ante at sapien. Sed ac lectus. Nulla ligula quis eleifend mi, id leo velit pede cursus arcu id nulla ac lectus. Phasellus vestibulum. Nunc viverra enim quis diam.</p>
</div> </div>
<div contenteditable="true" id="inline2" style="width: 49%; float: right;"> <div contenteditable="true" id="inline2" style="width: 49%; float: right;">
<h3> <h3>
Praesent wisi accumsan sit amet nibh Praesent wisi accumsan sit amet nibh
</h3> </h3>
<p>Donec ullamcorper, risus tortor, pretium porttitor. Morbi quam quis lectus non leo.</p> <p>Donec ullamcorper, risus tortor, pretium porttitor. Morbi quam quis lectus non leo.</p>
<p style="margin-left: 40px; ">Integer faucibus scelerisque. Proin faucibus at, aliquet vulputate, odio at eros. Fusce <a href="http://ckeditor.com/">gravida, erat vitae augue</a>. Fusce urna fringilla gravida.</p> <p style="margin-left: 40px; ">Integer faucibus scelerisque. Proin faucibus at, aliquet vulputate, odio at eros. Fusce <a href="http://ckeditor.com/">gravida, erat vitae augue</a>. Fusce urna fringilla gravida.</p>
<p>In hac habitasse platea dictumst. Praesent wisi accumsan sit amet nibh. Maecenas orci luctus a, lacinia quam sem, posuere commodo, odio condimentum tempor, pede semper risus. Suspendisse pede. In hac habitasse platea dictumst. Nam sed laoreet sit amet erat. Integer.</p> <p>In hac habitasse platea dictumst. Praesent wisi accumsan sit amet nibh. Maecenas orci luctus a, lacinia quam sem, posuere commodo, odio condimentum tempor, pede semper risus. Suspendisse pede. In hac habitasse platea dictumst. Nam sed laoreet sit amet erat. Integer.</p>
</div> </div>
</div> </div>
<div id="bottom"> <div id="bottom">
<!-- This div will handle all toolbars --> <!-- This div will handle all toolbars -->
</div> </div>
<script> <script>
// Turn off automatic editor creation first. // Turn off automatic editor creation first.
CKEDITOR.disableAutoInline = true; CKEDITOR.disableAutoInline = true;
CKEDITOR.inline( 'inline1', { CKEDITOR.inline( 'inline1', {
extraPlugins: 'sharedspace', extraPlugins: 'sharedspace',
removePlugins: 'floatingspace,resize', removePlugins: 'floatingspace,resize',
sharedSpaces: { sharedSpaces: {
top: 'top', top: 'top',
bottom: 'bottom' bottom: 'bottom'
} }
}); });
CKEDITOR.inline( 'inline2', { CKEDITOR.inline( 'inline2', {
extraPlugins: 'sharedspace', extraPlugins: 'sharedspace',
removePlugins: 'floatingspace,resize', removePlugins: 'floatingspace,resize',
sharedSpaces: { sharedSpaces: {
top: 'top', top: 'top',
bottom: 'bottom' bottom: 'bottom'
} }
}); });
CKEDITOR.appendTo( 'framed1', { CKEDITOR.appendTo( 'framed1', {
extraPlugins: 'sharedspace', extraPlugins: 'sharedspace',
removePlugins: 'maximize,resize', removePlugins: 'maximize,resize',
sharedSpaces: { sharedSpaces: {
top: 'top', top: 'top',
bottom: 'bottom' bottom: 'bottom'
} }
}, },
document.getElementById( 'inline1' ).innerHTML document.getElementById( 'inline1' ).innerHTML
); );
CKEDITOR.appendTo( 'framed2', { CKEDITOR.appendTo( 'framed2', {
extraPlugins: 'sharedspace', extraPlugins: 'sharedspace',
removePlugins: 'maximize,resize', removePlugins: 'maximize,resize',
sharedSpaces: { sharedSpaces: {
top: 'top', top: 'top',
bottom: 'bottom' bottom: 'bottom'
} }
}, },
document.getElementById( 'inline2' ).innerHTML document.getElementById( 'inline2' ).innerHTML
); );
</script> </script>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,232 +1,232 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Toolbar Configuration &mdash; CKEditor Sample</title> <title>Toolbar Configuration &mdash; CKEditor Sample</title>
<meta name="ckeditor-sample-name" content="Toolbar Configurations"> <meta name="ckeditor-sample-name" content="Toolbar Configurations">
<meta name="ckeditor-sample-group" content="Advanced Samples"> <meta name="ckeditor-sample-group" content="Advanced Samples">
<meta name="ckeditor-sample-description" content="Configuring CKEditor to display full or custom toolbar layout."> <meta name="ckeditor-sample-description" content="Configuring CKEditor to display full or custom toolbar layout.">
<script src="../../../ckeditor.js"></script> <script src="../../../ckeditor.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet"> <link href="../../../samples/sample.css" rel="stylesheet">
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Toolbar Configuration <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Toolbar Configuration
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample page demonstrates editor with loaded <a href="#fullToolbar">full toolbar</a> (all registered buttons) and, if This sample page demonstrates editor with loaded <a href="#fullToolbar">full toolbar</a> (all registered buttons) and, if
current editor's configuration modifies default settings, also editor with <a href="#currentToolbar">modified toolbar</a>. current editor's configuration modifies default settings, also editor with <a href="#currentToolbar">modified toolbar</a>.
</p> </p>
<p>Since CKEditor 4 there are two ways to configure toolbar buttons.</p> <p>Since CKEditor 4 there are two ways to configure toolbar buttons.</p>
<h2 class="samples">By <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbar">config.toolbar</a></h2> <h2 class="samples">By <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbar">config.toolbar</a></h2>
<p> <p>
You can explicitly define which buttons are displayed in which groups and in which order. You can explicitly define which buttons are displayed in which groups and in which order.
This is the more precise setting, but less flexible. If newly added plugin adds its This is the more precise setting, but less flexible. If newly added plugin adds its
own button you'll have to add it manually to your <code>config.toolbar</code> setting as well. own button you'll have to add it manually to your <code>config.toolbar</code> setting as well.
</p> </p>
<p>To add a CKEditor instance with custom toolbar setting, insert the following JavaScript call to your code:</p> <p>To add a CKEditor instance with custom toolbar setting, insert the following JavaScript call to your code:</p>
<pre class="samples"> <pre class="samples">
CKEDITOR.replace( <em>'textarea_id'</em>, { CKEDITOR.replace( <em>'textarea_id'</em>, {
<strong>toolbar:</strong> [ <strong>toolbar:</strong> [
{ name: 'document', items: [ 'Source', '-', 'NewPage', 'Preview', '-', 'Templates' ] }, // Defines toolbar group with name (used to create voice label) and items in 3 subgroups. { name: 'document', items: [ 'Source', '-', 'NewPage', 'Preview', '-', 'Templates' ] }, // Defines toolbar group with name (used to create voice label) and items in 3 subgroups.
[ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ], // Defines toolbar group without name. [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ], // Defines toolbar group without name.
'/', // Line break - next group will be placed in new line. '/', // Line break - next group will be placed in new line.
{ name: 'basicstyles', items: [ 'Bold', 'Italic' ] } { name: 'basicstyles', items: [ 'Bold', 'Italic' ] }
] ]
});</pre> });</pre>
<h2 class="samples">By <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups">config.toolbarGroups</a></h2> <h2 class="samples">By <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups">config.toolbarGroups</a></h2>
<p> <p>
You can define which groups of buttons (like e.g. <code>basicstyles</code>, <code>clipboard</code> You can define which groups of buttons (like e.g. <code>basicstyles</code>, <code>clipboard</code>
and <code>forms</code>) are displayed and in which order. Registered buttons are associated and <code>forms</code>) are displayed and in which order. Registered buttons are associated
with toolbar groups by <code>toolbar</code> property in their definition. with toolbar groups by <code>toolbar</code> property in their definition.
This setting's advantage is that you don't have to modify toolbar configuration This setting's advantage is that you don't have to modify toolbar configuration
when adding/removing plugins which register their own buttons. when adding/removing plugins which register their own buttons.
</p> </p>
<p>To add a CKEditor instance with custom toolbar groups setting, insert the following JavaScript call to your code:</p> <p>To add a CKEditor instance with custom toolbar groups setting, insert the following JavaScript call to your code:</p>
<pre class="samples"> <pre class="samples">
CKEDITOR.replace( <em>'textarea_id'</em>, { CKEDITOR.replace( <em>'textarea_id'</em>, {
<strong>toolbarGroups:</strong> [ <strong>toolbarGroups:</strong> [
{ name: 'document', groups: [ 'mode', 'document' ] }, // Displays document group with its two subgroups. { name: 'document', groups: [ 'mode', 'document' ] }, // Displays document group with its two subgroups.
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, // Group's name will be used to create voice label. { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, // Group's name will be used to create voice label.
'/', // Line break - next group will be placed in new line. '/', // Line break - next group will be placed in new line.
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'links' } { name: 'links' }
] ]
// NOTE: Remember to leave 'toolbar' property with the default value (null). // NOTE: Remember to leave 'toolbar' property with the default value (null).
});</pre> });</pre>
</div> </div>
<div id="currentToolbar" style="display: none"> <div id="currentToolbar" style="display: none">
<h2 class="samples">Current toolbar configuration</h2> <h2 class="samples">Current toolbar configuration</h2>
<p>Below you can see editor with current toolbar definition.</p> <p>Below you can see editor with current toolbar definition.</p>
<textarea cols="80" id="editorCurrent" name="editorCurrent" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea cols="80" id="editorCurrent" name="editorCurrent" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<pre id="editorCurrentCfg" class="samples"></pre> <pre id="editorCurrentCfg" class="samples"></pre>
</div> </div>
<div id="fullToolbar"> <div id="fullToolbar">
<h2 class="samples">Full toolbar configuration</h2> <h2 class="samples">Full toolbar configuration</h2>
<p>Below you can see editor with full toolbar, generated automatically by the editor.</p> <p>Below you can see editor with full toolbar, generated automatically by the editor.</p>
<p> <p>
<strong>Note</strong>: To create editor instance with full toolbar you don't have to set anything. <strong>Note</strong>: To create editor instance with full toolbar you don't have to set anything.
Just leave <code>toolbar</code> and <code>toolbarGroups</code> with the default, <code>null</code> values. Just leave <code>toolbar</code> and <code>toolbarGroups</code> with the default, <code>null</code> values.
</p> </p>
<textarea cols="80" id="editorFull" name="editorFull" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea cols="80" id="editorFull" name="editorFull" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<pre id="editorFullCfg" class="samples"></pre> <pre id="editorFullCfg" class="samples"></pre>
</div> </div>
<script> <script>
(function() { (function() {
'use strict'; 'use strict';
var buttonsNames; var buttonsNames;
CKEDITOR.config.extraPlugins = 'toolbar'; CKEDITOR.config.extraPlugins = 'toolbar';
CKEDITOR.on( 'instanceReady', function( evt ) { CKEDITOR.on( 'instanceReady', function( evt ) {
var editor = evt.editor, var editor = evt.editor,
editorCurrent = editor.name == 'editorCurrent', editorCurrent = editor.name == 'editorCurrent',
defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups || editor.config.removeButtons ), defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups || editor.config.removeButtons ),
pre = CKEDITOR.document.getById( editor.name + 'Cfg' ), pre = CKEDITOR.document.getById( editor.name + 'Cfg' ),
output = ''; output = '';
if ( editorCurrent ) { if ( editorCurrent ) {
// If default toolbar configuration has been modified, show "current toolbar" section. // If default toolbar configuration has been modified, show "current toolbar" section.
if ( !defaultToolbar ) if ( !defaultToolbar )
CKEDITOR.document.getById( 'currentToolbar' ).show(); CKEDITOR.document.getById( 'currentToolbar' ).show();
else else
return; return;
} }
if ( !buttonsNames ) if ( !buttonsNames )
buttonsNames = createButtonsNamesHash( editor.ui.items ); buttonsNames = createButtonsNamesHash( editor.ui.items );
// Toolbar isn't set explicitly, so it was created automatically from toolbarGroups. // Toolbar isn't set explicitly, so it was created automatically from toolbarGroups.
if ( !editor.config.toolbar ) { if ( !editor.config.toolbar ) {
output += output +=
'// Toolbar configuration generated automatically by the editor based on config.toolbarGroups.\n' + '// Toolbar configuration generated automatically by the editor based on config.toolbarGroups.\n' +
dumpToolbarConfiguration( editor ) + dumpToolbarConfiguration( editor ) +
'\n\n' + '\n\n' +
'// Toolbar groups configuration.\n' + '// Toolbar groups configuration.\n' +
dumpToolbarConfiguration( editor, true ) dumpToolbarConfiguration( editor, true )
} }
// Toolbar groups doesn't count in this case - print only toolbar. // Toolbar groups doesn't count in this case - print only toolbar.
else { else {
output += '// Toolbar configuration.\n' + output += '// Toolbar configuration.\n' +
dumpToolbarConfiguration( editor ); dumpToolbarConfiguration( editor );
} }
// Recreate to avoid old IE from loosing whitespaces on filling <pre> content. // Recreate to avoid old IE from loosing whitespaces on filling <pre> content.
var preOutput = pre.getOuterHtml().replace( /(?=<\/)/, output ); var preOutput = pre.getOuterHtml().replace( /(?=<\/)/, output );
CKEDITOR.dom.element.createFromHtml( preOutput ).replace( pre ); CKEDITOR.dom.element.createFromHtml( preOutput ).replace( pre );
} ); } );
CKEDITOR.replace( 'editorCurrent', { height: 100 } ); CKEDITOR.replace( 'editorCurrent', { height: 100 } );
CKEDITOR.replace( 'editorFull', { CKEDITOR.replace( 'editorFull', {
// Reset toolbar settings, so full toolbar will be generated automatically. // Reset toolbar settings, so full toolbar will be generated automatically.
toolbar: null, toolbar: null,
toolbarGroups: null, toolbarGroups: null,
removeButtons: null, removeButtons: null,
height: 100 height: 100
} ); } );
function dumpToolbarConfiguration( editor, printGroups ) { function dumpToolbarConfiguration( editor, printGroups ) {
var output = [], var output = [],
toolbar = editor.toolbar; toolbar = editor.toolbar;
for ( var i = 0; i < toolbar.length; ++i ) { for ( var i = 0; i < toolbar.length; ++i ) {
var group = dumpToolbarGroup( toolbar[ i ], printGroups ); var group = dumpToolbarGroup( toolbar[ i ], printGroups );
if ( group ) if ( group )
output.push( group ); output.push( group );
} }
return 'config.toolbar' + ( printGroups ? 'Groups' : '' ) + ' = [\n\t' + output.join( ',\n\t' ) + '\n];'; return 'config.toolbar' + ( printGroups ? 'Groups' : '' ) + ' = [\n\t' + output.join( ',\n\t' ) + '\n];';
} }
function dumpToolbarGroup( group, printGroups ) { function dumpToolbarGroup( group, printGroups ) {
var output = []; var output = [];
if ( typeof group == 'string' ) if ( typeof group == 'string' )
return '\'' + group + '\''; return '\'' + group + '\'';
if ( CKEDITOR.tools.isArray( group ) ) if ( CKEDITOR.tools.isArray( group ) )
return dumpToolbarItems( group ); return dumpToolbarItems( group );
// Skip group when printing entire toolbar configuration and there are no items in this group. // Skip group when printing entire toolbar configuration and there are no items in this group.
if ( !printGroups && !group.items ) if ( !printGroups && !group.items )
return; return;
if ( group.name ) if ( group.name )
output.push( 'name: \'' + group.name + '\'' ); output.push( 'name: \'' + group.name + '\'' );
if ( group.groups ) if ( group.groups )
output.push( 'groups: ' + dumpToolbarItems( group.groups ) ); output.push( 'groups: ' + dumpToolbarItems( group.groups ) );
if ( !printGroups ) if ( !printGroups )
output.push( 'items: ' + dumpToolbarItems( group.items ) ); output.push( 'items: ' + dumpToolbarItems( group.items ) );
return '{ ' + output.join( ', ' ) + ' }'; return '{ ' + output.join( ', ' ) + ' }';
} }
function dumpToolbarItems( items ) { function dumpToolbarItems( items ) {
if ( typeof items == 'string' ) if ( typeof items == 'string' )
return '\'' + items + '\''; return '\'' + items + '\'';
var names = [], var names = [],
i, item; i, item;
for ( var i = 0; i < items.length; ++i ) { for ( var i = 0; i < items.length; ++i ) {
item = items[ i ]; item = items[ i ];
if ( typeof item == 'string' ) if ( typeof item == 'string' )
names.push( item ); names.push( item );
else { else {
if ( item.type == CKEDITOR.UI_SEPARATOR ) if ( item.type == CKEDITOR.UI_SEPARATOR )
names.push( '-' ); names.push( '-' );
else else
names.push( buttonsNames[ item.name ] ); names.push( buttonsNames[ item.name ] );
} }
} }
return '[ \'' + names.join( '\', \'' ) + '\' ]'; return '[ \'' + names.join( '\', \'' ) + '\' ]';
} }
// Creates { 'lowercased': 'LowerCased' } buttons names hash. // Creates { 'lowercased': 'LowerCased' } buttons names hash.
function createButtonsNamesHash( items ) { function createButtonsNamesHash( items ) {
var hash = {}, var hash = {},
name; name;
for ( name in items ) { for ( name in items ) {
hash[ items[ name ].name ] = name; hash[ items[ name ].name ] = name;
} }
return hash; return hash;
} }
})(); })();
</script> </script>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,73 +1,73 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Using the CKEditor Read-Only API &mdash; CKEditor Sample</title> <title>Using the CKEditor Read-Only API &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" href="sample.css">
<script> <script>
var editor; var editor;
// The instanceReady event is fired, when an instance of CKEditor has finished // The instanceReady event is fired, when an instance of CKEditor has finished
// its initialization. // its initialization.
CKEDITOR.on( 'instanceReady', function( ev ) { CKEDITOR.on( 'instanceReady', function( ev ) {
editor = ev.editor; editor = ev.editor;
// Show this "on" button. // Show this "on" button.
document.getElementById( 'readOnlyOn' ).style.display = ''; document.getElementById( 'readOnlyOn' ).style.display = '';
// Event fired when the readOnly property changes. // Event fired when the readOnly property changes.
editor.on( 'readOnly', function() { editor.on( 'readOnly', function() {
document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : ''; document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none'; document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
}); });
}); });
function toggleReadOnly( isReadOnly ) { function toggleReadOnly( isReadOnly ) {
// Change the read-only state of the editor. // Change the read-only state of the editor.
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly
editor.setReadOnly( isReadOnly ); editor.setReadOnly( isReadOnly );
} }
</script> </script>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Using the CKEditor Read-Only API <a href="index.html">CKEditor Samples</a> &raquo; Using the CKEditor Read-Only API
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to use the This sample shows how to use the
<code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly">setReadOnly</a></code> <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly">setReadOnly</a></code>
API to put editor into the read-only state that makes it impossible for users to change the editor contents. API to put editor into the read-only state that makes it impossible for users to change the editor contents.
</p> </p>
<p> <p>
For details on how to create this setup check the source code of this sample page. For details on how to create this setup check the source code of this sample page.
</p> </p>
</div> </div>
<form action="sample_posteddata.php" method="post"> <form action="sample_posteddata.php" method="post">
<p> <p>
<textarea class="ckeditor" id="editor1" name="editor1" cols="100" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea class="ckeditor" id="editor1" name="editor1" cols="100" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p> </p>
<p> <p>
<input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none"> <input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none">
<input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none"> <input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none">
</p> </p>
</form> </form>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,365 +1,365 @@
/* /*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
*/ */
html, body, h1, h2, h3, h4, h5, h6, div, span, blockquote, p, address, form, fieldset, img, ul, ol, dl, dt, dd, li, hr, table, td, th, strong, em, sup, sub, dfn, ins, del, q, cite, var, samp, code, kbd, tt, pre html, body, h1, h2, h3, h4, h5, h6, div, span, blockquote, p, address, form, fieldset, img, ul, ol, dl, dt, dd, li, hr, table, td, th, strong, em, sup, sub, dfn, ins, del, q, cite, var, samp, code, kbd, tt, pre
{ {
line-height: 1.5; line-height: 1.5;
} }
body body
{ {
padding: 10px 30px; padding: 10px 30px;
} }
input, textarea, select, option, optgroup, button, td, th input, textarea, select, option, optgroup, button, td, th
{ {
font-size: 100%; font-size: 100%;
} }
pre pre
{ {
-moz-tab-size: 4; -moz-tab-size: 4;
-o-tab-size: 4; -o-tab-size: 4;
-webkit-tab-size: 4; -webkit-tab-size: 4;
tab-size: 4; tab-size: 4;
} }
pre, code, kbd, samp, tt pre, code, kbd, samp, tt
{ {
font-family: monospace,monospace; font-family: monospace,monospace;
font-size: 1em; font-size: 1em;
} }
body { body {
width: 960px; width: 960px;
margin: 0 auto; margin: 0 auto;
} }
code code
{ {
background: #f3f3f3; background: #f3f3f3;
border: 1px solid #ddd; border: 1px solid #ddd;
padding: 1px 4px; padding: 1px 4px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
} }
abbr abbr
{ {
border-bottom: 1px dotted #555; border-bottom: 1px dotted #555;
cursor: pointer; cursor: pointer;
} }
.new, .beta .new, .beta
{ {
text-transform: uppercase; text-transform: uppercase;
font-size: 10px; font-size: 10px;
font-weight: bold; font-weight: bold;
padding: 1px 4px; padding: 1px 4px;
margin: 0 0 0 5px; margin: 0 0 0 5px;
color: #fff; color: #fff;
float: right; float: right;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
} }
.new .new
{ {
background: #FF7E00; background: #FF7E00;
border: 1px solid #DA8028; border: 1px solid #DA8028;
text-shadow: 0 1px 0 #C97626; text-shadow: 0 1px 0 #C97626;
-moz-box-shadow: 0 2px 3px 0 #FFA54E inset; -moz-box-shadow: 0 2px 3px 0 #FFA54E inset;
-webkit-box-shadow: 0 2px 3px 0 #FFA54E inset; -webkit-box-shadow: 0 2px 3px 0 #FFA54E inset;
box-shadow: 0 2px 3px 0 #FFA54E inset; box-shadow: 0 2px 3px 0 #FFA54E inset;
} }
.beta .beta
{ {
background: #18C0DF; background: #18C0DF;
border: 1px solid #19AAD8; border: 1px solid #19AAD8;
text-shadow: 0 1px 0 #048CAD; text-shadow: 0 1px 0 #048CAD;
font-style: italic; font-style: italic;
-moz-box-shadow: 0 2px 3px 0 #50D4FD inset; -moz-box-shadow: 0 2px 3px 0 #50D4FD inset;
-webkit-box-shadow: 0 2px 3px 0 #50D4FD inset; -webkit-box-shadow: 0 2px 3px 0 #50D4FD inset;
box-shadow: 0 2px 3px 0 #50D4FD inset; box-shadow: 0 2px 3px 0 #50D4FD inset;
} }
h1.samples h1.samples
{ {
color: #0782C1; color: #0782C1;
font-size: 200%; font-size: 200%;
font-weight: normal; font-weight: normal;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
h1.samples a h1.samples a
{ {
color: #0782C1; color: #0782C1;
text-decoration: none; text-decoration: none;
border-bottom: 1px dotted #0782C1; border-bottom: 1px dotted #0782C1;
} }
.samples a:hover .samples a:hover
{ {
border-bottom: 1px dotted #0782C1; border-bottom: 1px dotted #0782C1;
} }
h2.samples h2.samples
{ {
color: #000000; color: #000000;
font-size: 130%; font-size: 130%;
margin: 15px 0 0 0; margin: 15px 0 0 0;
padding: 0; padding: 0;
} }
p, blockquote, address, form, pre, dl, h1.samples, h2.samples p, blockquote, address, form, pre, dl, h1.samples, h2.samples
{ {
margin-bottom: 15px; margin-bottom: 15px;
} }
ul.samples ul.samples
{ {
margin-bottom: 15px; margin-bottom: 15px;
} }
.clear .clear
{ {
clear: both; clear: both;
} }
fieldset fieldset
{ {
margin: 0; margin: 0;
padding: 10px; padding: 10px;
} }
body, input, textarea body, input, textarea
{ {
color: #333333; color: #333333;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
} }
body body
{ {
font-size: 75%; font-size: 75%;
} }
a.samples a.samples
{ {
color: #189DE1; color: #189DE1;
text-decoration: none; text-decoration: none;
} }
form form
{ {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
pre.samples pre.samples
{ {
background-color: #F7F7F7; background-color: #F7F7F7;
border: 1px solid #D7D7D7; border: 1px solid #D7D7D7;
overflow: auto; overflow: auto;
padding: 0.25em; padding: 0.25em;
white-space: pre-wrap; /* CSS 2.1 */ white-space: pre-wrap; /* CSS 2.1 */
word-wrap: break-word; /* IE7 */ word-wrap: break-word; /* IE7 */
} }
#footer #footer
{ {
clear: both; clear: both;
padding-top: 10px; padding-top: 10px;
} }
#footer hr #footer hr
{ {
margin: 10px 0 15px 0; margin: 10px 0 15px 0;
height: 1px; height: 1px;
border: solid 1px gray; border: solid 1px gray;
border-bottom: none; border-bottom: none;
} }
#footer p #footer p
{ {
margin: 0 10px 10px 10px; margin: 0 10px 10px 10px;
float: left; float: left;
} }
#footer #copy #footer #copy
{ {
float: right; float: right;
} }
#outputSample #outputSample
{ {
width: 100%; width: 100%;
table-layout: fixed; table-layout: fixed;
} }
#outputSample thead th #outputSample thead th
{ {
color: #dddddd; color: #dddddd;
background-color: #999999; background-color: #999999;
padding: 4px; padding: 4px;
white-space: nowrap; white-space: nowrap;
} }
#outputSample tbody th #outputSample tbody th
{ {
vertical-align: top; vertical-align: top;
text-align: left; text-align: left;
} }
#outputSample pre #outputSample pre
{ {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.description .description
{ {
border: 1px dotted #B7B7B7; border: 1px dotted #B7B7B7;
margin-bottom: 10px; margin-bottom: 10px;
padding: 10px 10px 0; padding: 10px 10px 0;
overflow: hidden; overflow: hidden;
} }
label label
{ {
display: block; display: block;
margin-bottom: 6px; margin-bottom: 6px;
} }
/** /**
* CKEditor editables are automatically set with the "cke_editable" class * CKEditor editables are automatically set with the "cke_editable" class
* plus cke_editable_(inline|themed) depending on the editor type. * plus cke_editable_(inline|themed) depending on the editor type.
*/ */
/* Style a bit the inline editables. */ /* Style a bit the inline editables. */
.cke_editable.cke_editable_inline .cke_editable.cke_editable_inline
{ {
cursor: pointer; cursor: pointer;
} }
/* Once an editable element gets focused, the "cke_focus" class is /* Once an editable element gets focused, the "cke_focus" class is
added to it, so we can style it differently. */ added to it, so we can style it differently. */
.cke_editable.cke_editable_inline.cke_focus .cke_editable.cke_editable_inline.cke_focus
{ {
box-shadow: inset 0px 0px 20px 3px #ddd, inset 0 0 1px #000; box-shadow: inset 0px 0px 20px 3px #ddd, inset 0 0 1px #000;
outline: none; outline: none;
background: #eee; background: #eee;
cursor: text; cursor: text;
} }
/* Avoid pre-formatted overflows inline editable. */ /* Avoid pre-formatted overflows inline editable. */
.cke_editable_inline pre .cke_editable_inline pre
{ {
white-space: pre-wrap; white-space: pre-wrap;
word-wrap: break-word; word-wrap: break-word;
} }
/** /**
* Samples index styles. * Samples index styles.
*/ */
.twoColumns, .twoColumns,
.twoColumnsLeft, .twoColumnsLeft,
.twoColumnsRight .twoColumnsRight
{ {
overflow: hidden; overflow: hidden;
} }
.twoColumnsLeft, .twoColumnsLeft,
.twoColumnsRight .twoColumnsRight
{ {
width: 45%; width: 45%;
} }
.twoColumnsLeft .twoColumnsLeft
{ {
float: left; float: left;
} }
.twoColumnsRight .twoColumnsRight
{ {
float: right; float: right;
} }
dl.samples dl.samples
{ {
padding: 0 0 0 40px; padding: 0 0 0 40px;
} }
dl.samples > dt dl.samples > dt
{ {
display: list-item; display: list-item;
list-style-type: disc; list-style-type: disc;
list-style-position: outside; list-style-position: outside;
margin: 0 0 3px; margin: 0 0 3px;
} }
dl.samples > dd dl.samples > dd
{ {
margin: 0 0 3px; margin: 0 0 3px;
} }
.warning .warning
{ {
color: #ff0000; color: #ff0000;
background-color: #FFCCBA; background-color: #FFCCBA;
border: 2px dotted #ff0000; border: 2px dotted #ff0000;
padding: 15px 10px; padding: 15px 10px;
margin: 10px 0; margin: 10px 0;
} }
/* Used on inline samples */ /* Used on inline samples */
blockquote blockquote
{ {
font-style: italic; font-style: italic;
font-family: Georgia, Times, "Times New Roman", serif; font-family: Georgia, Times, "Times New Roman", serif;
padding: 2px 0; padding: 2px 0;
border-style: solid; border-style: solid;
border-color: #ccc; border-color: #ccc;
border-width: 0; border-width: 0;
} }
.cke_contents_ltr blockquote .cke_contents_ltr blockquote
{ {
padding-left: 20px; padding-left: 20px;
padding-right: 8px; padding-right: 8px;
border-left-width: 5px; border-left-width: 5px;
} }
.cke_contents_rtl blockquote .cke_contents_rtl blockquote
{ {
padding-left: 8px; padding-left: 8px;
padding-right: 20px; padding-right: 20px;
border-right-width: 5px; border-right-width: 5px;
} }
img.right { img.right {
border: 1px solid #ccc; border: 1px solid #ccc;
float: right; float: right;
margin-left: 15px; margin-left: 15px;
padding: 5px; padding: 5px;
} }
img.left { img.left {
border: 1px solid #ccc; border: 1px solid #ccc;
float: left; float: left;
margin-right: 15px; margin-right: 15px;
padding: 5px; padding: 5px;
} }
.marker .marker
{ {
background-color: Yellow; background-color: Yellow;
} }

View file

@ -1,16 +1,16 @@
<?php /* <body><pre> <?php /* <body><pre>
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
CKEditor - Posted Data CKEditor - Posted Data
We are sorry, but your Web server does not support the PHP language used in this script. We are sorry, but your Web server does not support the PHP language used in this script.
Please note that CKEditor can be used with any other server-side language than just PHP. Please note that CKEditor can be used with any other server-side language than just PHP.
To save the content created with CKEditor you need to read the POST data on the server To save the content created with CKEditor you need to read the POST data on the server
side and write it to a file or the database. side and write it to a file or the database.
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or <a href="http://ckeditor.com/license">http://ckeditor.com/license</a> For licensing, see LICENSE.md or <a href="http://ckeditor.com/license">http://ckeditor.com/license</a>
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
</pre><div style="display:none"></body> */ include "assets/posteddata.php"; ?> </pre><div style="display:none"></body> */ include "assets/posteddata.php"; ?>

View file

@ -1,75 +1,75 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>TAB Key-Based Navigation &mdash; CKEditor Sample</title> <title>TAB Key-Based Navigation &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<link href="sample.css" rel="stylesheet"> <link href="sample.css" rel="stylesheet">
<style> <style>
.cke_focused, .cke_focused,
.cke_editable.cke_focused .cke_editable.cke_focused
{ {
outline: 3px dotted blue !important; outline: 3px dotted blue !important;
*border: 3px dotted blue !important; /* For IE7 */ *border: 3px dotted blue !important; /* For IE7 */
} }
</style> </style>
<script> <script>
CKEDITOR.on( 'instanceReady', function( evt ) { CKEDITOR.on( 'instanceReady', function( evt ) {
var editor = evt.editor; var editor = evt.editor;
editor.setData( 'This editor has it\'s tabIndex set to <strong>' + editor.tabIndex + '</strong>' ); editor.setData( 'This editor has it\'s tabIndex set to <strong>' + editor.tabIndex + '</strong>' );
// Apply focus class name. // Apply focus class name.
editor.on( 'focus', function() { editor.on( 'focus', function() {
editor.container.addClass( 'cke_focused' ); editor.container.addClass( 'cke_focused' );
}); });
editor.on( 'blur', function() { editor.on( 'blur', function() {
editor.container.removeClass( 'cke_focused' ); editor.container.removeClass( 'cke_focused' );
}); });
// Put startup focus on the first editor in tab order. // Put startup focus on the first editor in tab order.
if ( editor.tabIndex == 1 ) if ( editor.tabIndex == 1 )
editor.focus(); editor.focus();
}); });
</script> </script>
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; TAB Key-Based Navigation <a href="index.html">CKEditor Samples</a> &raquo; TAB Key-Based Navigation
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how tab key navigation among editor instances is This sample shows how tab key navigation among editor instances is
affected by the <code>tabIndex</code> attribute from affected by the <code>tabIndex</code> attribute from
the original page element. Use TAB key to move between the editors. the original page element. Use TAB key to move between the editors.
</p> </p>
</div> </div>
<p> <p>
<textarea class="ckeditor" cols="80" id="editor4" rows="10" tabindex="1"></textarea> <textarea class="ckeditor" cols="80" id="editor4" rows="10" tabindex="1"></textarea>
</p> </p>
<div class="ckeditor" contenteditable="true" id="editor1" tabindex="4"></div> <div class="ckeditor" contenteditable="true" id="editor1" tabindex="4"></div>
<p> <p>
<textarea class="ckeditor" cols="80" id="editor2" rows="10" tabindex="2"></textarea> <textarea class="ckeditor" cols="80" id="editor2" rows="10" tabindex="2"></textarea>
</p> </p>
<p> <p>
<textarea class="ckeditor" cols="80" id="editor3" rows="10" tabindex="3"></textarea> <textarea class="ckeditor" cols="80" id="editor3" rows="10" tabindex="3"></textarea>
</p> </p>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,69 +1,69 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>UI Color Picker &mdash; CKEditor Sample</title> <title>UI Color Picker &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" href="sample.css">
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; UI Color <a href="index.html">CKEditor Samples</a> &raquo; UI Color
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements
with a CKEditor instance with an option to change the color of its user interface.<br> with a CKEditor instance with an option to change the color of its user interface.<br>
<strong>Note:</strong>The UI skin color feature depends on the CKEditor skin <strong>Note:</strong>The UI skin color feature depends on the CKEditor skin
compatibility. The Moono and Kama skins are examples of skins that work with it. compatibility. The Moono and Kama skins are examples of skins that work with it.
</p> </p>
</div> </div>
<form action="sample_posteddata.php" method="post"> <form action="sample_posteddata.php" method="post">
<p> <p>
This editor instance has a UI color value defined in configuration to change the skin color, This editor instance has a UI color value defined in configuration to change the skin color,
To specify the color of the user interface, set the <code>uiColor</code> property: To specify the color of the user interface, set the <code>uiColor</code> property:
</p> </p>
<pre class="samples"> <pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', { CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>uiColor: '#14B8C4'</strong> <strong>uiColor: '#14B8C4'</strong>
});</pre> });</pre>
<p> <p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced. the <code>&lt;textarea&gt;</code> element to be replaced.
</p> </p>
<p> <p>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script> <script>
// Replace the <textarea id="editor"> with an CKEditor // Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations. // instance, using default configurations.
CKEDITOR.replace( 'editor1', { CKEDITOR.replace( 'editor1', {
uiColor: '#14B8C4', uiColor: '#14B8C4',
toolbar: [ toolbar: [
[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ], [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'FontSize', 'TextColor', 'BGColor' ] [ 'FontSize', 'TextColor', 'BGColor' ]
] ]
}); });
</script> </script>
</p> </p>
<p> <p>
<input type="submit" value="Submit"> <input type="submit" value="Submit">
</p> </p>
</form> </form>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,119 +1,119 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license For licensing, see LICENSE.md or http://ckeditor.com/license
--> -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>User Interface Globalization &mdash; CKEditor Sample</title> <title>User Interface Globalization &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script> <script src="../ckeditor.js"></script>
<script src="assets/uilanguages/languages.js"></script> <script src="assets/uilanguages/languages.js"></script>
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" href="sample.css">
</head> </head>
<body> <body>
<h1 class="samples"> <h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; User Interface Languages <a href="index.html">CKEditor Samples</a> &raquo; User Interface Languages
</h1> </h1>
<div class="description"> <div class="description">
<p> <p>
This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements
with a CKEditor instance with an option to change the language of its user interface. with a CKEditor instance with an option to change the language of its user interface.
</p> </p>
<p> <p>
It pulls the language list from CKEditor <code>_languages.js</code> file that contains the list of supported languages and creates It pulls the language list from CKEditor <code>_languages.js</code> file that contains the list of supported languages and creates
a drop-down list that lets the user change the UI language. a drop-down list that lets the user change the UI language.
</p> </p>
<p> <p>
By default, CKEditor automatically localizes the editor to the language of the user. By default, CKEditor automatically localizes the editor to the language of the user.
The UI language can be controlled with two configuration options: The UI language can be controlled with two configuration options:
<code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-language">language</a></code> and <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-language">language</a></code> and
<code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-defaultLanguage"> <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-defaultLanguage">
defaultLanguage</a></code>. The <code>defaultLanguage</code> setting specifies the defaultLanguage</a></code>. The <code>defaultLanguage</code> setting specifies the
default CKEditor language to be used when a localization suitable for user's settings is not available. default CKEditor language to be used when a localization suitable for user's settings is not available.
</p> </p>
<p> <p>
To specify the user interface language that will be used no matter what language is To specify the user interface language that will be used no matter what language is
specified in user's browser or operating system, set the <code>language</code> property: specified in user's browser or operating system, set the <code>language</code> property:
</p> </p>
<pre class="samples"> <pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', { CKEDITOR.replace( '<em>textarea_id</em>', {
// Load the German interface. // Load the German interface.
<strong>language: 'de'</strong> <strong>language: 'de'</strong>
});</pre> });</pre>
<p> <p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced. the <code>&lt;textarea&gt;</code> element to be replaced.
</p> </p>
</div> </div>
<form action="sample_posteddata.php" method="post"> <form action="sample_posteddata.php" method="post">
<p> <p>
Available languages (<span id="count"> </span> languages!):<br> Available languages (<span id="count"> </span> languages!):<br>
<script> <script>
document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' ); document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' );
// Get the language list from the _languages.js file. // Get the language list from the _languages.js file.
for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ ) { for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ ) {
document.write( document.write(
'<option value="' + window.CKEDITOR_LANGS[i].code + '">' + '<option value="' + window.CKEDITOR_LANGS[i].code + '">' +
window.CKEDITOR_LANGS[i].name + window.CKEDITOR_LANGS[i].name +
'</option>' ); '</option>' );
} }
document.write( '</select>' ); document.write( '</select>' );
</script> </script>
<br> <br>
<span style="color: #888888"> <span style="color: #888888">
(You may see strange characters if your system does not support the selected language) (You may see strange characters if your system does not support the selected language)
</span> </span>
</p> </p>
<p> <p>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script> <script>
// Set the number of languages. // Set the number of languages.
document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length; document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;
var editor; var editor;
function createEditor( languageCode ) { function createEditor( languageCode ) {
if ( editor ) if ( editor )
editor.destroy(); editor.destroy();
// Replace the <textarea id="editor"> with an CKEditor // Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations. // instance, using default configurations.
editor = CKEDITOR.replace( 'editor1', { editor = CKEDITOR.replace( 'editor1', {
language: languageCode, language: languageCode,
on: { on: {
instanceReady: function() { instanceReady: function() {
// Wait for the editor to be ready to set // Wait for the editor to be ready to set
// the language combo. // the language combo.
var languages = document.getElementById( 'languages' ); var languages = document.getElementById( 'languages' );
languages.value = this.langCode; languages.value = this.langCode;
languages.disabled = false; languages.disabled = false;
} }
} }
}); });
} }
// At page startup, load the default language: // At page startup, load the default language:
createEditor( '' ); createEditor( '' );
</script> </script>
</p> </p>
</form> </form>
<div id="footer"> <div id="footer">
<hr> <hr>
<p> <p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p> </p>
<p id="copy"> <p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved. Knabben. All rights reserved.
</p> </p>
</div> </div>
</body> </body>
</html> </html>

Some files were not shown because too many files have changed in this diff Show more