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,
type: String
},
emojiPicker: {
enableEmojiPicker: {
/**
* Enables emoji picker support, this implies that custom emoji are supported
*/
required: false,
type: Boolean,
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,
type: Boolean,
default: false
},
stickerPicker: {
enableStickerPicker: {
/**
* Enables sticker picker support, only makes sense when enableEmojiPicker=true
*/
required: false,
type: Boolean,
default: false

View File

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

View File

@ -5,7 +5,7 @@ const filterByKeyword = (list, keyword = '') => {
const EmojiPicker = {
props: {
stickerPicker: {
enableStickerPicker: {
required: false,
type: Boolean,
default: false
@ -97,6 +97,9 @@ const EmojiPicker = {
},
emojisView () {
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
v-if="stickerPicker"
v-if="stickerPickerEnabled"
class="additional-tabs"
>
<span

View File

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