diff --git a/frontend/src/components/pageEditor/bulkSelectionPanel/BulkSelection.ts b/frontend/src/components/pageEditor/bulkSelectionPanel/BulkSelection.ts index 8b54b9d2b..d99b03a51 100644 --- a/frontend/src/components/pageEditor/bulkSelectionPanel/BulkSelection.ts +++ b/frontend/src/components/pageEditor/bulkSelectionPanel/BulkSelection.ts @@ -21,10 +21,9 @@ export function appendExpression(currentInput: string, expr: string): string { // Produces a trailing space to allow the next token to be typed naturally. export function insertOperatorSmart(currentInput: string, op: LogicalOperator): string { const text = (currentInput || '').trim(); - if (text.length === 0) return `${op} `; - // Handle 'even' and 'odd' as page selection expressions, not logical operators if (op === 'even' || op === 'odd') { + if (text.length === 0) return `${op} `; // If current input ends with a logical operator, append the page selection with proper spacing const endsWithOperator = /(\b(and|not|or)\s*|[&|,!]\s*)$/i.test(text); if (endsWithOperator) { @@ -34,6 +33,8 @@ export function insertOperatorSmart(currentInput: string, op: LogicalOperator): } return `${text} or ${op} `; } + + if (text.length === 0) return `${op} `; // Extract up to the last two operator tokens (words or symbols) from the end const tokens: string[] = []; diff --git a/frontend/src/components/pageEditor/bulkSelectionPanel/OperatorsSection.tsx b/frontend/src/components/pageEditor/bulkSelectionPanel/OperatorsSection.tsx index 61cd508bb..37d35953c 100644 --- a/frontend/src/components/pageEditor/bulkSelectionPanel/OperatorsSection.tsx +++ b/frontend/src/components/pageEditor/bulkSelectionPanel/OperatorsSection.tsx @@ -53,8 +53,7 @@ const OperatorsSection = ({ csvInput, onInsertOperator }: OperatorsSectionProps) variant="outline" className={classes.operatorChip} onClick={() => onInsertOperator('even')} - disabled={!csvInput.trim()} - title="Combine selections (both conditions must be true)" + title="Select all even-numbered pages (2, 4, 6, 8...)" > even @@ -63,8 +62,7 @@ const OperatorsSection = ({ csvInput, onInsertOperator }: OperatorsSectionProps) variant="outline" className={classes.operatorChip} onClick={() => onInsertOperator('odd')} - disabled={!csvInput.trim()} - title="Add to selection (either condition can be true)" + title="Select all odd-numbered pages (1, 3, 5, 7...)" > odd