Skip to content

Commit 0dd3451

Browse files
committed
frontend/jupyter: add Clear Output option to individual cell context menu -- fixes #8569
1 parent 0ae2c0b commit 0dd3451

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/packages/frontend/jupyter/cell-buttonbar-menu.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useIntl } from "react-intl";
1111
import { alert_message } from "@cocalc/frontend/alerts";
1212
import { Icon } from "@cocalc/frontend/components";
1313
import { jupyter, labels } from "@cocalc/frontend/i18n";
14-
import { commands } from "./commands";
14+
import { commands, CLEAR_CELL_OUTPUT_LABEL } from "./commands";
1515
import {
1616
CODE_BAR_BTN_STYLE,
1717
COPY_CELL_ICON,
@@ -110,6 +110,13 @@ export function CodeBarDropdownMenu({ actions, frameActions, id, cell }) {
110110
onClick: pasteFromClipboard,
111111
},
112112
{ key: "divider5", type: "divider" },
113+
{
114+
key: "clear-output",
115+
label: intl.formatMessage(CLEAR_CELL_OUTPUT_LABEL),
116+
icon: <Icon name="battery-empty" />,
117+
onClick: () => frameActions.current?.clear_selected_outputs(),
118+
},
119+
{ key: "divider9", type: "divider" },
113120
{
114121
key: "cell-type",
115122
label: intl.formatMessage(jupyter.commands.cell_type_menu),
@@ -261,7 +268,7 @@ export function CodeBarDropdownMenu({ actions, frameActions, id, cell }) {
261268
onClick: () => frameActions.current?.delete_selected_cells(),
262269
},
263270

264-
{ key: "divider6", type: "divider" },
271+
{ key: "divider8", type: "divider" },
265272
{
266273
key: "split-cell",
267274
label: intl.formatMessage({

src/packages/frontend/jupyter/commands.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ import {
3636
SPLIT_CELL_ICON,
3737
} from "./consts";
3838

39+
export const CLEAR_CELL_OUTPUT_LABEL = defineMessage({
40+
id: "jupyter.cell-buttonbar-menu.clear-output",
41+
defaultMessage: "Clear Output",
42+
});
43+
3944
export interface KeyboardCommand {
4045
mode?: NotebookMode;
4146
which: number;

0 commit comments

Comments
 (0)