Невозможно вставить изображения, используя slate-drop-or-paste-images - PullRequest
0 голосов
/ 07 октября 2019

Я установил пакет slate-drop-or-paste-images, и он, похоже, не работает. Изображения являются пустыми элементами span при вставке. Есть ли что-то фундаментальное, чего мне не хватает в моем редакторе?

Мой код такой, как показано ниже.

const plugins = [
  MarkHotkey({ key: 'b', type: 'bold' }),
  MarkHotkey({ key: '`', type: 'code' }),
  MarkHotkey({ key: 'i', type: 'italic' }),
  MarkHotkey({ key: '~', type: 'strikethrough' }),
  MarkHotkey({ key: 'u', type: 'underline' }),
  Lists({
  blocks: {
    ordered_list: "ordered-list",
    unordered_list: "unordered-list",
    list_item: "list-item",
  },
  classNames: {
    ordered_list: "ordered-list",
    unordered_list: "unordered-list",
    list_item: "list-item"
  }
}),
   InsertImages({
    extensions: ['png','jpg','gif'],
    insertImage: (change, file) => {
      return change.insertBlock({
        type: 'image',
        isVoid: true,
        data: { file }
      })
    }
  })
]



<Editor 
                     plugins={plugins}
                     schema={schema}
                     value={this.state.value}
                     ref={editor => this.editor = editor}
                     onChange={(value)=>this.onChange(value)}
                     renderNode={(props, editor, next)=>this.renderNode(props,editor,next)}
                     renderBlock={(props, editor, next)=>this.renderBlock(props, editor, next)}
                     renderMark={(props, editor, next)=>this.renderMark(props, editor, next)} />

В моей функции блока визуализации я не могу получить доступ к данным src из объекта узла.

...