File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -209,6 +209,21 @@ export const Viewer = forwardRef<ViewerHandle, ViewerProps>(({
209209 onCodeBlockClick : handlePinpointCodeBlockClick ,
210210 } ) ;
211211
212+ // Suppress native context menu on touch devices (prevents cut/copy/paste overlay on mobile)
213+ useEffect ( ( ) => {
214+ const container = containerRef . current ;
215+ if ( ! container ) return ;
216+ const isTouchPrimary = window . matchMedia ( '(pointer: coarse)' ) . matches ;
217+ if ( ! isTouchPrimary ) return ;
218+
219+ const handleContextMenu = ( e : Event ) => {
220+ e . preventDefault ( ) ;
221+ } ;
222+
223+ container . addEventListener ( 'contextmenu' , handleContextMenu ) ;
224+ return ( ) => container . removeEventListener ( 'contextmenu' , handleContextMenu ) ;
225+ } , [ ] ) ;
226+
212227 // Detect when sticky action bar is "stuck" to show card background
213228 useEffect ( ( ) => {
214229 if ( ! stickyActions || ! stickySentinelRef . current ) return ;
@@ -923,6 +938,7 @@ export const Viewer = forwardRef<ViewerHandle, ViewerProps>(({
923938 className = { `w-full bg-card rounded-xl shadow-xl p-5 md:p-8 lg:p-10 xl:p-12 relative ${
924939 linkedDocInfo ? 'border-2 border-primary' : 'border border-border/50'
925940 } ${ inputMethod === 'pinpoint' ? 'cursor-crosshair' : '' } `}
941+ style = { { WebkitTouchCallout : 'none' } as React . CSSProperties }
926942 >
927943 { /* Repo info + plan diff badge + demo badge + linked doc badge - top left */ }
928944 { ( repoInfo || hasPreviousVersion || showDemoBadge || linkedDocInfo ) && (
You can’t perform that action at this time.
0 commit comments