MCPcopy Create free account
hub / github.com/TryCatchLearn/Overflow / onUpdate

Function onUpdate

webapp/src/components/rte/RichTextEditor.tsx:33–53  ·  view source on GitHub ↗
({editor})

Source from the content-addressed store, hash-verified

31 onBlur()
32 },
33 onUpdate({editor}) {
34 const html = editor.getHTML();
35 onChange(html);
36
37 const currentPublicIds = extractPublicIdsFromHtml(html);
38 const prev = prevPublicIds.current;
39
40 const deleted = prev.filter(id => !currentPublicIds.includes(id));
41
42 if (deleted.length > 0) {
43 deleted.forEach(publicId => {
44 fetch('/api/delete-image', {
45 method: 'POST',
46 headers: { 'Content-type': 'application/json' },
47 body: JSON.stringify(publicId),
48 }).then(() => console.log('deleted ' + publicId));
49 });
50 }
51
52 prevPublicIds.current = currentPublicIds;
53 },
54 immediatelyRender: false,
55 })
56

Callers

nothing calls this directly

Calls 1

extractPublicIdsFromHtmlFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…