44-->
55
66<template >
7- <div :id =" `page-${pageId}` "
7+ <div :id =" pageElementId "
88 :data-page-id =" pageId"
99 class =" app-content-list-item"
1010 :class =" {
6565 :title =" pageTitleIfTruncated"
6666 class =" app-content-list-item-line-one"
6767 :class =" { 'template': isTemplate }"
68- @click =" expand(pageId) " >
68+ @click =" expandAndScroll " >
6969 {{ pageTitleString }}
7070 </div >
7171 </router-link >
@@ -221,6 +221,12 @@ export default {
221221 ' pageParents' ,
222222 ]),
223223
224+ pageElementId () {
225+ return this .inFavoriteList
226+ ? ` page-favorite-${ this .pageId } `
227+ : ` page-${ this .pageId } `
228+ },
229+
224230 isActive () {
225231 return this .currentPage
226232 && this .currentPage .id === this .pageId
@@ -286,7 +292,7 @@ export default {
286292
287293 mounted () {
288294 // Scroll to item at initial mount if it's currentPage
289- if (this .isActive ) {
295+ if (this .isActive && ! this . inFavoriteList ) {
290296 scrollToPage (this .pageId )
291297 }
292298
@@ -303,15 +309,24 @@ export default {
303309
304310 toggleCollapsedOrRoute (ev ) {
305311 if (this .isCollapsible ) {
306- event .stopPropagation ()
312+ ev .stopPropagation ()
307313 this .toggleCollapsed (this .pageId )
308314 } else {
315+ this .expandAndScroll ()
309316 if (this .currentPage .id !== this .pageId ) {
310317 this .$router .push (this .to )
311318 }
312319 }
313320 },
314321
322+ expandAndScroll () {
323+ this .expand (this .pageId )
324+ // Scroll favored page in page list into viewport
325+ if (this .inFavoriteList ) {
326+ scrollToPage (this .pageId )
327+ }
328+ },
329+
315330 onDragstart (ev ) {
316331 // Set as dragged page if not root page (allows to move the page)
317332 if (! this .isRootPage ) {
@@ -328,25 +343,25 @@ export default {
328343 ev .dataTransfer .setData (' text/html' , html)
329344 },
330345
331- onDragend (ev ) {
346+ onDragend () {
332347 this .isHighlightedTarget = false
333348 this .setDragoverTargetPage (false )
334349 this .setDraggedPageId (null )
335350 },
336351
337- onDragover (ev ) {
352+ onDragover () {
338353 if (this .isPotentialDropTarget ) {
339354 this .isHighlightedTarget = true
340355 this .setDragoverTargetPage (true )
341356 }
342357 },
343358
344- onDragleave (ev ) {
359+ onDragleave () {
345360 this .isHighlightedTarget = false
346361 this .setDragoverTargetPage (false )
347362 },
348363
349- onDrop (ev ) {
364+ onDrop () {
350365 if (this .isDropTarget
351366 // Ingore if self is direct parent of dragged element
352367 && this .pageParent (this .draggedPageId ) !== this .pageId ) {
0 commit comments