Issue #1304Opened July 23, 2018by sanskipk0 reactions

"CanvasView.frame.el.contentDocument is null" in angular4

Question

Hi I integrated grapejs with angular4.I added custom button.After click on edit button throwing error:- TypeError ​ columnNumber: 7 ​ fileName: "http://localhost:4200/vendor.js" ​ lineNumber: 78800 ​ message: "CanvasView.frame.el.contentDocument is null" ngOnInit() { console.log('oninit')

 this.editor  = grapesjs.init({
        allowScripts: 1,
        showOffsets: 1,
        autorender: 0,
        noticeOnUnload: 0,
Code SnippetTEXT
container  : '#gjs',
            height: '100%',
            fromElement: true,
            clearOnRender: 0,
            storageManager: {autoload: 0},

          });
  }

  // edit(){
  //   console.log('edit',this.editor)
  //   this.editor.runCommand('sw-visibility');
  //   this.nameModel='hello grapes edit !'
  //   this.editor.render();
  // }
  editBtn(){
    console.log('editBtn',this.editor)
    //this.editor.setComponents(this.editor.getHtml())
    this.editor.runCommand('sw-visibility');
    document.getElementById("preview").style.display = "block";
    document.getElementById("edit").style.display = "none";
  }
![image](https://user-images.githubusercontent.com/41565928/43061645-a446decc-8e73-11e8-9718-ab9c2ce5df47.png)

Thanks,
sandeep kumar.

Answers (2)

artfJuly 26, 20180 reactions

There is a very similar issue #1288 please discuss it here. BTW I'd need a minimal live demo for such a case

lock[bot]September 17, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.