codex-team/editor.js

TypeError: Cannot read properties of undefined (reading 'isInternal')

Open

#2,563 opened on Dec 16, 2023

View on GitHub
 (3 comments) (0 reactions) (0 assignees)TypeScript (1,985 forks)batch import
good first issueissue for docs

Repository metrics

Stars
 (26,602 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hello! I'm trying to create a block tune for one of my apps, here is the code:

class MyBlockTune {
  constructor({ api }) {
    this.api = api;
  }

  isTune() {
    return true
  }

  render() {
    return [
      {
        icon: '<svg>...</svg>',
        label: 'Tune label',
        onActivate: () => { }
      }
    ]
  }
}

After activating it with:

{
  tools: {
    myBlockTune: MyBlockTune,
  },
  tunes: ['myBlockTune'],
}

Editor instance crashes with a following exception thrown:

Which is this line:

After investigating this line a bit with debugger, i can see that this.tunes.myBlockTune is not an instance of anything but is undefined instead.

Editor.js version: 2.28.2

Contributor guide