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

feat: Forward ref from <Editable /> #5681

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

yf-yang
Copy link
Contributor

@yf-yang yf-yang commented Jul 14, 2024

Description
Forward ref from <Editable />

Issue
Fixes: #4082 udecode/plate#3362

Checks

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • The relevant examples still work. (Run examples with yarn start.)
  • You've added a changeset if changing functionality. (Add one with yarn changeset add.)

Copy link

changeset-bot bot commented Jul 14, 2024

🦋 Changeset detected

Latest commit: 75f9548

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

This PR includes changesets to release 1 package
Name Type
slate-react Minor

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
Contributor Author

@yf-yang yf-yang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes are marked, others are prettier formatting

@@ -8,6 +8,7 @@ import React, {
useReducer,
useRef,
useState,
ForwardedRef,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type import

[]
)
export const Editable = React.forwardRef(
(props: EditableProps, forwardedRef: ForwardedRef<HTMLDivElement>) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converts to forwardRef

} else if (forwardedRef) {
forwardedRef.current = node
}
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forward the ref in the callbackRef

scheduleOnDOMSelectionChange,
editor,
onDOMBeforeInput,
forwardedRef,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add forwardedRef to the dependency array

@yf-yang yf-yang marked this pull request as ready for review July 14, 2024 14:43
@yf-yang
Copy link
Contributor Author

yf-yang commented Jul 14, 2024

🤔 Any hints of the broken workflow? I can execute yarn build locally.

@dylans
Copy link
Collaborator

dylans commented Jul 15, 2024

🤔 Any hints of the broken workflow? I can execute yarn build locally.

for some reason the website is failing to build... I'll look asap.

Copy link
Collaborator

@dylans dylans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making a small tweak to retrigger the CI.

packages/slate-react/src/components/editable.tsx Outdated Show resolved Hide resolved
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.

[Editable] forwardRef
2 participants