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

Forward EditorContent ref #4396

Merged
merged 2 commits into from
Jan 2, 2024
Merged

Conversation

ehynds
Copy link
Contributor

@ehynds ehynds commented Aug 29, 2023

Please describe your changes

Allow passing a ref to EditorContent to imperatively access the underlying div element.

My use case is to apply line clamping CSS to the EditorContent div based on its height.

How did you accomplish your changes

  1. Forward a ref passed to EditorContentWithKey to PureEditorContent
  2. Attach the ref to the div element returned by PureEditorContent

How have you tested your changes

Manual testing by rendering EditorContent with a ref prop.

How can we verify your changes

Run this code and expect div to have a value:

<EditorContent ref={(div) => {
  console.log('EditorContent ref:', div);
} />

Remarks

EditorContent used to accept a ref but it broke in #4000. Prior to #4000 the value of ref was PureEditorContent:

<EditorContent
  ref={(editorContent) => {
    const div = editorContent.editorContentRef.current;
  }}
/>

I simplified the value in this PR to the underlying div element thinking that we don't need to expose the implementation details.

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

@ehynds ehynds marked this pull request as ready for review August 29, 2023 18:20
@netlify
Copy link

netlify bot commented Aug 29, 2023

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 54f7d94
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/64ee46649b1e9d0009827c8d
😎 Deploy Preview https://deploy-preview-4396--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ehynds
Copy link
Contributor Author

ehynds commented Sep 21, 2023

@bdbch @svenadlung thoughts?

Copy link
Contributor

@bdbch bdbch left a comment

Choose a reason for hiding this comment

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

LGTM - lets get it into a RC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants