Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 371146c

Browse files
authored
FIX: Post helper menu results should be selectable (#1221)
This update fixes an issue where the results of the post helper menu was not selectable. Previously, selecting any text inside the menu was immediately closing the menu.
1 parent a6b0827 commit 371146c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

assets/javascripts/discourse/components/ai-post-helper-menu.gjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import FastEditModal from "discourse/components/modal/fast-edit";
1313
import { ajax } from "discourse/lib/ajax";
1414
import { popupAjaxError } from "discourse/lib/ajax-error";
1515
import { bind } from "discourse/lib/decorators";
16+
import { withPluginApi } from "discourse/lib/plugin-api";
1617
import { sanitize } from "discourse/lib/text";
1718
import { clipboardCopy } from "discourse/lib/utilities";
1819
import { i18n } from "discourse-i18n";
@@ -69,6 +70,23 @@ export default class AiPostHelperMenu extends Component {
6970

7071
@tracked _activeAiRequest = null;
7172

73+
constructor() {
74+
super(...arguments);
75+
76+
withPluginApi((api) => {
77+
api.registerValueTransformer(
78+
"post-text-selection-prevent-close",
79+
({ value }) => {
80+
if (this.menuState === this.MENU_STATES.result) {
81+
return true;
82+
}
83+
84+
return value;
85+
}
86+
);
87+
});
88+
}
89+
7290
get footnoteDisabled() {
7391
return this.streaming || !this.supportsAddFootnote;
7492
}

0 commit comments

Comments
 (0)