Skip to content

Commit

Permalink
perf: add API for disabling auto-scroll due to performance issues
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Apr 17, 2024
1 parent e038522 commit 3e5599e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/docs/pages/docs/api-reference/components/puck.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,14 @@ export function Editor() {

#### iframe params

| Param | Example | Type | Status |
| --------------------- | ---------------- | ------- | ------ |
| [`enabled`](#enabled) | `enabled: false` | boolean | - |
| Param | Example | Type | Status |
| ----------------------------------------- | ------------------------- | ------- | ------ |
| [`disableAutoScroll`](#disableautoscroll) | `disableAutoScroll: true` | boolean | - |
| [`enabled`](#enabled) | `enabled: false` | boolean | - |

##### `disableAutoScroll`

Disable auto-scroll of the iframe when the user drag an item near the edge.

##### `enabled`

Expand Down
1 change: 1 addition & 0 deletions packages/core/components/Puck/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ export function Puck<UserConfig extends Config = Config>({
}}
>
<DragDropContext
autoScrollerOptions={{ disabled: iframe.disableAutoScroll }}
onDragUpdate={(update) => {
setDraggedItem({ ...draggedItem, ...update });
onDragStartOrUpdate(update);
Expand Down
1 change: 1 addition & 0 deletions packages/core/types/IframeConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export type IframeConfig = {
enabled?: boolean;
disableAutoScroll?: boolean;
};

0 comments on commit 3e5599e

Please sign in to comment.