Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix plate store id with editor prop #2881

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

johnrazeur
Copy link
Contributor

Description

When we use the editor prop to instantiate Plate, we have a desynchronization between the editor id and the id in the plate store.

Plugin like Mention can't work because we check the editorId and the focusedEditorId:

const focusedEditorId = useEventEditorSelectors.focus?.() // undefined
const editorId = usePlateSelectors().id()

if (
  focusedEditorId !== editorId
) {
  return null
}

Without this fix, we need to set the editor id and the plate id with the same value:

const editor = createPlateEditor({
  id: 'test',
})

return (
  <Plate id="test" editor={editor}>
    // ...
  </Plate>
)

Copy link

changeset-bot bot commented Jan 14, 2024

🦋 Changeset detected

Latest commit: eeb2ec3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 50 packages
Name Type
@udecode/plate-core Patch
@udecode/plate-common Patch
@udecode/plate-utils Patch
@udecode/plate-alignment Patch
@udecode/plate-autoformat Patch
@udecode/plate-basic-elements Patch
@udecode/plate-basic-marks Patch
@udecode/plate-block-quote Patch
@udecode/plate-break Patch
@udecode/plate-caption Patch
@udecode/plate-cloud Patch
@udecode/plate-code-block Patch
@udecode/plate-combobox Patch
@udecode/plate-comments Patch
@udecode/plate-cursor Patch
@udecode/plate-dnd Patch
@udecode/plate-emoji Patch
@udecode/plate-excalidraw Patch
@udecode/plate-find-replace Patch
@udecode/plate-floating Patch
@udecode/plate-font Patch
@udecode/plate-heading Patch
@udecode/plate-highlight Patch
@udecode/plate-horizontal-rule Patch
@udecode/plate-indent-list Patch
@udecode/plate-indent Patch
@udecode/plate-juice Patch
@udecode/plate-kbd Patch
@udecode/plate-line-height Patch
@udecode/plate-link Patch
@udecode/plate-list Patch
@udecode/plate-media Patch
@udecode/plate-mention Patch
@udecode/plate-node-id Patch
@udecode/plate-normalizers Patch
@udecode/plate-paragraph Patch
@udecode/plate Patch
@udecode/plate-reset-node Patch
@udecode/plate-resizable Patch
@udecode/plate-select Patch
@udecode/plate-selection Patch
@udecode/plate-serializer-csv Patch
@udecode/plate-serializer-docx Patch
@udecode/plate-serializer-html Patch
@udecode/plate-serializer-md Patch
@udecode/plate-suggestion Patch
@udecode/plate-tabbable Patch
@udecode/plate-table Patch
@udecode/plate-trailing-block Patch
@udecode/plate-yjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 14, 2024

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 Jan 14, 2024 10:57am

@zbeyens zbeyens merged commit 902aab8 into udecode:main Jan 14, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants