Import/export: Fix3032 - importing document botches pad options (#3769)

Fixes #3032
This commit is contained in:
John McLear 2020-06-05 19:58:25 +01:00 committed by GitHub
parent e859edd8ab
commit 13bd859f31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -437,16 +437,27 @@ var pad = {
},
switchToPad: function(padId)
{
var newHref = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname) || clientVars.padId;
newHref = newHref[0];
var options = clientVars.padOptions;
if (typeof options != "undefined" && options != null)
{
var option_str = [];
$.each(options, function(k,v) {
var str = k + "=" + v;
option_str.push(str);
});
var option_str = option_str.join("&");
newHref = newHref + '?' + option_str;
}
// destroy old pad from DOM
// See https://github.com/ether/etherpad-lite/pull/3915
// TODO: Check if Destroying is enough and doesn't leave negative stuff
// See ace.js "editor.destroy" for a reference of how it was done before
$('#editorcontainer').find("iframe")[0].remove();
var options = document.location.href.split('?')[1];
var newHref = padId;
if (typeof options != "undefined" && options != null){
newHref = newHref + '?' + options;
}
if(window.history && window.history.pushState)
{