mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
Don't drag for ephemeral blocks (#1288)
This commit is contained in:
parent
ced3d73111
commit
eb00716e00
@ -180,7 +180,6 @@ const BlockFrame_Header = ({
|
|||||||
const preIconButton = util.useAtomValueSafe(viewModel?.preIconButton);
|
const preIconButton = util.useAtomValueSafe(viewModel?.preIconButton);
|
||||||
let headerTextUnion = util.useAtomValueSafe(viewModel?.viewText);
|
let headerTextUnion = util.useAtomValueSafe(viewModel?.viewText);
|
||||||
const magnified = jotai.useAtomValue(nodeModel.isMagnified);
|
const magnified = jotai.useAtomValue(nodeModel.isMagnified);
|
||||||
const ephemeral = jotai.useAtomValue(nodeModel.isEphemeral);
|
|
||||||
const manageConnection = util.useAtomValueSafe(viewModel?.manageConnection);
|
const manageConnection = util.useAtomValueSafe(viewModel?.manageConnection);
|
||||||
const dragHandleRef = preview ? null : nodeModel.dragHandleRef;
|
const dragHandleRef = preview ? null : nodeModel.dragHandleRef;
|
||||||
|
|
||||||
@ -236,12 +235,7 @@ const BlockFrame_Header = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="block-frame-default-header" ref={dragHandleRef} onContextMenu={onContextMenu}>
|
||||||
className="block-frame-default-header"
|
|
||||||
ref={dragHandleRef}
|
|
||||||
onContextMenu={onContextMenu}
|
|
||||||
draggable={!(preview || magnified || ephemeral)}
|
|
||||||
>
|
|
||||||
{preIconButtonElem}
|
{preIconButtonElem}
|
||||||
<div className="block-frame-default-header-iconview">
|
<div className="block-frame-default-header-iconview">
|
||||||
{viewIconElem}
|
{viewIconElem}
|
||||||
|
@ -219,16 +219,19 @@ const DisplayNode = ({ layoutModel, node }: DisplayNodeProps) => {
|
|||||||
const previewRef = useRef<HTMLDivElement>(null);
|
const previewRef = useRef<HTMLDivElement>(null);
|
||||||
const addlProps = useAtomValue(nodeModel.additionalProps);
|
const addlProps = useAtomValue(nodeModel.additionalProps);
|
||||||
const devicePixelRatio = useDevicePixelRatio();
|
const devicePixelRatio = useDevicePixelRatio();
|
||||||
|
const isEphemeral = useAtomValue(nodeModel.isEphemeral);
|
||||||
|
const isMagnified = useAtomValue(nodeModel.isMagnified);
|
||||||
|
|
||||||
const [{ isDragging }, drag, dragPreview] = useDrag(
|
const [{ isDragging }, drag, dragPreview] = useDrag(
|
||||||
() => ({
|
() => ({
|
||||||
type: dragItemType,
|
type: dragItemType,
|
||||||
|
canDrag: () => !(isEphemeral || isMagnified),
|
||||||
item: () => node,
|
item: () => node,
|
||||||
collect: (monitor) => ({
|
collect: (monitor) => ({
|
||||||
isDragging: monitor.isDragging(),
|
isDragging: monitor.isDragging(),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
[node, addlProps]
|
[node, addlProps, isEphemeral, isMagnified]
|
||||||
);
|
);
|
||||||
|
|
||||||
const [previewElementGeneration, setPreviewElementGeneration] = useState(0);
|
const [previewElementGeneration, setPreviewElementGeneration] = useState(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user