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.
This commit is contained in:
Keegan George 2025-03-26 11:28:57 -07:00 committed by GitHub
parent a6b08270c0
commit 371146cdfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@ import FastEditModal from "discourse/components/modal/fast-edit";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bind } from "discourse/lib/decorators";
import { withPluginApi } from "discourse/lib/plugin-api";
import { sanitize } from "discourse/lib/text";
import { clipboardCopy } from "discourse/lib/utilities";
import { i18n } from "discourse-i18n";
@ -69,6 +70,23 @@ export default class AiPostHelperMenu extends Component {
@tracked _activeAiRequest = null;
constructor() {
super(...arguments);
withPluginApi((api) => {
api.registerValueTransformer(
"post-text-selection-prevent-close",
({ value }) => {
if (this.menuState === this.MENU_STATES.result) {
return true;
}
return value;
}
);
});
}
get footnoteDisabled() {
return this.streaming || !this.supportsAddFootnote;
}