Skip to content

Generate HTML string in headless mode from editor state #5266

Closed Answered by 2wheeh
JavoByte asked this question in Q&A
Discussion options

You must be logged in to vote

Hi folks, I'm struggling with same situation ✋🏻.

I'm trying with following code after seeing some issues about this situation:

function setUpDom() {
  const dom = new JSDOM();

  const _window = global.window;
  const _document = global.document;
  const _documentFragment = global.DocumentFragment;
  const _navigator = global.navigator;

  // @ts-ignore
  global.window = dom.window;
  global.document = dom.window.document;
  global.DocumentFragment = dom.window.DocumentFragment;
  global.navigator = dom.window.navigator;

  return () => {
    // @ts-ignore
    global.window = _window;
    global.document = _document;
    global.DocumentFragment = _documentFragment;
    global.navigator = _…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by JavoByte
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants