CKEditor网站有点缺乏; 你能告诉我如何从CKEditor中删除状态栏('body ul li ...')吗?
编辑器底部有一个HTML列表 - body p ul li - 表示将如何生成键入的文本,我想删除此列表.
我在我的网络应用程序中使用CKEditor,我不知道如何使用HTML格式获取编辑器的内容.
var objEditor = CKEDITOR.instances["sectionTextArea"];
var q = objEditor.getData();
Run Code Online (Sandbox Code Playgroud)
这将获得在CKEditor中输入的文本,没有任何标记.
然而,
var q = objEditor.getHTML();
Run Code Online (Sandbox Code Playgroud)
将返回一个空值.我究竟做错了什么?
每次加载页面时我都需要使用JQuery将文本加载到CK编辑器中,以便从我使用的CK编辑器中获取数据
var editor_data = CKEDITOR.instances['editor1'].getData();
Run Code Online (Sandbox Code Playgroud)
现在有一个类似的功能,我可以用来将数据放回编辑器?
我正在使用ajax来设置这样的数据
$.ajax({
type: "POST",
url: "/inc/ajax/basic.php?menu_id="+menu_id+"&info=3",
success: function(msg){
CKEDITOR.instances['editor1'].setData(msg);
}
});
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么
在CKEditor 4中更改编辑器高度,有一个配置选项:config.height.
如何更改CKEditor 5的高度?(经典编辑)
是)我有的:
我发现有关在官方网站上将文件上传到服务器的信息:
示例 - 设置图像上载插件:
config.extraPlugins = 'uploadimage';
config.imageUploadUrl = '/uploader/upload.php?type=Images';
Run Code Online (Sandbox Code Playgroud)
响应:文件成功上载文件上传成功后,需要使用以下条目的JSON响应:
- 已上传 - 设为1.
- fileName - 上传文件的名称.
- url - 上传文件的URL(URL编码).
例:
{
"uploaded": 1,
"fileName": "foo.jpg",
"url": "/files/foo.jpg"
}
Run Code Online (Sandbox Code Playgroud)
Symfony返回JSON响应:
return new JsonResponse(
array(
'uploaded' => '1',
'fileName' => $image->getName(),
'url' => $image->getWebPath()
)
);
Run Code Online (Sandbox Code Playgroud)
成功上传图片后,我看到:
和JS控制台中的错误:
资源解释为Document但使用MIME类型application/json传输:" http://example.com/app_dev.php/dashboard/settings/upload/image?CKEditor=example_post_content&CKEditorFuncNum=1&langCode=en ".
但它必须像在官方页面上一样工作(参见第二个编辑器)
我试图从Symfony返回其他回复,例如:
$response = new Response();
$response->headers->set('Content-Type', 'application/json');
$response->setContent(
json_encode(
array(
'uploaded' => '1',
'fileName' => $image->getName(),
'url' => …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用jQuery向现有的CKEditor添加一段文本.这需要在单击链接时完成.
我试过这个解决方案,适用于常规textareas,但不适用于CKEditor:
jQuery.fn.extend({
insertAtCaret: function(myValue) {
return this.each(function(i) {
if (document.selection) {
//For browsers like Internet Explorer
this.focus();
sel = document.selection.createRange();
sel.text = myValue;
this.focus();
} else if (this.selectionStart || this.selectionStart == '0') {
//For browsers like Firefox and Webkit based
var startPos = this.selectionStart;
var endPos = this.selectionEnd;
var scrollTop = this.scrollTop;
this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos, this.value.length);
this.focus();
this.selectionStart = startPos + myValue.length;
this.selectionEnd = startPos + myValue.length;
this.scrollTop = scrollTop;
} else {
this.value …Run Code Online (Sandbox Code Playgroud) 我创建了一个使用CKEDITOR的cms应用程序,当我向CKEDITOR添加一些功能时,我需要刷新一些CKEDITOR .js /.css文件.
但CKEDITOR强制浏览器缓存它们.
我看到它对所有.js/.css文件使用查询字符串
这个查询字符反映了我认为的CKEDITOR版本:
/Js/ckeditor/config.js?t=CAPD
/Js/ckeditor/lang/it.js?t=CAPD
/Js/ckeditor/plugins/onchange/plugin.js?t=CAPD
Run Code Online (Sandbox Code Playgroud)
在CKEDITOR中是否有嵌入式方法?
我在文档中找不到任何内容.我正在使用CKEDITOR 4
主要问题是,当我上传一些更改时,客户端不会更新它们,并且新功能不可用或最坏情况CKEDITOR不起作用.
由于它是textarea,我在html属性中尝试cols ="50"但它不起作用.
另外,我找到了上一个问题的答案.他说我可以通过添加来做到这一点.
CKEDITOR.instances.myinstance.resize(1000, 900);但是,尺寸仍未改变.
这是我尝试的代码,谢谢.
更新
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script src="../plugin/jquery-1.6.1.min.js"></script>
<script src="../plugin/jquery.validate.min.js"></script>
<script type="text/javascript" src="../plugin/ckeditor/ckeditor.js"></script>
<script>
$(document).ready(function(){
$("#addlist").validate();
var editor = CKEDITOR.replace('editor1');
var div = document.getElementById('editor');
editor.resize($(div).width(),'900');
});
</script>
</head>
<body>
<form method="post" action="confirm.php">
<p><br />
<div id="editor">
<textarea id="editor1" name="editor1">
</div>
<? if (isset($_GET['file']))
{$filepath=$_GET['file'];
require_once("../template/".$filepath);}?> </textarea>
</p>
</br>
File Name </br>
<b>(Naming Without .html e.g. MyTemplate1) :</b>
</br>
<input id="tname" name="tname" class="required" />
<input type="submit" />
</p>
</form> …Run Code Online (Sandbox Code Playgroud)