blob: 8d9d7090a3de6367c7736a82e677450e34cb7a52 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import './suggest-commit-title-limit.css';
import type {DelegateEvent} from 'delegate-it';
import * as pageDetect from 'github-url-detection';
import features from '../feature-manager.js';
import onCommitTitleUpdate from '../github-events/on-commit-title-update.js';
function validateInput({delegateTarget: field}: DelegateEvent<Event, HTMLInputElement>): void {
field.classList.toggle('rgh-title-over-limit', field.value.length > 72);
}
function init(signal: AbortSignal): void {
document.body.classList.add('rgh-suggest-commit-title-limit');
onCommitTitleUpdate(validateInput, signal);
}
void features.add(import.meta.url, {
include: [
pageDetect.isEditingFile,
pageDetect.isPRConversation,
],
init,
});
/*
# Test data
## Commit title
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123
## URLs
- Any mergeable PR
- https://github.com/refined-github/sandbox/pull/8
- Any editable file
- https://github.com/refined-github/refined-github/edit/main/readme.md
*/
|