Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mbajur opened this issue Dec 16, 2023 · 1 comment
Open
Labels

Comments

@mbajur
Copy link

mbajur commented Dec 16, 2023

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:

image

Which is this line:

image

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

@mbajur mbajur added the bug label Dec 16, 2023
@bolandrm
Copy link

Running into the same issue.

changing:

  isTune() {
    return true
  }

to:

  static get isTune() {
    return true
  }

resolves it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants