我正在使用 CKEditor
我正在像这样加载 .js 文件
<script type="text/javascript" src="public/lib/ckeditor/ckeditor.js"></script>
Ckeditor 只在第一次出现,如果我导航到其他页面,然后返回到原始页面,ckeditor 将无法工作。
我试图加载 ckeditor.js
在index.html
-> 我的主文件加载了所有 .js 文件,甚至在 add.html
中单独加载我在哪里使用 ckeditor
<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 未加载页面..它只是显示常规文本区域..
我什至尝试加载 .js
add.html
之后的文件已满载..
像这样
$(document).ready(function(){
$.getScript("public/lib/ckeditor/ckeditor.js");
});
仍然,我无法在第二个 View 中看到 ckeditor..
我在做什么错误,我怎样才能让 ckeditor 在第一次访问页面后仍然可见...
最佳答案
试试这个....
在创建编辑器实例时,设置 CKEditor 配置的最佳方式是在页面内。这种方法可以避免修改CKEditor安装文件夹中的原始分发文件,使升级任务更容易。
页内设置可以传递给任何编辑器实例创建函数,即 CKEDITOR.replace
和 CKEDITOR.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>
关于javascript - 仅在第一次加载 js 文件-在 angularjs : Making the ckeditor visible for first time only 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32565921/