surmon-china / vue-codemirror

@codemirror code editor component for @vuejs

Home Page:https://github.surmon.me/vue-codemirror

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extensions Array has undefined item

kswzr opened this issue · comments

commented

Describe the bug

I've tried to use the codemirror example code from the README.md

When using this one, codemirror fails initalizing itself, with the given configuration.

The extensions var contains an array with an undefined element, which crashes on calling ext.extension in codemirror sourcecode.



export const createEditorState = ({ onUpdate, onChange, onFocus, onBlur, ...config }: CreateStateOptions) => {
  return EditorState.create({
    doc: config.doc,
    selection: config.selection,
    extensions: [
      ...(Array.isArray(config.extensions) ? config.extensions : [config.extensions]), // here is a undefined element..

Reproduction

Use the example code from the README.md

System Info

System:
    OS: macOS 13.0.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 185.20 MB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.19.1 - /opt/homebrew/opt/node@16/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.19.3 - /opt/homebrew/opt/node@16/bin/npm
  Browsers:
    Chrome: 110.0.5481.177
    Firefox: 110.0
    Safari: 16.1

Used Package Manager

yarn

Validations

  • Read the the documentation in detail.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
  • The provided reproduction is a minimal reproducible example of the bug.