blob: 2eb3d333cdc9a801fe2f210f82ee2b90bc92c7d1 [file] [log] [blame]
import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
import {
NodeMutation,
NodeMutationType,
} from '../../../../presentation/nodeWatcher/NodeWatcherHandler';
import FlattenThreads from '../../core/flattenThreads';
/** Readd reply button when the Community Console removes it */
export default class FlattenThreadsReaddReplyBtnHandler extends CssSelectorNodeWatcherHandler {
cssSelector = 'twpt-flatten-thread-reply-button';
mutationTypesProcessed = [NodeMutationType.RemovedNode];
constructor(private flattenThreads: FlattenThreads) {
super();
}
onMutatedNode({ node, mutationRecord }: NodeMutation<HTMLElement>) {
this.flattenThreads.injectReplyBtn(
mutationRecord.target,
JSON.parse(node.getAttribute('extraInfo')),
);
}
}