【发布时间】:2017-10-28 17:54:51
【问题描述】:
我正在尝试创建一个简单的自定义插件按钮来触发模式。这是我的代码:
$.FE.DefineIcon('mybutton', {
NAME: 'smile'
});
$.FE.RegisterCommand('mybutton', {
title: 'My Button',
undo: true,
focus: true,
refreshOnCallback: true,
popup: false,
callback: function() {
var editor = this;
this.selection.save();
$('#modal').modal('show');
$('#modal').on('click', 'a', function() {
editor.selection.restore();
editor.html.insert('<i class="icon-apple"></i>');
$(this).modal('hide');
});
},
});
以上所有操作都很好,但是由于我在同一页面上初始化了 3 个编辑器,因此所有 3 个编辑器都插入了“图标”。如何仅分配给活动编辑器。
【问题讨论】:
-
你能提供一个关于这个问题的工作示例吗? (jsfiddle)
标签: froala