Restore the when decorator and HTML (#1691)

* restore HTML code in display module

* restore when decorator code in event_handling module

* add when and HTML at pyscript import level

* add test for display with HTML

* add quick manual test for when

---------

Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
This commit is contained in:
Fabio Pliger
2023-09-12 06:27:56 -07:00
committed by GitHub
parent 32c3fb72cc
commit 2a2ff4066d
7 changed files with 87 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PyScript Next: When Decorator</title>
<link rel="stylesheet" href="../dist/core.css">
<script type="module" src="../dist/core.js"></script>
</head>
<body>
<p>Click for a hi!</p>
<py-script>
from pyscript import window, when
@when("click", selector="#say-hi")
def say_hi(event):
window.alert("Hi! 🤗")
</py-script>
<button id="say-hi">Click Me</button>
</body>
</html>