Remove parent path from frontmatter title in immersive editor

What does this MR do and why?

This MR updates the new Wiki immersive editor so the title that's visible to the user no longer includes the parent's path when creating a new sub-page.

Wiki actually has two kinds of titles:

  • the path, but it is submitted as name="wiki[title]" in the form, because legacy code . But there is a reason to keep this convention around: Since each wiki page is a document in the wiki git repo, this is used as the document name. Including the full path here ensures the document's folder structure corresponds to the wiki page structure. This one is usually a slug.
  • pageTitle, the one visible to the user. This is stored as part of the document, inside its Frontmatter metadata. That one may differ from the path, as it is not sluggified. May even be null, fallback is a de-sluggified path.

On new pages, the path is normally auto-generated from the pageTitle (sluggifying it). So before immersive editor, creating a sub-page included the parents path in the pageTitle ("Page/Sub-Page"), so it would auto-generate the correct path from that. The was at best weird to many users, and if they removed the Path part from the title they would inadvertently also remove the nesting.

This MR makes all that invisible to the user: It removes the parent path from the pageTitle, but keeps it in the auto-generated path.

References

#596485 (closed)

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Enable the feature flag with echo "Feature.enable(:wiki_immersive_editor)" | rails c
  2. Open or create a wiki (Plan>Wiki)
  3. In the wiki sidebar, hover over an existing page and click "+".
  4. see that the title does not include the parent's path.
  5. Click on the chevron-down-icon near the title and observe that the "Path" field still shows the parent's path.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Janis Altherr

Merge request reports

Loading