diff options
author | Filip785 <fdjuricic98@gmail.com> | 2020-07-09 17:12:43 +0200 |
---|---|---|
committer | Filip785 <fdjuricic98@gmail.com> | 2020-07-09 17:12:43 +0200 |
commit | 10a946cab3d40a30b2f9efc9d38a6a043eb25480 (patch) | |
tree | edd3ab6b1b0ca38c46c20df0429add8b53b80fed /ui/src/components | |
parent | abdbd50f5edb03917fc0cd770ad1f9f44f5b8980 (diff) | |
parent | 20f9bde88f52ce875be4d0dc4bd5dd346dfe6b84 (diff) |
Merge remote-tracking branch 'upstream/master' into cake-day
Diffstat (limited to 'ui/src/components')
-rw-r--r-- | ui/src/components/comment-form.tsx | 18 | ||||
-rw-r--r-- | ui/src/components/comment-node.tsx | 14 | ||||
-rw-r--r-- | ui/src/components/main.tsx | 10 |
3 files changed, 32 insertions, 10 deletions
diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index 770c127c..32bc3786 100644 --- a/ui/src/components/comment-form.tsx +++ b/ui/src/components/comment-form.tsx @@ -98,7 +98,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> { } componentDidMount() { - var textarea: any = document.getElementById(this.id); + let textarea: any = document.getElementById(this.id); autosize(textarea); this.tribute.attach(textarea); textarea.addEventListener('tribute-replaced', () => { @@ -106,6 +106,22 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> { this.setState(this.state); autosize.update(textarea); }); + + // Quoting of selected text + let selectedText = window.getSelection().toString(); + if (selectedText) { + let quotedText = + selectedText + .split('\n') + .map(t => `> ${t}`) + .join('\n') + '\n\n'; + this.state.commentForm.content = quotedText; + this.setState(this.state); + // Not sure why this needs a delay + setTimeout(() => autosize.update(textarea), 10); + } + + textarea.focus(); } componentDidUpdate() { diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index 2d1426b0..0e2d1d94 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -196,8 +196,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { </Link> </> )} - <div - className="mr-lg-4 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2" + <button + class="btn btn-sm text-muted" onClick={linkEvent(this, this.handleCommentCollapse)} > {this.state.collapsed ? ( @@ -209,9 +209,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { <use xlinkHref="#icon-minus-square"></use> </svg> )} - </div> - <span - className={`unselectable pointer ${this.scoreColor}`} + </button> + {/* This is an expanding spacer for mobile */} + <div className="mr-lg-4 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2"></div> + <button + className={`btn btn-sm p-0 unselectable pointer ${this.scoreColor}`} onClick={linkEvent(node, this.handleCommentUpvote)} data-tippy-content={this.pointsTippy} > @@ -219,7 +221,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { <use xlinkHref="#icon-zap"></use> </svg> <span class="mr-1">{this.state.score}</span> - </span> + </button> <span className="mr-1">•</span> <span> <MomentTime data={node.comment} /> diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index 20735049..9e9027d6 100644 --- a/ui/src/components/main.tsx +++ b/ui/src/components/main.tsx @@ -373,17 +373,21 @@ export class Main extends Component<any, MainState> { # </a> <a href="https://en.wikipedia.org/wiki/Fediverse">#</a> - <br></br> + <br class="big"></br> <code>#</code> <br></br> <b>#</b> - <br></br> + <br class="big"></br> <a href={repoUrl}>#</a> - <br></br> + <br class="big"></br> <a href="https://www.rust-lang.org">#</a> <a href="https://actix.rs/">#</a> <a href="https://infernojs.org">#</a> <a href="https://www.typescriptlang.org/">#</a> + <br class="big"></br> + <a href="https://github.com/LemmyNet/lemmy/graphs/contributors?type=a"> + # + </a> </T> </p> </div> |