diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index e118f8cf9..95a882288 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -172,7 +172,7 @@ define(function () { out.viewOpen = "Voir dans un nouvel onglet"; out.viewOpenTitle = "Ouvrir le lien en lecture seule dans un nouvel onglet"; out.fileShare = "Copier le lien"; - out.fileEmbed = "Obtenir le code d'intégration"; + out.getEmbedCode = "Obtenir le code d'intégration"; out.fileEmbedTitle = "Intégrer le fichier dans une page web"; out.fileEmbedScript = "Pour intégrer un fichier, veuillez inclure le script suivant une fois dans votre page afin de pouvoir charger le Media Tag :"; out.fileEmbedTag = "Ensuite vous pouvez placer ce Media Tag où vous souhaitez dans votre page pour l'intégrer :"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 3905b7601..51ba6ae4a 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -174,7 +174,9 @@ define(function () { out.viewOpen = "Open read-only link in a new tab"; out.viewOpenTitle = "Open this pad in read-only mode in a new tab"; out.fileShare = "Copy link"; - out.fileEmbed = "Get embed code"; + out.getEmbedCode = "Get embed code"; + out.viewEmbedTitle = ""; + out.viewEmbedTag = ""; out.fileEmbedTitle = "Embed the file in an external page"; out.fileEmbedScript = "To embed this file, include this script once in your page to load the Media Tag:"; out.fileEmbedTag = "Then place this Media Tag wherever in your page you would like to embed:"; diff --git a/www/common/sframe-channel.js b/www/common/sframe-channel.js index fc9bcd0dd..c4aed597b 100644 --- a/www/common/sframe-channel.js +++ b/www/common/sframe-channel.js @@ -7,7 +7,7 @@ define([ return Math.random().toString(16).replace('0.', '') + Math.random().toString(16).replace('0.', ''); }; - var create = function (ow, cb) { + var create = function (ow, cb, isSandbox) { var otherWindow; var handlers = {}; var queries = {}; @@ -131,7 +131,7 @@ define([ console.log(msg); } }); - if (window !== window.top) { + if (isSandbox) { // we're in the sandbox otherWindow = ow; cb(chan); diff --git a/www/common/sframe-common-interface.js b/www/common/sframe-common-interface.js index 459991e1c..c6dff14f6 100644 --- a/www/common/sframe-common-interface.js +++ b/www/common/sframe-common-interface.js @@ -230,31 +230,31 @@ define([ $userAdmin.find('a.logout').click(function () { Common.logout(function () { - window.top.location = origin+'/'; + window.parent.location = origin+'/'; }); }); $userAdmin.find('a.settings').click(function () { if (padType) { window.open(origin+'/settings/'); } else { - window.top.location = origin+'/settings/'; + window.parent.location = origin+'/settings/'; } }); $userAdmin.find('a.profile').click(function () { if (padType) { window.open(origin+'/profile/'); } else { - window.top.location = origin+'/profile/'; + window.parent.location = origin+'/profile/'; } }); $userAdmin.find('a.login').click(function () { Common.setLoginRedirect(function () { - window.top.location = origin+'/login/'; + window.parent.location = origin+'/login/'; }); }); $userAdmin.find('a.register').click(function () { Common.setLoginRedirect(function () { - window.top.location = origin+'/register/'; + window.parent.location = origin+'/register/'; }); }); diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 484c48681..36dd5e6ca 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -357,7 +357,7 @@ define([ Object.freeze(funcs); return { create: function (cb) { nThen(function (waitFor) { - SFrameChannel.create(window.top, waitFor(function (sfc) { ctx.sframeChan = sfc; })); + SFrameChannel.create(window.parent, waitFor(function (sfc) { ctx.sframeChan = sfc; }), true); // CpNfInner.start() should be here.... }).nThen(function () { ctx.metadataMgr = MetadataMgr.create(ctx.sframeChan); diff --git a/www/common/toolbar2.js b/www/common/toolbar2.js index dd2b8c4b2..6909d8c0d 100644 --- a/www/common/toolbar2.js +++ b/www/common/toolbar2.js @@ -491,8 +491,8 @@ define([ }); options.push({ tag: 'a', - attributes: {title: Messages.editShareTitle, 'class': 'fileEmbed'}, - content: ' ' + Messages.fileEmbed + attributes: {title: Messages.fileEmbedTitle, 'class': 'fileEmbed'}, + content: ' ' + Messages.getEmbedCode }); var dropdownConfigShare = { text: $('
').text(Messages.fileEmbedTag).appendTo($content);
+ $('
').appendTo($tag);
+ var iframeId = uid();
+ var iframeEmbed = '';
+ $('', {
+ type: 'text',
+ id: iframeId,
+ readonly: 'readonly',
+ value: iframeEmbed,
+ }).appendTo($tag);
+ Cryptpad.alert($content.html(), null, true);
+ $('#'+iframeId).click(function () {
+ this.select();
+ });
+ //var success = Cryptpad.Clipboard.copy(url);
+ //if (success) { Cryptpad.log(Messages.shareSuccess); }
+ });
}
toolbar.$leftside.append($shareBlock);
@@ -611,7 +645,7 @@ define([
window.open(href);
return;
}
- window.top.location = href;
+ window.parent.location = href;
};
var onContext = function (e) { e.stopPropagation(); };