fix: prevent exit countdown during editing text
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import type { Particle } from "@/api/types";
|
import type { Particle } from "@/api/types";
|
||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
} from "@/lib/particle-path";
|
} from "@/lib/particle-path";
|
||||||
import { editTextParticleContent } from "@/lib/firestore-particles";
|
import { editTextParticleContent } from "@/lib/firestore-particles";
|
||||||
import { TextEditor } from "@/features/compose/text-editor";
|
import { TextEditor } from "@/features/compose/text-editor";
|
||||||
|
import { usePlaybackSuspenderStore } from "@/stores/playback-suspender-store";
|
||||||
|
|
||||||
type TextParticle = Extract<Particle, { type: "text" }>;
|
type TextParticle = Extract<Particle, { type: "text" }>;
|
||||||
|
|
||||||
@@ -24,6 +25,12 @@ export function TextEditOverlay({
|
|||||||
streamPath,
|
streamPath,
|
||||||
onClose,
|
onClose,
|
||||||
}: TextEditOverlayProps) {
|
}: TextEditOverlayProps) {
|
||||||
|
useEffect(() => {
|
||||||
|
const { suspend, release } = usePlaybackSuspenderStore.getState();
|
||||||
|
suspend();
|
||||||
|
return release;
|
||||||
|
}, []);
|
||||||
|
|
||||||
const [textContent, setTextContent] = useState(particle.properties.content);
|
const [textContent, setTextContent] = useState(particle.properties.content);
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user