mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Warn to save content
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
parent
8ca4cf3260
commit
fe318126bd
4 changed files with 97 additions and 2 deletions
|
@ -126,6 +126,8 @@ import DebugCanvas, {
|
|||
loadSavedDebugState,
|
||||
} from "./components/DebugCanvas";
|
||||
import { AIComponents } from "./components/AI";
|
||||
import type { SaveWarningRef } from "./components/SaveWarning";
|
||||
import { SaveWarning } from "./components/SaveWarning";
|
||||
|
||||
polyfill();
|
||||
|
||||
|
@ -331,6 +333,8 @@ const ExcalidrawWrapper = () => {
|
|||
|
||||
const [langCode, setLangCode] = useAppLangCode();
|
||||
|
||||
const activityRef = useRef<SaveWarningRef | null>(null);
|
||||
|
||||
// initial state
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -615,6 +619,8 @@ const ExcalidrawWrapper = () => {
|
|||
collabAPI.syncElements(elements);
|
||||
}
|
||||
|
||||
activityRef.current?.activity();
|
||||
|
||||
// this check is redundant, but since this is a hot path, it's best
|
||||
// not to evaludate the nested expression every time
|
||||
if (!LocalData.isSavePaused()) {
|
||||
|
@ -856,6 +862,7 @@ const ExcalidrawWrapper = () => {
|
|||
setTheme={(theme) => setAppTheme(theme)}
|
||||
refresh={() => forceRefresh((prev) => !prev)}
|
||||
/>
|
||||
<SaveWarning ref={activityRef} />
|
||||
<AppWelcomeScreen
|
||||
onCollabDialogOpen={onCollabDialogOpen}
|
||||
isCollabEnabled={!isCollabDisabled}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue