bootstrap-wysiwyg not working in IE

0

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?

javascript
internet-explorer
bootstrap-wysiwyg
asked on Stack Overflow Sep 23, 2013 by Rao Ehsan • edited Feb 19, 2014 by Sterling Archer

3 Answers

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)) {
answered on Stack Overflow Aug 20, 2014 by Kjell-Åke Gafvelin
4

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))
answered on Stack Overflow Sep 12, 2014 by Quy Nguyen
2

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

References:

answered on Stack Overflow Sep 23, 2013 by Tim Down • edited Sep 23, 2013 by Tim Down

User contributions licensed under CC BY-SA 3.0