Update
This commit is contained in:
@@ -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, clearInitialState } = useMediaStore();
|
||||
const { getSetting } = useLocalSettingsStore();
|
||||
const { setSelectedTextElement } = useVideoEditorStore();
|
||||
const emitter = useMitt();
|
||||
@@ -121,8 +121,28 @@ const Editor = () => {
|
||||
const isBelowMinWidth = useViewportDetection(320);
|
||||
|
||||
useEffect(() => {
|
||||
// Clear any previous initial state to allow fresh initialization
|
||||
clearInitialState();
|
||||
|
||||
// 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();
|
||||
}, []);
|
||||
|
||||
// Cleanup: Clear initial state when component unmounts
|
||||
return () => {
|
||||
clearInitialState();
|
||||
};
|
||||
}, [setInitialMeme, setInitialBackground, setInitialText, setStoreMeme, setStoreBackground, setStoreText, init, clearInitialState]);
|
||||
|
||||
// Listen for text element selection (but don't auto-open sidebar)
|
||||
useEffect(() => {
|
||||
@@ -173,7 +193,7 @@ const Editor = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="relative mx-auto flex min-h-[93vh] flex-col space-y-2 pt-4" style={{ width: `${responsiveWidth}px` }}>
|
||||
<div className="relative mx-auto flex min-h-[88vh] flex-col space-y-2" style={{ width: `${responsiveWidth}px` }}>
|
||||
<EditSidebar isOpen={isEditSidebarOpen} onClose={handleEditClose} />
|
||||
<EditNavSidebar isOpen={isEditNavSidebarOpen} onClose={handleEditNavClose} />
|
||||
<TextSidebar isOpen={isTextSidebarOpen} onClose={handleTextSidebarClose} />
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useMitt } from '@/plugins/MittContext';
|
||||
import useLocalSettingsStore from '@/stores/localSettingsStore';
|
||||
|
||||
@@ -12,14 +11,8 @@ const EditorHeader = ({ className = '', onNavClick = () => {}, isNavActive = fal
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={cn('flex w-full items-center justify-center gap-2', className)}>
|
||||
<img alt="MEMEFA.ST LOGO" className="h-10 w-10" src="logo/memefast-logo-144.png"></img>
|
||||
|
||||
<div className="font-display ml-0 text-lg tracking-wide md:ml-3 md:text-xl">
|
||||
<span className="text-foreground">MEME</span>
|
||||
<span className="text-[#00DD00] dark:text-[#00FF00]">FAST</span>
|
||||
</div>
|
||||
</div>
|
||||
<></>
|
||||
// <BrandLogo></BrandLogo>
|
||||
// <div className={cn('flex w-full items-center justify-between rounded-xl bg-white p-2 shadow-sm dark:bg-neutral-800', className)}>
|
||||
// <Button onClick={onNavClick} variant="outline" size="icon" className="invisible rounded">
|
||||
// <Menu className="h-8 w-8" />
|
||||
|
||||
Reference in New Issue
Block a user