moderator-toolbox-nxg-for-reddit / modules/removalreasons/dom

modules/removalreasons/dom

Functions

createRemovalReasonsHandlers()

createRemovalReasonsHandlers(__namedParameters): RemovalReasonsHandlers

Defined in: extension/data/modules/removalreasons/dom.tsx:376

Creates the DOM handlers for the removal reasons module. Injects toolbox Remove buttons, registers an “Add removal reason” action link, and opens the removal overlay when a remove action is triggered.

Parameters

__namedParameters

RemovalReasonsSettings

Returns

RemovalReasonsHandlers


injectRemoveButton()

injectRemoveButton(thingId, subredditName, thingSlot): () => void

Defined in: extension/data/modules/removalreasons/dom.tsx:298

Hides the native Remove button for a thing and inserts a toolbox Remove button in its place. Returns a cleanup function that removes the injected button and restores the native one.

Parameters

thingId

string

Fullname of the thing (e.g. t3_xxx).

subredditName

string

Bare subreddit name (no r/ prefix).

thingSlot

Element

The thingActions slot element used to locate the thing in the DOM.

Returns

() => void


openRemovalOverlayForProposal()

openRemovalOverlayForProposal(__namedParameters): Promise<{ close: () => void; ok: true; } | { ok: false; reason: "error" | "no-reasons"; }>

Defined in: extension/data/modules/removalreasons/dom.tsx:152

Opens the removal-reasons overlay off-page to accept-with-edit a captured proposal: re-fetches the thing + the subreddit’s reasons, seeds the overlay from the proposal’s captured selection/usernote/ban/delivery, and performs the removal directly (passing an acceptGate puts the overlay in direct-perform mode and prevents re-capturing it). onAccepted fires after a successful removal so the caller can mark the proposal accepted.

Parameters

__namedParameters
acceptGate?

RemovalAcceptGate

Claim/release gate placing the overlay in direct-perform mode (see the overlay prop).

fullname

string

isComment

boolean

onAccepted

() => void

seededFromIntent

RemovalReasonsOverlayPreseed

subreddit

string

Returns

Promise<{ close: () => void; ok: true; } | { ok: false; reason: "error" | "no-reasons"; }>

{ok:true, close} when the overlay opened, or a typed failure.

Interfaces

RemovalReasonsHandlers

Defined in: extension/data/modules/removalreasons/dom.tsx:249

Event handler callbacks returned by createRemovalReasonsHandlers.

Properties

cleanup

cleanup: () => Promise<void>

Defined in: extension/data/modules/removalreasons/dom.tsx:253

Disposes the renderers registered by this factory. Pass to lifecycle.mount in index.ts.

Returns

Promise<void>

handleClick

handleClick: (event) => Promise<void>

Defined in: extension/data/modules/removalreasons/dom.tsx:251

Handles document-level click events that may open the removal reasons overlay.

Parameters
event

MouseEvent

Returns

Promise<void>