@trustquery/browser 0.3.4 → 0.3.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustquery/browser",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Turn any textarea into an interactive trigger-based editor with inline styling",
5
5
  "type": "module",
6
6
  "main": "dist/trustquery.js",
@@ -650,6 +650,16 @@ export default class DropdownManager {
650
650
  console.log('[DropdownManager] Dropdown option selected:', option, 'for:', matchData.text);
651
651
  }
652
652
 
653
+ // IMPORTANT: Trigger callback FIRST, before input event dispatch
654
+ // The input event triggers a synchronous re-render that removes the dropdown,
655
+ // so the callback must run while everything is still intact
656
+ if (this.options.onWordClick) {
657
+ this.options.onWordClick({
658
+ ...matchData,
659
+ selectedOption: option
660
+ });
661
+ }
662
+
653
663
  // Check if option has on-select.display
654
664
  if (option['on-select'] && option['on-select'].display && this.options.textarea) {
655
665
  const displayText = option['on-select'].display;
@@ -679,14 +689,6 @@ export default class DropdownManager {
679
689
  }
680
690
  }
681
691
  }
682
-
683
- // Trigger callback
684
- if (this.options.onWordClick) {
685
- this.options.onWordClick({
686
- ...matchData,
687
- selectedOption: option
688
- });
689
- }
690
692
  }
691
693
 
692
694
  /**