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

Collapsible sections #3646

Closed
rocramer opened this issue Jan 7, 2023 · 6 comments · Fixed by #6251
Closed

Collapsible sections #3646

rocramer opened this issue Jan 7, 2023 · 6 comments · Fixed by #6251
Assignees

Comments

@rocramer
Copy link

rocramer commented Jan 7, 2023

Is your feature request related to a problem? Please describe.
We are working with pretty large documents. Often we would like to hide some parts of the document to have a better overview of the document. Collapsible sections could be a good addition for the text editor. A wide variety of markdown editors are supporting this. For example GitHub.

Are there any plans on adding this feature?

@juliushaertl
Copy link
Member

Copying discussion from #1841 @luka-nextcloud wrote:

  1. Add markdown collapsible section (https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab) :
  • steps:
    • Add toolbar item to insert collapsible section
    • Add styling to editing area to make user understand that cursor is being in or out side collapsible section
    • Add fold/unfold function on section title

@juliushaertl
Copy link
Member

Copying discussion from #1841 @juliushaertl wrote:

A few more things to consider from my perspective:

  • Which node types for formattings can be supported within the section title and content (especially when representing this in markdown)?
  • Implementation wise this could reuse https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details but would need to work with contenteditable inline editing, this is something to check upfront, otherwise we may need custom implementation that we should avoid if possible
  • The menu button could insert a new details element, but how would it behave if
    • Clicking it with selected text
    • Should there be a way to undo the details section but keep the content?
  • This should be covered by jest tests for the markdown syntax parts and cypress for any user iteractions possible

@juliushaertl
Copy link
Member

Copying discussion from #1841 @mejo- wrote:

Another question would be whether spoilers (that's another way how these expandable sections are often called) can be nested. Seems like HTML allows this, and so does GFM (Github flavoured markdown: https://gist.github.com/scmx/eca72d44afee0113ceb0349dd54a84a2?permalink_comment_id=4196669#gistcomment-4196669. But it seems rather useless to me and brings extra complexity, so I don't think that we have to support it.

The menu button could insert a new details element, but how would it behave if -> Clicking it with selected text

I'd expect the editor to ask me for a summary text and move the selected content into the details section of the spoiler.

Should there be a way to undo the details section but keep the content?

I'd expect this, definitely. When inside a details section, the menu button should remove the details section but preserve its content.

@juliushaertl
Copy link
Member

Talking about what we allow we also need to check upfront how we can parse the details sections in markdown as we block html by default so we would need to explicitly parse the details and summary tags. Since we use markdown-it to convert from markdown to html which then is used in tiptap we may need to write a custom plugin for that to handle that. All existing plugins that I've found implement a different syntax.

mejo- added a commit that referenced this issue Aug 23, 2024
Uses `<details>` and `<summary>` summary both for markdown and HTML
serialization.

Fixes: #3646

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this issue Aug 23, 2024
Uses `<details>` and `<summary>` summary both for markdown and HTML
serialization.

Fixes: #3646

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this issue Aug 26, 2024
Uses `<details>` and `<summary>` summary both for markdown and HTML
serialization.

Fixes: #3646

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this issue Aug 26, 2024
Uses `<details>` and `<summary>` summary both for markdown and HTML
serialization.

Fixes: #3646

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this issue Aug 26, 2024
Uses `<details>` and `<summary>` summary both for markdown and HTML
serialization.

Fixes: #3646

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this issue Aug 27, 2024
Uses `<details>` and `<summary>` summary both for markdown and HTML
serialization.

Fixes: #3646

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this issue Aug 27, 2024
Uses `<details>` and `<summary>` summary both for markdown and HTML
serialization.

Fixes: #3646

Signed-off-by: Jonas <jonas@freesources.org>
mejo- added a commit that referenced this issue Aug 27, 2024
Uses `<details>` and `<summary>` summary both for markdown and HTML
serialization.

Fixes: #3646

Signed-off-by: Jonas <jonas@freesources.org>
@XueSheng-GIT
Copy link

@juliushaertl this issue is marked fixed but there's no available release yet, right? Any plans for NC29/30 or will this only be part of a future NC31?

@juliushaertl
Copy link
Member

Yes, for 31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ☑️ Done
Development

Successfully merging a pull request may close this issue.

6 participants