/* menu - emoticon */ import $ from '../../util/dom-core.js' import Panel from '../panel.js' // 构造函数 function Emoticon(editor) { this.editor = editor this.$elem = $( `
` ) this.type = 'panel' // 当前是否 active 状态 this._active = false } // 原型 Emoticon.prototype = { constructor: Emoticon, onClick: function () { this._createPanel() }, _createPanel: function () { const editor = this.editor const config = editor.config // 获取表情配置 const emotions = config.emotions || [] // 创建表情 dropPanel 的配置 const tabConfig = [] emotions.forEach(emotData => { const emotType = emotData.type const content = emotData.content || [] // 这一组表情最终拼接出来的 html let faceHtml = '' // emoji 表情 if (emotType === 'emoji') { content.forEach(item => { if (item) { faceHtml += '' + item + '' } }) } // 图片表情 if (emotType === 'image') { content.forEach(item => { const src = item.src const alt = item.alt if (src) { // 加一个 data-w-e 属性,点击图片的时候不再提示编辑图片 faceHtml += '