mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
Re-add show source for comments (#2290)
Co-authored-by: SleeplessOne1917 <insomnia-void@protonmail.com>
This commit is contained in:
parent
82b939b0ec
commit
714618c80c
1 changed files with 24 additions and 1 deletions
|
@ -112,6 +112,13 @@ interface CommentNodeProps {
|
||||||
onPurgeComment(form: PurgeComment): Promise<void>;
|
onPurgeComment(form: PurgeComment): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleToggleViewSource(i: CommentNode) {
|
||||||
|
i.setState(({ viewSource, ...restPrev }) => ({
|
||||||
|
viewSource: !viewSource,
|
||||||
|
...restPrev,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
state: CommentNodeState = {
|
state: CommentNodeState = {
|
||||||
showReply: false,
|
showReply: false,
|
||||||
|
@ -306,7 +313,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="comment-bottom-btns d-flex justify-content-between justify-content-lg-start flex-wrap text-muted fw-bold">
|
<div className="comment-bottom-btns d-flex justify-content-between justify-content-lg-start flex-wrap text-muted fw-bold mt-1">
|
||||||
{this.props.showContext && this.getLinkButton()}
|
{this.props.showContext && this.getLinkButton()}
|
||||||
{this.props.markable && (
|
{this.props.markable && (
|
||||||
<button
|
<button
|
||||||
|
@ -345,6 +352,22 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
counts={counts}
|
counts={counts}
|
||||||
my_vote={my_vote}
|
my_vote={my_vote}
|
||||||
/>
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-link btn-animate text-muted"
|
||||||
|
onClick={linkEvent(this, handleToggleViewSource)}
|
||||||
|
data-tippy-content={I18NextService.i18n.t(
|
||||||
|
"view_source",
|
||||||
|
)}
|
||||||
|
aria-label={I18NextService.i18n.t("view_source")}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon="file-text"
|
||||||
|
classes={`icon-inline ${
|
||||||
|
this.state.viewSource && "text-success"
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
<CommentActionDropdown
|
<CommentActionDropdown
|
||||||
commentView={this.commentView}
|
commentView={this.commentView}
|
||||||
admins={this.props.admins}
|
admins={this.props.admins}
|
||||||
|
|
Loading…
Reference in a new issue