mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-06 15:38:53 -05:00
fix
This commit is contained in:
parent
004584de03
commit
2ea45bfd78
@ -28,14 +28,14 @@ export function MediaItem(props) {
|
|||||||
(props.hasAnySelection ? ' has-any-selection' : '');
|
(props.hasAnySelection ? ' has-any-selection' : '');
|
||||||
|
|
||||||
const handleItemClick = (e) => {
|
const handleItemClick = (e) => {
|
||||||
// Only handle clicks when selection mode is active
|
// Only handle clicks when selection mode is active AND at least one item is selected
|
||||||
if (props.showSelection) {
|
if (props.showSelection && props.hasAnySelection) {
|
||||||
// Check if click was on the checkbox (already handled)
|
// Check if click was on the checkbox (already handled)
|
||||||
if (e.target.type === 'checkbox' || e.target.closest('.item-selection-checkbox')) {
|
if (e.target.type === 'checkbox' || e.target.closest('.item-selection-checkbox')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if click was on the edit icon or view icon
|
// Check if click was on the edit icon or publish icon
|
||||||
if (e.target.closest('.item-edit-icon') || e.target.closest('.item-view-icon')) {
|
if (e.target.closest('.item-edit-icon') || e.target.closest('.item-view-icon')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -55,12 +55,11 @@ export function MediaItem(props) {
|
|||||||
<div className={finalClassname} onClick={handleItemClick}>
|
<div className={finalClassname} onClick={handleItemClick}>
|
||||||
<div className="item-content">
|
<div className="item-content">
|
||||||
{props.showSelection && (
|
{props.showSelection && (
|
||||||
<div className="item-selection-checkbox" onClick={(e) => e.stopPropagation()}>
|
<div className="item-selection-checkbox">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={props.isSelected || false}
|
checked={props.isSelected || false}
|
||||||
onChange={(e) => { props.onCheckboxChange && props.onCheckboxChange(e); }}
|
onChange={(e) => { props.onCheckboxChange && props.onCheckboxChange(e); }}
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
aria-label="Select media"
|
aria-label="Select media"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user