mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
* added a *py-editor* plugin based on *codemirror* * use a `<script type="py-editor">` wrapper to bootstrap code * tested that all is good via smoke-test in test/py-editor.html
54 lines
1.5 KiB
HTML
54 lines
1.5 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>PyTerminal</title>
|
|
<link rel="stylesheet" href="../dist/core.css">
|
|
<script type="module" src="../dist/core.js"></script>
|
|
<style>
|
|
.py-editor-box, .mpy-editor-box {
|
|
padding: .5rem;
|
|
position: relative;
|
|
}
|
|
.py-editor-run-button, .mpy-editor-run-button {
|
|
position: absolute;
|
|
right: .5rem;
|
|
top: .5rem;
|
|
opacity: 0;
|
|
transition: opacity .25s;
|
|
}
|
|
.py-editor-box:hover .py-editor-run-button,
|
|
.mpy-editor-box:hover .mpy-editor-run-button,
|
|
.py-editor-run-button:focus,
|
|
.py-editor-run-button:disabled,
|
|
.mpy-editor-run-button:focus,
|
|
.mpy-editor-run-button:disabled {
|
|
opacity: 1;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script type="py-editor">
|
|
import sys
|
|
print(sys.version)
|
|
</script>
|
|
<script type="mpy-editor">
|
|
import sys
|
|
print(sys.version)
|
|
a = 42
|
|
</script>
|
|
<script type="mpy-editor" env="shared">
|
|
if not 'a' in globals():
|
|
a = 1
|
|
else:
|
|
a += 1
|
|
print(a)
|
|
</script>
|
|
<script type="mpy-editor" env="shared">
|
|
# doubled a
|
|
print(a * 2)
|
|
</script>
|
|
</body>
|
|
</html>
|