Skip to content

Commit

Permalink
fix(client): load emoji image when commentbox emoji button click
Browse files Browse the repository at this point in the history
fix #70
  • Loading branch information
lizheming committed Dec 17, 2020
1 parent 6856576 commit 7b9a1e2
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions packages/client/src/components/CommentBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,21 @@ export default function({
>{ctx.locale.reply}</button>
</div>
</div>
<div className="vemojis" style={{display: showEmoji ? 'block' : 'none'}}>
{Object.keys(ctx.emojiMaps).map(key => (
<i title={key} key={key} onClick={_ => insertAtCaret(editorRef.current, `:${key}:`)}>
<img
alt={key}
className="vemoji"
referrerPolicy="no-referrer"
src={/^(?:https?:)?\/\//.test(ctx.emojiMaps[key]) ? ctx.emojiMaps[key] : ctx.emojiCDN + ctx.emojiMaps[key]}
/>
</i>
))}
</div>
{showEmoji ? (
<div className="vemojis">
{Object.keys(ctx.emojiMaps).map(key => (
<i title={key} key={key} onClick={_ => insertAtCaret(editorRef.current, `:${key}:`)}>
<img
alt={key}
loading="lazy"
className="vemoji"
referrerPolicy="no-referrer"
src={/^(?:https?:)?\/\//.test(ctx.emojiMaps[key]) ? ctx.emojiMaps[key] : ctx.emojiCDN + ctx.emojiMaps[key]}
/>
</i>
))}
</div>
) : null}
<div
className="vinput vpreview"
style={{display: showPreview ? 'block' : 'none'}}
Expand Down

0 comments on commit 7b9a1e2

Please sign in to comment.