mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 15:25:44 +00:00
fix last code rabbit comments
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user