mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-21 16:01:35 +08:00
feat: expand clickable area of topic in-place renaming (#10548)
* chore: update electron dependency from 37.4.0 to 37.6.0 * feat(TopicsTab): add double click to edit topic name Move double click handler from TopicName component to parent div to improve UX * fix(TopicsTab): prevent topic edit on double click when already editing
This commit is contained in:
parent
d2d5064eed
commit
a9843b4128
@ -525,6 +525,11 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic,
|
|||||||
onContextMenu={() => setTargetTopic(topic)}
|
onContextMenu={() => setTargetTopic(topic)}
|
||||||
className={classNames(isActive ? 'active' : '', singlealone ? 'singlealone' : '')}
|
className={classNames(isActive ? 'active' : '', singlealone ? 'singlealone' : '')}
|
||||||
onClick={editingTopicId === topic.id && topicEdit.isEditing ? undefined : () => onSwitchTopic(topic)}
|
onClick={editingTopicId === topic.id && topicEdit.isEditing ? undefined : () => onSwitchTopic(topic)}
|
||||||
|
onDoubleClick={() => {
|
||||||
|
if (editingTopicId === topic.id && topicEdit.isEditing) return
|
||||||
|
setEditingTopicId(topic.id)
|
||||||
|
topicEdit.startEdit(topic.name)
|
||||||
|
}}
|
||||||
style={{
|
style={{
|
||||||
borderRadius,
|
borderRadius,
|
||||||
cursor: editingTopicId === topic.id && topicEdit.isEditing ? 'default' : 'pointer'
|
cursor: editingTopicId === topic.id && topicEdit.isEditing ? 'default' : 'pointer'
|
||||||
@ -541,13 +546,7 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic,
|
|||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<TopicName
|
<TopicName className={getTopicNameClassName()} title={topicName}>
|
||||||
className={getTopicNameClassName()}
|
|
||||||
title={topicName}
|
|
||||||
onDoubleClick={() => {
|
|
||||||
setEditingTopicId(topic.id)
|
|
||||||
topicEdit.startEdit(topic.name)
|
|
||||||
}}>
|
|
||||||
{topicName}
|
{topicName}
|
||||||
</TopicName>
|
</TopicName>
|
||||||
)}
|
)}
|
||||||
@ -571,7 +570,8 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic,
|
|||||||
} else {
|
} else {
|
||||||
handleDeleteClick(topic.id, e)
|
handleDeleteClick(topic.id, e)
|
||||||
}
|
}
|
||||||
}}>
|
}}
|
||||||
|
onDoubleClick={(e) => e.stopPropagation()}>
|
||||||
{deletingTopicId === topic.id ? (
|
{deletingTopicId === topic.id ? (
|
||||||
<DeleteIcon size={14} color="var(--color-error)" style={{ pointerEvents: 'none' }} />
|
<DeleteIcon size={14} color="var(--color-error)" style={{ pointerEvents: 'none' }} />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@ -13328,7 +13328,7 @@ __metadata:
|
|||||||
docx: "npm:^9.0.2"
|
docx: "npm:^9.0.2"
|
||||||
dompurify: "npm:^3.2.6"
|
dompurify: "npm:^3.2.6"
|
||||||
dotenv-cli: "npm:^7.4.2"
|
dotenv-cli: "npm:^7.4.2"
|
||||||
electron: "npm:37.4.0"
|
electron: "npm:37.6.0"
|
||||||
electron-builder: "npm:26.0.15"
|
electron-builder: "npm:26.0.15"
|
||||||
electron-devtools-installer: "npm:^3.2.0"
|
electron-devtools-installer: "npm:^3.2.0"
|
||||||
electron-store: "npm:^8.2.0"
|
electron-store: "npm:^8.2.0"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user