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

节点搜索 #21

Closed
GeorgeShiZZZ opened this issue Apr 24, 2024 · 12 comments
Closed

节点搜索 #21

GeorgeShiZZZ opened this issue Apr 24, 2024 · 12 comments
Labels
enhancement New feature or request

Comments

@GeorgeShiZZZ
Copy link
Contributor

大大,有考虑过做一个节点搜索的功能吗?树太大以后真的很难定位。

@zhongfq zhongfq added the enhancement New feature or request label Apr 24, 2024
@zhongfq
Copy link
Collaborator

zhongfq commented Apr 24, 2024

先考虑一下,看一下怎么做合理

@zhongfq
Copy link
Collaborator

zhongfq commented Apr 26, 2024

@zhongfq zhongfq closed this as completed Apr 26, 2024
@GeorgeShiZZZ
Copy link
Contributor Author

谢谢大大,稍稍提个优化,我觉得查询的input上加个回车事件就更好了,然后过滤节点的时候大概率不会去查询节点的方法名称,可以把desc加入过滤的list中,感觉这样更好一点。emmm其实我感觉name,desc,input,agrs,output,path其实都应该在搜索队列里。

@zhongfq
Copy link
Collaborator

zhongfq commented Apr 26, 2024

谢谢大大,稍稍提个优化,我觉得查询的input上加个回车事件就更好了,然后过滤节点的时候大概率不会去查询节点的方法名称,可以把desc加入过滤的list中,感觉这样更好一点。emmm其实我感觉name,desc,input,agrs,output,path其实都应该在搜索队列里。

用回车事件触发搜索,普通 输入不触发?

@zhongfq zhongfq reopened this Apr 26, 2024
@GeorgeShiZZZ
Copy link
Contributor Author

我的意思是回车事件触发跳转下一个,就是在调用下向下的那个方法,就和vscode一样

@GeorgeShiZZZ
Copy link
Contributor Author

onKeyPress={ handleKeyPress }
const handleKeyPress = (event: any) => {
if (event.key === 'Enter') {
if (results.length > 0) {
const idx = ( resultIndex + 1 ) % results.length
setResultIndex(idx)
editor.graph.focusItem(results[idx])
selectNode(results[idx])
}
}
}
大概就这个意思

@zhongfq
Copy link
Collaborator

zhongfq commented Apr 28, 2024

onKeyPress={ handleKeyPress } const handleKeyPress = (event: any) => { if (event.key === 'Enter') { if (results.length > 0) { const idx = ( resultIndex + 1 ) % results.length setResultIndex(idx) editor.graph.focusItem(results[idx]) selectNode(results[idx]) } } } 大概就这个意思

你可以拉测试分支,自己编译试一下

@GeorgeShiZZZ
Copy link
Contributor Author

可以了大大,很完美,先膜拜一下。大大,filterNodes方法,是否应该是组合判断,不然只能单独判断一种形式的参数,最后可以加一个node.id的过滤,只是提供建议,大大可以参考下。
2222

@zhongfq
Copy link
Collaborator

zhongfq commented Apr 29, 2024

可以了大大,很完美,先膜拜一下。大大,filterNodes方法,是否应该是组合判断,不然只能单独判断一种形式的参数,最后可以加一个node.id的过滤,只是提供建议,大大可以参考下。 2222

组合判断没有太大的意义,我们搜索的是节点而已,不需要高亮显示内容,所以只需要有一个满足就行了

另外要包含id的判断,你可以提一个PR,我测试一下

@GeorgeShiZZZ
Copy link
Contributor Author

大大们,给个权限。

@GeorgeShiZZZ
Copy link
Contributor Author

大大,没权限算了,提供个思路,就是共用一个搜索框,ctrl+f搜索正常参数,ctrl+g搜索节点。这样可以不用很多代码,就实现id查询。

@zhongfq
Copy link
Collaborator

zhongfq commented Apr 29, 2024

大大们,给个权限。

提PR不用权限的啊,在你的fork的仓库实现好,然后使用create pull request,提到上游仓库

@zhongfq zhongfq closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants