refs #681 Insert selected emoji from emoji picker

This commit is contained in:
AkiraFukushima 2018-11-03 01:13:57 +09:00
parent 50c8bea5f0
commit 67a53b0429
1 changed files with 16 additions and 8 deletions

View File

@ -34,15 +34,18 @@
</li>
</ul>
</el-popover>
<el-button type="text" class="emoji-selector" @click="toggleEmojiPicker" v-click-outside="hideEmojiPicker">
<div v-click-outside="hideEmojiPicker">
<el-button type="text" class="emoji-selector" @click="toggleEmojiPicker">
<icon name="regular/smile" scale="1.2"></icon>
</el-button>
<div v-show="openEmojiPicker" class="emoji-picker">
<picker
set="emojione"
:autoFocus="true"
@select="selectEmoji"
/>
</div>
</div>
</div>
</template>
@ -284,6 +287,11 @@ export default {
},
hideEmojiPicker () {
this.openEmojiPicker = false
},
selectEmoji (emoji) {
const current = this.$refs.status.selectionStart
this.status = `${this.status.slice(0, current)}${emoji.native} ${this.status.slice(current)}`
this.hideEmojiPicker()
}
}
}