diff --git a/assets/javascripts/discourse/connectors/post-text-buttons/ai-helper-options-menu.gjs b/assets/javascripts/discourse/connectors/post-text-buttons/ai-helper-options-menu.gjs index 53dbf8c2..c6a90b3f 100644 --- a/assets/javascripts/discourse/connectors/post-text-buttons/ai-helper-options-menu.gjs +++ b/assets/javascripts/discourse/connectors/post-text-buttons/ai-helper-options-menu.gjs @@ -59,7 +59,7 @@ export default class AIHelperOptionsMenu extends Component { highlightSelectedText() { const postId = this.args.outletArgs.data.quoteState.postId; const postElement = document.querySelector( - `article[data-post-id='${postId}']` + `article[data-post-id='${postId}'] .cooked` ); if (!postElement) { @@ -135,7 +135,7 @@ export default class AIHelperOptionsMenu extends Component { const postId = this.args.outletArgs.data.quoteState.postId; const postElement = document.querySelector( - `article[data-post-id='${postId}']` + `article[data-post-id='${postId}'] .cooked` ); if (!postElement) { diff --git a/spec/system/ai_helper/ai_post_helper_spec.rb b/spec/system/ai_helper/ai_post_helper_spec.rb index 1aa52f94..141e7788 100644 --- a/spec/system/ai_helper/ai_post_helper_spec.rb +++ b/spec/system/ai_helper/ai_post_helper_spec.rb @@ -65,6 +65,14 @@ RSpec.describe "AI Post helper", type: :system, js: true do expect(post_ai_helper).to have_no_highlighted_text end + it "allows post control buttons to still be functional after clicking the AI button" do + select_post_text(post) + post_ai_helper.click_ai_button + topic_page.click_like_reaction_for(post) + wait_for { post.reload.like_count == 1 } + expect(post.like_count).to eq(1) + end + context "when using explain mode" do let(:mode) { CompletionPrompt::EXPLAIN }