【问题标题】:js file loading only for first time - in angularjs : Making the ckeditor visible for first time onlyjs 文件仅第一次加载 - 在 angularjs 中:使 ckeditor 仅第一次可见
【发布时间】:2015-09-15 12:05:57
【问题描述】:

我正在使用 CKEditor

我正在像这样加载 .js 文件

<script type="text/javascript" src="public/lib/ckeditor/ckeditor.js"></script>

Ckeditor 仅在第一次出现,如果我导航到其他页面,然后返回原始页面,则 ckeditor 无法正常工作..

我试图在index.html 中加载ckeditor.js -> 我的主文件加载所有.js 文件,甚至在我使用ckeditor 的add.html 中单独加载

<textarea class="ckeditor" name="receipeBody" ></textarea>

即,

public/app/js/angular.min.js
public/app/app/app.js
public/app/app/data.js
public/app/app/directives.js
public/app/app/authCtrl.js

我尝试在主页甚至add.html 页面中加载。

它只在第一次工作,如果我导航到其他页面并返回到add.html 页面,ckeditor 没有加载..它只是显示常规文本区域..

我什至尝试在add.html 完全加载后加载.js 文件..

这样

$(document).ready(function(){
    $.getScript("public/lib/ckeditor/ckeditor.js");
});

不过,我无法在第二个视图中看到 ckeditor..

我做错了什么以及如何使 ckeditor 即使在第一次访问页面后也可见...

【问题讨论】:

    标签: javascript php jquery angularjs ckeditor


    【解决方案1】:

    试试这个....

    设置 CKEditor 配置的最佳方式是在页面内创建编辑器实例时。这种方法可以让您避免修改CKEditor安装文件夹中的原始分发文件,使升级任务更容易。

    页内设置可以传递给任何编辑器实例创建函数,即CKEDITOR.replaceCKEDITOR.appendTo

    <textarea id="ckeditor"></textarea>
    
        <script>
    
                CKEDITOR.replace( 'ckeditor', {
    
                height : '500px',
        removePlugins: 'bidi,font,forms,flash,horizontalrule,iframe,justify,table,tabletools,smiley,Paste from Word',
        removeButtons: 'Anchor,Underline,Strike,Subscript,Superscript,Image,Paste,Print,Templates,Preview,NewPage,PasteText,PasteFromWord,Replace,About,Language,Save,PageBreak,Scayt,ShowBlocks',
        format_tags: 'p;h1;h2;h3;pre;address'
    } );
    
            </script>
    

    http://docs.ckeditor.com/#!/guide/dev_configuration

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-22
      相关资源
      最近更新 更多