ToolJet/docs/static/scroll-sidebar.js
Pratik Agrawal a107d8ee3d
[docs]: App Builder Revamp (#12628)
* canvas

* components

* WIP

* Feedback Improvements

* Component Library

* library

* canvas grid size and numbers

* update component library intro

* final feedback for canvas and ui component

* comp prop

* canvas feedback by nechal

* add icons in library

* component properties

* component properties

* multi pages

* update: datasource connection

* WIP - Component Inspect

* sidebar

* Add component table

* remove old comp layout

* remove (Legacy)

* [wip] component properties

* merge: app builder overview

* component properties

* fix: updated creating and accessing queries

* pages

* pages update

* fix: review

* fix: review

* component properties - karan and devang feedback

* page and component data

* fix: review

* Update folder structure

* pages call feedback

* fix: review

* feat: transformation and binding

* fix: transformation

* fix: transformation

* remove old content

* fix: review

* feat: custom code structure

* WIP Component States

* component state

* feat: fx doc

* fix: image error

* event wip

* comp state

* events and logic overview

* update nav bar

* wip event triggers

* fix: fx doc

* Event Triggers

* csa and actions

* update: custom code

* fix: call

* feat: code-transformations

* feat: manage variables

* fix: review-transform-data

* fix: manage variables

* nav bar struct update and variables docs

* wip ss

* imgs till event handler docs

* fix: review

* feat: import libraries

* fix: review

* wip use cases ss

* complete events

* wip inspector

* fix: review

* wip inspector

* fix: review

* wip inspector

* wip inspector

* wip inspector

* Inspector

* complete inspector

* fix: runpy

* feat: secrets and contants

* final feedback update

* fix: review

* fix: sidebar

* fix: review

* Add Screenshot

* comment sidebar

* fix: review

* live feedback

* added flowchart

* final update

* update banner

* first level grammatical fixes

* remove extra full stop

* work on imgs

* update general flow and fix grammatical issues

* correct path

* correct path

* Update Interlinking

* delete old files

* fix broken link

* fix links

---------

Co-authored-by: PriteshKiri <[email protected]>
Co-authored-by: Karan Rathod <[email protected]>
2025-07-07 11:43:43 +05:30

34 lines
1.2 KiB
JavaScript

function centerActiveSidebarItem() {
const activeItem = document.querySelector('.menu__link--active');
if (activeItem) {
const container = activeItem.closest('.menu');
if (container) {
const containerRect = container.getBoundingClientRect();
const itemRect = activeItem.getBoundingClientRect();
const offset = itemRect.top - containerRect.top - container.clientHeight / 2 + itemRect.height / 2;
container.scrollTo({
top: container.scrollTop + offset,
behavior: 'smooth',
});
}
}
}
// Retry until sidebar is ready (because Docusaurus uses client-side routing)
function waitForSidebarAndCenter(retries = 10) {
const sidebarExists = document.querySelector('.menu__link--active');
if (sidebarExists) {
centerActiveSidebarItem();
} else if (retries > 0) {
setTimeout(() => waitForSidebarAndCenter(retries - 1), 200);
}
}
document.addEventListener('DOMContentLoaded', () => {
waitForSidebarAndCenter();
});
// Also run on client-side navigation
window.addEventListener('popstate', waitForSidebarAndCenter);
window.addEventListener('hashchange', waitForSidebarAndCenter);