mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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.
This commit is contained in:
parent
9919046c1c
commit
d128dc0e61
@ -235,6 +235,7 @@ export default class PostTextSelectionToolbar extends Component {
|
|||||||
<PluginOutlet
|
<PluginOutlet
|
||||||
@name="quote-share-buttons-after"
|
@name="quote-share-buttons-after"
|
||||||
@connectorTagName="span"
|
@connectorTagName="span"
|
||||||
|
@outletArgs={{hash data=@data}}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
@ -209,6 +209,7 @@ export default class PostTextSelection extends Component {
|
|||||||
topic: this.args.topic,
|
topic: this.args.topic,
|
||||||
quoteState,
|
quoteState,
|
||||||
insertQuote: this.insertQuote,
|
insertQuote: this.insertQuote,
|
||||||
|
buildQuote: this.buildQuote,
|
||||||
hideToolbar: this.hideToolbar,
|
hideToolbar: this.hideToolbar,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -271,6 +272,11 @@ export default class PostTextSelection extends Component {
|
|||||||
await this.hideToolbar();
|
await this.hideToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
async buildQuote() {
|
||||||
|
return await this.args.buildQuoteMarkdown();
|
||||||
|
}
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
{{this.documentListeners}}
|
{{this.documentListeners}}
|
||||||
|
@ -457,6 +457,18 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
buildQuoteMarkdown() {
|
||||||
|
const { postId, buffer, opts } = this.quoteState;
|
||||||
|
const loadedPost = this.get("model.postStream").findLoadedPost(postId);
|
||||||
|
const promise = loadedPost
|
||||||
|
? Promise.resolve(loadedPost)
|
||||||
|
: this.get("model.postStream").loadPost(postId);
|
||||||
|
|
||||||
|
return promise.then((post) => {
|
||||||
|
return buildQuote(post, buffer, opts);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
fillGapBefore(args) {
|
fillGapBefore(args) {
|
||||||
return this.get("model.postStream").fillGapBefore(args.post, args.gap);
|
return this.get("model.postStream").fillGapBefore(args.post, args.gap);
|
||||||
},
|
},
|
||||||
|
@ -596,6 +596,7 @@
|
|||||||
<PostTextSelection
|
<PostTextSelection
|
||||||
@quoteState={{this.quoteState}}
|
@quoteState={{this.quoteState}}
|
||||||
@selectText={{action "selectText"}}
|
@selectText={{action "selectText"}}
|
||||||
|
@buildQuoteMarkdown={{this.buildQuoteMarkdown}}
|
||||||
@editPost={{action "editPost"}}
|
@editPost={{action "editPost"}}
|
||||||
@topic={{this.model}}
|
@topic={{this.model}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user