MCPcopy Index your code
hub / github.com/resend/react-email / addCommands

Function addCommands

packages/editor/src/plugins/image/extension.tsx:33–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 },
32
33 addCommands() {
34 return {
35 setImage:
36 (attrs) =>
37 ({ commands }) => {
38 return commands.insertContent({
39 type: this.name,
40 attrs,
41 });
42 },
43
44 uploadImage:
45 () =>
46 ({ editor }) => {
47 const input = document.createElement('input');
48 input.type = 'file';
49 input.accept = 'image/*';
50 input.onchange = () => {
51 const file = input.files?.[0];
52 if (file) {
53 void executeUploadFlow({
54 editor,
55 file,
56 uploadImage: options.uploadImage,
57 });
58 }
59 };
60 input.click();
61 return true;
62 },
63 };
64 },
65
66 addProseMirrorPlugins() {
67 const { editor } = this;

Callers

nothing calls this directly

Calls 1

executeUploadFlowFunction · 0.90

Tested by

no test coverage detected