fix(view): clear Execution output from the view surface

Add an Execution Clear button and clear the Execution out/plots/plan card in addition to code-cell outputs. The same clearOutputs path calls /api/session/clear, so ordinary stateless pages and foreign sessions are both wired.
This commit is contained in:
cflmy committed 2026-10-18 12:47:56 +08:00
1 parent fb28eee62f
commit bff2f53e52
2 files changed
+29 -3

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
### Added
- **foreign 拥有视图会话**:新增 `foreign.session kernels= cells=`,返回 foreign 会话句柄;`view` 只消费 `会话` 绑定,不再识别 `内核表` / `会话表` 保留名。没有 `会话` 时,view cells 使用无状态一次性执行,不创建内核。清除输出已接通 `/api/session/clear`,普通 view 与 foreign cells 共用;移除 `In []` / `Out []` 与 Notebook 品牌;没有新增 CLI 或第二个交互模式。
- **foreign 拥有视图会话**:新增 `foreign.session kernels= cells=`,返回 foreign 会话句柄;`view` 只消费 `会话` 绑定,不再识别 `内核表` / `会话表` 保留名。没有 `会话` 时,view cells 使用无状态一次性执行,不创建内核。清除输出已接通 `/api/session/clear`,普通 view 与 foreign cells 共用,并由 Execution 面板的 Clear 按钮清除页面输出;移除 `In []` / `Out []` 与 Notebook 品牌;没有新增 CLI 或第二个交互模式。
### Fixed
+28 -2
View File
@@ -625,6 +625,24 @@ ul.doc-loop, ol.doc-branch {
border-radius: 10px;
border: 1px solid transparent;
}
.exec-clear {
float: right;
font: inherit;
font-size: 0.72rem;
padding: 0.2rem 0.6rem;
border: 1px solid var(--line);
border-radius: 999px;
background: var(--surface);
color: var(--muted);
cursor: pointer;
}
.exec-clear:hover { color: var(--ink); border-color: var(--muted); }
body.notebook-page .exec-clear {
border-color: var(--nb-border);
background: var(--nb-surface-2);
color: var(--nb-text);
}
body.notebook-page .exec-clear:hover { border-color: var(--nb-accent); color: var(--nb-strong); }
.out, .source {
font-family: var(--mono);
font-size: 0.82rem;
@@ -3627,6 +3645,13 @@ body.notebook-page .stdin-form button {
});
var exec = document.getElementById("exec-main");
if (exec) { exec.hidden = true; exec.textContent = ""; }
var execBlock = document.getElementById("exec-block");
if (execBlock) {
execBlock.querySelectorAll(".plots, .plan-card").forEach(function (el) {
el.hidden = true;
el.innerHTML = "";
});
}
var stateOut = document.getElementById("nb-state-out");
if (stateOut) { stateOut.hidden = true; stateOut.textContent = ""; }
var pullOut = document.getElementById("nb-pull-out");
@@ -3719,6 +3744,7 @@ body.notebook-page .stdin-form button {
window.open("debug?path=" + encodeURIComponent(path), "_blank");
});
bind("nb-clear", clearOutputs);
bind("exec-clear", clearOutputs);
bind("nb-reload", function () {
post("api/session/reload", {}).then(function (r) {
if (!r.ok) { status(r.error || "reload failed"); return; }
@@ -3906,8 +3932,8 @@ window.MARQDO_AUTO_STREAM = {auto_stream};
<h2>Structure</h2>
{structure_block}
</section>
<section class="block exec-block">
<h2>Execution</h2>
<section class="block exec-block" id="exec-block">
<h2>Execution <button type="button" class="exec-clear" id="exec-clear">Clear</button></h2>
{stdin_panel}
{stream_panel}
{plan_card}