代码笔记

Prosemirror自定义视图

Dec. 14 · 1min

Prosemirror有三种自定义视图的方式

toDOM

pluginView

type PluginView = {
  // 每次编辑器状态(state)更新时都会调用
  update: (view: EditorView, prevState: EditorState) => void
  // Called when the view is destroyed or receives a state with different plugins.
  destroy: () => void
}

const myPlugin = new Plugin({
  view(view: EditorView) => PluginView,
});

nodeView

> cd ..