MCPcopy Create free account
hub / github.com/TruthHun/BookStack / insertEmotionImgs

Function insertEmotionImgs

static/wangEditor/js/wangEditor.js:5099–5116  ·  view source on GitHub ↗
(data, $tabContent)

Source from the content-addressed store, hash-verified

5097
5098 // 添加表情图片的函数
5099 function insertEmotionImgs(data, $tabContent) {
5100 // 添加表情图片
5101 $.each(data, function (k, emotion) {
5102 var src = emotion.icon || emotion.url;
5103 var value = emotion.value || emotion.title;
5104 // 通过配置 editor.config.emotionsShow 的值来修改插入到编辑器的内容(图片/value)
5105 var commandValue = emotionsShow === 'icon' ? src : value;
5106 var $command = $('<a href="#" commandValue="' + commandValue + '"></a>');
5107 var $img = $('<img>');
5108 $img.attr('_src', src); // 先将 src 复制到 '_src' 属性,先不加载
5109
5110 $command.append($img);
5111 $tabContent.append($command);
5112
5113 // 记录下每一个表情图片的地址
5114 editor.emotionUrls.push(src);
5115 });
5116 }
5117
5118 // 拼接 dropPanel 内容
5119 var $panelContent = $('<div class="panel-tab"></div>');

Callers 1

wangEditor.jsFile · 0.85

Calls 1

$Function · 0.50

Tested by

no test coverage detected