From: Dessalines Date: Fri, 22 Nov 2019 02:14:59 +0000 (-0800) Subject: Adding archive button for valid post urls. X-Git-Url: http://these/git/%7B%60/static/assets/css/themes/%24%7BappleTouchIcon%7D?a=commitdiff_plain;h=bcf994efe9959803edc80359918dd1413604b12a;p=lemmy.git Adding archive button for valid post urls. - Fixes #342 --- diff --git a/README.md b/README.md index f32cb516..3b0155a7 100644 --- a/README.md +++ b/README.md @@ -246,15 +246,15 @@ If you'd like to add translations, take a look a look at the [English translatio lang | done | missing --- | --- | --- -de | 79% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,subscribed,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,expires,recent_comments,nsfw,show_nsfw,theme,crypto,monero,joined,by,to,transfer_community,transfer_site,are_you_sure,yes,no -eo | 88% | number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,theme,are_you_sure,yes,no -es | 96% | replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup -fr | 96% | replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup -it | 97% | forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup -nl | 90% | preview,upload_image,formatting_help,view_source,sticky,unsticky,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,theme -ru | 83% | cross_posts,cross_post,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,recent_comments,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no -sv | 96% | replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup -zh | 81% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,recent_comments,nsfw,show_nsfw,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no +de | 79% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,subscribed,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,expires,recent_comments,nsfw,show_nsfw,theme,crypto,monero,joined,by,to,transfer_community,transfer_site,are_you_sure,yes,no +eo | 87% | number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,theme,are_you_sure,yes,no +es | 96% | archive_link,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup +fr | 96% | archive_link,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup +it | 97% | archive_link,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup +nl | 89% | preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,theme +ru | 83% | cross_posts,cross_post,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,recent_comments,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no +sv | 96% | archive_link,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup +zh | 81% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,formatting_help,view_source,sticky,unsticky,archive_link,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,replies,mentions,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,recent_comments,nsfw,show_nsfw,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no If you'd like to update this report, run: diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx index d3739b47..a3ea8fa3 100644 --- a/ui/src/components/post-form.tsx +++ b/ui/src/components/post-form.tsx @@ -24,6 +24,7 @@ import { validURL, capitalizeFirstLetter, markdownHelpUrl, + archiveUrl, mdToHtml, } from '../utils'; import * as autosize from 'autosize'; @@ -175,6 +176,17 @@ export class PostForm extends Component { onChange={linkEvent(this, this.handleImageUpload)} /> + {validURL(this.state.postForm.url) && ( + + # + + )} {this.state.imageLoading && ( diff --git a/ui/src/translations/en.ts b/ui/src/translations/en.ts index f73e0d09..e20ba40a 100644 --- a/ui/src/translations/en.ts +++ b/ui/src/translations/en.ts @@ -35,6 +35,7 @@ export const en = { sticky: 'sticky', unsticky: 'unsticky', link: 'link', + archive_link: 'archive link', mod: 'mod', mods: 'mods', moderates: 'Moderates', diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 18144dde..2cf80d14 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -24,6 +24,7 @@ import * as emojiShortName from 'emoji-short-name'; export const repoUrl = 'https://github.com/dessalines/lemmy'; export const markdownHelpUrl = 'https://commonmark.org/help/'; +export const archiveUrl = 'https://archive.is'; export const postRefetchSeconds: number = 60 * 1000; export const fetchLimit: number = 20;