使用ajax的ckeditor

发布于 2024-08-31 16:39:34 字数 232 浏览 3 评论 0原文

我正在准备剧本。我正在使用 AJAX(load()) 和 jQuery。

我得到一个页面,其中包含带有 ckeditor 的 textarea by load() jQuery AJAX 函数。

虽然我包含 ckeditor's.js 文件,但加载的页面不包含 javascript 文件,并显示没有 ckeditor 的普通文本区域。

如何使用 ckeditor 加载包含 textarea 的文件?

I am preparing a script. I am using AJAX(load()) with jQuery.

I am getting a page which includes textarea with ckeditor by load() jQuery AJAX function.

Although I include ckeditor's.js file, loaded page doesn't includes javascript file and shows a normal textarea without ckeditor.

How can I load file which includes textarea with ckeditor?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

走过海棠暮 2024-09-07 16:39:34

使用 load() 创建文本区域后,您必须在您创建的任何文本区域上调用 CKEDITOR.replace(),以便初始化编辑器...你在做这个吗?

如果您正在加载多个文本区域,并且希望文档中的所有文本区域都成为 CKEDITOR,那么您可以:

load();
CKEDITOR.replaceAll();

After creating the textarea with load(), you have to call CKEDITOR.replace() on any textareas which you have created, in order to initialize the editor... Are you doing this?

If you are loading multiple textareas, and you want all the textareas in the document to become CKEDITORs, then you do:

load();
CKEDITOR.replaceAll();
衣神在巴黎 2024-09-07 16:39:34

我正在使用这样的ajax加载:

$(".main").load("new_doc.php");

new_doc.php 是:

<script type="text/javascript" src="files/ckeditor.js"></script>
<textarea class="ckeditor" cols="80" id="editor" name="editor" rows="10">asddsa</textarea>

我只看到普通的文本区域。

I am using ajax load like that:

$(".main").load("new_doc.php");

new_doc.php is:

<script type="text/javascript" src="files/ckeditor.js"></script>
<textarea class="ckeditor" cols="80" id="editor" name="editor" rows="10">asddsa</textarea>

I see only normal textarea.

月亮坠入山谷 2024-09-07 16:39:34

好的朋友,我解决了这个解决方案:

我通过使用 jquery load() 使用 ckeditor 获取 new_doc.php (加载页面); fn。

因此代码将 basePath 视为 new_doc.php 的目录。我使用了这个函数:

CKEDITOR.basePath = "ckeditor/";

我将“ckeditor”目录中的“skins”目录复制到new_doc.php的目录中。

并且解决方案已解决。

谢谢大家。

OK friends I solve this solution:

I am getting new_doc.php (loaded page) with ckeditor by using jquery load(); fn.

So the codes see the basePath as new_doc.php's directory. I used this function:

CKEDITOR.basePath = "ckeditor/";

and I copied "skins" directory which is in the "ckeditor" directory to new_doc.php's directory.

And the solution is solved.

Thanks to everybody.

你的笑 2024-09-07 16:39:34

我可以使用 mouseMove 破解它,然后快速删除 .ckeditor 类以避免重复。到目前为止对我有用

$("body").on("mousemove", function(){ 

    $('.ckeditor').each(function(index, element) {
       CKEDITOR.replaceAll();
      $(this).removeClass('ckeditor');
    });

});

I can hack it using mouseMove then quickly remove .ckeditor class to avoid repetitions. Works for me so far

$("body").on("mousemove", function(){ 

    $('.ckeditor').each(function(index, element) {
       CKEDITOR.replaceAll();
      $(this).removeClass('ckeditor');
    });

});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文