Skip to content

Extract submission-via-ctrl-enter-everywhere from others - #5607

Merged
fregante merged 11 commits into
refined-github:mainfrom
darkred:allow-submission-via-ctrl-enter
May 1, 2022
Merged

fregante merged 11 commits into
refined-github:mainfrom
darkred:allow-submission-via-ctrl-enter

Conversation

@darkred

@darkred darkred commented Apr 20, 2022 •

Copy link
Copy Markdown
Contributor

This PR follows the suggestion by @fregante in #4252 (comment) i.e. extracts the addQuickSubmit() function (which adds ability to submit new/edited files via ctrl-enter) as a separate feature: allow-submission-via-ctrl-enter.

function addQuickSubmit(): void {
select('input#commit-summary-input')!.classList.add('js-quick-submit');
}

Not sure why we added this here. Doesn't this allow submission via ctrl-enter? It should be extracted to its own feature (and the shortcut should mention cmd on Mac )

Test URLs

Screenshot

Notes to reviewers:

  1. For reference, I originally got the above initial function from the create-release-shortcut feature, following yakov's suggestion in Add avoid-accidental-submissions feature #4252 (comment) :
    function addQuickSubmit(): void {
    select('textarea[aria-label="Describe this release"]')?.classList.add('js-quick-submit');
    }

     
  2. Maybe I should use isMac (with a ternary if) instead of 'ctrl/cmd enter': 'Publish a new/edited file', ?
    Can it be used when defining keyboard shortcuts ?
     
  3. Maybe the feature should be renamed to something more descriptive, e.g.
    allow-submission-with-ctrl-enter-when-publishing-files

@darkred darkred changed the title Extract addQuickSubmit() as a separate feature allow-submission-via-ctrl-enter Extract addQuickSubmit() as a separate feature: allow-submission-via-ctrl-enter Apr 20, 2022
@fregante

Copy link
Copy Markdown
Member

2. Maybe I should use isMac

Yes, it can be used there

3. Maybe the feature should be renamed to something more descriptive, e.g.

The feature should not be necessarily limited to files, we're just ensuring that GitHub’s own behavior is consistent. Maybe submission-via-ctrl-enter-everywere? There are more places where this can be enabled too, I think it doesn't work when editing releases.

Comment thread readme.md Resolved
@fregante fregante changed the title Extract addQuickSubmit() as a separate feature: allow-submission-via-ctrl-enter Extract allow-submission-via-ctrl-enter from avoid-accidental-submissions Apr 21, 2022
@darkred

darkred commented Apr 21, 2022 •

Copy link
Copy Markdown
Contributor Author
  1. Maybe I should use isMac

Yes, it can be used there

  1. Maybe the feature should be renamed to something more descriptive, e.g.

The feature should not be necessarily limited to files, we're just ensuring that GitHub’s own behavior is consistent. Maybe submission-via-ctrl-enter-everywere? There are more places where this can be enabled too, I think it doesn't work when editing releases.

Ok, so I now use the use of isMac and renamed it to submission-via-ctrl-enter-everywere. Thanks.

I also tested the former by changing the useragent in Chrome to Mac and it's working ok :

screenshot:

2022-04-21_194926

@darkred darkred changed the title Extract allow-submission-via-ctrl-enter from avoid-accidental-submissions Extract submission-via-ctrl-enter-everywere from avoid-accidental-submissions Apr 21, 2022
@darkred

darkred commented Apr 21, 2022 •

Copy link
Copy Markdown
Contributor Author

The feature should not be necessarily limited to files, we're just ensuring that GitHub’s own behavior is consistent. Maybe submission-via-ctrl-enter-everywere? There are more places where this can be enabled too, I think it doesn't work when editing releases.

Regarding the above, the currently used text for the created shortcut is "'Publish a new/edited file'".
As I noted in the OP, the addQuickSubmit() function also exists in the create-release-shortcut feature.
I don't know/haven't found in which other places to also enable this new feature.

@fregante

fregante commented Apr 21, 2022 •

Copy link
Copy Markdown
Member

Regarding the above, the currently used text for the created shortcut is "'Publish a new/edited file'".

We should drop it. GitHub does not show that shortcut anywhere else

As I noted in the OP, the addQuickSubmit() function also exists in the create-release-shortcut feature.

Good find! Let's move those selectors here too since it's identical.

@darkred

darkred commented Apr 21, 2022 •

Copy link
Copy Markdown
Contributor Author

We should drop it. GitHub does not show that shortcut anywhere else

Ok, I dropped the shortcut.

Good find! Let's move those selectors here too since it's identical.

I moved the selector.

@darkred darkred changed the title Extract submission-via-ctrl-enter-everywere from avoid-accidental-submissions Extract submission-via-ctrl-enter-everywhere from avoid-accidental-submissions Apr 21, 2022
Comment thread readme.md Resolved
darkred and others added 2 commits April 22, 2022 00:41
@fregante fregante changed the title Extract submission-via-ctrl-enter-everywhere from avoid-accidental-submissions Extract submission-via-ctrl-enter-everywhere from other features Apr 22, 2022
@cheap-glitch cheap-glitch added enhancement meta Related to Refined GitHub itself labels Apr 27, 2022
@fregante fregante changed the title Extract submission-via-ctrl-enter-everywhere from other features Extract submission-via-ctrl-enter-everywhere from others May 1, 2022
@fregante
fregante merged commit 65479e0 into refined-github:main May 1, 2022
@darkred
darkred deleted the allow-submission-via-ctrl-enter branch May 1, 2022 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

5 participants