@@ -349,7 +349,7 @@ const WorkflowContent = React.memo(
349349 const workflowReadOnly = workflowLocked && ! sandbox
350350 const canvasOpacityClass = isCanvasReady
351351 ? workflowReadOnly
352- ? 'opacity-60 '
352+ ? 'opacity-75 '
353353 : 'opacity-100'
354354 : 'opacity-0'
355355
@@ -2184,6 +2184,18 @@ const WorkflowContent = React.memo(
21842184 [ screenToFlowPosition , handleToolbarDrop ]
21852185 )
21862186
2187+ const onDropLocked = useCallback (
2188+ ( event : React . DragEvent ) => {
2189+ event . preventDefault ( )
2190+ if ( ! event . dataTransfer ?. types . includes ( 'application/json' ) ) return
2191+ const message = effectivePermissions . canAdmin
2192+ ? 'Unlock the workflow to add blocks.'
2193+ : 'This workflow is locked. Ask an admin to unlock it.'
2194+ addNotification ( { level : 'info' , message, workflowId : activeWorkflowId || undefined } )
2195+ } ,
2196+ [ effectivePermissions . canAdmin , addNotification , activeWorkflowId ]
2197+ )
2198+
21872199 const handleCanvasPointerMove = useCallback (
21882200 ( event : React . PointerEvent < Element > ) => {
21892201 const position = screenToFlowPosition ( {
@@ -4074,8 +4086,16 @@ const WorkflowContent = React.memo(
40744086 nodeTypes = { nodeTypes }
40754087 edgeTypes = { edgeTypes }
40764088 onMouseDown = { handleCanvasMouseDown }
4077- onDrop = { effectivePermissions . canEdit ? onDrop : undefined }
4078- onDragOver = { effectivePermissions . canEdit ? onDragOver : undefined }
4089+ onDrop = {
4090+ effectivePermissions . canEdit
4091+ ? onDrop
4092+ : workflowReadOnly
4093+ ? onDropLocked
4094+ : undefined
4095+ }
4096+ onDragOver = {
4097+ effectivePermissions . canEdit || workflowReadOnly ? onDragOver : undefined
4098+ }
40794099 onInit = { ( instance ) => {
40804100 if ( embedded ) {
40814101 return
0 commit comments