mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
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>
This commit is contained in:
committed by
GitHub
parent
6eca06ac0b
commit
355866a1f1
@@ -1,6 +1,7 @@
|
|||||||
// PyScript py-terminal plugin
|
// PyScript py-terminal plugin
|
||||||
import { TYPES, hooks } from "../core.js";
|
import { TYPES, hooks } from "../core.js";
|
||||||
import { notify } from "./error.js";
|
import { notify } from "./error.js";
|
||||||
|
import { defineProperty } from "polyscript/exports";
|
||||||
|
|
||||||
const SELECTOR = [...TYPES.keys()]
|
const SELECTOR = [...TYPES.keys()]
|
||||||
.map((type) => `script[type="${type}"][terminal],${type}-script[terminal]`)
|
.map((type) => `script[type="${type}"][terminal],${type}-script[terminal]`)
|
||||||
@@ -76,6 +77,7 @@ const pyTerminal = async () => {
|
|||||||
terminal.open(target);
|
terminal.open(target);
|
||||||
fitAddon.fit();
|
fitAddon.fit();
|
||||||
terminal.focus();
|
terminal.focus();
|
||||||
|
defineProperty(element, "terminal", { value: terminal });
|
||||||
};
|
};
|
||||||
|
|
||||||
// branch logic for the worker
|
// branch logic for the worker
|
||||||
|
|||||||
Reference in New Issue
Block a user