File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,23 +102,21 @@ class Pages {
102102 }
103103
104104 /**
105- * Ordered pages for the parent `<select>` with visual nesting (indent = depth ).
105+ * Ordered pages for the parent `<select>` with nesting depth (indent in the template ).
106106 *
107107 * @param excludePageId - when editing, exclude this page and its descendants (same as groupByParent)
108108 */
109109 public static async getParentSelectOptions (
110110 excludePageId ?: EntityId
111- ) : Promise < Array < { page : Page ; depth : number ; indent : string } > > {
111+ ) : Promise < Array < { page : Page ; depth : number } > > {
112112 const { pages, pagesMap } = excludePageId
113113 ? await this . groupByParentWithMap ( excludePageId )
114114 : await this . groupByParentWithMap ( '' as EntityId ) ;
115- const indentUnit = '\u00a0\u00a0' ;
116115
117- return pages . map ( ( page ) => {
118- const depth = Pages . computePageDepth ( page , pagesMap ) ;
119-
120- return { page, depth, indent : indentUnit . repeat ( depth ) } ;
121- } ) ;
116+ return pages . map ( ( page ) => ( {
117+ page,
118+ depth : Pages . computePageDepth ( page , pagesMap ) ,
119+ } ) ) ;
122120 }
123121
124122 /**
Original file line number Diff line number Diff line change 3030 {% set _page = entry .page %}
3131 {% if toString(_page ._id ) != toString(currentPageId ) %}
3232 <option value =" {{ toString(_page ._id ) }}" {{ page is not empty and toString(page ._parent ) == toString(_page ._id ) ? ' selected' : ' ' }}>
33- {{- entry .indent -}}{{- _page .title -}}
33+ {%- if entry .depth > 0 -%}
34+ {%- for _ in 1 .. entry.depth %} {% endfor -%}
35+ {%- endif -%}
36+ {{- _page .title | striptags -}}
3437 </option >
3538 {% endif %}
3639 {% endfor %}
4245 <select id =" above" name =" above" >
4346 <option value =" 0" >—</option >
4447 {% for _page in parentsChildrenOrdered %}
45- <option value =" {{ toString(_page ._id ) }}" >{{ _page .title }}</option >
48+ <option value =" {{ toString(_page ._id ) }}" >{{ _page .title | striptags }}</option >
4649 {% endfor %}
4750 </select >
4851 </div >
You can’t perform that action at this time.
0 commit comments