feat(editor): drawing guard before navigations drop a started move (R-12)
The move mode lives in the work store with its document stamp. guardDrawing ends an unstarted mode at once and asks « Abandonner le déplacement ? » (DrawingGuardDialog, at workspace level) once work is started, before a tab, a section, « Aller à », Back and a history jump out of the editor; the leave guard and sign-out count started work. An undo from the header, Ctrl+Z or the message only cancels a pending mode or preview (R-13), and a document change drops a stale mode, keeping a started one to be said. ConfirmDialog takes an optional body. Strings for Task 4 added.
This commit is contained in:
1 parent
8cd1bda6c2
commit
2882821661
18 files changed
+465
-37
No files matched your search
@@ -5,6 +5,7 @@ import Icon from '@/components/ui/Icon'
|
||||
import SignOutLossDialog from './SignOutLossDialog'
|
||||
import { hasUserCopies, removeUserCopies } from '@/editor/state/recovery'
|
||||
import { leaveGuardArmed, useEditorStore } from '@/editor/state/editorStore'
|
||||
import { guardWork, useAnnotationWork } from '@/editor/annotations/workStore'
|
||||
import { useAuthStore } from '@/state/authStore'
|
||||
import { useT } from '@/i18n/useT'
|
||||
|
||||
@@ -17,7 +18,10 @@ export default function SignOutButton({
|
||||
const navigate = useNavigate()
|
||||
const signOut = useAuthStore((s) => s.signOut)
|
||||
const userId = useAuthStore((s) => s.user?.id)
|
||||
const unsavedWork = useEditorStore(leaveGuardArmed)
|
||||
const sheetWork = useEditorStore(leaveGuardArmed)
|
||||
// A started move on the drawing is unsaved work too (R-12).
|
||||
const drawingWork = useAnnotationWork((work) => guardWork(work) !== null)
|
||||
const unsavedWork = sheetWork || drawingWork
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [confirming, setConfirming] = useState(false)
|
||||
|
||||
|
||||
Reference in new issue
Block a user