fix(dock): delay plugin resident status until drag release from quick…#1607
Open
Ivy233 wants to merge 1 commit into
Open
fix(dock): delay plugin resident status until drag release from quick…#1607Ivy233 wants to merge 1 commit into
Ivy233 wants to merge 1 commit into
Conversation
8a42367 to
02bc92c
Compare
18202781743
reviewed
May 26, 2026
e420b79 to
7b9e530
Compare
18202781743
reviewed
May 27, 2026
… panel 1. Use staging mechanism for plugins dragged from quick panel to tray 2. Only commit visibility change when mouse is released, not during drag 3. Preserve original behavior for plugins dragged within tray itself 4. Remove unnecessary setSurfaceVisible call in onExited handler Log: Fix plugins being marked as resident during drag instead of on drop Influence: 1. Verify plugins from quick panel are not marked resident until drop 2. Verify tray-internal plugin dragging still works correctly fix(dock): 延迟插件驻留状态直到从快捷中心拖拽松手 1. 对从快捷中心拖拽到托盘的插件使用暂存机制 2. 仅在松手时提交可见性变更,拖拽过程中不触发 3. 保留托盘内部插件拖拽的原有行为 4. 移除 onExited 处理器中不必要的 setSurfaceVisible 调用 Log: 修复插件在拖拽过程中被标记为驻留而非松手时标记的问题 Influence: 1. 验证从快捷中心拖拽的插件在松手前不会被标记为驻留 2. 验证托盘内部插件拖拽仍然正常工作 PMS: BUG-361185
7b9e530 to
62aacec
Compare
deepin pr auto review你好!我是CodeGeeX。我已仔细审查了你提供的Git Diff。本次修改主要是对托盘拖放逻辑的重构,将快捷面板( 以下是针对语法逻辑、代码质量、代码性能和代码安全方面的审查意见与改进建议: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
综合改进后的代码示例结合以上建议,改进后的代码片段如下: // 建议在文件顶部或相关上下文定义常量
// const DND_SECTION_TYPE = "text/x-dde-shell-tray-dnd-sectionType"
// const DND_SOURCE_QUICK_PANEL = "quickPanel"
// onEntered 内部:
let shouldAllowDrop = showStashActionVisible ? (dropHoverIndex !== 0) : (dropHoverIndex !== -1)
// 注意:确保 source 在此处已正确获取
let isQuickPanel = source === "quickPanel"
if (shouldAllowDrop && (isStash || isQuickPanel)) {
// 收纳区或快捷面板拖拽:使用暂存机制
if (surfaceId && currentItemIndex >= 0) { // 防御性编程
DDT.TraySortOrderModel.stageDropPosition(surfaceId, Math.floor(currentItemIndex))
}
} else if (shouldAllowDrop) {
// 托盘内部拖拽:使用定时器机制
dropTrayTimer.handleDrop = function() {
if (isDropped || dragExited) return
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore)
}
dropTrayTimer.restart()
}
// onDropped 内部:
let isBefore = dropIdx.isBefore
let isStash = dropEvent.getDataAsString("text/x-dde-shell-tray-dnd-sectionType") === "stashed"
let isQuickPanel = source === "quickPanel" // 确保此处 source 已定义
// console.log("dropped", currentItemIndex, isBefore, isStash) // 移除或降级为 debug 日志
// 从收纳区或快捷中心拖拽的使用暂存机制
if (isStash || isQuickPanel) {
DDT.TraySortOrderModel.commitStagedDrop()
} else {
// 托盘内部拖拽直接提交
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore);
}
DDT.TraySortOrderModel.actionsAlwaysVisible = false
// onExited 内部:
onExited: function () {
dragExited = true
DDT.TraySortOrderModel.clearStagedDrop()
// 警告:请确认以下逻辑是否已被其他生命周期钩子(如 onCanceled)接管!
// 如果没有,从快捷面板拖入后退出可能无法正确清理状态
/*
if (source !== "" && !isDropped) {
dropTrayTimer.stop()
DDT.TraySortOrderModel.setSurfaceVisible(surfaceId, false)
}
*/
// Hide action icons when drag leaves tray without dropping
if (!isDropped) {
DDT.TraySortOrderModel.actionsAlwaysVisible = false
}
}重点确认事项:请务必核实 |
18202781743
approved these changes
May 27, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, Ivy233 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… panel
Log: Fix plugins being marked as resident during drag instead of on drop
Influence:
fix(dock): 延迟插件驻留状态直到从快捷中心拖拽松手
Log: 修复插件在拖拽过程中被标记为驻留而非松手时标记的问题
Influence:
PMS: BUG-361185