@magicx-eng/ai-autocomplete-angular 0.57.3 → 0.58.1

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.
@@ -2393,6 +2393,12 @@ class AIAutocompleteController {
2393
2393
  return;
2394
2394
  this.core.handleTextChange(value);
2395
2395
  }
2396
+ /** Forward the editor text while an IME composes. Only completions for the word are shown. */
2397
+ handleCompositionText(value) {
2398
+ if (this.isDestroyed)
2399
+ return;
2400
+ this.core.handleCompositionText(value);
2401
+ }
2396
2402
  /** Forward keyboard events from the consumer's `<textarea>` to the core. */
2397
2403
  handleKeyDown(event) {
2398
2404
  if (this.isDestroyed)
@@ -2887,12 +2893,15 @@ class AIAutocompleteEditorHostDirective {
2887
2893
  }
2888
2894
  // === Internal helpers ===
2889
2895
  fireInput() {
2890
- if (this.composing)
2891
- return;
2892
2896
  const el = this.el.nativeElement;
2893
2897
  const raw = extractPlainText(el);
2894
2898
  const shouldCapitalize = raw.length > 0 && raw[0] !== raw[0].toUpperCase();
2895
2899
  const next = shouldCapitalize ? raw[0].toUpperCase() + raw.slice(1) : raw;
2900
+ // While composing, the core only previews the text.
2901
+ if (this.composing) {
2902
+ this.controller.handleCompositionText(next);
2903
+ return;
2904
+ }
2896
2905
  this.controller.handleTextChange(next);
2897
2906
  }
2898
2907
  bindDocumentSelectionListener() {