@magicx-eng/ai-autocomplete-angular 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1138,7 +1138,14 @@ class AIAutocompleteEditorHostDirective {
1138
1138
  return;
1139
1139
  const anchor = sel.anchorNode;
1140
1140
  const startEl = anchor.nodeType === Node.ELEMENT_NODE ? anchor : anchor.parentElement;
1141
- const strong = startEl?.closest('strong[data-seg="completed"][data-param-id]');
1141
+ // Only a COLLAPSED selection means "the caret landed in a chip". A
1142
+ // range selection (Cmd+A, shift-arrow, drag) anchors at its start,
1143
+ // which lands inside the first `<strong>` whenever the input begins
1144
+ // with a chip — starting re-edit there parks the caret on that chip
1145
+ // and destroys the user's selection.
1146
+ const strong = sel.isCollapsed
1147
+ ? startEl?.closest('strong[data-seg="completed"][data-param-id]')
1148
+ : null;
1142
1149
  // `DOMStringMap` is an index signature; bracket notation is required
1143
1150
  // by `noPropertyAccessFromIndexSignature`.
1144
1151
  const enclosing = strong?.dataset["paramId"] ?? null;