Rao Ehsan
Rao Ehsan

Reputation: 776

bootstrap-wysiwyg not working in IE

I am trying to provide bootstrap-wysiwyg editor. It works fine in firefox but in IE I am getting exception

Unhandled exception at line 30, column 7 in http://localhost:21585/Scripts/plugins/bootstrap-wysiwyg.js

0x80040100 - JavaScript runtime error: This command is not supported.

The line is

if (document.queryCommandState(command)) {

command = "fontSize 5"

Any idea?

Upvotes: 0

Views: 2620

Answers (3)

Quy Nguyen
Quy Nguyen

Reputation: 158

I resolve this issue as below: find:

$(options.toolbarSelector).find(toolbarBtnSelector).each(function () {
                    var command = $(this).data(options.commandRole);
                    if (document.queryCommandState(command)) {

change this line:

if (document.queryCommandState(command))

to:

if (editor.is(':focus') && document.queryCommandState(command))

Upvotes: 4

Since IE can't handle "fontSize 5" you have to remove the "5".

So locate the following lines in bootstrap-wysiwyg.js

var command = $(this).data(options.commandRole);
if (document.queryCommandState(command)) {

and change it to look like this

var command = $(this).data(options.commandRole);
command = command.split(' ').shift();
if (document.queryCommandState(command)) {

Upvotes: 4

Tim Down
Tim Down

Reputation: 324627

As the error suggests, "fontSize 5" is not a valid command name. Use "fontSize" instead.

References:

Upvotes: 2

Related Questions