Skip to content

Commit c69c310

Browse files
author
thomaswilburn
committed
Fix #33
1 parent e6c600e commit c69c310

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"dependencies": {
1616
"@babel/core": "^7.1.6",
1717
"@babel/preset-env": "^7.9.0",
18+
"@nprapps/sidechain": "^1.1.1",
1819
"aws-sdk": "^2.359.0",
1920
"babelify": "^10.0.0",
2021
"body-parser": "^1.18.3",

server/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = async function(config) {
2828

2929
console.log("Setting middleware...");
3030
app.use(express.static("server/static"));
31+
app.use("/node_modules", express.static("node_modules"));
3132
app.use(bodyparser.json());
3233
app.use(bodyparser.urlencoded({ extended: true }));
3334

server/static/parentPage.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "./remoteConsole.js";
22
import { showToast } from "./toast.js";
33
import { $ } from "./qsa.js";
4+
import "/node_modules/@nprapps/sidechain/src/index.js";
45

56
var delay = (d = 1000) => new Promise(ok => setTimeout(ok, d));
67

server/templates/parentPage.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ <h1><%= slug %></h1>
9393
<% } %>
9494

9595
<div class="preview-container" data-width="mobile">
96-
<div data-pym-loader data-child-src="./index.html" id="preview">Loading...</div>
96+
<!-- <div data-pym-loader data-child-src="./index.html" id="preview">Loading...</div> -->
97+
<side-chain src="./index.html" id="preview"></side-chain>
9798
</div>
9899

99100
</div>
@@ -168,14 +169,16 @@ <h2>Copyedit e-mail</h2>
168169
var { search, searchParams } = here;
169170
var child = searchParams.get("preview") || "index.html";
170171
var childURL = `./${child}${search}`;
171-
embed.dataset.childSrc = childURL;
172+
embed.setAttribute("src", childURL);
172173
previewSelect.value = child;
173174

174175
previewSelect.addEventListener("change", function() {
175176
var child = previewSelect.value;
176177
var there = new URL(window.location);
177178
there.searchParams.set("preview", child);
178-
window.location.search = there.search;
179+
window.history.replaceState(null, null, there.search);
180+
var childURL = `./${child}${there.search}`;
181+
embed.setAttribute("src", childURL);
179182
});
180183
}
181184
</script>

0 commit comments

Comments
 (0)