mac multi select
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user