Skip to content

Commit 938adad

Browse files
committed
completely remove the "insert image" button/menu item for jupyter
- markdown editors (both slate and codemirror) already solve this problem better - and this attachment thing doesn't even work at all
1 parent bf463da commit 938adad

File tree

8 files changed

+0
-123
lines changed

8 files changed

+0
-123
lines changed

src/packages/frontend/frame-editors/jupyter-editor/cell-notebook/actions.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -984,15 +984,6 @@ export class NotebookFrameActions {
984984
}
985985
}
986986

987-
public insert_image(): void {
988-
const cur_id = this.store.get("cur_id");
989-
if (this.jupyter_actions.store.get_cell_type(cur_id) === "markdown") {
990-
this.jupyter_actions.insert_image(cur_id); // causes a modal dialog to appear.
991-
} else {
992-
throw Error(`insert_image -- cell must be a markdown cell`);
993-
}
994-
}
995-
996987
public toggle_selected_outputs(property: "collapsed" | "scrolled"): void {
997988
this.jupyter_actions.toggle_outputs(
998989
this.store.get_selected_cell_ids_list(),

src/packages/frontend/frame-editors/jupyter-editor/editor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ const JUPYTER_MENUS = {
320320
children: ["format cells", "format all cells"],
321321
},
322322
],
323-
"insert-image": ["insert image"],
324323
},
325324
view: {
326325
label: "View",

src/packages/frontend/jupyter/cell-input.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@ export const CellInput: React.FC<CellInputProps> = React.memo(
117117
);
118118
}
119119

120-
function handle_upload_click(): void {
121-
if (props.actions == null) {
122-
return;
123-
}
124-
props.actions.insert_image(props.id);
125-
}
126-
127120
function handle_md_double_click(): void {
128121
frameActions.current?.switch_md_cell_to_edit(props.cell.get("id"));
129122
}
@@ -208,14 +201,6 @@ export const CellInput: React.FC<CellInputProps> = React.memo(
208201
>
209202
<Icon name="edit" /> Edit
210203
</Button>
211-
<Button
212-
style={CODE_BAR_BTN_STYLE}
213-
size="small"
214-
type="text"
215-
onClick={handle_upload_click}
216-
>
217-
<Icon name="image" />
218-
</Button>
219204
<CellIndexNumber index={props.index} />
220205
</div>
221206
</div>

src/packages/frontend/jupyter/commands.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,6 @@ export function commands(actions: AllActions): {
434434
},
435435
},
436436

437-
"insert image": {
438-
i: "image",
439-
b: "Image",
440-
m: "Insert Images in Markdown Cell",
441-
f: () => actions.frame_actions?.insert_image(),
442-
},
443-
444437
"interrupt kernel": {
445438
i: "stop",
446439
b: "Stop",

src/packages/frontend/jupyter/insert-image.tsx

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/packages/frontend/jupyter/main.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import { ConfirmDialog } from "./confirm-dialog";
3737
import { EditAttachments } from "./edit-attachments";
3838
import { EditCellMetadata } from "./edit-cell-metadata";
3939
import { FindAndReplace } from "./find-and-replace";
40-
import { InsertImage } from "./insert-image";
4140
import { JupyterContext } from "./jupyter-context";
4241
import useKernelUsage from "./kernel-usage";
4342
import KernelWarning from "./kernel-warning";
@@ -169,8 +168,6 @@ export const JupyterEditor: React.FC<Props> = React.memo((props: Props) => {
169168
]);
170169
const path: undefined | string = useRedux([name, "path"]);
171170
const cell_toolbar: undefined | string = useRedux([name, "cell_toolbar"]);
172-
// show insert image dialog
173-
const insert_image: undefined | string = useRedux([name, "insert_image"]);
174171
const edit_attachments: undefined | string = useRedux([
175172
name,
176173
"edit_attachments",
@@ -336,19 +333,6 @@ export const JupyterEditor: React.FC<Props> = React.memo((props: Props) => {
336333
);
337334
}
338335

339-
function render_insert_image() {
340-
if (insert_image == null || project_id == null) {
341-
return;
342-
}
343-
return (
344-
<InsertImage
345-
actions={actions}
346-
project_id={project_id}
347-
insert_image={insert_image}
348-
/>
349-
);
350-
}
351-
352336
function render_edit_attachments() {
353337
if (edit_attachments == null || cells == null) {
354338
return;
@@ -427,7 +411,6 @@ export const JupyterEditor: React.FC<Props> = React.memo((props: Props) => {
427411
<>
428412
{render_about()}
429413
{render_nbconvert()}
430-
{render_insert_image()}
431414
{render_edit_attachments()}
432415
{render_edit_cell_metadata()}
433416
{render_find_and_replace()}

src/packages/jupyter/redux/actions.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,16 +2094,6 @@ export abstract class JupyterActions extends Actions<JupyterStoreState> {
20942094
); // case to bool
20952095
};
20962096

2097-
public insert_image(id: string): void {
2098-
if (this.check_edit_protection(id, "inserting an image")) {
2099-
return;
2100-
}
2101-
if (this.store.get_cell_type(id) != "markdown") {
2102-
throw Error("must be a markdown cell -- id " + id);
2103-
}
2104-
this.setState({ insert_image: id }); // causes a modal dialog to appear.
2105-
}
2106-
21072097
scroll(pos): any {
21082098
this.deprecated("scroll", pos);
21092099
}

src/packages/jupyter/redux/store.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export interface JupyterStoreState {
7171
find_and_replace: any;
7272
has_uncommitted_changes?: boolean;
7373
has_unsaved_changes?: boolean;
74-
insert_image: string; // id of a markdown cell
7574
introspect: any;
7675
kernel_error?: string;
7776
kernel_info?: any;

0 commit comments

Comments
 (0)