最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - bootstrap-wysiwyg not working in IE - Stack Overflow

programmeradmin0浏览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 mand is not supported.

The line is

if (document.queryCommandState(mand)) {

mand = "fontSize 5"

Any idea?

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 mand is not supported.

The line is

if (document.queryCommandState(mand)) {

mand = "fontSize 5"

Any idea?

Share Improve this question edited Feb 19, 2014 at 18:14 Sterling Archer 22.4k19 gold badges85 silver badges121 bronze badges asked Sep 23, 2013 at 11:32 Rao EhsanRao Ehsan 7768 silver badges15 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

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

So locate the following lines in bootstrap-wysiwyg.js

var mand = $(this).data(options.mandRole);
if (document.queryCommandState(mand)) {

and change it to look like this

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

I resolve this issue as below: find:

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

change this line:

if (document.queryCommandState(mand))

to:

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

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

References:

  • MSDN
  • MDN (Mozilla)
发布评论

评论列表(0)

  1. 暂无评论