codex-team/editor.js

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

開放

#2,563 建立於 2023年12月16日

 (3 則留言) (0 個反應) (0 位負責人)TypeScript (1,985 個分叉)batch import
good first issueissue for docs

倉庫指標

星標
 (26,602 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

貢獻者指南