diff --git a/app/static/js/core/sheet-buttons.js b/app/static/js/core/sheet-buttons.js index f97cd41..d0195d9 100644 --- a/app/static/js/core/sheet-buttons.js +++ b/app/static/js/core/sheet-buttons.js @@ -44,12 +44,21 @@ async function registerCellToButton(hyperlinkCellRef, scriptName, xwConfig) { typeof globalThis.getAuth === "function" ? await globalThis.getAuth() : ""; - await xlwings.runPython( - window.location.origin + - config.appPath + - `/xlwings/custom-scripts-call/${scriptName}`, - { ...xwConfig, auth: token }, - ); + if (config.onWasm) { + let body = await xlwings.getBookData(xwConfig); + await pyscriptDone; + let r = await window.custom_scripts_call(body, scriptName); + r = JSON.parse(r); + // let actions = r.toJs(); + await xlwings.runActions(r); + } else { + await xlwings.runPython( + window.location.origin + + config.appPath + + `/xlwings/custom-scripts-call/${scriptName}`, + { ...xwConfig, auth: token }, + ); + } } finally { sheet.getRange(selectedRangeAddress).getOffsetRange(1, 0).select(); await context.sync(); diff --git a/app/static/js/core/xlwingsjs/xlwings.js b/app/static/js/core/xlwingsjs/xlwings.js index beb1bb6..66d4bf1 100644 --- a/app/static/js/core/xlwingsjs/xlwings.js +++ b/app/static/js/core/xlwingsjs/xlwings.js @@ -57,6 +57,7 @@ export function init() { config.appPath + "/xlwings/custom-scripts-call/" + element.getAttribute("xw-click"); + // TODO: this is duplicated in sheet-buttons.js if (config.onWasm) { let body = await xlwings.getBookData(xwConfig); await pyscriptDone; diff --git a/app/templates/base.html b/app/templates/base.html index c4b7ec6..6db06d0 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -85,6 +85,7 @@ {% if settings.enable_wasm %} + {% endif %} {% endblock head %} diff --git a/app/templates/examples/hello_world/taskpane_hello.html b/app/templates/examples/hello_world/taskpane_hello.html index 8b82e61..b055274 100644 --- a/app/templates/examples/hello_world/taskpane_hello.html +++ b/app/templates/examples/hello_world/taskpane_hello.html @@ -3,9 +3,6 @@ {% block content %}