simo
simo

Reputation: 24580

Discontiguous selection is not supported

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.

I tried to window['rangy'].initialized = false; like this:

<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?

enter image description here

Upvotes: 3

Views: 6286

Answers (2)

Zeeshan Ali
Zeeshan Ali

Reputation: 341

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

Upvotes: 6

Tim Down
Tim Down

Reputation: 324627

That message is just a warning that doesn't throw an actual error so shouldn't affect anything. The warning was added to Chrome a few versions ago and is triggered by Rangy's initialization code. More recent versions of Rangy have a workaround but I assume bootstrap-wysihtml5-rails has an older version.

I'm pretty sure that it can't be causing the issue with the buttons and that you have another issue, but it's possible Chrome's behaviour has changed.

Some background:

Upvotes: 1

Related Questions