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

Function removeImageBySrc

packages/editor/src/plugins/image/upload-flow.ts:72–89  ·  view source on GitHub ↗
(editor: Editor, src: string)

Source from the content-addressed store, hash-verified

70}
71
72function removeImageBySrc(editor: Editor, src: string): void {
73 const { state } = editor;
74 const { tr } = state;
75 let found = false;
76
77 state.doc.descendants((node, pos) => {
78 if (found) return false;
79 if (node.type.name === 'image' && node.attrs.src === src) {
80 tr.delete(pos, pos + node.nodeSize);
81 found = true;
82 return false;
83 }
84 });
85
86 if (found) {
87 editor.view.dispatch(tr);
88 }
89}

Callers 1

executeUploadFlowFunction · 0.85

Calls 1

dispatchMethod · 0.80

Tested by

no test coverage detected