'TypeError: Cannot read properties of undefined (reading 'append') in Grapesjs

Working in Grapesjs Component

  // Append components directly to the canvas
  editor.addComponents(`<div>
                       
                         <span title="foo">Hello world!!!</span>
                       </div>`);

  // or into some, already defined, component.
 // For instance, appending to a selected component would be:
 editor.getSelected().append(`<div> 
              <span>Hello My Append Component</span>
        </div>`);

when I using append get this error



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source