【问题标题】:Froala editor v2 (new) inline destroy bug(?)Froala 编辑器 v2(新)内联销毁错误(?)
【发布时间】:2019-12-20 22:07:25
【问题描述】:

在销毁内联编辑器时,使用最新版本的 froala 编辑器 (v2) 似乎不起作用。 它将这个元素留在编辑器元素中:<i class="fa fa-code"></i>。如果您转到内联示例站点,您可以看到此行为:https://www.froala.com/wysiwyg-editor/v2.0/docs/examples/inline

并在开发者控制台中输入以下内容:$('div#froala-editor').froalaEditor('destroy');

有谁知道如何解决这个问题?它还将编辑器包装器留在编辑器容器中,并在其上保留编辑器类,即使文档指出销毁命令将完全删除编辑器并将元素恢复到其初始化前状态。

非常感谢!

【问题讨论】:

    标签: javascript jquery debugging froala


    【解决方案1】:

    请参考这个 JSFiddle -

    https://jsfiddle.net/froala/8yxLcg5k/

    $(function() {
      $('div#froala-editor').froalaEditor();
    });
    
    // Destroy action.
    $('a#btn-destroy').on('click', function (e) {
      e.preventDefault();
    
      if ($('div#froala-editor').data('froala.editor')) {
        $('div#froala-editor').froalaEditor('destroy');
      }
    });
    
    // Initialize action.
    $('a#btn-init').on('click', function (e) {
      e.preventDefault();
    
      if (!$('div#froala-editor').data('froala.editor')) {
        $('div#froala-editor').froalaEditor();
      }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-17
      • 1970-01-01
      • 2019-04-21
      • 1970-01-01
      • 2015-12-18
      • 2022-06-16
      相关资源
      最近更新 更多