-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add hasFooEditor
#105
Add hasFooEditor
#105
Conversation
@fregante Just curious, is there anything preventing this repo from migrating to @refined-github? Or do you simply prefer to keep it as-is? |
Good idea, I think it'd be better to add I chose not to migrate it for now |
Sounds good, breaking changes matter. I do consider the name a little bit weird though. Regardless of how this is going, |
"Weird" in the sense that there's no "file editor" page. Is "hasFileEditor" better? |
index.ts
Outdated
@@ -298,16 +298,37 @@ collect.set('isEditingFile', [ | |||
'https://github.com/sindresorhus/refined-github/edit/ghe-injection/source/background.ts', | |||
]); | |||
|
|||
export const hasFileEditor = (url: URL | HTMLAnchorElement | Location = location): boolean => isEditingFile(url) || isNewFile(url) || isDeletingFile(url); | |||
collect.set('hasFileEditor', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also mark them as combinedTestOnly
to avoid having to list the URLs. But it's fine either way
You can merge this PR, I added you as a collab. You can release a new minor version: https://github.com/fregante/github-url-detection/actions/workflows/npm-publish.yml
|
I will try to move this repo to the organization, but I have to set up redirects for the github.io domain, change the meta, and then ensure that the secrets still work. You can help by opening a PR to make the meta changes (fregante/github-url-detection -> refined-github/github-url-detection) Ideally we'd also have the same npm auto-publishing setup on the other repository, so PR welcome there too to copy the workflow. |
Reason: both kind of pages are almost identical ("editing something").
While both are frequently used together, sometimes
isNewFoo
is easily left out since it's a special case that doesn't matter most of the time.To replicate the old behavior ofisEditingFoo
, useisEditingFoo() && !isNewFoo()
.We need some utils to check for these pages at the same time.
Changes:
hasFileEditor
:isEditingFile
,isNewFile
andisDeletingFile
hasReleaseEditor
:isEditingRelease
andisNewRelease
hasWikiPageEditor
:isEditingWikiPage
andisNewWikiPage
hasRichTextEditor
checks forhasReleaseEditor
instead ofisEditingRelease