From 355866a1f1c6064ea40b8b51c016963e6ace8968 Mon Sep 17 00:00:00 2001 From: Andrea Giammarchi Date: Wed, 3 Jan 2024 16:24:38 +0100 Subject: [PATCH] PyTerminal - expose the reference through the element (#1921) * PyTerminal - expose the reference through the element * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- pyscript.core/src/plugins/py-terminal.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyscript.core/src/plugins/py-terminal.js b/pyscript.core/src/plugins/py-terminal.js index 1cf7a740..9812ac2f 100644 --- a/pyscript.core/src/plugins/py-terminal.js +++ b/pyscript.core/src/plugins/py-terminal.js @@ -1,6 +1,7 @@ // PyScript py-terminal plugin import { TYPES, hooks } from "../core.js"; import { notify } from "./error.js"; +import { defineProperty } from "polyscript/exports"; const SELECTOR = [...TYPES.keys()] .map((type) => `script[type="${type}"][terminal],${type}-script[terminal]`) @@ -76,6 +77,7 @@ const pyTerminal = async () => { terminal.open(target); fitAddon.fit(); terminal.focus(); + defineProperty(element, "terminal", { value: terminal }); }; // branch logic for the worker