【问题标题】:Froala Editor v2 multiple editors Current instanceFroala Editor v2 多个编辑器 当前实例
【发布时间】: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


【解决方案1】:

如果您使用 react 或 angular,您可以使用 state 来设置编辑器,然后使用 froala 中的“initialized”等事件来设置编辑器。这区分了页面或视图中的各种编辑器。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-14
    • 1970-01-01
    • 2019-04-21
    • 1970-01-01
    • 2019-01-23
    • 2017-08-11
    相关资源
    最近更新 更多