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

Subchapter Level Setting Bug #1404

Closed
OlofSvahnVbg opened this issue Sep 12, 2023 · 3 comments · Fixed by #1408
Closed

Subchapter Level Setting Bug #1404

OlofSvahnVbg opened this issue Sep 12, 2023 · 3 comments · Fixed by #1408
Assignees
Labels
new feature Request for adding/changing functionality
Milestone

Comments

@OlofSvahnVbg
Copy link
Collaborator

The Subchapter Level setting doesn't work correctly. If you choose, for instance, 0 in the input...
image
the value does not carry over to client side.

The problem seems to be here (in the code):
image
The property tableOfContent does not appear on the modeldoc object (document).

It does, however, exist in this.props.options?.tableOfContents. And if you use this instead, the setting works from admin.

Is this an okay solution, or does it interfere with the node backend perhaps?

@OlofSvahnVbg OlofSvahnVbg added this to the 3.x milestone Sep 12, 2023
@OlofSvahnVbg OlofSvahnVbg self-assigned this Sep 12, 2023
@OlofSvahnVbg
Copy link
Collaborator Author

A consequence of this fix is that the Contents view in print menu cannot be opened if the setting is set to 0:
image
because it does not have any subchapters to show:
image

@OlofSvahnVbg
Copy link
Collaborator Author

A possible fix to these problems is to introduce an extra value for chapter levels to show in print:
image

@jacobwod
Copy link
Member

I guess tocChapterLevels ends up as 100 because the expression evaluates to it if chapterLevelsToShow is 0. Try using the nullish coalescing operator.

> 0 || 100
< 100

> 0 ?? 100
< 0

@OlofSvahnVbg OlofSvahnVbg added new feature Request for adding/changing functionality and removed bug labels Oct 3, 2023
@jesade-vbg jesade-vbg linked a pull request Oct 4, 2023 that will close this issue
@jesade-vbg jesade-vbg modified the milestones: 3.x, 3.13 Oct 5, 2023
@github-project-automation github-project-automation bot moved this to Done in Hajk Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Request for adding/changing functionality
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants