Page MenuHomePhabricator

D7824.diff
No OneTemporary

D7824.diff

diff --git a/web/utils/tooltip-action-utils.js b/web/utils/tooltip-action-utils.js
--- a/web/utils/tooltip-action-utils.js
+++ b/web/utils/tooltip-action-utils.js
@@ -28,6 +28,7 @@
type TooltipSize,
type TooltipPosition,
} from './tooltip-utils.js';
+import { useEditModalContext } from '../chat/edit-message-provider.js';
import MessageTooltip from '../chat/message-tooltip.react.js';
import type { PositionInfo } from '../chat/position-types.js';
import { useTooltipContext } from '../chat/tooltip-provider.js';
@@ -231,25 +232,42 @@
threadInfo: ThreadInfo,
): ?MessageTooltipAction {
const { messageInfo } = item;
-
const canEditMessage = useCanEditMessage(threadInfo, messageInfo);
+ const { renderEditModal } = useEditModalContext();
+ const { clearTooltip } = useTooltipContext();
return React.useMemo(() => {
if (!canEditMessage) {
return null;
}
+
const buttonContent = (
<SWMansionIcon icon="edit-1" size={18} disableFill={false} />
);
+
const onClickEdit = () => {
- // TODO: Enter edit mode
+ clearTooltip();
+ renderEditModal({
+ messageInfo: item,
+ threadInfo,
+ isError: false,
+ editedMessageDraft: messageInfo.text,
+ });
};
+
return {
actionButtonContent: buttonContent,
onClick: onClickEdit,
label: 'Edit',
};
- }, [canEditMessage]);
+ }, [
+ canEditMessage,
+ clearTooltip,
+ item,
+ messageInfo.text,
+ renderEditModal,
+ threadInfo,
+ ]);
}
function useMessageTooltipActions(

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 9:33 AM (5 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2600425
Default Alt Text
D7824.diff (1 KB)

Event Timeline