Skip to content
Discussion options

You must be logged in to vote

Correct—DOM event handlers like onPaste and onDrop are still supported, but only in the React version of plugins (PlatePlugin), not in SlatePlugin. In PlatePlugin, you can use the handlers option to add DOM event handlers directly in your plugin config, for example:

const MyPlugin = createPlatePlugin({
  key: 'my-plugin',
  handlers: {
    onPaste: ({ editor, event }) => {
      // custom paste logic
    },
    onDrop: ({ editor, event }) => {
      // custom drop logic
    },
  },
});

This is documented in the plugin event handlers section and enforced in the PlatePlugin TypeScript types. SlatePlugin only supports onNodeChange and onTextChange, so DOM event logic must be handled at the …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@dosubot
Comment options

Answer selected by zbeyens
@MathiasGretland
Comment options

@zbeyens
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants