mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-17 18:04:01 +00:00
Merge branch 'dev'
This commit is contained in:
commit
aec7679a07
6 changed files with 1744 additions and 24 deletions
7
ui/src/components/comment-form.tsx
vendored
7
ui/src/components/comment-form.tsx
vendored
|
@ -1,7 +1,8 @@
|
||||||
import { Component, linkEvent } from 'inferno';
|
import { Component, linkEvent } from 'inferno';
|
||||||
import { CommentNode as CommentNodeI, CommentForm as CommentFormI, SearchForm, SearchType, SortType, UserOperation, SearchResponse } from '../interfaces';
|
import { CommentNode as CommentNodeI, CommentForm as CommentFormI, SearchForm, SearchType, SortType, UserOperation, SearchResponse } from '../interfaces';
|
||||||
import { Subscription } from "rxjs";
|
import { Subscription } from "rxjs";
|
||||||
import { capitalizeFirstLetter, mentionDropdownFetchLimit, msgOp, md, emojiMentionList, mdToHtml, randomStr, imageUploadUrl, markdownHelpUrl } from '../utils';
|
import { capitalizeFirstLetter, mentionDropdownFetchLimit, msgOp, mdToHtml, randomStr, imageUploadUrl, markdownHelpUrl } from '../utils';
|
||||||
|
import { twemojis } from '../twemojis';
|
||||||
import { WebSocketService, UserService } from '../services';
|
import { WebSocketService, UserService } from '../services';
|
||||||
import * as autosize from 'autosize';
|
import * as autosize from 'autosize';
|
||||||
import { i18n } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
|
@ -49,12 +50,12 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
|
||||||
trigger: ':',
|
trigger: ':',
|
||||||
menuItemTemplate: (item: any) => {
|
menuItemTemplate: (item: any) => {
|
||||||
let emoji = `:${item.original.key}:`;
|
let emoji = `:${item.original.key}:`;
|
||||||
return `${md.renderInline(emoji)} ${emoji}`;
|
return `${item.original.val} ${emoji}`;
|
||||||
},
|
},
|
||||||
selectTemplate: (item: any) => {
|
selectTemplate: (item: any) => {
|
||||||
return `:${item.original.key}:`;
|
return `:${item.original.key}:`;
|
||||||
},
|
},
|
||||||
values: emojiMentionList(),
|
values: Object.entries(twemojis).map(e => {return {'key': e[0], 'val': e[1]}}),
|
||||||
allowSpaces: false,
|
allowSpaces: false,
|
||||||
autocompleteMode: true,
|
autocompleteMode: true,
|
||||||
menuItemLimit: 10,
|
menuItemLimit: 10,
|
||||||
|
|
2
ui/src/components/comment-node.tsx
vendored
2
ui/src/components/comment-node.tsx
vendored
|
@ -65,6 +65,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
let node = this.props.node;
|
let node = this.props.node;
|
||||||
return (
|
return (
|
||||||
<div className={`comment ${node.comment.parent_id && !this.props.noIndent ? 'ml-4' : ''}`}>
|
<div className={`comment ${node.comment.parent_id && !this.props.noIndent ? 'ml-4' : ''}`}>
|
||||||
|
{!this.state.collapsed &&
|
||||||
<div className={`vote-bar mr-2 float-left small text-center ${this.props.viewOnly && 'no-click'}`}>
|
<div className={`vote-bar mr-2 float-left small text-center ${this.props.viewOnly && 'no-click'}`}>
|
||||||
<button className={`btn p-0 ${node.comment.my_vote == 1 ? 'text-info' : 'text-muted'}`} onClick={linkEvent(node, this.handleCommentLike)}>
|
<button className={`btn p-0 ${node.comment.my_vote == 1 ? 'text-info' : 'text-muted'}`} onClick={linkEvent(node, this.handleCommentLike)}>
|
||||||
<svg class="icon upvote"><use xlinkHref="#icon-arrow-up"></use></svg>
|
<svg class="icon upvote"><use xlinkHref="#icon-arrow-up"></use></svg>
|
||||||
|
@ -74,6 +75,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
<svg class="icon downvote"><use xlinkHref="#icon-arrow-down"></use></svg>
|
<svg class="icon downvote"><use xlinkHref="#icon-arrow-down"></use></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
<div id={`comment-${node.comment.id}`} className={`details comment-node ml-4 ${this.isCommentNew ? 'mark' : ''}`}>
|
<div id={`comment-${node.comment.id}`} className={`details comment-node ml-4 ${this.isCommentNew ? 'mark' : ''}`}>
|
||||||
<ul class="list-inline mb-0 text-muted small">
|
<ul class="list-inline mb-0 text-muted small">
|
||||||
<li className="list-inline-item">
|
<li className="list-inline-item">
|
||||||
|
|
4
ui/src/css/main.css
vendored
4
ui/src/css/main.css
vendored
|
@ -63,6 +63,10 @@ body, .text-white, .navbar-brand, .badge-light, .btn-secondary {
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.md-div h1,h2,h3,h4,h5 {
|
||||||
|
font-size:1.171875rem;
|
||||||
|
}
|
||||||
|
|
||||||
.comment-node {
|
.comment-node {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
1
ui/src/emoji_list.ts
vendored
1
ui/src/emoji_list.ts
vendored
File diff suppressed because one or more lines are too long
1721
ui/src/twemojis.ts
vendored
Normal file
1721
ui/src/twemojis.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
15
ui/src/utils.ts
vendored
15
ui/src/utils.ts
vendored
|
@ -11,8 +11,8 @@ import { UserOperation, Comment, User, SortType, ListingType } from './interface
|
||||||
import * as markdown_it from 'markdown-it';
|
import * as markdown_it from 'markdown-it';
|
||||||
declare var markdownitEmoji: any;
|
declare var markdownitEmoji: any;
|
||||||
import * as markdown_it_container from 'markdown-it-container';
|
import * as markdown_it_container from 'markdown-it-container';
|
||||||
import { emoji_list } from './emoji_list';
|
|
||||||
import * as twemoji from 'twemoji';
|
import * as twemoji from 'twemoji';
|
||||||
|
import { twemojis } from './twemojis';
|
||||||
|
|
||||||
export const repoUrl = 'https://github.com/dessalines/lemmy';
|
export const repoUrl = 'https://github.com/dessalines/lemmy';
|
||||||
export const imageUploadUrl = 'https://postimages.org/';
|
export const imageUploadUrl = 'https://postimages.org/';
|
||||||
|
@ -49,7 +49,9 @@ export const md = new markdown_it({
|
||||||
return '</details>\n';
|
return '</details>\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).use(markdownitEmoji);
|
}).use(markdownitEmoji, {
|
||||||
|
defs: twemojis
|
||||||
|
});
|
||||||
|
|
||||||
md.renderer.rules.emoji = function(token, idx) {
|
md.renderer.rules.emoji = function(token, idx) {
|
||||||
return twemoji.parse(token[idx].content);
|
return twemoji.parse(token[idx].content);
|
||||||
|
@ -195,15 +197,6 @@ export function getLanguage(): string {
|
||||||
return (navigator.language || navigator.userLanguage);
|
return (navigator.language || navigator.userLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function emojiMentionList(): Array<{}> {
|
|
||||||
let keyedEmojis = [];
|
|
||||||
for (let e of emoji_list) {
|
|
||||||
let obj = {key: e};
|
|
||||||
keyedEmojis.push(obj);
|
|
||||||
}
|
|
||||||
return keyedEmojis;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getMomentLanguage(): string {
|
export function getMomentLanguage(): string {
|
||||||
let lang = getLanguage();
|
let lang = getLanguage();
|
||||||
if (lang.startsWith('zh')) {
|
if (lang.startsWith('zh')) {
|
||||||
|
|
Loading…
Reference in a new issue