jHtmlArea不使用jQuery 1.9.1及更高版本 - 该怎么办?

时间:2013-06-12 15:08:11

标签: javascript jquery html jhtmlarea

我刚刚发现,使用jHtmlArea这个漂亮的WYSIWYG文本编辑器不适用于1.9.1及更高版本的较新jQuery版本。

我从示例中获取了大部分代码,但想引用当前的jQuery库。

<body>

    $(function () {
        $("textarea").htmlarea();
    });

    <textarea id="txtDefaultHtmlArea" cols="50" rows="15">
        <p><h3>Test H3</h3>This is some sample text to test out the <b>WYSIWYG Control</b>.</p>
    </textarea>
</body>

我创造了一个小提琴。除非我打开Migrate 1.1.0脚本,否则编辑器不显示格式正确的文本区域,只有裸HTML和编辑器按钮不起作用。

以下是目前的情况:

JSFiddle showing the result

我还使用asp.net WebForms页面和本地文件重现了这种行为。

我该怎么办?我应该去尝试为我修复jHtmlArea吗?对于页面上的其他组件,我想使用当前的jQuery。 当我在同一页面上引用旧版和新版jQuery版本时,我会遇到麻烦吗?

更新:这已经由jHtmlArea的autor解决,according to this closed bug

1 个答案:

答案 0 :(得分:1)

您可以使用jQuery migrate进行向后兼容,它会在控制台中向您显示需要修复的内容,以便与jQuery 1.9 +保持同步。

来自文档http://blog.jquery.com/2013/02/04/jquery-1-9-1-released/

Please, please, please, use the jQuery Migrate plugin and look at the upgrade guide if you’re just
starting your upgrade to jQuery 1.9. The plugin will quickly find and fix any compatibility issues,
just look in the browser console. Once you fix the warnings you can remove it. Or, leave the plugin in
place until you have the chance to fix your code and plugins to make them 1.9-compatible.