Commit 8d444cd2 authored by Julia Radzhabova's avatar Julia Radzhabova

Check origin of messages received in api.

parent 24ce4d9b
...@@ -180,6 +180,7 @@ ...@@ -180,6 +180,7 @@
_config.editorConfig.canHistoryRestore = _config.events && !!_config.events.onRequestRestore; _config.editorConfig.canHistoryRestore = _config.events && !!_config.events.onRequestRestore;
_config.editorConfig.canSendEmailAddresses = _config.events && !!_config.events.onRequestEmailAddresses; _config.editorConfig.canSendEmailAddresses = _config.events && !!_config.events.onRequestEmailAddresses;
_config.editorConfig.canRequestEditRights = _config.events && !!_config.events.onRequestEditRights; _config.editorConfig.canRequestEditRights = _config.events && !!_config.events.onRequestEditRights;
_config.frameEditorId = placeholderId;
var onMouseUp = function (evt) { var onMouseUp = function (evt) {
_processMouse(evt); _processMouse(evt);
...@@ -257,7 +258,7 @@ ...@@ -257,7 +258,7 @@
}; };
var _onMessage = function(msg) { var _onMessage = function(msg) {
if (msg) { if (msg && msg.frameEditorId == placeholderId) {
var events = _config.events || {}, var events = _config.events || {},
handler = events[msg.event], handler = events[msg.event],
res; res;
...@@ -662,6 +663,9 @@ ...@@ -662,6 +663,9 @@
if (config.editorConfig.customization.loaderLogo !== '') params += "&logo=" + config.editorConfig.customization.loaderLogo; if (config.editorConfig.customization.loaderLogo !== '') params += "&logo=" + config.editorConfig.customization.loaderLogo;
} }
} }
if (config.frameEditorId)
params += "&frameEditorId=" + config.frameEditorId;
return params; return params;
} }
......
...@@ -99,6 +99,7 @@ Common.Gateway = new(function() { ...@@ -99,6 +99,7 @@ Common.Gateway = new(function() {
var _postMessage = function(msg) { var _postMessage = function(msg) {
// TODO: specify explicit origin // TODO: specify explicit origin
if (window.parent && window.JSON) { if (window.parent && window.JSON) {
msg.frameEditorId = window.frameEditorId;
window.parent.postMessage(window.JSON.stringify(msg), "*"); window.parent.postMessage(window.JSON.stringify(msg), "*");
} }
}; };
......
...@@ -239,6 +239,8 @@ ...@@ -239,6 +239,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -231,6 +231,8 @@ ...@@ -231,6 +231,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -227,6 +227,8 @@ ...@@ -227,6 +227,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -227,6 +227,8 @@ ...@@ -227,6 +227,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -264,6 +264,8 @@ ...@@ -264,6 +264,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -255,6 +255,8 @@ ...@@ -255,6 +255,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -238,6 +238,8 @@ ...@@ -238,6 +238,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -231,6 +231,8 @@ ...@@ -231,6 +231,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -228,6 +228,8 @@ ...@@ -228,6 +228,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -227,6 +227,8 @@ ...@@ -227,6 +227,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -263,6 +263,8 @@ ...@@ -263,6 +263,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -254,6 +254,8 @@ ...@@ -254,6 +254,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -239,6 +239,8 @@ ...@@ -239,6 +239,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -231,6 +231,8 @@ ...@@ -231,6 +231,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -230,6 +230,8 @@ ...@@ -230,6 +230,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -228,6 +228,8 @@ ...@@ -228,6 +228,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -270,6 +270,8 @@ ...@@ -270,6 +270,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
...@@ -255,6 +255,8 @@ ...@@ -255,6 +255,8 @@
loading = 'Loading...', loading = 'Loading...',
logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null; logo = params["logo"] ? ((params["logo"] !== 'none') ? ('<img src="' + encodeUrlParam(params["logo"]) + '" class="loader-logo" />') : '') : null;
window.frameEditorId = params["frameEditorId"];
if ( lang == 'de') loading = 'Ladevorgang...'; if ( lang == 'de') loading = 'Ladevorgang...';
else if ( lang == 'es') loading = 'Cargando...'; else if ( lang == 'es') loading = 'Cargando...';
else if ( lang == 'fr') loading = 'Chargement en cours...'; else if ( lang == 'fr') loading = 'Chargement en cours...';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment