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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,6 +4,7 @@
'use strict';
var
window = require('window'),
Utils = require('Common/Utils')
;
@ -326,7 +327,7 @@
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'),
Enums = require('Common/Enums'),
Consts = require('Common/Consts'),
Globals = require('Common/Globals')
;
@ -108,14 +107,6 @@
return Utils.isArray(aValue) && 0 < aValue.length;
};
/**
* @return {*|null}
*/
Utils.notificationClass = function ()
{
return window.Notification && window.Notification.requestPermission ? window.Notification : null;
};
/**
* @param {string} sQueryString
* @return {Object}
@ -380,125 +371,6 @@
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}
*/
@ -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 {string} sMethodName
@ -876,7 +628,6 @@
*/
Utils.initDataConstructorBySettings = function (oData)
{
oData.editorDefaultType = ko.observable(Enums.EditorDefaultType.Html);
oData.showImages = ko.observable(false);
oData.contactsAutosave = ko.observable(false);
oData.interfaceAnimation = ko.observable(true);
@ -888,16 +639,10 @@
oData.useLocalProxyForExternalImages = ko.observable(false);
oData.desktopNotifications = ko.observable(false);
oData.useThreads = ko.observable(true);
oData.replySameFolder = 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) {
if (Globals.bMobileDevice || !bValue)
{
@ -911,146 +656,6 @@
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.capaAdditionalIdentities = ko.observable(false);
oData.capaGravatar = ko.observable(false);
@ -1061,54 +666,6 @@
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);
};
@ -1153,13 +710,13 @@
}
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')
});
}
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')
});
}
@ -1224,7 +781,7 @@
*/
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);
};
@ -1291,7 +848,7 @@
$('#rl-content', oBody).html(oTemplate.html());
$('html', oWin.document).addClass('external ' + $('html').attr('class'));
Utils.i18nToNode(oBody);
require('Common/Translator').i18nToNode(oBody);
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
*/

View file

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

60
dev/External/ko.js vendored
View file

@ -41,7 +41,7 @@
sPlacement = '',
oSubscription = null,
Globals = require('Common/Globals'),
Utils = require('Common/Utils')
Translator = require('Common/Translator')
;
if (!Globals.bMobileDevice)
@ -63,7 +63,7 @@
'title': function () {
var sValue = bi18n ? ko.unwrap(fValueAccessor()) : fValueAccessor()();
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 () {
$oEl.tooltip('hide');
@ -286,16 +286,14 @@
ko.bindingHandlers.i18nInit = {
'init': function (oElement) {
var Utils = require('Common/Utils');
Utils.i18nToNode(oElement);
require('Common/Translator').i18nToNode(oElement);
}
};
ko.bindingHandlers.i18nUpdate = {
'update': function (oElement, fValueAccessor) {
var Utils = require('Common/Utils');
ko.unwrap(fValueAccessor());
Utils.i18nToNode(oElement);
require('Common/Translator').i18nToNode(oElement);
}
};
@ -788,6 +786,56 @@
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)
{
var mValue = oTarget();

View file

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

View file

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

View file

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

View file

@ -10,6 +10,9 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Events = require('Common/Events'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
Data = require('Storage/User/Data'),
Cache = require('Storage/User/Cache'),
@ -48,7 +51,8 @@
;
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 ()
@ -67,7 +71,7 @@
{
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();
}
@ -87,7 +91,7 @@
.messageListSearch(sSearch)
;
if (Enums.Layout.NoPreview === Data.layout() && Data.message())
if (Enums.Layout.NoPreview === UserSettingsStore.layout() && Data.message())
{
Data.message(null);
}
@ -103,7 +107,7 @@
Data.messageList.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-side-preview-pane', Enums.Layout.SidePreview === nValue);
@ -112,7 +116,7 @@
Events.pub('layout', [nValue]);
});
Data.layout.valueHasMutated();
UserSettingsStore.layout.valueHasMutated();
Events.sub('mailbox.inbox-unread-count', function (nCount) {
Data.foldersInboxUnreadCount(nCount);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@
ko = require('ko'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Links = require('Common/Links'),
Data = require('Storage/User/Data'),
@ -24,7 +24,7 @@
this.accounts = Data.accounts;
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.visibility = ko.computed(function () {

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote')
;
@ -53,7 +54,7 @@
if (this.newPassword() !== this.newPassword2())
{
this.passwordMismatch(true);
this.errorDescription(Utils.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
this.errorDescription(Translator.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
}
else
{
@ -112,7 +113,7 @@
this.passwordUpdateError(true);
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'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
FilterStore = require('Stores/Filter'),
Remote = require('Storage/User/Remote')
;
@ -22,6 +23,9 @@
{
var self = this;
this.modules = FilterStore.modules;
this.filters = FilterStore.collection;
this.haveChanges = ko.observable(false);
this.processText = ko.observable('');
@ -29,22 +33,16 @@
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.filterRaw = ko.observable('');
this.filterRaw.capa = ko.observable('');
this.filterRaw = FilterStore.raw;
this.filterRaw.capa = FilterStore.capa;
this.filterRaw.active = ko.observable(false);
this.filterRaw.allow = ko.observable(false);
this.filterRaw.error = ko.observable(false);
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.visibility = ko.computed(function () {
@ -78,8 +76,8 @@
}
else
{
self.saveErrorText(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.CantSaveFilters));
self.saveErrorText(oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) :
Translator.getNotification(Enums.Notification.CantSaveFilters));
}
}, this.filters(), this.filterRaw(), this.filterRaw.active());
@ -173,7 +171,6 @@
require('Knoin/Knoin').showScreenPopup(
require('View/Popup/Filter'), [oNew, function () {
self.filters.push(oNew);
self.haveChanges(true);
self.filterRaw.active(false);
}, false]);
};

View file

@ -8,6 +8,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'),
@ -34,19 +35,19 @@
if (bCreating)
{
return Utils.i18n('SETTINGS_FOLDERS/CREATING_PROCESS');
return Translator.i18n('SETTINGS_FOLDERS/CREATING_PROCESS');
}
else if (bDeleting)
{
return Utils.i18n('SETTINGS_FOLDERS/DELETING_PROCESS');
return Translator.i18n('SETTINGS_FOLDERS/DELETING_PROCESS');
}
else if (bRenaming)
{
return Utils.i18n('SETTINGS_FOLDERS/RENAMING_PROCESS');
return Translator.i18n('SETTINGS_FOLDERS/RENAMING_PROCESS');
}
else if (bLoading)
{
return Utils.i18n('SETTINGS_FOLDERS/LOADING_PROCESS');
return Translator.i18n('SETTINGS_FOLDERS/LOADING_PROCESS');
}
return '';
@ -105,7 +106,7 @@
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{
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();
@ -176,7 +177,7 @@
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{
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();
@ -188,7 +189,7 @@
}
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'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
NotificationSettingsStore = require('Stores/NotificationSettings'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote')
@ -21,31 +25,28 @@
*/
function GeneralUserSettings()
{
this.mainLanguage = Data.mainLanguage;
this.mainMessagesPerPage = Data.mainMessagesPerPage;
this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
this.editorDefaultType = Data.editorDefaultType;
this.language = UserSettingsStore.language;
this.messagesPerPage = UserSettingsStore.messagesPerPage;
this.messagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
this.editorDefaultType = UserSettingsStore.editorDefaultType;
this.layout = UserSettingsStore.layout;
this.usePreviewPane = UserSettingsStore.usePreviewPane;
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.useThreads = Data.useThreads;
this.replySameFolder = Data.replySameFolder;
this.layout = Data.layout;
this.usePreviewPane = Data.usePreviewPane;
this.useCheckboxesInList = Data.useCheckboxesInList;
this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
this.isDesktopNotificationsSupported = ko.computed(function () {
return Enums.DesktopNotifications.NotSupported !== Data.desktopNotificationsPermisions();
});
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.languageFullName = ko.computed(function () {
return Utils.convertLangName(this.language());
}, this);
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
@ -57,21 +58,21 @@
this.isAnimationSupported = Globals.bAnimationSupported;
this.editorDefaultTypes = ko.computed(function () {
Globals.langChangeTrigger();
Translator.trigger();
return [
{'id': Enums.EditorDefaultType.Html, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
{'id': Enums.EditorDefaultType.Plain, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
{'id': Enums.EditorDefaultType.HtmlForced, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
{'id': Enums.EditorDefaultType.PlainForced, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
{'id': Enums.EditorDefaultType.Html, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
{'id': Enums.EditorDefaultType.Plain, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
{'id': Enums.EditorDefaultType.HtmlForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
{'id': Enums.EditorDefaultType.PlainForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
];
}, this);
this.layoutTypes = ko.computed(function () {
Globals.langChangeTrigger();
Translator.trigger();
return [
{'id': Enums.Layout.NoPreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
{'id': Enums.Layout.SidePreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
{'id': Enums.Layout.BottomPreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
{'id': Enums.Layout.NoPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
{'id': Enums.Layout.SidePreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
{'id': Enums.Layout.BottomPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
];
}, this);
}
@ -96,11 +97,11 @@
}
;
Data.language.subscribe(function (sValue) {
self.language.subscribe(function (sValue) {
self.languageTrigger(Enums.SaveSettingsStep.Animate);
Utils.reloadLanguage(sValue,
Translator.reload(sValue,
fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult),
fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult));
@ -109,13 +110,13 @@
});
});
Data.editorDefaultType.subscribe(function (sValue) {
self.editorDefaultType.subscribe(function (sValue) {
Remote.saveSettings(f0, {
'EditorDefaultType': sValue
});
});
Data.messagesPerPage.subscribe(function (iValue) {
self.messagesPerPage.subscribe(function (iValue) {
Remote.saveSettings(f1, {
'MPP': iValue
});
@ -127,7 +128,7 @@
});
});
Data.useDesktopNotifications.subscribe(function (bValue) {
self.enableDesktopNotification.subscribe(function (bValue) {
Utils.timeOutAction('SaveDesktopNotifications', function () {
Remote.saveSettings(null, {
'DesktopNotifications': bValue ? '1' : '0'
@ -152,7 +153,7 @@
});
});
Data.layout.subscribe(function (nValue) {
self.layout.subscribe(function (nValue) {
Data.messageList([]);
@ -172,7 +173,7 @@
GeneralUserSettings.prototype.onShow = function ()
{
Data.desktopNotifications.valueHasMutated();
this.enableDesktopNotification.valueHasMutated();
};
GeneralUserSettings.prototype.selectLanguage = function ()

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
HtmlEditor = require('Common/HtmlEditor'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote')
@ -74,7 +75,7 @@
}, this);
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.visibility = ko.computed(function () {

View file

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

View file

@ -10,26 +10,29 @@
{
var
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.googleLoggined = Data.googleLoggined;
this.googleUserName = Data.googleUserName;
this.googleActions = SocialStore.google.loading;
this.googleLoggined = SocialStore.google.loggined;
this.googleUserName = SocialStore.google.userName;
this.facebookEnable = Data.facebookEnable;
this.facebookEnable = SocialStore.facebook.enabled;
this.facebookActions = Data.facebookActions;
this.facebookLoggined = Data.facebookLoggined;
this.facebookUserName = Data.facebookUserName;
this.facebookActions = SocialStore.facebook.loading;
this.facebookLoggined = SocialStore.facebook.loggined;
this.facebookUserName = SocialStore.facebook.userName;
this.twitterEnable = Data.twitterEnable;
this.twitterEnable = SocialStore.twitter.enabled;
this.twitterActions = Data.twitterActions;
this.twitterLoggined = Data.twitterLoggined;
this.twitterUserName = Data.twitterUserName;
this.twitterActions = SocialStore.twitter.loading;
this.twitterLoggined = SocialStore.twitter.loggined;
this.twitterUserName = SocialStore.twitter.userName;
this.connectGoogle = Utils.createCommand(this, function () {
if (!this.googleLoggined())

View file

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

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {
@ -21,27 +20,6 @@
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.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities));
this.capaGravatar(Settings.capa(Enums.Capa.Gravatar));
@ -58,43 +36,17 @@
this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
this.showImages(!!Settings.settingsGet('ShowImages'));
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
this.interfaceAnimation(!!Settings.settingsGet('InterfaceAnimation'));
this.mainMessagesPerPage(Settings.settingsGet('MPP'));
this.desktopNotifications(!!Settings.settingsGet('DesktopNotifications'));
this.useThreads(!!Settings.settingsGet('UseThreads'));
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
this.layout(Enums.Layout.SidePreview);
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
{
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'));
require('Stores/Social').populate();
require('Stores/UserSettings').populate();
require('Stores/NotificationSettings').populate();
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 () {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {
@ -16,6 +15,7 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Links = require('Common/Links'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Cache = require('Storage/User/Cache'),
@ -271,7 +271,8 @@
}, this);
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;
}, this);
@ -327,13 +328,13 @@
this.messageFullScreenMode(false);
this.hideMessageBodies();
if (Enums.Layout.NoPreview === this.layout() &&
if (Enums.Layout.NoPreview === require('Stores/UserSettings').layout() &&
-1 < window.location.hash.indexOf('message-preview'))
{
require('App/User').historyBack();
}
}
else if (Enums.Layout.NoPreview === this.layout())
else if (Enums.Layout.NoPreview === require('Stores/UserSettings').layout())
{
this.message.focused(true);
}
@ -347,7 +348,7 @@
}
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);
}
@ -430,22 +431,7 @@
return aList;
}, 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
this.filterModules = ko.observable({});
this.composeInEdit = ko.observable(false);
this.capaOpenPGP = ko.observable(false);
this.openpgpkeys = ko.observableArray([]);
@ -460,21 +446,6 @@
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.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30);
@ -546,17 +517,17 @@
if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length)
{
var
self = this,
iIndex = 0,
iLen = aNewMessages.length,
fNotificationHelper = function (sImageSrc, sTitle, sText)
{
var
NotificationClass = Utils.notificationClass(),
NotificationSettingsStore = require('Stores/NotificationSettings'),
NotificationClass = NotificationSettingsStore.notificationClass(),
oNotification = null
;
if (NotificationClass && self.useDesktopNotifications())
if (NotificationClass && NotificationSettingsStore.enableDesktopNotification())
{
oNotification = new NotificationClass(sTitle, {
'body': sText,
@ -596,7 +567,7 @@
fNotificationHelper(
Links.notificationMailIcon(),
this.accountEmail(),
Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
Translator.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
'COUNT': iLen
})
);

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(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/mixins.less";

View file

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

View file

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

View file

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

View file

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

View file

@ -19,6 +19,10 @@
Events = require('Common/Events'),
Links = require('Common/Links'),
HtmlEditor = require('Common/HtmlEditor'),
Translator = require('Common/Translator'),
SocialStore = require('Stores/Social'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'),
@ -61,6 +65,7 @@
this.bSkipNextHide = false;
this.composeInEdit = Data.composeInEdit;
this.editorDefaultType = UserSettingsStore.editorDefaultType;
this.capaOpenPGP = Data.capaOpenPGP;
@ -419,7 +424,8 @@
this.triggerForResize();
}, this);
this.dropboxEnabled = ko.observable(!!Settings.settingsGet('DropboxApiKey'));
this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
this.dropboxCommand = Utils.createCommand(this, function () {
@ -659,15 +665,15 @@
if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode)
{
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
{
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 : '');
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.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')
}) : ''
);
@ -719,7 +725,7 @@
if (!bResult)
{
this.savedError(true);
this.savedOrSendingText(Utils.getNotification(Enums.Notification.CantSaveMessage));
this.savedOrSendingText(Translator.getNotification(Enums.Notification.CantSaveMessage));
}
this.reloadDraftFolder();
@ -848,7 +854,7 @@
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);
}, null, null, null, false]);
}
@ -1052,7 +1058,7 @@
case Enums.ComposeType.Reply:
case Enums.ComposeType.ReplyAll:
sFrom = oMessage.fromToLine(false, true);
sReplyTitle = Utils.i18n('COMPOSE/REPLY_MESSAGE_TITLE', {
sReplyTitle = Translator.i18n('COMPOSE/REPLY_MESSAGE_TITLE', {
'DATETIME': sDate,
'EMAIL': sFrom
});
@ -1066,12 +1072,12 @@
sFrom = oMessage.fromToLine(false, true);
sTo = oMessage.toToLine(false, true);
sCc = oMessage.ccToLine(false, true);
sText = '<br /><br /><br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_FROM') + ': ' + sFrom +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') + ': ' + sTo +
(0 < sCc.length ? '<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') + ': ' + Utils.encodeHtml(sDate) +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT') + ': ' + Utils.encodeHtml(sSubject) +
sText = '<br /><br /><br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') +
'<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_FROM') + ': ' + sFrom +
'<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') + ': ' + sTo +
(0 < sCc.length ? '<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') +
'<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') + ': ' + Utils.encodeHtml(sDate) +
'<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT') + ': ' + Utils.encodeHtml(sSubject) +
'<br /><br />' + sText;
break;
case Enums.ComposeType.ForwardAsAttachment:
@ -1087,8 +1093,8 @@
this.editor(function (oEditor) {
oEditor.setHtml(sText, false);
if (Enums.EditorDefaultType.PlainForced === Data.editorDefaultType() ||
(!oMessage.isHtml() && Enums.EditorDefaultType.HtmlForced !== Data.editorDefaultType()))
if (Enums.EditorDefaultType.PlainForced === self.editorDefaultType() ||
(!oMessage.isHtml() && Enums.EditorDefaultType.HtmlForced !== self.editorDefaultType()))
{
oEditor.modeToggle(false);
}
@ -1107,8 +1113,8 @@
this.editor(function (oEditor) {
oEditor.setHtml(sText, false);
if (Enums.EditorDefaultType.Html !== Data.editorDefaultType() &&
Enums.EditorDefaultType.HtmlForced !== Data.editorDefaultType())
if (Enums.EditorDefaultType.Html !== self.editorDefaultType() &&
Enums.EditorDefaultType.HtmlForced !== self.editorDefaultType())
{
oEditor.modeToggle(false);
}
@ -1197,7 +1203,7 @@
}
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())
{
Utils.delegateRun(self, 'closeCommand');
@ -1251,7 +1257,7 @@
oScript = window.document.createElement('script');
oScript.type = 'text/javascript';
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);
}
@ -1538,7 +1544,7 @@
{
oAttachment
.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;
}
@ -1585,11 +1591,11 @@
if (null !== mErrorCode)
{
sError = Utils.getUploadErrorDescByCode(mErrorCode);
sError = Translator.getUploadErrorDescByCode(mErrorCode);
}
else if (!oAttachmentJson)
{
sError = Utils.i18n('UPLOAD/ERROR_UNKNOWN');
sError = Translator.i18n('UPLOAD/ERROR_UNKNOWN');
}
if (oAttachment)
@ -1711,7 +1717,7 @@
if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
{
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;
}
@ -1731,7 +1737,7 @@
if (!bResult)
{
oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
oAttachment.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
}
}, [oDropboxFile['link']]);
@ -1767,7 +1773,7 @@
if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
{
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;
}
@ -1788,7 +1794,7 @@
if (!bResult)
{
oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
oAttachment.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
}
}, oDriveFile['downloadUrl'], sAccessToken);
@ -1877,7 +1883,7 @@
.waiting(false)
.uploading(false)
.complete(true)
.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded))
.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded))
;
}
}, this);

View file

@ -10,6 +10,7 @@
Utils = require('Common/Utils'),
Enums = require('Common/Enums'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
@ -58,7 +59,7 @@
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;
}
@ -67,7 +68,7 @@
oPrivateKey = Data.findPrivateKeyByEmail(this.from(), this.password());
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()
}));
@ -77,7 +78,7 @@
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;
}
@ -88,7 +89,7 @@
var aKeys = Data.findPublicKeysByEmail(sEmail);
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
}));
@ -131,7 +132,7 @@
}
catch (e)
{
self.notification(Utils.i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
self.notification(Translator.i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
'ERROR': '' + e
}));

View file

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

View file

@ -9,9 +9,12 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
FilterStore = require('Stores/Filter'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
;
@ -26,10 +29,11 @@
this.isNew = ko.observable(true);
this.modules = FilterStore.modules;
this.fTrueCallback = null;
this.filter = ko.observable(null);
this.modules = Data.filterModules;
this.allowMarkAsRead = ko.observable(false);
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
@ -71,11 +75,11 @@
return true;
});
this.actionTypeOptions = [];
this.fieldOptions = [];
this.typeOptions = [];
this.actionTypeOptions = ko.observableArray([]);
this.fieldOptions = ko.observableArray([]);
this.typeOptions = ko.observableArray([]);
this.populateOptions();
Translator.initOnStartOrLangChange(this.populateOptions, this);
this.modules.subscribe(this.populateOptions, this);
@ -87,9 +91,10 @@
FilterPopupView.prototype.populateOptions = function ()
{
this.actionTypeOptions = [];
this.actionTypeOptions([]);
// 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();
if (oModules)
@ -102,44 +107,44 @@
if (oModules.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)
{
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)
{
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)
{
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,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD')});
'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD')});
this.fieldOptions = [
{'id': Enums.FilterConditionField.From, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_FROM')},
{'id': Enums.FilterConditionField.Recipient, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS')},
{'id': Enums.FilterConditionField.Subject, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT')}
];
this.fieldOptions([
{'id': Enums.FilterConditionField.From, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_FROM')},
{'id': Enums.FilterConditionField.Recipient, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS')},
{'id': Enums.FilterConditionField.Subject, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT')}
]);
this.typeOptions = [
{'id': Enums.FilterConditionType.Contains, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS')},
{'id': Enums.FilterConditionType.NotContains, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS')},
{'id': Enums.FilterConditionType.EqualTo, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO')},
{'id': Enums.FilterConditionType.NotEqualTo, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO')}
];
this.typeOptions([
{'id': Enums.FilterConditionType.Contains, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS')},
{'id': Enums.FilterConditionType.NotContains, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS')},
{'id': Enums.FilterConditionType.EqualTo, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_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'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
Cache = require('Storage/User/Cache'),
@ -41,7 +42,7 @@
}, this);
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()
});
}, this);
@ -77,11 +78,11 @@
{
if (oData && oData.ErrorCode)
{
self.clearingError(Utils.getNotification(oData.ErrorCode));
self.clearingError(Translator.getNotification(oData.ErrorCode));
}
else
{
self.clearingError(Utils.getNotification(Enums.Notification.MailServerError));
self.clearingError(Translator.getNotification(Enums.Notification.MailServerError));
}
}
}, oFolderToClear.fullNameRaw);

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'),
Consts = require('Common/Consts'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'),
@ -26,8 +27,8 @@
{
AbstractView.call(this, 'Popups', 'PopupsFolderCreate');
Utils.initOnStartOrLangChange(function () {
this.sNoParentText = Utils.i18n('POPUPS_CREATE_FOLDER/SELECT_NO_PARENT');
Translator.initOnStartOrLangChange(function () {
this.sNoParentText = Translator.i18n('POPUPS_CREATE_FOLDER/SELECT_NO_PARENT');
}, this);
this.folderName = ko.observable('');
@ -84,7 +85,7 @@
else
{
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);

View file

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

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote'),
Data = require('Storage/User/Data'),
@ -88,12 +89,12 @@
}
else if (oData.ErrorCode)
{
this.submitError(Utils.getNotification(oData.ErrorCode));
this.submitError(Translator.getNotification(oData.ErrorCode));
}
}
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());

View file

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

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/Admin/Remote'),
@ -99,11 +100,11 @@
this.saveError('');
if (oData && oData.ErrorCode)
{
this.saveError(Utils.getNotification(oData.ErrorCode));
this.saveError(Translator.getNotification(oData.ErrorCode));
}
else
{
this.saveError(Utils.getNotification(Enums.Notification.CantSavePluginSettings));
this.saveError(Translator.getNotification(Enums.Notification.CantSavePluginSettings));
}
}
};
@ -146,7 +147,7 @@
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())
{
Utils.delegateRun(self, 'cancelCommand');

View file

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

View file

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

View file

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

View file

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

3
dev/bootstrap.js vendored
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
<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">
<span class="i18n" data-i18n-text="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span>
</div>

View file

@ -10,7 +10,7 @@
</div>
</div>
<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>
<img class="e-image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-bind="attr: { 'src': themePreviewSrc }" />
</div>

View file

@ -1,134 +1,134 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
body
{
/* Font */
font-family: sans-serif, Arial, Verdana, "Trebuchet MS";
font-size: 12px;
/* Text color */
color: #333;
/* Remove the background color to make it transparent */
background-color: #fff;
margin: 20px;
}
.cke_editable
{
font-size: 13px;
line-height: 1.6;
}
blockquote
{
font-style: italic;
font-family: Georgia, Times, "Times New Roman", serif;
padding: 2px 0;
border-style: solid;
border-color: #ccc;
border-width: 0;
}
.cke_contents_ltr blockquote
{
padding-left: 20px;
padding-right: 8px;
border-left-width: 5px;
}
.cke_contents_rtl blockquote
{
padding-left: 8px;
padding-right: 20px;
border-right-width: 5px;
}
a
{
color: #0782C1;
}
ol,ul,dl
{
/* IE7: reset rtl list margin. (#7334) */
*margin-right: 0px;
/* preserved spaces for list items with text direction other than the list. (#6249,#8049)*/
padding: 0 40px;
}
h1,h2,h3,h4,h5,h6
{
font-weight: normal;
line-height: 1.2;
}
hr
{
border: 0px;
border-top: 1px solid #ccc;
}
img.right
{
border: 1px solid #ccc;
float: right;
margin-left: 15px;
padding: 5px;
}
img.left
{
border: 1px solid #ccc;
float: left;
margin-right: 15px;
padding: 5px;
}
pre
{
white-space: pre-wrap; /* CSS 2.1 */
word-wrap: break-word; /* IE7 */
-moz-tab-size: 4;
-o-tab-size: 4;
-webkit-tab-size: 4;
tab-size: 4;
}
.marker
{
background-color: Yellow;
}
span[lang]
{
font-style: italic;
}
figure
{
text-align: center;
border: solid 1px #ccc;
border-radius: 2px;
background: rgba(0,0,0,0.05);
padding: 10px;
margin: 10px 20px;
display: inline-block;
}
figure > figcaption
{
text-align: center;
display: block; /* For IE8 */
}
a > img {
padding: 1px;
margin: 1px;
border: none;
outline: 1px solid #0782C1;
}
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
body
{
/* Font */
font-family: sans-serif, Arial, Verdana, "Trebuchet MS";
font-size: 12px;
/* Text color */
color: #333;
/* Remove the background color to make it transparent */
background-color: #fff;
margin: 20px;
}
.cke_editable
{
font-size: 13px;
line-height: 1.6;
}
blockquote
{
font-style: italic;
font-family: Georgia, Times, "Times New Roman", serif;
padding: 2px 0;
border-style: solid;
border-color: #ccc;
border-width: 0;
}
.cke_contents_ltr blockquote
{
padding-left: 20px;
padding-right: 8px;
border-left-width: 5px;
}
.cke_contents_rtl blockquote
{
padding-left: 8px;
padding-right: 20px;
border-right-width: 5px;
}
a
{
color: #0782C1;
}
ol,ul,dl
{
/* IE7: reset rtl list margin. (#7334) */
*margin-right: 0px;
/* preserved spaces for list items with text direction other than the list. (#6249,#8049)*/
padding: 0 40px;
}
h1,h2,h3,h4,h5,h6
{
font-weight: normal;
line-height: 1.2;
}
hr
{
border: 0px;
border-top: 1px solid #ccc;
}
img.right
{
border: 1px solid #ccc;
float: right;
margin-left: 15px;
padding: 5px;
}
img.left
{
border: 1px solid #ccc;
float: left;
margin-right: 15px;
padding: 5px;
}
pre
{
white-space: pre-wrap; /* CSS 2.1 */
word-wrap: break-word; /* IE7 */
-moz-tab-size: 4;
-o-tab-size: 4;
-webkit-tab-size: 4;
tab-size: 4;
}
.marker
{
background-color: Yellow;
}
span[lang]
{
font-style: italic;
}
figure
{
text-align: center;
border: solid 1px #ccc;
border-radius: 2px;
background: rgba(0,0,0,0.05);
padding: 10px;
margin: 10px 20px;
display: inline-block;
}
figure > figcaption
{
text-align: center;
display: block; /* For IE8 */
}
a > img {
padding: 1px;
margin: 1px;
border: none;
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"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>OnChange event plugin</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>On Change event Plugin for CKEditor</h1>
<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>
<h3 id="contact">Author:</h3>
<p><a href="mailto:amla70@gmail.com">Alfonso Mart&iacute;nez de Lizarrondo</a></p>
<h3>Sponsored by:</h3>
<p>Falcana</p>
<h3>Version history: </h3>
<ol>
<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.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.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.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.8: 8-June-2013 Use setInterval fix by Roman Minkin.</li>
</ol>
<h2>Installation</h2>
<h3>1. Copying the files</h3>
<p>Extract the contents of the zip in you plugins directory, so it ends up like
this<br>
<!--<img src="installation.png" alt="Screenshot of installation" width="311" height="346" longdesc="#install">-->
</p>
<pre id="--install">
ckeditor\
...
images\
lang\
plugins\
...
onchange\
plugin.js
docs\
install.html
...
skins\
themes\
</pre>
<h3>2. Adding it to CKEditor</h3>
<p>Now add the plugin in your <em>config.js</em> or custom js configuration
file:
<code>config.extraPlugins='onchange'; </code>
</p>
<h3>3. Configuration</h3>
<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>.</p>
<h3>4. Use it</h3>
<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>.</p>
<!--
<h2>Final notes</h2>
-->
<h2>Disclaimers</h2>
<p>CKEditor is &copy; CKSource.com</p>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>OnChange event plugin</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>On Change event Plugin for CKEditor</h1>
<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>
<h3 id="contact">Author:</h3>
<p><a href="mailto:amla70@gmail.com">Alfonso Mart&iacute;nez de Lizarrondo</a></p>
<h3>Sponsored by:</h3>
<p>Falcana</p>
<h3>Version history: </h3>
<ol>
<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.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.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.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.8: 8-June-2013 Use setInterval fix by Roman Minkin.</li>
</ol>
<h2>Installation</h2>
<h3>1. Copying the files</h3>
<p>Extract the contents of the zip in you plugins directory, so it ends up like
this<br>
<!--<img src="installation.png" alt="Screenshot of installation" width="311" height="346" longdesc="#install">-->
</p>
<pre id="--install">
ckeditor\
...
images\
lang\
plugins\
...
onchange\
plugin.js
docs\
install.html
...
skins\
themes\
</pre>
<h3>2. Adding it to CKEditor</h3>
<p>Now add the plugin in your <em>config.js</em> or custom js configuration
file:
<code>config.extraPlugins='onchange'; </code>
</p>
<h3>3. Configuration</h3>
<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>.</p>
<h3>4. Use it</h3>
<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>.</p>
<!--
<h2>Final notes</h2>
-->
<h2>Disclaimers</h2>
<p>CKEditor is &copy; CKSource.com</p>
</body>
</html>

View file

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

View file

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

View file

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

View file

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

View file

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

File diff suppressed because one or more lines are too long

View file

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

View file

@ -1,311 +1,311 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Massive inline editing &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<script>
// This code is generally not necessary, but it is here to demonstrate
// how to customize specific editor instances on the fly. This fits well
// this demo because we have editable elements (like headers) that
// require less features.
// The "instanceCreated" event is fired for every editor instance created.
CKEDITOR.on( 'instanceCreated', function( event ) {
var editor = event.editor,
element = editor.element;
// Customize editors for headers and tag list.
// These editors don't need features like smileys, templates, iframes etc.
if ( element.is( 'h1', 'h2', 'h3' ) || element.getAttribute( 'id' ) == 'taglist' ) {
// Customize the editor configurations on "configLoaded" event,
// which is fired after the configuration file loading and
// execution. This makes it possible to change the
// configurations before the editor initialization takes place.
editor.on( 'configLoaded', function() {
// Remove unnecessary plugins to make the editor simpler.
editor.config.removePlugins = 'colorbutton,find,flash,font,' +
'forms,iframe,image,newpage,removeformat,' +
'smiley,specialchar,stylescombo,templates';
// Rearrange the layout of the toolbar.
editor.config.toolbarGroups = [
{ name: 'editing', groups: [ 'basicstyles', 'links' ] },
{ name: 'undo' },
{ name: 'clipboard', groups: [ 'selection', 'clipboard' ] },
{ name: 'about' }
];
});
}
});
</script>
<link href="sample.css" rel="stylesheet">
<style>
/* The following styles are just to make the page look nice. */
/* Workaround to show Arial Black in Firefox. */
@font-face
{
font-family: 'arial-black';
src: local('Arial Black');
}
*[contenteditable="true"]
{
padding: 10px;
}
#container
{
width: 960px;
margin: 30px auto 0;
}
#header
{
overflow: hidden;
padding: 0 0 30px;
border-bottom: 5px solid #05B2D2;
position: relative;
}
#headerLeft,
#headerRight
{
width: 49%;
overflow: hidden;
}
#headerLeft
{
float: left;
padding: 10px 1px 1px;
}
#headerLeft h2,
#headerLeft h3
{
text-align: right;
margin: 0;
overflow: hidden;
font-weight: normal;
}
#headerLeft h2
{
font-family: "Arial Black",arial-black;
font-size: 4.6em;
line-height: 1.1;
text-transform: uppercase;
}
#headerLeft h3
{
font-size: 2.3em;
line-height: 1.1;
margin: .2em 0 0;
color: #666;
}
#headerRight
{
float: right;
padding: 1px;
}
#headerRight p
{
line-height: 1.8;
text-align: justify;
margin: 0;
}
#headerRight p + p
{
margin-top: 20px;
}
#headerRight > div
{
padding: 20px;
margin: 0 0 0 30px;
font-size: 1.4em;
color: #666;
}
#columns
{
color: #333;
overflow: hidden;
padding: 20px 0;
}
#columns > div
{
float: left;
width: 33.3%;
}
#columns #column1 > div
{
margin-left: 1px;
}
#columns #column3 > div
{
margin-right: 1px;
}
#columns > div > div
{
margin: 0px 10px;
padding: 10px 20px;
}
#columns blockquote
{
margin-left: 15px;
}
#tagLine
{
border-top: 5px solid #05B2D2;
padding-top: 20px;
}
#taglist {
display: inline-block;
margin-left: 20px;
font-weight: bold;
margin: 0 0 0 20px;
}
</style>
</head>
<body>
<div>
<h1 class="samples"><a href="index.html">CKEditor Samples</a> &raquo; Massive inline editing</h1>
<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>
<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>
</div>
</div>
<div id="container">
<div id="header">
<div id="headerLeft">
<h2 id="sampleTitle" contenteditable="true">
CKEditor<br> Goes Inline!
</h2>
<h3 contenteditable="true">
Lorem ipsum dolor sit amet dolor duis blandit vestibulum faucibus a, tortor.
</h3>
</div>
<div id="headerRight">
<div contenteditable="true">
<p>
Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies.
</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.
</p>
</div>
</div>
</div>
<div id="columns">
<div id="column1">
<div contenteditable="true">
<h3>
Fusce vitae porttitor
</h3>
<p>
<strong>
Lorem ipsum dolor sit amet dolor. Duis blandit vestibulum faucibus a, tortor.
</strong>
</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.
</p>
<blockquote>
<p>
Fusce vitae porttitor a, euismod convallis nisl, blandit risus tortor, pretium.
Vehicula vitae, imperdiet vel, ornare enim vel sodales rutrum
</p>
</blockquote>
<blockquote>
<p>
Libero nunc, rhoncus ante ipsum non ipsum. Nunc eleifend pede turpis id sollicitudin fringilla. Phasellus ultrices, velit ac arcu.
</p>
</blockquote>
<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>
</div>
</div>
<div id="column2">
<div contenteditable="true">
<h3>
Integer condimentum sit amet
</h3>
<p>
<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>
<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>
</div>
<div contenteditable="true">
<h3>
Praesent wisi accumsan sit amet nibh
</h3>
<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>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 id="column3">
<div contenteditable="true">
<p>
<img src="assets/inlineall/logo.png" alt="CKEditor logo" style="float:left">
</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>
Nullam laoreet vel consectetuer tellus suscipit
</h3>
<ul>
<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>Mauris eget tellus. Donec non felis. Nam eget dolor. Vestibulum enim. Donec.</li>
</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>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>
</div>
</div>
</div>
<div id="tagLine">
Tags of this article:
<p id="taglist" contenteditable="true">
inline, editing, floating, CKEditor
</p>
</div>
</div>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">
http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a>
- Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Massive inline editing &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<script>
// This code is generally not necessary, but it is here to demonstrate
// how to customize specific editor instances on the fly. This fits well
// this demo because we have editable elements (like headers) that
// require less features.
// The "instanceCreated" event is fired for every editor instance created.
CKEDITOR.on( 'instanceCreated', function( event ) {
var editor = event.editor,
element = editor.element;
// Customize editors for headers and tag list.
// These editors don't need features like smileys, templates, iframes etc.
if ( element.is( 'h1', 'h2', 'h3' ) || element.getAttribute( 'id' ) == 'taglist' ) {
// Customize the editor configurations on "configLoaded" event,
// which is fired after the configuration file loading and
// execution. This makes it possible to change the
// configurations before the editor initialization takes place.
editor.on( 'configLoaded', function() {
// Remove unnecessary plugins to make the editor simpler.
editor.config.removePlugins = 'colorbutton,find,flash,font,' +
'forms,iframe,image,newpage,removeformat,' +
'smiley,specialchar,stylescombo,templates';
// Rearrange the layout of the toolbar.
editor.config.toolbarGroups = [
{ name: 'editing', groups: [ 'basicstyles', 'links' ] },
{ name: 'undo' },
{ name: 'clipboard', groups: [ 'selection', 'clipboard' ] },
{ name: 'about' }
];
});
}
});
</script>
<link href="sample.css" rel="stylesheet">
<style>
/* The following styles are just to make the page look nice. */
/* Workaround to show Arial Black in Firefox. */
@font-face
{
font-family: 'arial-black';
src: local('Arial Black');
}
*[contenteditable="true"]
{
padding: 10px;
}
#container
{
width: 960px;
margin: 30px auto 0;
}
#header
{
overflow: hidden;
padding: 0 0 30px;
border-bottom: 5px solid #05B2D2;
position: relative;
}
#headerLeft,
#headerRight
{
width: 49%;
overflow: hidden;
}
#headerLeft
{
float: left;
padding: 10px 1px 1px;
}
#headerLeft h2,
#headerLeft h3
{
text-align: right;
margin: 0;
overflow: hidden;
font-weight: normal;
}
#headerLeft h2
{
font-family: "Arial Black",arial-black;
font-size: 4.6em;
line-height: 1.1;
text-transform: uppercase;
}
#headerLeft h3
{
font-size: 2.3em;
line-height: 1.1;
margin: .2em 0 0;
color: #666;
}
#headerRight
{
float: right;
padding: 1px;
}
#headerRight p
{
line-height: 1.8;
text-align: justify;
margin: 0;
}
#headerRight p + p
{
margin-top: 20px;
}
#headerRight > div
{
padding: 20px;
margin: 0 0 0 30px;
font-size: 1.4em;
color: #666;
}
#columns
{
color: #333;
overflow: hidden;
padding: 20px 0;
}
#columns > div
{
float: left;
width: 33.3%;
}
#columns #column1 > div
{
margin-left: 1px;
}
#columns #column3 > div
{
margin-right: 1px;
}
#columns > div > div
{
margin: 0px 10px;
padding: 10px 20px;
}
#columns blockquote
{
margin-left: 15px;
}
#tagLine
{
border-top: 5px solid #05B2D2;
padding-top: 20px;
}
#taglist {
display: inline-block;
margin-left: 20px;
font-weight: bold;
margin: 0 0 0 20px;
}
</style>
</head>
<body>
<div>
<h1 class="samples"><a href="index.html">CKEditor Samples</a> &raquo; Massive inline editing</h1>
<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>
<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>
</div>
</div>
<div id="container">
<div id="header">
<div id="headerLeft">
<h2 id="sampleTitle" contenteditable="true">
CKEditor<br> Goes Inline!
</h2>
<h3 contenteditable="true">
Lorem ipsum dolor sit amet dolor duis blandit vestibulum faucibus a, tortor.
</h3>
</div>
<div id="headerRight">
<div contenteditable="true">
<p>
Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies.
</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.
</p>
</div>
</div>
</div>
<div id="columns">
<div id="column1">
<div contenteditable="true">
<h3>
Fusce vitae porttitor
</h3>
<p>
<strong>
Lorem ipsum dolor sit amet dolor. Duis blandit vestibulum faucibus a, tortor.
</strong>
</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.
</p>
<blockquote>
<p>
Fusce vitae porttitor a, euismod convallis nisl, blandit risus tortor, pretium.
Vehicula vitae, imperdiet vel, ornare enim vel sodales rutrum
</p>
</blockquote>
<blockquote>
<p>
Libero nunc, rhoncus ante ipsum non ipsum. Nunc eleifend pede turpis id sollicitudin fringilla. Phasellus ultrices, velit ac arcu.
</p>
</blockquote>
<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>
</div>
</div>
<div id="column2">
<div contenteditable="true">
<h3>
Integer condimentum sit amet
</h3>
<p>
<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>
<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>
</div>
<div contenteditable="true">
<h3>
Praesent wisi accumsan sit amet nibh
</h3>
<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>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 id="column3">
<div contenteditable="true">
<p>
<img src="assets/inlineall/logo.png" alt="CKEditor logo" style="float:left">
</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>
Nullam laoreet vel consectetuer tellus suscipit
</h3>
<ul>
<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>Mauris eget tellus. Donec non felis. Nam eget dolor. Vestibulum enim. Donec.</li>
</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>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>
</div>
</div>
</div>
<div id="tagLine">
Tags of this article:
<p id="taglist" contenteditable="true">
inline, editing, floating, CKEditor
</p>
</div>
</div>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">
http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a>
- Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

@ -1,121 +1,121 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Inline Editing by Code &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<link href="sample.css" rel="stylesheet">
<style>
#editable
{
padding: 10px;
float: left;
}
</style>
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Inline Editing by Code
</h1>
<div class="description">
<p>
This sample shows how to create an inline editor instance of CKEditor. It is created
with a JavaScript call using the following code:
</p>
<pre class="samples">
// This property tells CKEditor to not activate every element with contenteditable=true element.
CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline( document.getElementById( 'editable' ) );
</pre>
<p>
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.
</p>
</div>
<div id="editable" contenteditable="true">
<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>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>
<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>
<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;">
<caption><strong>Mission crew</strong></caption>
<thead>
<tr>
<th scope="col">Position</th>
<th scope="col">Astronaut</th>
</tr>
</thead>
<tbody>
<tr>
<td>Commander</td>
<td>Neil A. Armstrong</td>
</tr>
<tr>
<td>Command Module Pilot</td>
<td>Michael Collins</td>
</tr>
<tr>
<td>Lunar Module Pilot</td>
<td>Edwin &quot;Buzz&quot; E. Aldrin, Jr.</td>
</tr>
</tbody>
</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>
<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>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>
</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>
<hr />
<p style="text-align: right;"><small>Source: <a href="http://en.wikipedia.org/wiki/Apollo_11">Wikipedia.org</a></small></p>
</div>
<script>
// We need to turn off the automatic editor creation first.
CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline( 'editable' );
</script>
<div id="footer">
<hr>
<p contenteditable="true">
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">
http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a>
- Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Inline Editing by Code &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<link href="sample.css" rel="stylesheet">
<style>
#editable
{
padding: 10px;
float: left;
}
</style>
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Inline Editing by Code
</h1>
<div class="description">
<p>
This sample shows how to create an inline editor instance of CKEditor. It is created
with a JavaScript call using the following code:
</p>
<pre class="samples">
// This property tells CKEditor to not activate every element with contenteditable=true element.
CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline( document.getElementById( 'editable' ) );
</pre>
<p>
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.
</p>
</div>
<div id="editable" contenteditable="true">
<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>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>
<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>
<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;">
<caption><strong>Mission crew</strong></caption>
<thead>
<tr>
<th scope="col">Position</th>
<th scope="col">Astronaut</th>
</tr>
</thead>
<tbody>
<tr>
<td>Commander</td>
<td>Neil A. Armstrong</td>
</tr>
<tr>
<td>Command Module Pilot</td>
<td>Michael Collins</td>
</tr>
<tr>
<td>Lunar Module Pilot</td>
<td>Edwin &quot;Buzz&quot; E. Aldrin, Jr.</td>
</tr>
</tbody>
</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>
<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>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>
</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>
<hr />
<p style="text-align: right;"><small>Source: <a href="http://en.wikipedia.org/wiki/Apollo_11">Wikipedia.org</a></small></p>
</div>
<script>
// We need to turn off the automatic editor creation first.
CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline( 'editable' );
</script>
<div id="footer">
<hr>
<p contenteditable="true">
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">
http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a>
- Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

@ -1,100 +1,100 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>jQuery Adapter &mdash; CKEditor Sample</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="../ckeditor.js"></script>
<script src="../adapters/jquery.js"></script>
<link href="sample.css" rel="stylesheet">
<style>
#editable
{
padding: 10px;
float: left;
}
</style>
<script>
CKEDITOR.disableAutoInline = true;
$( document ).ready( function() {
$( '#editor1' ).ckeditor(); // Use CKEDITOR.replace() if element is <textarea>.
$( '#editable' ).ckeditor(); // Use CKEDITOR.inline().
} );
function setValue() {
$( '#editor1' ).val( $( 'input#val' ).val() );
}
</script>
</head>
<body>
<h1 class="samples">
<a href="index.html" id="a-test">CKEditor Samples</a> &raquo; Create Editors with jQuery
</h1>
<form action="sample_posteddata.php" method="post">
<div class="description">
<p>
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.
</p>
<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="/ckeditor/ckeditor.js"&gt;&lt;/script&gt;
&lt;script src="/ckeditor/adapters/jquery.js"&gt;&lt;/script&gt;
</pre>
<p>Then you can replace HTML elements with a CKEditor instance using the <code>ckeditor()</code> method.</p>
<pre class="samples">
$( document ).ready( function() {
$( 'textarea#editor1' ).ckeditor();
} );
</pre>
</div>
<h2 class="samples">Inline Example</h2>
<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>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>
<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>
<br style="clear: both">
<h2 class="samples">Classic (iframe-based) Example</h2>
<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;
</textarea>
<p style="overflow: hidden">
<input style="float: left" type="submit" value="Submit">
<span style="float: right">
<input type="text" id="val" value="I'm using jQuery val()!" size="30">
<input onclick="setValue();" type="button" value="Set value">
</span>
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>jQuery Adapter &mdash; CKEditor Sample</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="../ckeditor.js"></script>
<script src="../adapters/jquery.js"></script>
<link href="sample.css" rel="stylesheet">
<style>
#editable
{
padding: 10px;
float: left;
}
</style>
<script>
CKEDITOR.disableAutoInline = true;
$( document ).ready( function() {
$( '#editor1' ).ckeditor(); // Use CKEDITOR.replace() if element is <textarea>.
$( '#editable' ).ckeditor(); // Use CKEDITOR.inline().
} );
function setValue() {
$( '#editor1' ).val( $( 'input#val' ).val() );
}
</script>
</head>
<body>
<h1 class="samples">
<a href="index.html" id="a-test">CKEditor Samples</a> &raquo; Create Editors with jQuery
</h1>
<form action="sample_posteddata.php" method="post">
<div class="description">
<p>
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.
</p>
<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="/ckeditor/ckeditor.js"&gt;&lt;/script&gt;
&lt;script src="/ckeditor/adapters/jquery.js"&gt;&lt;/script&gt;
</pre>
<p>Then you can replace HTML elements with a CKEditor instance using the <code>ckeditor()</code> method.</p>
<pre class="samples">
$( document ).ready( function() {
$( 'textarea#editor1' ).ckeditor();
} );
</pre>
</div>
<h2 class="samples">Inline Example</h2>
<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>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>
<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>
<br style="clear: both">
<h2 class="samples">Classic (iframe-based) Example</h2>
<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;
</textarea>
<p style="overflow: hidden">
<input style="float: left" type="submit" value="Submit">
<span style="float: right">
<input type="text" id="val" value="I'm using jQuery val()!" size="30">
<input onclick="setValue();" type="button" value="Set value">
</span>
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

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

File diff suppressed because one or more lines are too long

View file

@ -1,103 +1,103 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>ENTER Key Configuration &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<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-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.">
<script>
var editor;
function changeEnter() {
// If we already have an editor, let's destroy it first.
if ( editor )
editor.destroy( true );
// Create the editor again, with the appropriate settings.
editor = CKEDITOR.replace( 'editor1', {
extraPlugins: 'enterkey',
enterMode: Number( document.getElementById( 'xEnter' ).value ),
shiftEnterMode: Number( document.getElementById( 'xShiftEnter' ).value )
});
}
window.onload = changeEnter;
</script>
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; ENTER Key Configuration
</h1>
<div class="description">
<p>
This sample shows how to configure the <em>Enter</em> and <em>Shift+Enter</em> keys
to perform actions specified in the
<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>
parameters, respectively.
You can choose from the following options:
</p>
<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_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>
</ul>
<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.
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>enterMode: CKEDITOR.ENTER_DIV</strong>
});</pre>
<p>
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.
</p>
</div>
<div style="float: left; margin-right: 20px">
When <em>Enter</em> is pressed:<br>
<select id="xEnter" onchange="changeEnter();">
<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="2">Break the line with a &lt;BR&gt;</option>
</select>
</div>
<div style="float: left">
When <em>Shift+Enter</em> is pressed:<br>
<select id="xShiftEnter" onchange="changeEnter();">
<option value="1">Create a new &lt;P&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>
</select>
</div>
<br style="clear: both">
<form action="../../../samples/sample_posteddata.php" method="post">
<p>
<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>
</p>
<p>
<input type="submit" value="Submit">
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>ENTER Key Configuration &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<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-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.">
<script>
var editor;
function changeEnter() {
// If we already have an editor, let's destroy it first.
if ( editor )
editor.destroy( true );
// Create the editor again, with the appropriate settings.
editor = CKEDITOR.replace( 'editor1', {
extraPlugins: 'enterkey',
enterMode: Number( document.getElementById( 'xEnter' ).value ),
shiftEnterMode: Number( document.getElementById( 'xShiftEnter' ).value )
});
}
window.onload = changeEnter;
</script>
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; ENTER Key Configuration
</h1>
<div class="description">
<p>
This sample shows how to configure the <em>Enter</em> and <em>Shift+Enter</em> keys
to perform actions specified in the
<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>
parameters, respectively.
You can choose from the following options:
</p>
<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_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>
</ul>
<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.
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>enterMode: CKEDITOR.ENTER_DIV</strong>
});</pre>
<p>
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.
</p>
</div>
<div style="float: left; margin-right: 20px">
When <em>Enter</em> is pressed:<br>
<select id="xEnter" onchange="changeEnter();">
<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="2">Break the line with a &lt;BR&gt;</option>
</select>
</div>
<div style="float: left">
When <em>Shift+Enter</em> is pressed:<br>
<select id="xShiftEnter" onchange="changeEnter();">
<option value="1">Create a new &lt;P&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>
</select>
</div>
<br style="clear: both">
<form action="../../../samples/sample_posteddata.php" method="post">
<p>
<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>
</p>
<p>
<input type="submit" value="Submit">
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

@ -1,280 +1,280 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Output for Flash &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<script src="../../../samples/sample.js"></script>
<script src="assets/outputforflash/swfobject.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-required-plugins" content="sourcearea">
<meta name="ckeditor-sample-name" content="Output for Flash">
<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.">
<style>
.alert
{
background: #ffa84c;
padding: 10px 15px;
font-weight: bold;
display: block;
margin-bottom: 20px;
}
</style>
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Producing Flash Compliant HTML Output
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor to output
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">
Adobe Flash</a>.
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.
</p>
<p>
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.
</p>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<p>
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
<strong>Send to Flash</strong> button.
</p>
<table style="width: 100%; border-spacing: 0; border-collapse:collapse;">
<tr>
<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>
<script>
if ( document.location.protocol == 'file:' )
alert( 'Warning: This samples does not work when loaded from local filesystem' +
'due to security restrictions implemented in Flash.' +
'\n\nPlease load the sample from a web server instead.' );
var editor = CKEDITOR.replace( 'editor1', {
/*
* Ensure that htmlwriter plugin, which is required for this sample, is loaded.
*/
extraPlugins: 'htmlwriter',
height: 290,
width: '100%',
toolbar: [
[ 'Source', '-', 'Bold', 'Italic', 'Underline', '-', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ],
'/',
[ 'Font', 'FontSize' ],
[ 'TextColor', '-', 'About' ]
],
/*
* 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;}',
/*
* Quirks doctype
*/
docType: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
/*
* Core styles.
*/
coreStyles_bold: { element: 'b' },
coreStyles_italic: { element: 'i' },
coreStyles_underline: { element: 'u' },
/*
* Font face.
*/
// Define the way font elements will be applied to the document. The "font"
// element will be used.
font_style: {
element: 'font',
attributes: { 'face': '#(family)' }
},
/*
* Font sizes.
*/
// The CSS part of the font sizes isn't used by Flash, it is there to get the
// 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_style: {
element: 'font',
attributes: { 'size': '#(size)' },
styles: { 'font-size': '#(size)px' }
} ,
/*
* Font colors.
*/
colorButton_enableMore: true,
colorButton_foreStyle: {
element: 'font',
attributes: { 'color': '#(color)' }
},
colorButton_backStyle: {
element: 'font',
styles: { 'background-color': '#(color)' }
},
on: { 'instanceReady': configureFlashOutput }
});
/*
* Adjust the behavior of the dataProcessor to match the
* requirements of Flash
*/
function configureFlashOutput( ev ) {
var editor = ev.editor,
dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
// Out self closing tags the HTML4 way, like <br>.
dataProcessor.writer.selfClosingEnd = '>';
// Make output formatting match Flash expectations
var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) {
dataProcessor.writer.setRules( e, {
indent: false,
breakBeforeOpen: false,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: false
});
}
dataProcessor.writer.setRules( 'br', {
indent: false,
breakBeforeOpen: false,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: false
});
// Output properties as attributes, not styles.
htmlFilter.addRules( {
elements: {
$: function( element ) {
var style, match, width, height, align;
// Output dimensions of images as width and height
if ( element.name == 'img' ) {
style = element.attributes.style;
if ( style ) {
// Get the width from the style.
match = ( /(?:^|\s)width\s*:\s*(\d+)px/i ).exec( style );
width = match && match[1];
// Get the height from the style.
match = ( /(?:^|\s)height\s*:\s*(\d+)px/i ).exec( style );
height = match && match[1];
if ( width ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' );
element.attributes.width = width;
}
if ( height ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' );
element.attributes.height = height;
}
}
}
// Output alignment of paragraphs using align
if ( element.name == 'p' ) {
style = element.attributes.style;
if ( style ) {
// Get the align from the style.
match = ( /(?:^|\s)text-align\s*:\s*(\w*);?/i ).exec( style );
align = match && match[1];
if ( align ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' );
element.attributes.align = align;
}
}
}
if ( element.attributes.style === '' )
delete element.attributes.style;
return element;
}
}
});
}
function sendToFlash() {
var html = CKEDITOR.instances.editor1.getData() ;
// Quick fix for link color.
html = html.replace( /<a /g, '<font color="#0000FF"><u><a ' )
html = html.replace( /<\/a>/g, '</a></u></font>' )
var flash = document.getElementById( 'ckFlashContainer' ) ;
flash.setData( html ) ;
}
CKEDITOR.domReady( function() {
if ( !swfobject.hasFlashPlayerVersion( '8' ) ) {
CKEDITOR.dom.element.createFromHtml( '<span class="alert">' +
'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>.' +
'</span>' ).insertBefore( editor.element );
}
swfobject.embedSWF(
'assets/outputforflash/outputforflash.swf',
'ckFlashContainer',
'550',
'400',
'8',
{ wmode: 'transparent' }
);
});
</script>
<p>
<input type="button" value="Send to Flash" onclick="sendToFlash();">
</p>
</td>
<td style="vertical-align: top; padding-left: 20px">
<div id="ckFlashContainer"></div>
</td>
</tr>
</table>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Output for Flash &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<script src="../../../samples/sample.js"></script>
<script src="assets/outputforflash/swfobject.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-required-plugins" content="sourcearea">
<meta name="ckeditor-sample-name" content="Output for Flash">
<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.">
<style>
.alert
{
background: #ffa84c;
padding: 10px 15px;
font-weight: bold;
display: block;
margin-bottom: 20px;
}
</style>
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Producing Flash Compliant HTML Output
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor to output
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">
Adobe Flash</a>.
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.
</p>
<p>
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.
</p>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<p>
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
<strong>Send to Flash</strong> button.
</p>
<table style="width: 100%; border-spacing: 0; border-collapse:collapse;">
<tr>
<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>
<script>
if ( document.location.protocol == 'file:' )
alert( 'Warning: This samples does not work when loaded from local filesystem' +
'due to security restrictions implemented in Flash.' +
'\n\nPlease load the sample from a web server instead.' );
var editor = CKEDITOR.replace( 'editor1', {
/*
* Ensure that htmlwriter plugin, which is required for this sample, is loaded.
*/
extraPlugins: 'htmlwriter',
height: 290,
width: '100%',
toolbar: [
[ 'Source', '-', 'Bold', 'Italic', 'Underline', '-', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ],
'/',
[ 'Font', 'FontSize' ],
[ 'TextColor', '-', 'About' ]
],
/*
* 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;}',
/*
* Quirks doctype
*/
docType: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
/*
* Core styles.
*/
coreStyles_bold: { element: 'b' },
coreStyles_italic: { element: 'i' },
coreStyles_underline: { element: 'u' },
/*
* Font face.
*/
// Define the way font elements will be applied to the document. The "font"
// element will be used.
font_style: {
element: 'font',
attributes: { 'face': '#(family)' }
},
/*
* Font sizes.
*/
// The CSS part of the font sizes isn't used by Flash, it is there to get the
// 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_style: {
element: 'font',
attributes: { 'size': '#(size)' },
styles: { 'font-size': '#(size)px' }
} ,
/*
* Font colors.
*/
colorButton_enableMore: true,
colorButton_foreStyle: {
element: 'font',
attributes: { 'color': '#(color)' }
},
colorButton_backStyle: {
element: 'font',
styles: { 'background-color': '#(color)' }
},
on: { 'instanceReady': configureFlashOutput }
});
/*
* Adjust the behavior of the dataProcessor to match the
* requirements of Flash
*/
function configureFlashOutput( ev ) {
var editor = ev.editor,
dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
// Out self closing tags the HTML4 way, like <br>.
dataProcessor.writer.selfClosingEnd = '>';
// Make output formatting match Flash expectations
var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) ) {
dataProcessor.writer.setRules( e, {
indent: false,
breakBeforeOpen: false,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: false
});
}
dataProcessor.writer.setRules( 'br', {
indent: false,
breakBeforeOpen: false,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: false
});
// Output properties as attributes, not styles.
htmlFilter.addRules( {
elements: {
$: function( element ) {
var style, match, width, height, align;
// Output dimensions of images as width and height
if ( element.name == 'img' ) {
style = element.attributes.style;
if ( style ) {
// Get the width from the style.
match = ( /(?:^|\s)width\s*:\s*(\d+)px/i ).exec( style );
width = match && match[1];
// Get the height from the style.
match = ( /(?:^|\s)height\s*:\s*(\d+)px/i ).exec( style );
height = match && match[1];
if ( width ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' );
element.attributes.width = width;
}
if ( height ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' );
element.attributes.height = height;
}
}
}
// Output alignment of paragraphs using align
if ( element.name == 'p' ) {
style = element.attributes.style;
if ( style ) {
// Get the align from the style.
match = ( /(?:^|\s)text-align\s*:\s*(\w*);?/i ).exec( style );
align = match && match[1];
if ( align ) {
element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' );
element.attributes.align = align;
}
}
}
if ( element.attributes.style === '' )
delete element.attributes.style;
return element;
}
}
});
}
function sendToFlash() {
var html = CKEDITOR.instances.editor1.getData() ;
// Quick fix for link color.
html = html.replace( /<a /g, '<font color="#0000FF"><u><a ' )
html = html.replace( /<\/a>/g, '</a></u></font>' )
var flash = document.getElementById( 'ckFlashContainer' ) ;
flash.setData( html ) ;
}
CKEDITOR.domReady( function() {
if ( !swfobject.hasFlashPlayerVersion( '8' ) ) {
CKEDITOR.dom.element.createFromHtml( '<span class="alert">' +
'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>.' +
'</span>' ).insertBefore( editor.element );
}
swfobject.embedSWF(
'assets/outputforflash/outputforflash.swf',
'ckFlashContainer',
'550',
'400',
'8',
{ wmode: 'transparent' }
);
});
</script>
<p>
<input type="button" value="Send to Flash" onclick="sendToFlash();">
</p>
</td>
<td style="vertical-align: top; padding-left: 20px">
<div id="ckFlashContainer"></div>
</td>
</tr>
</table>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

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

View file

@ -1,65 +1,65 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>New Image plugin &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<script>
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
CKEDITOR.tools.enableHtml5Elements( document );
</script>
<link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-name" content="New Image plugin">
<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-isnew" content="1">
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; New Image plugin
</h1>
<div class="description">
<p>
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.
</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>:
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>extraPlugins: 'image2'</strong>
} );
</pre>
</div>
<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;
</textarea>
<script>
CKEDITOR.replace( 'editor1', {
extraPlugins: 'image2',
height: 450
} );
</script>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>New Image plugin &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<script>
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
CKEDITOR.tools.enableHtml5Elements( document );
</script>
<link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-name" content="New Image plugin">
<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-isnew" content="1">
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; New Image plugin
</h1>
<div class="description">
<p>
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.
</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>:
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>extraPlugins: 'image2'</strong>
} );
</pre>
</div>
<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;
</textarea>
<script>
CKEDITOR.replace( 'editor1', {
extraPlugins: 'image2',
height: 450
} );
</script>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

@ -1,119 +1,119 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Shared-Space Plugin &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<link rel="stylesheet" href="../../../samples/sample.css">
<meta name="ckeditor-sample-name" content="Shared-Space plugin">
<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.">
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Sharing Toolbar and Bottom-bar Spaces
</h1>
<div class="description">
<p>
This sample shows several editor instances that share the very same spaces for both the toolbar and the bottom bar.
</p>
</div>
<div id="top">
<!-- This div will handle all toolbars -->
</div>
<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="framed2" style="width: 49%; float: right; margin-bottom: 20px;"></div>
<hr style="clear: both; margin: 20px 0;">
<div contenteditable="true" id="inline1" style="width: 49%; float: left;">
<h3>
Integer condimentum sit amet
</h3>
<p>
<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>
<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>
</div>
<div contenteditable="true" id="inline2" style="width: 49%; float: right;">
<h3>
Praesent wisi accumsan sit amet nibh
</h3>
<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>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 id="bottom">
<!-- This div will handle all toolbars -->
</div>
<script>
// Turn off automatic editor creation first.
CKEDITOR.disableAutoInline = true;
CKEDITOR.inline( 'inline1', {
extraPlugins: 'sharedspace',
removePlugins: 'floatingspace,resize',
sharedSpaces: {
top: 'top',
bottom: 'bottom'
}
});
CKEDITOR.inline( 'inline2', {
extraPlugins: 'sharedspace',
removePlugins: 'floatingspace,resize',
sharedSpaces: {
top: 'top',
bottom: 'bottom'
}
});
CKEDITOR.appendTo( 'framed1', {
extraPlugins: 'sharedspace',
removePlugins: 'maximize,resize',
sharedSpaces: {
top: 'top',
bottom: 'bottom'
}
},
document.getElementById( 'inline1' ).innerHTML
);
CKEDITOR.appendTo( 'framed2', {
extraPlugins: 'sharedspace',
removePlugins: 'maximize,resize',
sharedSpaces: {
top: 'top',
bottom: 'bottom'
}
},
document.getElementById( 'inline2' ).innerHTML
);
</script>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Shared-Space Plugin &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<link rel="stylesheet" href="../../../samples/sample.css">
<meta name="ckeditor-sample-name" content="Shared-Space plugin">
<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.">
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Sharing Toolbar and Bottom-bar Spaces
</h1>
<div class="description">
<p>
This sample shows several editor instances that share the very same spaces for both the toolbar and the bottom bar.
</p>
</div>
<div id="top">
<!-- This div will handle all toolbars -->
</div>
<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="framed2" style="width: 49%; float: right; margin-bottom: 20px;"></div>
<hr style="clear: both; margin: 20px 0;">
<div contenteditable="true" id="inline1" style="width: 49%; float: left;">
<h3>
Integer condimentum sit amet
</h3>
<p>
<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>
<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>
</div>
<div contenteditable="true" id="inline2" style="width: 49%; float: right;">
<h3>
Praesent wisi accumsan sit amet nibh
</h3>
<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>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 id="bottom">
<!-- This div will handle all toolbars -->
</div>
<script>
// Turn off automatic editor creation first.
CKEDITOR.disableAutoInline = true;
CKEDITOR.inline( 'inline1', {
extraPlugins: 'sharedspace',
removePlugins: 'floatingspace,resize',
sharedSpaces: {
top: 'top',
bottom: 'bottom'
}
});
CKEDITOR.inline( 'inline2', {
extraPlugins: 'sharedspace',
removePlugins: 'floatingspace,resize',
sharedSpaces: {
top: 'top',
bottom: 'bottom'
}
});
CKEDITOR.appendTo( 'framed1', {
extraPlugins: 'sharedspace',
removePlugins: 'maximize,resize',
sharedSpaces: {
top: 'top',
bottom: 'bottom'
}
},
document.getElementById( 'inline1' ).innerHTML
);
CKEDITOR.appendTo( 'framed2', {
extraPlugins: 'sharedspace',
removePlugins: 'maximize,resize',
sharedSpaces: {
top: 'top',
bottom: 'bottom'
}
},
document.getElementById( 'inline2' ).innerHTML
);
</script>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

@ -1,232 +1,232 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Toolbar Configuration &mdash; CKEditor Sample</title>
<meta name="ckeditor-sample-name" content="Toolbar Configurations">
<meta name="ckeditor-sample-group" content="Advanced Samples">
<meta name="ckeditor-sample-description" content="Configuring CKEditor to display full or custom toolbar layout.">
<script src="../../../ckeditor.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet">
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Toolbar Configuration
</h1>
<div class="description">
<p>
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>.
</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>
<p>
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
own button you'll have to add it manually to your <code>config.toolbar</code> setting as well.
</p>
<p>To add a CKEditor instance with custom toolbar setting, insert the following JavaScript call to your code:</p>
<pre class="samples">
CKEDITOR.replace( <em>'textarea_id'</em>, {
<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.
[ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ], // Defines toolbar group without name.
'/', // Line break - next group will be placed in new line.
{ name: 'basicstyles', items: [ 'Bold', 'Italic' ] }
]
});</pre>
<h2 class="samples">By <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups">config.toolbarGroups</a></h2>
<p>
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
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
when adding/removing plugins which register their own buttons.
</p>
<p>To add a CKEditor instance with custom toolbar groups setting, insert the following JavaScript call to your code:</p>
<pre class="samples">
CKEDITOR.replace( <em>'textarea_id'</em>, {
<strong>toolbarGroups:</strong> [
{ 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.
'/', // Line break - next group will be placed in new line.
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'links' }
]
// NOTE: Remember to leave 'toolbar' property with the default value (null).
});</pre>
</div>
<div id="currentToolbar" style="display: none">
<h2 class="samples">Current toolbar configuration</h2>
<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>
<pre id="editorCurrentCfg" class="samples"></pre>
</div>
<div id="fullToolbar">
<h2 class="samples">Full toolbar configuration</h2>
<p>Below you can see editor with full toolbar, generated automatically by the editor.</p>
<p>
<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.
</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>
<pre id="editorFullCfg" class="samples"></pre>
</div>
<script>
(function() {
'use strict';
var buttonsNames;
CKEDITOR.config.extraPlugins = 'toolbar';
CKEDITOR.on( 'instanceReady', function( evt ) {
var editor = evt.editor,
editorCurrent = editor.name == 'editorCurrent',
defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups || editor.config.removeButtons ),
pre = CKEDITOR.document.getById( editor.name + 'Cfg' ),
output = '';
if ( editorCurrent ) {
// If default toolbar configuration has been modified, show "current toolbar" section.
if ( !defaultToolbar )
CKEDITOR.document.getById( 'currentToolbar' ).show();
else
return;
}
if ( !buttonsNames )
buttonsNames = createButtonsNamesHash( editor.ui.items );
// Toolbar isn't set explicitly, so it was created automatically from toolbarGroups.
if ( !editor.config.toolbar ) {
output +=
'// Toolbar configuration generated automatically by the editor based on config.toolbarGroups.\n' +
dumpToolbarConfiguration( editor ) +
'\n\n' +
'// Toolbar groups configuration.\n' +
dumpToolbarConfiguration( editor, true )
}
// Toolbar groups doesn't count in this case - print only toolbar.
else {
output += '// Toolbar configuration.\n' +
dumpToolbarConfiguration( editor );
}
// Recreate to avoid old IE from loosing whitespaces on filling <pre> content.
var preOutput = pre.getOuterHtml().replace( /(?=<\/)/, output );
CKEDITOR.dom.element.createFromHtml( preOutput ).replace( pre );
} );
CKEDITOR.replace( 'editorCurrent', { height: 100 } );
CKEDITOR.replace( 'editorFull', {
// Reset toolbar settings, so full toolbar will be generated automatically.
toolbar: null,
toolbarGroups: null,
removeButtons: null,
height: 100
} );
function dumpToolbarConfiguration( editor, printGroups ) {
var output = [],
toolbar = editor.toolbar;
for ( var i = 0; i < toolbar.length; ++i ) {
var group = dumpToolbarGroup( toolbar[ i ], printGroups );
if ( group )
output.push( group );
}
return 'config.toolbar' + ( printGroups ? 'Groups' : '' ) + ' = [\n\t' + output.join( ',\n\t' ) + '\n];';
}
function dumpToolbarGroup( group, printGroups ) {
var output = [];
if ( typeof group == 'string' )
return '\'' + group + '\'';
if ( CKEDITOR.tools.isArray( group ) )
return dumpToolbarItems( group );
// Skip group when printing entire toolbar configuration and there are no items in this group.
if ( !printGroups && !group.items )
return;
if ( group.name )
output.push( 'name: \'' + group.name + '\'' );
if ( group.groups )
output.push( 'groups: ' + dumpToolbarItems( group.groups ) );
if ( !printGroups )
output.push( 'items: ' + dumpToolbarItems( group.items ) );
return '{ ' + output.join( ', ' ) + ' }';
}
function dumpToolbarItems( items ) {
if ( typeof items == 'string' )
return '\'' + items + '\'';
var names = [],
i, item;
for ( var i = 0; i < items.length; ++i ) {
item = items[ i ];
if ( typeof item == 'string' )
names.push( item );
else {
if ( item.type == CKEDITOR.UI_SEPARATOR )
names.push( '-' );
else
names.push( buttonsNames[ item.name ] );
}
}
return '[ \'' + names.join( '\', \'' ) + '\' ]';
}
// Creates { 'lowercased': 'LowerCased' } buttons names hash.
function createButtonsNamesHash( items ) {
var hash = {},
name;
for ( name in items ) {
hash[ items[ name ].name ] = name;
}
return hash;
}
})();
</script>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Toolbar Configuration &mdash; CKEditor Sample</title>
<meta name="ckeditor-sample-name" content="Toolbar Configurations">
<meta name="ckeditor-sample-group" content="Advanced Samples">
<meta name="ckeditor-sample-description" content="Configuring CKEditor to display full or custom toolbar layout.">
<script src="../../../ckeditor.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet">
</head>
<body>
<h1 class="samples">
<a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Toolbar Configuration
</h1>
<div class="description">
<p>
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>.
</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>
<p>
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
own button you'll have to add it manually to your <code>config.toolbar</code> setting as well.
</p>
<p>To add a CKEditor instance with custom toolbar setting, insert the following JavaScript call to your code:</p>
<pre class="samples">
CKEDITOR.replace( <em>'textarea_id'</em>, {
<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.
[ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ], // Defines toolbar group without name.
'/', // Line break - next group will be placed in new line.
{ name: 'basicstyles', items: [ 'Bold', 'Italic' ] }
]
});</pre>
<h2 class="samples">By <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups">config.toolbarGroups</a></h2>
<p>
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
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
when adding/removing plugins which register their own buttons.
</p>
<p>To add a CKEditor instance with custom toolbar groups setting, insert the following JavaScript call to your code:</p>
<pre class="samples">
CKEDITOR.replace( <em>'textarea_id'</em>, {
<strong>toolbarGroups:</strong> [
{ 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.
'/', // Line break - next group will be placed in new line.
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'links' }
]
// NOTE: Remember to leave 'toolbar' property with the default value (null).
});</pre>
</div>
<div id="currentToolbar" style="display: none">
<h2 class="samples">Current toolbar configuration</h2>
<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>
<pre id="editorCurrentCfg" class="samples"></pre>
</div>
<div id="fullToolbar">
<h2 class="samples">Full toolbar configuration</h2>
<p>Below you can see editor with full toolbar, generated automatically by the editor.</p>
<p>
<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.
</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>
<pre id="editorFullCfg" class="samples"></pre>
</div>
<script>
(function() {
'use strict';
var buttonsNames;
CKEDITOR.config.extraPlugins = 'toolbar';
CKEDITOR.on( 'instanceReady', function( evt ) {
var editor = evt.editor,
editorCurrent = editor.name == 'editorCurrent',
defaultToolbar = !( editor.config.toolbar || editor.config.toolbarGroups || editor.config.removeButtons ),
pre = CKEDITOR.document.getById( editor.name + 'Cfg' ),
output = '';
if ( editorCurrent ) {
// If default toolbar configuration has been modified, show "current toolbar" section.
if ( !defaultToolbar )
CKEDITOR.document.getById( 'currentToolbar' ).show();
else
return;
}
if ( !buttonsNames )
buttonsNames = createButtonsNamesHash( editor.ui.items );
// Toolbar isn't set explicitly, so it was created automatically from toolbarGroups.
if ( !editor.config.toolbar ) {
output +=
'// Toolbar configuration generated automatically by the editor based on config.toolbarGroups.\n' +
dumpToolbarConfiguration( editor ) +
'\n\n' +
'// Toolbar groups configuration.\n' +
dumpToolbarConfiguration( editor, true )
}
// Toolbar groups doesn't count in this case - print only toolbar.
else {
output += '// Toolbar configuration.\n' +
dumpToolbarConfiguration( editor );
}
// Recreate to avoid old IE from loosing whitespaces on filling <pre> content.
var preOutput = pre.getOuterHtml().replace( /(?=<\/)/, output );
CKEDITOR.dom.element.createFromHtml( preOutput ).replace( pre );
} );
CKEDITOR.replace( 'editorCurrent', { height: 100 } );
CKEDITOR.replace( 'editorFull', {
// Reset toolbar settings, so full toolbar will be generated automatically.
toolbar: null,
toolbarGroups: null,
removeButtons: null,
height: 100
} );
function dumpToolbarConfiguration( editor, printGroups ) {
var output = [],
toolbar = editor.toolbar;
for ( var i = 0; i < toolbar.length; ++i ) {
var group = dumpToolbarGroup( toolbar[ i ], printGroups );
if ( group )
output.push( group );
}
return 'config.toolbar' + ( printGroups ? 'Groups' : '' ) + ' = [\n\t' + output.join( ',\n\t' ) + '\n];';
}
function dumpToolbarGroup( group, printGroups ) {
var output = [];
if ( typeof group == 'string' )
return '\'' + group + '\'';
if ( CKEDITOR.tools.isArray( group ) )
return dumpToolbarItems( group );
// Skip group when printing entire toolbar configuration and there are no items in this group.
if ( !printGroups && !group.items )
return;
if ( group.name )
output.push( 'name: \'' + group.name + '\'' );
if ( group.groups )
output.push( 'groups: ' + dumpToolbarItems( group.groups ) );
if ( !printGroups )
output.push( 'items: ' + dumpToolbarItems( group.items ) );
return '{ ' + output.join( ', ' ) + ' }';
}
function dumpToolbarItems( items ) {
if ( typeof items == 'string' )
return '\'' + items + '\'';
var names = [],
i, item;
for ( var i = 0; i < items.length; ++i ) {
item = items[ i ];
if ( typeof item == 'string' )
names.push( item );
else {
if ( item.type == CKEDITOR.UI_SEPARATOR )
names.push( '-' );
else
names.push( buttonsNames[ item.name ] );
}
}
return '[ \'' + names.join( '\', \'' ) + '\' ]';
}
// Creates { 'lowercased': 'LowerCased' } buttons names hash.
function createButtonsNamesHash( items ) {
var hash = {},
name;
for ( name in items ) {
hash[ items[ name ].name ] = name;
}
return hash;
}
})();
</script>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

@ -1,73 +1,73 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Using the CKEditor Read-Only API &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<link rel="stylesheet" href="sample.css">
<script>
var editor;
// The instanceReady event is fired, when an instance of CKEditor has finished
// its initialization.
CKEDITOR.on( 'instanceReady', function( ev ) {
editor = ev.editor;
// Show this "on" button.
document.getElementById( 'readOnlyOn' ).style.display = '';
// Event fired when the readOnly property changes.
editor.on( 'readOnly', function() {
document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
});
});
function toggleReadOnly( isReadOnly ) {
// Change the read-only state of the editor.
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly
editor.setReadOnly( isReadOnly );
}
</script>
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Using the CKEditor Read-Only API
</h1>
<div class="description">
<p>
This sample shows how to use the
<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.
</p>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<form action="sample_posteddata.php" method="post">
<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>
</p>
<p>
<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">
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Using the CKEditor Read-Only API &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<link rel="stylesheet" href="sample.css">
<script>
var editor;
// The instanceReady event is fired, when an instance of CKEditor has finished
// its initialization.
CKEDITOR.on( 'instanceReady', function( ev ) {
editor = ev.editor;
// Show this "on" button.
document.getElementById( 'readOnlyOn' ).style.display = '';
// Event fired when the readOnly property changes.
editor.on( 'readOnly', function() {
document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
});
});
function toggleReadOnly( isReadOnly ) {
// Change the read-only state of the editor.
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly
editor.setReadOnly( isReadOnly );
}
</script>
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; Using the CKEditor Read-Only API
</h1>
<div class="description">
<p>
This sample shows how to use the
<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.
</p>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<form action="sample_posteddata.php" method="post">
<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>
</p>
<p>
<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">
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</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.
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
{
line-height: 1.5;
}
body
{
padding: 10px 30px;
}
input, textarea, select, option, optgroup, button, td, th
{
font-size: 100%;
}
pre
{
-moz-tab-size: 4;
-o-tab-size: 4;
-webkit-tab-size: 4;
tab-size: 4;
}
pre, code, kbd, samp, tt
{
font-family: monospace,monospace;
font-size: 1em;
}
body {
width: 960px;
margin: 0 auto;
}
code
{
background: #f3f3f3;
border: 1px solid #ddd;
padding: 1px 4px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
abbr
{
border-bottom: 1px dotted #555;
cursor: pointer;
}
.new, .beta
{
text-transform: uppercase;
font-size: 10px;
font-weight: bold;
padding: 1px 4px;
margin: 0 0 0 5px;
color: #fff;
float: right;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.new
{
background: #FF7E00;
border: 1px solid #DA8028;
text-shadow: 0 1px 0 #C97626;
-moz-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;
}
.beta
{
background: #18C0DF;
border: 1px solid #19AAD8;
text-shadow: 0 1px 0 #048CAD;
font-style: italic;
-moz-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;
}
h1.samples
{
color: #0782C1;
font-size: 200%;
font-weight: normal;
margin: 0;
padding: 0;
}
h1.samples a
{
color: #0782C1;
text-decoration: none;
border-bottom: 1px dotted #0782C1;
}
.samples a:hover
{
border-bottom: 1px dotted #0782C1;
}
h2.samples
{
color: #000000;
font-size: 130%;
margin: 15px 0 0 0;
padding: 0;
}
p, blockquote, address, form, pre, dl, h1.samples, h2.samples
{
margin-bottom: 15px;
}
ul.samples
{
margin-bottom: 15px;
}
.clear
{
clear: both;
}
fieldset
{
margin: 0;
padding: 10px;
}
body, input, textarea
{
color: #333333;
font-family: Arial, Helvetica, sans-serif;
}
body
{
font-size: 75%;
}
a.samples
{
color: #189DE1;
text-decoration: none;
}
form
{
margin: 0;
padding: 0;
}
pre.samples
{
background-color: #F7F7F7;
border: 1px solid #D7D7D7;
overflow: auto;
padding: 0.25em;
white-space: pre-wrap; /* CSS 2.1 */
word-wrap: break-word; /* IE7 */
}
#footer
{
clear: both;
padding-top: 10px;
}
#footer hr
{
margin: 10px 0 15px 0;
height: 1px;
border: solid 1px gray;
border-bottom: none;
}
#footer p
{
margin: 0 10px 10px 10px;
float: left;
}
#footer #copy
{
float: right;
}
#outputSample
{
width: 100%;
table-layout: fixed;
}
#outputSample thead th
{
color: #dddddd;
background-color: #999999;
padding: 4px;
white-space: nowrap;
}
#outputSample tbody th
{
vertical-align: top;
text-align: left;
}
#outputSample pre
{
margin: 0;
padding: 0;
}
.description
{
border: 1px dotted #B7B7B7;
margin-bottom: 10px;
padding: 10px 10px 0;
overflow: hidden;
}
label
{
display: block;
margin-bottom: 6px;
}
/**
* CKEditor editables are automatically set with the "cke_editable" class
* plus cke_editable_(inline|themed) depending on the editor type.
*/
/* Style a bit the inline editables. */
.cke_editable.cke_editable_inline
{
cursor: pointer;
}
/* Once an editable element gets focused, the "cke_focus" class is
added to it, so we can style it differently. */
.cke_editable.cke_editable_inline.cke_focus
{
box-shadow: inset 0px 0px 20px 3px #ddd, inset 0 0 1px #000;
outline: none;
background: #eee;
cursor: text;
}
/* Avoid pre-formatted overflows inline editable. */
.cke_editable_inline pre
{
white-space: pre-wrap;
word-wrap: break-word;
}
/**
* Samples index styles.
*/
.twoColumns,
.twoColumnsLeft,
.twoColumnsRight
{
overflow: hidden;
}
.twoColumnsLeft,
.twoColumnsRight
{
width: 45%;
}
.twoColumnsLeft
{
float: left;
}
.twoColumnsRight
{
float: right;
}
dl.samples
{
padding: 0 0 0 40px;
}
dl.samples > dt
{
display: list-item;
list-style-type: disc;
list-style-position: outside;
margin: 0 0 3px;
}
dl.samples > dd
{
margin: 0 0 3px;
}
.warning
{
color: #ff0000;
background-color: #FFCCBA;
border: 2px dotted #ff0000;
padding: 15px 10px;
margin: 10px 0;
}
/* Used on inline samples */
blockquote
{
font-style: italic;
font-family: Georgia, Times, "Times New Roman", serif;
padding: 2px 0;
border-style: solid;
border-color: #ccc;
border-width: 0;
}
.cke_contents_ltr blockquote
{
padding-left: 20px;
padding-right: 8px;
border-left-width: 5px;
}
.cke_contents_rtl blockquote
{
padding-left: 8px;
padding-right: 20px;
border-right-width: 5px;
}
img.right {
border: 1px solid #ccc;
float: right;
margin-left: 15px;
padding: 5px;
}
img.left {
border: 1px solid #ccc;
float: left;
margin-right: 15px;
padding: 5px;
}
.marker
{
background-color: Yellow;
}
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
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
{
line-height: 1.5;
}
body
{
padding: 10px 30px;
}
input, textarea, select, option, optgroup, button, td, th
{
font-size: 100%;
}
pre
{
-moz-tab-size: 4;
-o-tab-size: 4;
-webkit-tab-size: 4;
tab-size: 4;
}
pre, code, kbd, samp, tt
{
font-family: monospace,monospace;
font-size: 1em;
}
body {
width: 960px;
margin: 0 auto;
}
code
{
background: #f3f3f3;
border: 1px solid #ddd;
padding: 1px 4px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
abbr
{
border-bottom: 1px dotted #555;
cursor: pointer;
}
.new, .beta
{
text-transform: uppercase;
font-size: 10px;
font-weight: bold;
padding: 1px 4px;
margin: 0 0 0 5px;
color: #fff;
float: right;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.new
{
background: #FF7E00;
border: 1px solid #DA8028;
text-shadow: 0 1px 0 #C97626;
-moz-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;
}
.beta
{
background: #18C0DF;
border: 1px solid #19AAD8;
text-shadow: 0 1px 0 #048CAD;
font-style: italic;
-moz-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;
}
h1.samples
{
color: #0782C1;
font-size: 200%;
font-weight: normal;
margin: 0;
padding: 0;
}
h1.samples a
{
color: #0782C1;
text-decoration: none;
border-bottom: 1px dotted #0782C1;
}
.samples a:hover
{
border-bottom: 1px dotted #0782C1;
}
h2.samples
{
color: #000000;
font-size: 130%;
margin: 15px 0 0 0;
padding: 0;
}
p, blockquote, address, form, pre, dl, h1.samples, h2.samples
{
margin-bottom: 15px;
}
ul.samples
{
margin-bottom: 15px;
}
.clear
{
clear: both;
}
fieldset
{
margin: 0;
padding: 10px;
}
body, input, textarea
{
color: #333333;
font-family: Arial, Helvetica, sans-serif;
}
body
{
font-size: 75%;
}
a.samples
{
color: #189DE1;
text-decoration: none;
}
form
{
margin: 0;
padding: 0;
}
pre.samples
{
background-color: #F7F7F7;
border: 1px solid #D7D7D7;
overflow: auto;
padding: 0.25em;
white-space: pre-wrap; /* CSS 2.1 */
word-wrap: break-word; /* IE7 */
}
#footer
{
clear: both;
padding-top: 10px;
}
#footer hr
{
margin: 10px 0 15px 0;
height: 1px;
border: solid 1px gray;
border-bottom: none;
}
#footer p
{
margin: 0 10px 10px 10px;
float: left;
}
#footer #copy
{
float: right;
}
#outputSample
{
width: 100%;
table-layout: fixed;
}
#outputSample thead th
{
color: #dddddd;
background-color: #999999;
padding: 4px;
white-space: nowrap;
}
#outputSample tbody th
{
vertical-align: top;
text-align: left;
}
#outputSample pre
{
margin: 0;
padding: 0;
}
.description
{
border: 1px dotted #B7B7B7;
margin-bottom: 10px;
padding: 10px 10px 0;
overflow: hidden;
}
label
{
display: block;
margin-bottom: 6px;
}
/**
* CKEditor editables are automatically set with the "cke_editable" class
* plus cke_editable_(inline|themed) depending on the editor type.
*/
/* Style a bit the inline editables. */
.cke_editable.cke_editable_inline
{
cursor: pointer;
}
/* Once an editable element gets focused, the "cke_focus" class is
added to it, so we can style it differently. */
.cke_editable.cke_editable_inline.cke_focus
{
box-shadow: inset 0px 0px 20px 3px #ddd, inset 0 0 1px #000;
outline: none;
background: #eee;
cursor: text;
}
/* Avoid pre-formatted overflows inline editable. */
.cke_editable_inline pre
{
white-space: pre-wrap;
word-wrap: break-word;
}
/**
* Samples index styles.
*/
.twoColumns,
.twoColumnsLeft,
.twoColumnsRight
{
overflow: hidden;
}
.twoColumnsLeft,
.twoColumnsRight
{
width: 45%;
}
.twoColumnsLeft
{
float: left;
}
.twoColumnsRight
{
float: right;
}
dl.samples
{
padding: 0 0 0 40px;
}
dl.samples > dt
{
display: list-item;
list-style-type: disc;
list-style-position: outside;
margin: 0 0 3px;
}
dl.samples > dd
{
margin: 0 0 3px;
}
.warning
{
color: #ff0000;
background-color: #FFCCBA;
border: 2px dotted #ff0000;
padding: 15px 10px;
margin: 10px 0;
}
/* Used on inline samples */
blockquote
{
font-style: italic;
font-family: Georgia, Times, "Times New Roman", serif;
padding: 2px 0;
border-style: solid;
border-color: #ccc;
border-width: 0;
}
.cke_contents_ltr blockquote
{
padding-left: 20px;
padding-right: 8px;
border-left-width: 5px;
}
.cke_contents_rtl blockquote
{
padding-left: 8px;
padding-right: 20px;
border-right-width: 5px;
}
img.right {
border: 1px solid #ccc;
float: right;
margin-left: 15px;
padding: 5px;
}
img.left {
border: 1px solid #ccc;
float: left;
margin-right: 15px;
padding: 5px;
}
.marker
{
background-color: Yellow;
}

View file

@ -1,16 +1,16 @@
<?php /* <body><pre>
-------------------------------------------------------------------------------------------
CKEditor - Posted Data
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.
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.
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>
-------------------------------------------------------------------------------------------
</pre><div style="display:none"></body> */ include "assets/posteddata.php"; ?>
<?php /* <body><pre>
-------------------------------------------------------------------------------------------
CKEditor - Posted Data
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.
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.
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>
-------------------------------------------------------------------------------------------
</pre><div style="display:none"></body> */ include "assets/posteddata.php"; ?>

View file

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

View file

@ -1,69 +1,69 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>UI Color Picker &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<link rel="stylesheet" href="sample.css">
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; UI Color
</h1>
<div class="description">
<p>
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>
<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.
</p>
</div>
<form action="sample_posteddata.php" method="post">
<p>
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:
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>uiColor: '#14B8C4'</strong>
});</pre>
<p>
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.
</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>
<script>
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1', {
uiColor: '#14B8C4',
toolbar: [
[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'FontSize', 'TextColor', 'BGColor' ]
]
});
</script>
</p>
<p>
<input type="submit" value="Submit">
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>UI Color Picker &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<link rel="stylesheet" href="sample.css">
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; UI Color
</h1>
<div class="description">
<p>
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>
<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.
</p>
</div>
<form action="sample_posteddata.php" method="post">
<p>
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:
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', {
<strong>uiColor: '#14B8C4'</strong>
});</pre>
<p>
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.
</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>
<script>
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1', {
uiColor: '#14B8C4',
toolbar: [
[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'FontSize', 'TextColor', 'BGColor' ]
]
});
</script>
</p>
<p>
<input type="submit" value="Submit">
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View file

@ -1,119 +1,119 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>User Interface Globalization &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<script src="assets/uilanguages/languages.js"></script>
<link rel="stylesheet" href="sample.css">
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; User Interface Languages
</h1>
<div class="description">
<p>
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.
</p>
<p>
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.
</p>
<p>
By default, CKEditor automatically localizes the editor to the language of the user.
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-defaultLanguage">
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.
</p>
<p>
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:
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', {
// Load the German interface.
<strong>language: 'de'</strong>
});</pre>
<p>
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.
</p>
</div>
<form action="sample_posteddata.php" method="post">
<p>
Available languages (<span id="count"> </span> languages!):<br>
<script>
document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' );
// Get the language list from the _languages.js file.
for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ ) {
document.write(
'<option value="' + window.CKEDITOR_LANGS[i].code + '">' +
window.CKEDITOR_LANGS[i].name +
'</option>' );
}
document.write( '</select>' );
</script>
<br>
<span style="color: #888888">
(You may see strange characters if your system does not support the selected language)
</span>
</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>
<script>
// Set the number of languages.
document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;
var editor;
function createEditor( languageCode ) {
if ( editor )
editor.destroy();
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
editor = CKEDITOR.replace( 'editor1', {
language: languageCode,
on: {
instanceReady: function() {
// Wait for the editor to be ready to set
// the language combo.
var languages = document.getElementById( 'languages' );
languages.value = this.langCode;
languages.disabled = false;
}
}
});
}
// At page startup, load the default language:
createEditor( '' );
</script>
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>User Interface Globalization &mdash; CKEditor Sample</title>
<script src="../ckeditor.js"></script>
<script src="assets/uilanguages/languages.js"></script>
<link rel="stylesheet" href="sample.css">
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> &raquo; User Interface Languages
</h1>
<div class="description">
<p>
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.
</p>
<p>
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.
</p>
<p>
By default, CKEditor automatically localizes the editor to the language of the user.
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-defaultLanguage">
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.
</p>
<p>
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:
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>', {
// Load the German interface.
<strong>language: 'de'</strong>
});</pre>
<p>
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.
</p>
</div>
<form action="sample_posteddata.php" method="post">
<p>
Available languages (<span id="count"> </span> languages!):<br>
<script>
document.write( '<select disabled="disabled" id="languages" onchange="createEditor( this.value );">' );
// Get the language list from the _languages.js file.
for ( var i = 0 ; i < window.CKEDITOR_LANGS.length ; i++ ) {
document.write(
'<option value="' + window.CKEDITOR_LANGS[i].code + '">' +
window.CKEDITOR_LANGS[i].name +
'</option>' );
}
document.write( '</select>' );
</script>
<br>
<span style="color: #888888">
(You may see strange characters if your system does not support the selected language)
</span>
</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>
<script>
// Set the number of languages.
document.getElementById( 'count' ).innerHTML = window.CKEDITOR_LANGS.length;
var editor;
function createEditor( languageCode ) {
if ( editor )
editor.destroy();
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
editor = CKEDITOR.replace( 'editor1', {
language: languageCode,
on: {
instanceReady: function() {
// Wait for the editor to be ready to set
// the language combo.
var languages = document.getElementById( 'languages' );
languages.value = this.langCode;
languages.disabled = false;
}
}
});
}
// At page startup, load the default language:
createEditor( '' );
</script>
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

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