({editor})
| 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…