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

Alter behaviour of default actions/roles e.g. when copying a link #43

Closed
jarivo opened this issue Jun 27, 2017 · 4 comments · Fixed by #44
Closed

Alter behaviour of default actions/roles e.g. when copying a link #43

jarivo opened this issue Jun 27, 2017 · 4 comments · Fixed by #44

Comments

@jarivo
Copy link
Contributor

jarivo commented Jun 27, 2017

Hi,

This issue is related to #14, but I think it is appropriate to discuss it separately.

The specific use case for altering the behaviour of the default roles is found in Caprine.
Currently it is impleted that clicking on links removes the tracking bits from the URL.
This is not the case when using the context-menu (e.g. "Copy Link").
Therefore it would be useful to be able to modify the content of that link without the need to rewrite some of the boilerplate.

Thoughts?

@sindresorhus
Copy link
Owner

I agree with the problem, do you have any suggestions on how we could solve this?

@jarivo
Copy link
Contributor Author

jarivo commented Jun 27, 2017

With the solution defined in #14, I think a simple callback won't be possible with the "enums".

I will try and start implementing #14 (in the coming days) and maybe things will become clearer down the road.

@sindresorhus
Copy link
Owner

sindresorhus commented Jun 27, 2017

@jarivo Sure, it could. We could make x.COPY => x.COPY({transform: url => url.replace()}), but not sure it's the best solution. Maybe we could have a hook option function that receives every action and is able to modify it or something.

I will try and start implementing #14 (in the coming days)

🤗

@jarivo
Copy link
Contributor Author

jarivo commented Jun 27, 2017

I personally prefer your first suggestion, it is clean and "future-proof" for extra options which might be action-specific. If they want a general hook function, they can by adding it as a transform for each of them.

The second suggestion is less work on our side, but I think it would become messy when someone needs to implement custom behaviour for all of them. Sure it is much easier when you want to manipulate all incoming text/urls/strings (e.g. replacing http with https)

So I think both of them have some use cases, but the first one seems less of a hurdle for the end user.

This was referenced Jul 2, 2017
sindresorhus pushed a commit that referenced this issue Apr 9, 2019
Fixes #14 
Fixes #43

Co-authored-by: Joni Van Roost <joni.vanroost@student.kdg.be>
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 a pull request may close this issue.

2 participants