Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Allow Slider to accept custom history prop

Richie McIlroy4c3b942ca107
diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsx
index 83d8b4caf..8601aa0d7 100644
--- a/apps/desktop/src/routes/editor/ui.tsx
+++ b/apps/desktop/src/routes/editor/ui.tsx
@@ -65,9 +65,11 @@ export function Subfield(
export function Slider(
props: ComponentProps<typeof KSlider> & {
formatTooltip?: string | ((v: number) => string);
+ history?: { pause: () => () => void };
},
) {
- const { projectHistory: history } = useEditorContext();
+ const context = useEditorContext();
+ const history = props.history ?? context?.projectHistory;
// Pause history when slider is being dragged
let resumeHistory: (() => void) | null = null;
@@ -86,7 +88,7 @@ export function Slider(
props.class,
)}
onChange={(v) => {
- if (!resumeHistory) resumeHistory = history.pause();
+ if (!resumeHistory && history) resumeHistory = history.pause();
props.onChange?.(v);
}}
onChangeEnd={(e) => {