<commit_before>import select from 'select-dom';
import delegate from 'delegate-it';
import * as pageDetect from 'github-url-detection';

import features from '.';

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

function onKeyDown(event: delegate.Event<KeyboardEvent, HTMLInputElement>): void {
	if (
		event.key !== 'Enter' ||
		event.ctrlKey ||
		event.metaKey ||
		event.isComposing || // #4323
		select.exists('.suggester', event.delegateTarget.form!) // GitHub’s autocomplete dropdown
	) {
		return;
	}

	event.preventDefault();
	select([
		'#issue_body',
		'#pull_request_body',
		'#commit-description-textarea',
		'#merge_message_field'
	], event.delegateTarget.form!)!.focus();
}

function init(): void {
	delegate(document, [
		'input#issue_title',
		'input#pull_request_title',
		'input#commit-summary-input',
		'#merge_title_field'
	].join(), 'keydown', onKeyDown);
}

void features.add(__filebasename, {
	include: [
		pageDetect.isNewIssue,
		pageDetect.isCompare,
		pageDetect.isNewFile,
		pageDetect.isEditingFile,
		pageDetect.isPRConversation
	],
	init
}, {
	shortcuts: {
		'ctrl enter': 'Publish a new/edited file'
	},
	include: [
		pageDetect.isNewFile,
		pageDetect.isEditingFile
	],
	init: addQuickSubmit
});
<commit_msg>Disable `avoid-accidental-submissions` when editing the title of existing PRs (#4528)<commit_after>import select from 'select-dom';
import delegate from 'delegate-it';
import * as pageDetect from 'github-url-detection';

import features from '.';

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

function onKeyDown(event: delegate.Event<KeyboardEvent, HTMLInputElement>): void {
	if (
		event.key !== 'Enter' ||
		event.ctrlKey ||
		event.metaKey ||
		event.isComposing || // #4323
		select.exists('.suggester', event.delegateTarget.form!) // GitHub’s autocomplete dropdown
	) {
		return;
	}

	event.preventDefault();
	select([
		'#issue_body',
		'#pull_request_body',
		'#commit-description-textarea',
		'#merge_message_field'
	], event.delegateTarget.form!)!.focus();
}

function init(): void {
	delegate(document, [
		'form.new_issue input#issue_title',
		'input#pull_request_title',
		'input#commit-summary-input',
		'#merge_title_field'
	].join(), 'keydown', onKeyDown);
}

void features.add(__filebasename, {
	include: [
		pageDetect.isNewIssue,
		pageDetect.isCompare,
		pageDetect.isNewFile,
		pageDetect.isEditingFile,
		pageDetect.isPRConversation
	],
	init
}, {
	shortcuts: {
		'ctrl enter': 'Publish a new/edited file'
	},
	include: [
		pageDetect.isNewFile,
		pageDetect.isEditingFile
	],
	init: addQuickSubmit
});

{'fraction_non_alphanumeric': 0.15224656516895654, 'fraction_numerical': 0.004455997029335313, 'mean_word_length': 5.013392857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1782989', 'n_tokens_mistral': 1004, 'n_tokens_neox': 917, 'n_words': 164}