Create polished demo videos without editing skills. Mac/Windows/Linux
fix last code rabbit comments
Alan Trebugeaiscc0dd6648483
diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsxindex e97d9e44..2421d6ba 100644--- a/src/components/video-editor/SettingsPanel.tsx+++ b/src/components/video-editor/SettingsPanel.tsx@@ -262,6 +262,11 @@ function ExtensionSettingsSection({}if (field.type === "slider") {+ const step = field.step ?? 0.01;+ const stepText = String(step);+ const precision = stepText.includes(".")+ ? stepText.split(".")[1]?.length ?? 0+ : 0;return (<div key={field.id} className="mt-1"><SliderControl@@ -270,12 +275,12 @@ function ExtensionSettingsSection({defaultValue={field.defaultValue as number}min={field.min ?? 0}max={field.max ?? 1}- step={field.step ?? 0.01}+ step={step}onChange={(v) => {extensionHost.setExtensionSetting(extensionId, field.id, v);forceUpdate((n) => n + 1);}}- formatValue={(v) => v.toFixed(1)}+ formatValue={(v) => v.toFixed(precision)}parseInput={(text) => parseFloat(text)}/></div>@@ -1552,11 +1557,17 @@ export function SettingsPanel({};const resetFrameSection = () => {+ const preferredFrame = initialEditorPreferences.frame;+ const resolvedFrame = preferredFrame+ ? availableFrames.some((candidate) => candidate.id === preferredFrame)+ ? preferredFrame+ : null+ : null;onShadowChange?.(initialEditorPreferences.shadowIntensity);onBorderRadiusChange?.(initialEditorPreferences.borderRadius);onAspectRatioChange?.(initialEditorPreferences.aspectRatio);onPaddingChange?.({ ...initialEditorPreferences.padding });- onFrameChange?.(initialEditorPreferences.frame);+ onFrameChange?.(resolvedFrame);removeBackgroundStateRef.current = null;};diff --git a/src/lib/extensions/extensionHost.ts b/src/lib/extensions/extensionHost.tsindex 41cd5c33..d0683e7e 100644--- a/src/lib/extensions/extensionHost.ts+++ b/src/lib/extensions/extensionHost.ts@@ -185,6 +185,14 @@ export class ExtensionHost {isPlaying: boolean;} | null = null;+ constructor() {+ if (typeof window !== "undefined") {+ window.addEventListener("beforeunload", () => {+ this.flushPersistedSettings();+ });+ }+ }+/*** Activate an extension given its info and resolved module URL.*/@@ -274,6 +282,7 @@ export class ExtensionHost {}this.activeExtensions.delete(extensionId);+ this.flushPersistedSettings();this.notifyListeners();console.log(`[extensions] Deactivated: ${extensionId}`);}@@ -286,6 +295,7 @@ export class ExtensionHost {for (const id of ids) {await this.deactivateExtension(id);}+ this.flushPersistedSettings();}// ---------------------------------------------------------------------------@@ -619,6 +629,14 @@ export class ExtensionHost {}, 500);}+ private flushPersistedSettings(): void {+ if (this.persistTimeout) {+ clearTimeout(this.persistTimeout);+ this.persistTimeout = null;+ }+ this.writePersistedSettingsStore(this.getFullSettingsStore());+ }+/*** Create the permission-gated API object for an extension.*/