不支持不连续选择 [英] Discontiguous selection is not supported

查看:89
本文介绍了不支持不连续选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试bootstrap-wysihtml5-rails,我正在使用Twitter Bootstrap 2

I am trying bootstrap-wysihtml5-rails, I am using twitter bootstrap 2

但是当我得到图像中的结果时,出现错误:

but when I get this result as in the image, and the error:

Discontiguous selection is not supported.

我试图这样window['rangy'].initialized = false;:

<script type="text/javascript">
    $(document).ready(function(){


        window['rangy'].initialized = false;

        $('.wysihtml5').each(function(i, elem) {
            $(elem).wysihtml5();
        });
    })
</script>

但是我仍然遇到相同的错误,我可以忍受它,但是似乎它像图像中的一样破坏了编辑器的按钮,任何人都可以帮忙吗?

But I still get the same error, I could live with it, but it seems that it breaks the buttons of the editor as in the image, any one can help?

推荐答案

只需在代码后添加 window.getSelection().removeAllRanges(); 即可.

Just add window.getSelection().removeAllRanges(); after your code, this will do the magic.

这篇关于不支持不连续选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆