Create Operation Messages plugin
Description
A plugin to pass arbitrary messages via Slate operations, for use with Yjs.
Example
const onMessage = jest.fn();
const editor = createPlateEditor({
plugins: [
createOpMessagesPlugin({
options: {
onMessage,
},
}) as any,
],
});
dispatchOpMessage(editor, 'create_user', { name: 'John' });
expect(onMessage).toHaveBeenLastCalledWith({
messageType: 'create_user',
data: { name: 'John' },
inverse: false,
});
editor.undo();
expect(onMessage).toHaveBeenLastCalledWith({
messageType: 'create_user',
data: { name: 'John' },
inverse: true,
});
editor.redo();
expect(onMessage).toHaveBeenLastCalledWith({
messageType: 'create_user',
data: { name: 'John' },
inverse: false,
});
⚠️ No Changeset found
Latest commit: 7498955ba73321f0bf48823cff9f8a0cf26e89cd
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| plate | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 22, 2023 7:27pm |