summaryrefslogtreecommitdiff
path: root/source/features/clean-rich-text-editor.tsx
blob: bc3c1fc68a53981a1b6db2ea105406691a73b9f7 (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
import './clean-rich-text-editor.css';
import select from 'select-dom';
import onetime from 'onetime';
import * as pageDetect from 'github-url-detection';

import features from '.';

function hideButtons(): void {
	document.body.classList.add('rgh-clean-rich-text-editor');
}

function hideTextareaTooltip(): void {
	for (const textarea of select.all('.comment-form-textarea')) {
		textarea.title = '';
	}
}

void features.add(__filebasename, {
	include: [
		pageDetect.hasRichTextEditor,
	],
	deduplicate: 'has-rgh-inner',
	init: hideTextareaTooltip,
}, {
	include: [
		pageDetect.isRepo,
	],
	awaitDomReady: false,
	init: onetime(hideButtons),
});