0

我正在尝试提供 bootstrap-wysiwyg 编辑器。它在 Firefox 中运行良好,但在 IE 中出现异常

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.

这条线是

if (document.queryCommandState(command)) {

命令 =“字体大小 5”

任何想法?

4

3 回答 3

4

由于 IE 无法处理“fontSize 5”,因此您必须删除“5”。

因此,在bootstrap-wysiwyg.js中找到以下行

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

并把它改成这样

var command = $(this).data(options.commandRole);
command = command.split(' ').shift();
if (document.queryCommandState(command)) {
于 2014-08-20T08:16:48.703 回答
4

我解决这个问题如下:找到:

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

改变这一行:

if (document.queryCommandState(command))

至:

if (editor.is(':focus') && document.queryCommandState(command))
于 2014-09-12T04:46:38.497 回答
2

正如错误所暗示的,“fontSize 5”不是有效的命令名称。请改用“fontSize”。

参考:

于 2013-09-23T11:35:11.397 回答