diff --git a/CHANGELOG.md b/CHANGELOG.md index d33670da..abfa2aab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Bookmarks are now added to the top of the list + ## [0.19.0] - 2024-01-10 ### Added diff --git a/playlet-lib/src/components/Services/Bookmarks/Bookmarks.bs b/playlet-lib/src/components/Services/Bookmarks/Bookmarks.bs index 012f6828..5bf6a33c 100644 --- a/playlet-lib/src/components/Services/Bookmarks/Bookmarks.bs +++ b/playlet-lib/src/components/Services/Bookmarks/Bookmarks.bs @@ -29,12 +29,15 @@ function Load() as void return end if - for each bookmarkGroup in bookmarks.groups + groupCount = bookmarks.groups.Count() + ' GetOrCreateBookmarkGroup inserts at the beginning of the list, so we need to iterate backwards + for i = groupCount - 1 to 0 step -1 + bookmarkGroup = bookmarks.groups[i] bookmarkGroupNode = GetOrCreateBookmarkGroup(bookmarkGroup.title) bookmarksCount = bookmarkGroup.bookmarks.Count() - ' AddFeedSourceBookmark inserts at the beginning of the list, so we need to iterate backwards - for i = bookmarksCount - 1 to 0 step -1 - bookmark = bookmarkGroup.bookmarks[i] + ' AddFeedSourceBookmark also inserts at the beginning of the list, so we need to iterate backwards + for j = bookmarksCount - 1 to 0 step -1 + bookmark = bookmarkGroup.bookmarks[j] AddFeedSourceBookmark(bookmark.feedSource, bookmark.id, bookmarkGroupNode) end for end for @@ -85,7 +88,7 @@ function GetOrCreateBookmarkGroup(groupName as string) as object node = CreateObject("roSGNode", "ContentNode") node.id = id node.title = groupName - m.top.content.appendChild(node) + m.top.content.insertChild(node, 0) LogInfo("Added bookmark group:", groupName) return node end function