mac multi select

This commit is contained in:
nBiqoz
2025-09-12 13:28:39 +02:00
parent 0360e1ca9f
commit d7d3a3c7e9
5 changed files with 60 additions and 25 deletions

View File

@@ -162,11 +162,15 @@ export const useContextMenu = ({
if (!contextMenu.selectedText) return;
const originalText = contextMenu.selectedText;
const firstWordIndex = contextMenu.wordIndices[0];
const selectedIndices = contextMenu.wordIndices;
const clickedWord = words[firstWordIndex];
const wordStart = clickedWord?.start;
const wordEnd = clickedWord?.end;
// Calculer les positions de début et fin pour tous les mots sélectionnés
const sortedIndices = selectedIndices.sort((a, b) => a - b);
const firstWord = words[sortedIndices[0]];
const lastWord = words[sortedIndices[sortedIndices.length - 1]];
const wordStart = firstWord?.start;
const wordEnd = lastWord?.end;
const existingMapping = entityMappings.find(
(m) => m.text === originalText
@@ -179,7 +183,9 @@ export const useContextMenu = ({
text: originalText,
label: displayName,
entityType,
applyToAll
applyToAll,
wordIndices: selectedIndices,
positions: { start: wordStart, end: wordEnd }
});
onUpdateMapping(