2013-06-12 33 views
2

我刚刚发现,使用jHtmlArea这个漂亮的所见即所得文本编辑器,不适用于1.9.1及更高版本的较新的jQuery版本。jHtmlArea不能使用jQuery 1.9.1及以上版本 - 该怎么办?

我已经从示例中获取了大部分代码,但希望引用当前的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,according to this closed bug的作者解决。

+1

使用的jQuery插件迁移http://blog.jquery.com/2013/02/04/jquery-1-9-1-released/ –

+0

@wirey他们似乎做得很好。除非jHtmlArea的原始作者修复此原因,否则我会这样做。 – Marcel

+0

@wirey我有很好的成功,正如你所说,并没有发现任何相关的问题。请作为答复发布,我会接受。 – Marcel

回答

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.
相关问题