@sanity/visual-editing
Advanced tools
+3
-3
| { | ||
| "name": "@sanity/visual-editing", | ||
| "version": "5.3.2", | ||
| "version": "5.3.3", | ||
| "keywords": [ | ||
@@ -64,5 +64,5 @@ "overlays", | ||
| "xstate": "^5.26.0", | ||
| "@sanity/preview-url-secret": "^4.0.4", | ||
| "@sanity/insert-menu": "^3.0.4", | ||
| "@sanity/visual-editing-csm": "^3.0.6" | ||
| "@sanity/visual-editing-csm": "^3.0.6", | ||
| "@sanity/preview-url-secret": "^4.0.4" | ||
| }, | ||
@@ -69,0 +69,0 @@ "devDependencies": { |
+4
-11
@@ -232,3 +232,3 @@ import type {ClientPerspective} from '@sanity/client' | ||
| isDragging: false, | ||
| perspective: null, | ||
| perspective: 'published', | ||
| wasMaybeCollapsed: false, | ||
@@ -257,13 +257,6 @@ dragMinimapTransition: false, | ||
| usePerspectiveSync(comlink, dispatch) | ||
| usePerspectiveSync(comlink, dispatch, onPerspectiveChange) | ||
| useEffect(() => { | ||
| if (!onPerspectiveChange || perspective === null) return undefined | ||
| useReportDocuments(comlink, elements, perspective) | ||
| const raf = requestAnimationFrame(() => startTransition(() => onPerspectiveChange(perspective))) | ||
| return () => cancelAnimationFrame(raf) | ||
| }, [onPerspectiveChange, perspective]) | ||
| useReportDocuments(comlink, elements, perspective ?? 'published') | ||
| const updateDragPreviewCustomProps = useCallback( | ||
@@ -471,3 +464,3 @@ (x: number, y: number) => { | ||
| > | ||
| <DocumentReporter documentIds={documentIds} perspective={perspective ?? 'published'} /> | ||
| <DocumentReporter documentIds={documentIds} perspective={perspective} /> | ||
| <OverlaysController | ||
@@ -474,0 +467,0 @@ comlink={comlink} |
@@ -25,3 +25,3 @@ import type {ClientPerspective} from '@sanity/client' | ||
| wasMaybeCollapsed: boolean | ||
| perspective: ClientPerspective | null | ||
| perspective: ClientPerspective | ||
| isDragging: boolean | ||
@@ -28,0 +28,0 @@ dragInsertPosition: DragInsertPosition |
| import type {VisualEditingControllerMsg} from '@sanity/presentation-comlink' | ||
| import {useEffect} from 'react' | ||
| import {useEffect, useEffectEvent} from 'react' | ||
| import type {OverlayMsg, VisualEditingNode} from '../types' | ||
| import type { ClientPerspective } from '@sanity/client' | ||
@@ -10,3 +11,8 @@ export function usePerspectiveSync( | ||
| dispatch: (value: OverlayMsg | VisualEditingControllerMsg) => void, | ||
| onPerspectiveChange?: (perspective: ClientPerspective) => void, | ||
| ): void { | ||
| const handlePerspective = useEffectEvent((data: {perspective: ClientPerspective}) => { | ||
| dispatch({type: 'presentation/perspective', data}) | ||
| onPerspectiveChange?.(data.perspective) | ||
| }) | ||
| useEffect(() => { | ||
@@ -20,3 +26,3 @@ const controller = new AbortController() | ||
| .then((data) => { | ||
| dispatch({type: 'presentation/perspective', data}) | ||
| handlePerspective(data) | ||
| }) | ||
@@ -29,3 +35,3 @@ .catch(() => { | ||
| const unsub = comlink?.on('presentation/perspective', (data) => { | ||
| dispatch({type: 'presentation/perspective', data}) | ||
| handlePerspective(data) | ||
| }) | ||
@@ -32,0 +38,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1047642
013638
-0.01%