MCPcopy Index your code
hub / github.com/refined-github/refined-github / addQuickEditButton

Function addQuickEditButton

source/features/quick-comment-edit.tsx:30–52  ·  view source on GitHub ↗
(menuButon: HTMLButtonElement, {signal}: SignalAsOptions)

Source from the content-addressed store, hash-verified

28const editMenuItemSelector = 'li[data-component="ActionList.Item"]:has(.octicon-pencil)';
29
30async function addQuickEditButton(menuButon: HTMLButtonElement, {signal}: SignalAsOptions): Promise<void> {
31 if (await isConversationIneditable(signal)) {
32 features.unload(import.meta.url);
33 return;
34 }
35
36 const editButton = tooltipped('Edit comment',
37 <button
38 type="button"
39 className="Button Button--iconOnly Button--invisible Button--small"
40 onClick={async () => withMenuOpen(menuButon, menu => {
41 $(editMenuItemSelector, menu).click();
42 })}
43 >
44 <PencilIcon />
45 </button>,
46 );
47 menuButon.before(editButton);
48
49 // Remove our edit button when entering editing mode in case React doesn't, preventing duplicate buttons where only one works
50 await onElementRemoval(menuButon, signal);
51 editButton.remove();
52}
53
54async function addQuickEditButtonLegacy(commentDropdown: HTMLDetailsElement, {signal}: SignalAsOptions): Promise<void> {
55 if (await isConversationIneditable(signal)) {

Callers

nothing calls this directly

Calls 3

tooltippedFunction · 0.85
withMenuOpenFunction · 0.85
removeMethod · 0.80

Tested by

no test coverage detected