tmagic-editor icon indicating copy to clipboard operation
tmagic-editor copied to clipboard

修复拖拽调整页面顺序

Open undefine-qql opened this issue 11 months ago • 3 comments

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

undefine-qql avatar Jan 14 '25 10:01 undefine-qql

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.tshttps://github.com/Tencent/tmagic-editor/pull/640#discussion_r1917826041:

@@ -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"){

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

― Reply to this email directly, view it on GitHubhttps://github.com/Tencent/tmagic-editor/pull/640#pullrequestreview-2554915102, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADNFIAWSPUQTQEC47D2WQNT2K5ICDAVCNFSM6AAAAABVERYIRCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKNJUHEYTKMJQGI. You are receiving this because you authored the thread.Message ID: @.***>

undefine-qql avatar Jan 16 '25 07:01 undefine-qql

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

jia000 avatar Jan 16 '25 11:01 jia000

对,这样写更容易理解

---原始邮件--- 发件人: @.> 发送时间: 2025年1月16日(周四) 晚上7:17 收件人: @.>; 抄送: @.@.>; 主题: Re: [Tencent/tmagic-editor] 修复拖拽调整页面顺序 (PR #640)

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 = {}) =>

@param parentId 父节点 id / export const replaceChildNode = (newNode: MNode, data?: MNode[], parentId?: Id) => { + if(newNode.id==="1"){ 这个“1”是有什么特殊意义? ― Reply to this email directly, view it on GitHub<#640 (review)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADNFIAWSPUQTQEC47D2WQNT2K5ICDAVCNFSM6AAAAABVERYIRCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKNJUHEYTKMJQGI. You are receiving this because you authored the thread.Message ID: @.**>

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

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

undefine-qql avatar Jan 16 '25 11:01 undefine-qql