From 0ca385deaf00d905081c66d0e0164558531e0e70 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 3 Apr 2020 13:46:25 -0400 Subject: Adding a text body preview and icon for posts with a body. Fixes #617 --- ui/src/utils.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ui/src/utils.ts') diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 8ecef19b..d659509c 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -823,3 +823,11 @@ function hsl(num: number) { function randomHsl() { return `hsla(${Math.random() * 360}, 100%, 50%, 1)`; } + +export function previewLines(text: string, lines: number = 3): string { + // Use lines * 2 because markdown requires 2 lines + return text + .split('\n') + .slice(0, lines * 2) + .join('\n'); +} -- cgit v1.2.3 From ed264aba3c12243352f68c2de6a5f21f23778bd0 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 9 Apr 2020 16:11:11 -0400 Subject: Updating code url references to https://github.com/LemmyNet/lemmy --- ui/src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/src/utils.ts') diff --git a/ui/src/utils.ts b/ui/src/utils.ts index d659509c..ceb05764 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -44,7 +44,7 @@ import emojiShortName from 'emoji-short-name'; import Toastify from 'toastify-js'; import tippy from 'tippy.js'; -export const repoUrl = 'https://github.com/dessalines/lemmy'; +export const repoUrl = 'https://github.com/LemmyNet/lemmy'; export const helpGuideUrl = '/docs/about_guide.html'; export const markdownHelpUrl = `${helpGuideUrl}#markdown-guide`; export const sortingHelpUrl = `${helpGuideUrl}#sorting`; -- cgit v1.2.3 From d6d040f5da2317af19b3df426556914d1b2a14fe Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 12 Apr 2020 12:47:48 -0400 Subject: Add Emoji squashed commit. --- ui/src/utils.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ui/src/utils.ts') diff --git a/ui/src/utils.ts b/ui/src/utils.ts index ceb05764..fd23bf9e 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -43,6 +43,7 @@ import twemoji from 'twemoji'; import emojiShortName from 'emoji-short-name'; import Toastify from 'toastify-js'; import tippy from 'tippy.js'; +import EmojiButton from '@joeattardi/emoji-button'; export const repoUrl = 'https://github.com/LemmyNet/lemmy'; export const helpGuideUrl = '/docs/about_guide.html'; @@ -88,6 +89,14 @@ export const themes = [ 'i386', ]; +export const emojiPicker = new EmojiButton({ + // Use the emojiShortName from native + // style: 'twemoji', + theme: 'dark', + position: 'auto-start', + // TODO i18n +}); + export function randomStr() { return Math.random() .toString(36) @@ -473,8 +482,9 @@ export function setupTribute(): Tribute { { trigger: ':', menuItemTemplate: (item: any) => { - let emoji = `:${item.original.key}:`; - return `${item.original.val} ${emoji}`; + let shortName = `:${item.original.key}:`; + let twemojiIcon = twemoji.parse(item.original.val); + return `${twemojiIcon} ${shortName}`; }, selectTemplate: (item: any) => { return `:${item.original.key}:`; -- cgit v1.2.3 From 676690097f0e781dfca2704b1ee88e5a7dfeb91c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 12 Apr 2020 14:55:52 -0400 Subject: Use twemoji style for emoji picker. --- ui/src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/src/utils.ts') diff --git a/ui/src/utils.ts b/ui/src/utils.ts index fd23bf9e..21a7fef8 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -91,7 +91,7 @@ export const themes = [ export const emojiPicker = new EmojiButton({ // Use the emojiShortName from native - // style: 'twemoji', + style: 'twemoji', theme: 'dark', position: 'auto-start', // TODO i18n -- cgit v1.2.3