diff --git a/assets/javascripts/discourse/components/ai-post-helper-menu.gjs b/assets/javascripts/discourse/components/ai-post-helper-menu.gjs index 701d9368..ce013a1b 100644 --- a/assets/javascripts/discourse/components/ai-post-helper-menu.gjs +++ b/assets/javascripts/discourse/components/ai-post-helper-menu.gjs @@ -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; }