TinyMCE自带保存按钮长得像下载似的,看着很别扭。那么怎么替换成我们想要的按钮呢?
TinyMCE是按照按钮的名称“save”去icons.js中找到对应的svg定义,然后渲染按钮。所以,我们完全可以在icons.js中修改svg。
可以从网上下载我们需要的图表svg,然后粘贴即可。
同样,也可以利用editor的实例方法,在运行时完成图标替换:
const iconSvg =
'<svg width="24" height="24"><path d="M17.064,4.656l-2.05-2.035C14.936,2.544,14.831,2.5,14.721,2.5H3.854c-0.229,0-0.417,0.188-0.417,0.417v14.167c0,0.229,0.188,0.417,0.417,0.417h12.917c0.229,0,0.416-0.188,0.416-0.417V4.952C17.188,4.84,17.144,4.733,17.064,4.656M6.354,3.333h7.917V10H6.354V3.333z M16.354,16.667H4.271V3.333h1.25v7.083c0,0.229,0.188,0.417,0.417,0.417h8.75c0.229,0,0.416-0.188,0.416-0.417V3.886l1.25,1.239V16.667z M13.402,4.688v3.958c0,0.229-0.186,0.417-0.417,0.417c-0.229,0-0.417-0.188-0.417-0.417V4.688c0-0.229,0.188-0.417,0.417-0.417C13.217,4.271,13.402,4.458,13.402,4.688" fill-rule="nonzero"/></svg>'
editor.ui.registry.addIcon("save", iconSvg);
网友评论