editor: fix the wrong URL when we use etherpad without /p/ in the URL (#4070)

This commit is contained in:
Alex 2020-06-02 00:12:42 +03:00 committed by GitHub
parent b1e50ab835
commit f45d85f615
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -293,18 +293,20 @@ var padeditbar = (function()
},
setEmbedLinks: function()
{
var padUrl = window.location.href.split("?")[0];
if ($('#readonlyinput').is(':checked'))
{
var basePath = document.location.href.substring(0, document.location.href.indexOf("/p/"));
var readonlyLink = basePath + "/p/" + clientVars.readOnlyId;
var urlParts = padUrl.split("/");
urlParts.pop();
var readonlyLink = urlParts.join("/") + "/" + clientVars.readOnlyId;
$('#embedinput').val('<iframe name="embed_readonly" src="' + readonlyLink + '?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false" width="100%" height="600" frameborder="0"></iframe>');
$('#linkinput').val(readonlyLink);
}
else
{
var padurl = window.location.href.split("?")[0];
$('#embedinput').val('<iframe name="embed_readwrite" src="' + padurl + '?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false" width="100%" height="600" frameborder="0"></iframe>');
$('#linkinput').val(padurl);
$('#embedinput').val('<iframe name="embed_readwrite" src="' + padUrl + '?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false" width="100%" height="600" frameborder="0"></iframe>');
$('#linkinput').val(padUrl);
}
},
checkAllIconsAreDisplayedInToolbar: function()