Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3387448
D7824.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D7824.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D7824: [web] Enter edit state after pressing edit button
Attached
Detach File
Event Timeline
Log In to Comment