根据网上前辈提供的,还真的不错,下面也整理一下
添加一个名叫“macros”的普通按钮在工具栏上:
第一步:找到ueditor.config.js文件中的toolbars数组,增加一个“macros”字符串,
然后找到labelMap数组,对应着添加一个labelMap,用于鼠标移上按钮时的提示。
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
, toolbars:[
[\'fullscreen\', \'source\', \'|\', \'undo\', \'redo\', \'|\',
\'bold\', \'italic\', \'underline\', \'fontborder\', \'strikethrough\', \'superscript\', \'subscript\', \'removeformat\', \'formatmatch\', \'autotypeset\', \'blockquote\', \'pasteplain\', \'|\', \'forecolor\', \'backcolor\', \'insertorderedlist\', \'insertunorderedlist\', \'selectall\', \'cleardoc\', \'|\',
\'rowspacingtop\', \'rowspacingbottom\', \'lineheight\', \'|\',
\'customstyle\', \'paragraph\', \'fontfamily\', \'fontsize\', \'|\',
\'directionalityltr\', \'directionalityrtl\', \'indent\', \'|\',
\'justifyleft\', \'justifycenter\', \'justifyright\', \'justifyjustify\', \'|\', \'touppercase\', \'tolowercase\', \'|\',
\'link\', \'unlink\', \'anchor\', \'|\', \'imagenone\', \'imageleft\', \'imageright\', \'imagecenter\', \'|\',
\'insertimage\', \'emotion\', \'scrawl\', \'insertvideo\', \'music\', \'attachment\', \'map\', \'gmap\', \'insertframe\',\'insertcode\', \'webapp\', \'pagebreak\', \'template\', \'background\', \'|\',
\'horizontal\', \'date\', \'time\', \'spechars\', \'snapscreen\', \'wordimage\', \'|\',
\'inserttable\', \'deletetable\', \'insertparagraphbeforetable\', \'insertrow\', \'deleterow\', \'insertcol\', \'deletecol\', \'mergecells\', \'mergeright\', \'mergedown\', \'splittocells\', \'splittorows\', \'splittocols\', \'|\',
\'print\', \'preview\', \'searchreplace\', \'help\', \'macros\',
] ]
//当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
,labelMap:{ \'macros\': \'hello\' }