Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not allow drag by dropdown menu #187

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/GridLayout/GridLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import {
COMPACT_TYPE_HORIZONTAL_NOWRAP,
DEFAULT_GROUP,
OVERLAY_CONTROLS_CLASS_NAME,
DRAGGABLE_CANCEL_CLASS_NAME,
TEMPORARY_ITEM_ID,
} from '../../constants';
import {DashKitContext} from '../../context/DashKitContext';
Expand Down Expand Up @@ -534,7 +534,7 @@ export default class GridLayout extends React.PureComponent {
key={`group_${group}`}
isDraggable={editMode}
isResizable={editMode}
draggableCancel={`.${OVERLAY_CONTROLS_CLASS_NAME}`}
draggableCancel={`.${DRAGGABLE_CANCEL_CLASS_NAME}`}
{...(draggableHandleClassName
? {draggableHandle: `.${draggableHandleClassName}`}
: null)}
Expand Down
6 changes: 5 additions & 1 deletion src/components/OverlayControls/OverlayControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import noop from 'lodash/noop';

import {
COPIED_WIDGET_STORE_KEY,
DRAGGABLE_CANCEL_CLASS_NAME,
MenuItems,
OVERLAY_CONTROLS_CLASS_NAME,
OVERLAY_ICON_SIZE,
Expand Down Expand Up @@ -111,7 +112,7 @@ class OverlayControls extends React.Component<OverlayControlsProps> {
? this.getCustomControlsWithWidgets()
: this.renderControls();

return <div className={b({position})}>{controls}</div>;
return <div className={b({position}, [DRAGGABLE_CANCEL_CLASS_NAME])}>{controls}</div>;
}

private getItems = () => {
Expand Down Expand Up @@ -311,6 +312,9 @@ class OverlayControls extends React.Component<OverlayControlsProps> {
<Icon data={Ellipsis} size={OVERLAY_ICON_SIZE} />
</Button>
)}
popupProps={{
contentClassName: DRAGGABLE_CANCEL_CLASS_NAME,
}}
/>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ export const DEFAULT_WIDGET_WIDTH = 3;
export const DEFAULT_GROUP = '__default';

export const COMPACT_TYPE_HORIZONTAL_NOWRAP = 'horizontal-nowrap';

export const DRAGGABLE_CANCEL_CLASS_NAME = 'dashkit_draggable_cancel';
Loading