Skip to content

Conversation

@paleo
Copy link

@paleo paleo commented May 24, 2024

I needed to render a blot asynchronously. So I created a duplicated version of the converter (QuillDeltaToHtmlAsyncConverter) for asynchronous rendering.

Example:

import { QuillDeltaToHtmlAsyncConverter } from 'quill-delta-to-html'; 

const converter = new QuillDeltaToHtmlAsyncConverter(ops);

converter.renderCustomWith(async function(customOp, contextOp) {
    await // …
    return `<span id="${val.id}">${val.text}</span>`;
});

const html = await converter.convert();

@nozer Would you be interested if I refreshed your code? In this PR, I duplicated the code because it is old and I wasn't comfortable with refactoring. But here's what I plan to do in a second PR:

  • Upgrade all the dependencies
  • Lint with Biome
  • Test with Jest or Vitest
  • Use modern JS/TS (no var, etc.)
  • Remove the compiled files
  • If possible, rewrite the code in a way that async an sync code is written once (probably with functions & objects instead of classes)

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