This commit is contained in:
ct
2025-07-17 02:52:56 +08:00
parent ae77050934
commit 9aeb410b24
5 changed files with 62 additions and 12 deletions

View File

@@ -107,8 +107,8 @@ const useResponsiveDimensions = () => {
return dimensions;
};
const Editor = () => {
const { init } = useMediaStore();
const Editor = ({ setInitialMeme, setInitialBackground, setInitialText }) => {
const { init, setInitialMeme: setStoreMeme, setInitialBackground: setStoreBackground, setInitialText: setStoreText } = useMediaStore();
const { getSetting } = useLocalSettingsStore();
const { setSelectedTextElement } = useVideoEditorStore();
const emitter = useMitt();
@@ -121,8 +121,20 @@ const Editor = () => {
const isBelowMinWidth = useViewportDetection(320);
useEffect(() => {
// Set initial values if props are provided
if (setInitialMeme) {
setInitialMeme(setStoreMeme);
}
if (setInitialBackground) {
setInitialBackground(setStoreBackground);
}
if (setInitialText) {
setInitialText(setStoreText);
}
// Initialize (will skip API call if initial values were set)
init();
}, []);
}, [setInitialMeme, setInitialBackground, setInitialText, setStoreMeme, setStoreBackground, setStoreText, init]);
// Listen for text element selection (but don't auto-open sidebar)
useEffect(() => {