review/naming + bugfix for stickers

This commit is contained in:
Henry Jameson 2019-09-12 20:36:43 +03:00
parent 9bd0ed7912
commit 3505e53756
5 changed files with 27 additions and 13 deletions

View file

@ -54,17 +54,28 @@ const EmojiInput = {
required: true, required: true,
type: String type: String
}, },
emojiPicker: { enableEmojiPicker: {
/**
* Enables emoji picker support, this implies that custom emoji are supported
*/
required: false, required: false,
type: Boolean, type: Boolean,
default: false default: false
}, },
emojiPickerExternalTrigger: { hideEmojiButton: {
/**
enableStickerPicker: {
* intended to use with external picker trigger, i.e. you have a button outside
* input that will open up the picker, see triggerShowPicker()
*/
required: false, required: false,
type: Boolean, type: Boolean,
default: false default: false
}, },
stickerPicker: { enableStickerPicker: {
/**
* Enables sticker picker support, only makes sense when enableEmojiPicker=true
*/
required: false, required: false,
type: Boolean, type: Boolean,
default: false default: false

View file

@ -4,19 +4,19 @@
class="emoji-input" class="emoji-input"
> >
<slot /> <slot />
<template v-if="emojiPicker"> <template v-if="enableEmojiPicker">
<div <div
v-if="!emojiPickerExternalTrigger" v-if="!hideEmojiButton"
class="emoji-picker-icon" class="emoji-picker-icon"
@click.prevent="togglePicker" @click.prevent="togglePicker"
> >
<i class="icon-smile" /> <i class="icon-smile" />
</div> </div>
<EmojiPicker <EmojiPicker
v-if="emojiPicker" v-if="enableEmojiPicker"
ref="picker" ref="picker"
:class="{ hide: !showPicker }" :class="{ hide: !showPicker }"
:sticker-picker="stickerPicker" :enable-sticker-picker="enableStickerPicker"
class="emoji-picker-panel" class="emoji-picker-panel"
@emoji="insert" @emoji="insert"
@sticker-uploaded="onStickerUploaded" @sticker-uploaded="onStickerUploaded"

View file

@ -5,7 +5,7 @@ const filterByKeyword = (list, keyword = '') => {
const EmojiPicker = { const EmojiPicker = {
props: { props: {
stickerPicker: { enableStickerPicker: {
required: false, required: false,
type: Boolean, type: Boolean,
default: false default: false
@ -97,6 +97,9 @@ const EmojiPicker = {
}, },
emojisView () { emojisView () {
return this.emojis.filter(value => value.emojis.length > 0) return this.emojis.filter(value => value.emojis.length > 0)
},
stickerPickerEnabled () {
return (this.$store.state.instance.stickers || []).length !== 0
} }
} }
} }

View file

@ -17,7 +17,7 @@
</span> </span>
</span> </span>
<span <span
v-if="stickerPicker" v-if="stickerPickerEnabled"
class="additional-tabs" class="additional-tabs"
> >
<span <span

View file

@ -61,7 +61,7 @@
<EmojiInput <EmojiInput
v-if="newStatus.spoilerText || alwaysShowSubject" v-if="newStatus.spoilerText || alwaysShowSubject"
v-model="newStatus.spoilerText" v-model="newStatus.spoilerText"
emoji-picker enable-emoji-picker
:suggest="emojiSuggestor" :suggest="emojiSuggestor"
class="form-control" class="form-control"
> >
@ -78,9 +78,9 @@
v-model="newStatus.status" v-model="newStatus.status"
:suggest="emojiUserSuggestor" :suggest="emojiUserSuggestor"
class="form-control main-input" class="form-control main-input"
emoji-picker enable-emoji-picker
emoji-picker-external-trigger hide-emoji-button
sticker-picker enable-sticker-picker
@sticker-uploaded="addMediaFile" @sticker-uploaded="addMediaFile"
@sticker-upload-failed="uploadFailed" @sticker-upload-failed="uploadFailed"
> >