From bb7e8657cb21cb002f8874cd7c7940005e92d4fb Mon Sep 17 00:00:00 2001 From: titaneric Date: Thu, 15 Apr 2021 01:57:03 +0800 Subject: [PATCH] Adapt wasm-pack new response --- src/theme/book.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/theme/book.js b/src/theme/book.js index 6df0cf49..8a106ef5 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -181,9 +181,9 @@ function playground_text(playground) { body: JSON.stringify(params) }) .then(response => response.json()) - .then(({ wasm_js, wasm_bg, error }) => { - if (error) { - throw new Error(error); + .then(({ wasm_js, wasm_bg, success, stderr }) => { + if (!success) { + throw new Error(stderr); } return { @@ -238,11 +238,13 @@ function playground_text(playground) { function createIFrame(src) { var iframe = document.createElement('iframe'); + iframe.scrolling = 'no'; iframe.style.height = "100%"; iframe.style.width = "100%"; iframe.style.padding = 0; iframe.style.margin = 0; iframe.style.border = 0; + iframe.style.overflow = "hidden"; iframe.src = createObjectURL(src, "text/html"); return iframe }