diff --git a/package.json b/package.json index 8b68883..1b0b90f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@finsweet/ts-utils", - "version": "0.13.5", + "version": "0.13.6", "description": "Typescript utils for custom Webflow projects.", "main": "index.ts", "module": "index.ts", diff --git a/webflow/getCollectionElements.ts b/webflow/getCollectionElements.ts index a5526e3..d04f4c3 100644 --- a/webflow/getCollectionElements.ts +++ b/webflow/getCollectionElements.ts @@ -13,7 +13,7 @@ export function getCollectionElements( ): NodeListOf; export function getCollectionElements( reference: string | Element, - target: 'next', + target: 'next' | 'previous', page?: Document ): HTMLAnchorElement | null | undefined; export function getCollectionElements( @@ -23,7 +23,7 @@ export function getCollectionElements( ): HTMLDivElement | null | undefined; export function getCollectionElements( reference: string | Element, - target: 'wrapper' | 'list' | 'items' | 'next', + target: 'wrapper' | 'list' | 'items' | 'next' | 'previous', page: Document = document ): HTMLDivElement | NodeListOf | HTMLAnchorElement | null | undefined { const referenceElement = typeof reference === 'string' ? page.querySelector(reference) : reference; @@ -34,6 +34,7 @@ export function getCollectionElements( if (target === 'items') return referenceElement.querySelectorAll('.w-dyn-item'); if (target === 'next') return referenceElement.querySelector('.w-pagination-next'); + if (target === 'previous') return referenceElement.querySelector('.w-pagination-previous'); return ( referenceElement.querySelector(`.w-dyn-items`) ||