Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/uproot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def cli() -> None:
@click.command(help="Run this uproot project")
@click.option("--host", "-h", default="127.0.0.1", show_default="127.0.0.1", help="Host")
@click.option("--port", "-p", default=8000, show_default=8000, help="Port")
@click.option("--no-enter", default=False, is_flag=True, help="Disable form submission via Enter")
@click.option("--unsafe", default=False, is_flag=True, help="Run without admin authentication")
@click.option("--public-demo", default=False, is_flag=True, help="Run a public demo (use with --unsafe)")
@click.pass_context
Expand All @@ -132,6 +133,7 @@ def run(
ctx: click.Context,
host: str,
port: int,
no_enter: bool,
unsafe: bool,
public_demo: bool,
) -> None:
Expand All @@ -140,6 +142,7 @@ def run(

d.HOST = host
d.PORT = port
d.NO_ENTER = no_enter
d.UNSAFE = unsafe
d.PUBLIC_DEMO = public_demo

Expand Down
12 changes: 12 additions & 0 deletions src/uproot/default/Bare.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,18 @@ <h5 class="modal-title">

uproot.slidersWithoutAnchoring();

if (ui.no_enter) {
// disable Enter for form submission

document.querySelectorAll("form").forEach((form) => {
form.addEventListener("keydown", (e) => {
if (e.key === "Enter" && e.target.tagName !== "TEXTAREA") {
e.preventDefault();
}
});
});
}

// clear selection feature for non-required radios

uproot.nonRequiredRadios();
Expand Down
1 change: 1 addition & 0 deletions src/uproot/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
LANGUAGE: ISO639 = "en"
LOGIN_TOKEN: Optional[str] = None
LOGGER: Any = logging.getLogger("uproot")
NO_ENTER: bool = False
ORIGIN: Optional[str] = os.getenv("UPROOT_ORIGIN")

# Auto-detect Heroku app URL if not explicitly set
Expand Down
1 change: 1 addition & 0 deletions src/uproot/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ async def render(
sname=sname,
thisis=thisis,
uname=uname,
no_enter=d.NO_ENTER,
)
| (metadata if metadata is not None else {})
)
Expand Down
Loading