Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复拖拽调整页面顺序 #640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

undefine-qql
Copy link

修复由于页面自定义属性变更,Sortable配置中dataIdAttr有误导致拖拽页面调整排序后,点击源码或保存按钮后无效的情况

@@ -279,6 +279,9 @@ export const getDepNodeIds = (dataSourceDeps: DataSourceDeps = {}) =>
* @param parentId 父节点 id
*/
export const replaceChildNode = (newNode: MNode, data?: MNode[], parentId?: Id) => {
if(newNode.id==="1"){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个“1”是有什么特殊意义?

@undefine-qql
Copy link
Author

undefine-qql commented Jan 16, 2025 via email

@jia000
Copy link
Collaborator

jia000 commented Jan 16, 2025

newNode.id==="1"代表根节点,无需进行后面的操作,不然执行到下面也会报错“未找到父节点”
________________________________ From: @.*** @.> on behalf of roymondchen @.> Sent: Thursday, January 16, 2025 2:41 PM To: Tencent/tmagic-editor @.> Cc: undefined @.>; Author @.***> Subject: Re: [Tencent/tmagic-editor] 修复拖拽调整页面顺序 (PR #640) @jia000 requested changes on this pull request.
________________________________ In packages/utils/src/index.ts<#640 (comment)>:
@@ -279,6 +279,9 @@ export const getDepNodeIds = (dataSourceDeps: DataSourceDeps = {}) =>

根节点的判断应该是 newNode.type === NodeType.ROOT

@undefine-qql
Copy link
Author

undefine-qql commented Jan 16, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants