From d128dc0e6141e3a813971742f366337432ca9b31 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Tue, 14 Nov 2023 08:47:39 +1000 Subject: [PATCH] FEATURE: Add buildQuoteMarkdown for post toolbar (#24326) This allows outlets for the post-text-selection-toolbar to get just the raw markdown of the selected text for a quote, rather than opening the composer. --- .../app/components/post-text-selection-toolbar.gjs | 1 + .../discourse/app/components/post-text-selection.gjs | 6 ++++++ .../javascripts/discourse/app/controllers/topic.js | 12 ++++++++++++ .../javascripts/discourse/app/templates/topic.hbs | 1 + 4 files changed, 20 insertions(+) diff --git a/app/assets/javascripts/discourse/app/components/post-text-selection-toolbar.gjs b/app/assets/javascripts/discourse/app/components/post-text-selection-toolbar.gjs index 09b3cd2daff..2734ea4c3d4 100644 --- a/app/assets/javascripts/discourse/app/components/post-text-selection-toolbar.gjs +++ b/app/assets/javascripts/discourse/app/components/post-text-selection-toolbar.gjs @@ -235,6 +235,7 @@ export default class PostTextSelectionToolbar extends Component { diff --git a/app/assets/javascripts/discourse/app/components/post-text-selection.gjs b/app/assets/javascripts/discourse/app/components/post-text-selection.gjs index 66667b22096..92a7689c00b 100644 --- a/app/assets/javascripts/discourse/app/components/post-text-selection.gjs +++ b/app/assets/javascripts/discourse/app/components/post-text-selection.gjs @@ -209,6 +209,7 @@ export default class PostTextSelection extends Component { topic: this.args.topic, quoteState, insertQuote: this.insertQuote, + buildQuote: this.buildQuote, hideToolbar: this.hideToolbar, }, }; @@ -271,6 +272,11 @@ export default class PostTextSelection extends Component { await this.hideToolbar(); } + @action + async buildQuote() { + return await this.args.buildQuoteMarkdown(); + } +