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

Make getPathToSource configurable as a prop #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dariocravero
Copy link

We have a use case in which some of our React components are actually morphed from another file type. By exposing that prop we can replace the file name and open the real source instead.

Thanks for making this component! It's super handy. :)

@changeset-bot
Copy link

changeset-bot bot commented Apr 27, 2022

⚠️ No Changeset found

Latest commit: 5c5234e

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

Copy link
Owner

@ericclemmons ericclemmons left a comment

Choose a reason for hiding this comment

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

Thanks for opening this PR!

Do you think #29 and this have some overlap?

getPathToSource addresses your need, while #29 wants to avoid the default window.open behavior.

It sounds like a handler like onOpenComponent({ editor, source }) would let you craft the correct URL and open it?

(But then you'd be responsible for window.open 🤔 )

Now that I type it out, this PR makes sense on it's own I think :D

Ok, let me get back to reviewing!

@dariocravero
Copy link
Author

I'll be alright with having an onOpenComponent/onOpenFile prop too like in #29 btw. I agree that it could then be used for other integrations other than text editors as @frantic said.

@frantic
Copy link
Contributor

frantic commented Apr 28, 2022

Let's roll with onOpenComponent? The downside that the user of this code would have to format the file path and call window.open themselves but I think it's okay, just a more advanced option. I'll update the PR

@dariocravero
Copy link
Author

dariocravero commented Apr 29, 2022 via email

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