如何通过 jQuery Ajax 导入 CKEditor?

发布于 2024-09-27 04:34:20 字数 614 浏览 0 评论 0原文

我正在制作一个简单的数据网格应用程序,当我单击表中的一行时,我希望能够导入带有 CKEditor 的文本区域框。

现在,当我导入 .php 页面时,什么也没有显示。至于导入的所有其他 html 部分,页面上已经运行的 JS 并不引用导入的 html。对于其他代码,我只是将 JS 重写到正在导入的文件中,但是当我使用 ckeditor 执行此操作时:

<script type='text/javascript'>
    window.onload = function() {
        CKEDITOR.replace( 'editor' );
    };
    CKEDITOR.replace( 'editor', {
        filebrowserBrowseUrl : 'ckeditor/browse.php',
        filebrowserUploadUrl : 'ckeditor/upload.php'
    });
</script>

没有任何反应。当我导入主 ckeditr.js 文件时,它至少会显示出来,但编辑器变得无法聚焦。

有谁知道,我具体可以对 CKEditor 做什么,或者一般来说,关于 JS 不应用于导入的 html?

I'm making a simple data grid aplication and when I click a row in a table, I want to be able to import a textarea box with CKEditor on it.

Now when I import the .php page, nothing shows up. As for every other html part, that was imported, the already running JS on the page isn't refering to the imported html. For the other code, I just rewrite the JS to the file being imported, but when I do that with ckeditor with:

<script type='text/javascript'>
    window.onload = function() {
        CKEDITOR.replace( 'editor' );
    };
    CKEDITOR.replace( 'editor', {
        filebrowserBrowseUrl : 'ckeditor/browse.php',
        filebrowserUploadUrl : 'ckeditor/upload.php'
    });
</script>

Nothing heppens. When I import the main ckeditr.js file, it shows up at least, but the editor becomes unfocusable.

Does anyone know, what I can do about CKEditor concretely, or generally about the JS not being applyed on imported html?

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

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

发布评论

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

评论(1

心是晴朗的。 2024-10-04 04:34:20

迈克,

首先确保您在 html head 示例中加载 ckeditor

 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
     <script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
    </head>
    ....

,然后运行动态 ckeditor 的文档就绪示例

$(document).ready(function(){
      $('body').append('<textarea id="editor" />');
       CKEDITOR.replace( 'editor' );
});

注意

这篇文章包含 jquery

Mike,

first make sure you load the ckeditor in your html head example

 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
     <script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
    </head>
    ....

then run doc ready exmample of dynamic ckeditor

$(document).ready(function(){
      $('body').append('<textarea id="editor" />');
       CKEDITOR.replace( 'editor' );
});

NOTE

this post includes jquery

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