Skip to content

Conversation

pabzm
Copy link

@pabzm pabzm commented Aug 26, 2025

This allows to include images without uploading them onto a server first. Instead their content is specified inline in a data-URI https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data.

Example of an imageUploadFunction that takes advantage of this:

(file, onSuccess, onError) => {
    const reader = new FileReader();
    reader.addEventListener('load', () => onSuccess(reader.result));
    reader.addEventListener('error', (event) => onError(event));
    reader.addEventListener('abort', (event) => onError(event));
    reader.readAsDataURL(file);
}

This allows to include images without uploading them onto a server first. Instead their content is specified inline in a
data-URI <https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data>.

Example of an `imageUploadFunction` that takes advantage of this:

(file, onSuccess, onError) => {
    const reader = new FileReader();
    reader.addEventListener('load', () => onSuccess(reader.result));
    reader.addEventListener('error', (event) => onError(event));
    reader.addEventListener('abort', (event) => onError(event));
    reader.readAsDataURL(file);
}
@pabzm
Copy link
Author

pabzm commented Aug 26, 2025

This appears to break cypress/e2e/4.image-rendering/image-rendering.cy.js:12 ("must render an image inside the editor").

I'm at a loss about the reason, though, since the inserted syntax is the same as before, as far as I can see. Do you maybe have a hint why the test fails?

Nevermind, subsequent test runs are green. Seems to have been a glitch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant