CM created from linked doc is not updating display

I’ve got a working CM editor, whose document I’d like to link so that it is displayed inside another editor. The code I’m using is:

  // create a wrapper element for the CM clone
  var cloneDOM = document.createElement('div');
  cloneDOM.id  = "printedCM";
  cloneDOM.style.height = "auto";
  document.getElementById('middle').appendChild(cloneDOM);
  // create the clone, using the wrapper element and a linked doc from the current editor
  var clone    = new CodeMirror(cloneDOM, {value: editor.getDoc().linkedDoc()});
  // copy lineNumber settings
  clone.setOption("lineNumbers", this.editor.getOption("lineNumbers"));

I can confirm that clone.getValue() always produces the text contained in editor.getValue(), so I know the doc is being updated. However, the cloneDOM instance always shows a blank editor, even after I call clone.refresh().

I’m also fairly certain this worked in CM4. Am I missing something obvious? Has something changed from v4->v5?

Thanks so much,
Emmanuel

The multi-buffer demo still seems to work. Can you create a self-contained example that shows the problem?

Sorry for the delay in writing back - I have no good explanation for why this code failed before, but it seems to be working now. I’m going to blame the browser cache because I truly have no other explanation. :confounded: