Skip to content

Improve heading2doc/li2doc sorting #9668

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

Closed
3 tasks done
zxhd863943427 opened this issue Nov 16, 2023 · 4 comments
Closed
3 tasks done

Improve heading2doc/li2doc sorting #9668

zxhd863943427 opened this issue Nov 16, 2023 · 4 comments
Assignees
Milestone

Comments

@zxhd863943427
Copy link
Contributor

zxhd863943427 commented Nov 16, 2023

heading2doc api 插入子文档的顺序不一致

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

我在改进重构插件的拆分标题为子文档的功能,结果发现按顺序调用api的结果是乱序的。经过排查,发现哪怕手动拖动标题到文档述操作的结果也是乱序的,因此确实是api实现的问题。

图片

Expected result

希望heading2doc的结果是确定的,无论是新插入的会在最下方还是最上方都好,但千万不要是随便找一个位置插入或上下交替插入。

Screenshot or screen recording presentation

No response

Version environment

- Version: v2.10.13
- Operating System: win10
- Browser (if used):

Log file

无需日志

More information

No response

@88250
Copy link
Member

88250 commented Nov 16, 2023

使用的排序规则是?

@88250
Copy link
Member

88250 commented Nov 16, 2023

标题转换文档后不设置 sort 值,在列出文档树的时候如果是自定义排序,sort 值相同(为 0)的情况下会根据文档 ID 中的时间部分进行降序,其他排序方式没有这个比较,可能会有问题。

image

@88250 88250 self-assigned this Nov 16, 2023
@zxhd863943427
Copy link
Contributor Author

使用的是自定义排序。那应该如何操作才能让它按顺序插入?

@88250
Copy link
Member

88250 commented Nov 17, 2023

我们调整一下,heading2doc/li2doc 时在自定义排序 sort.json 中插入一个当前层级下最小的 sort 值,这样就可以排序在顶部了。

@88250 88250 changed the title heading2doc api 插入子文档的顺序不一致 Improve heading2doc/li2doc sorting Nov 17, 2023
@88250 88250 added this to the 2.10.16 milestone Nov 17, 2023
88250 added a commit that referenced this issue Nov 17, 2023

Verified

This commit was signed with the committer’s verified signature.
@88250 88250 closed this as completed Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants