ckeditor

How to determine if CKEditor is loaded?

一世执手 提交于 2019-12-04 00:03:25
How do I find out if CKEditor is loaded? I've looked through the API docs, but could only find the loaded event. I want to check if CKEditor is loaded, because if I load it a second time, my textareas disapears. The loaded event didn't work for me. instanceReady worked: CKEDitor_loaded = false; CKEDITOR.on('instanceReady', function(){ CKEditor_loaded = true; }); var waitCKEDITOR = setInterval(function() { if (window.CKEDITOR) { clearInterval(waitCKEDITOR); //CKEDITOR.replace(...); } }, 100/*milli*/); Pekka supports GoFundMonica I've looked through the API docs, but could only find the loaded

Django文件上传下载与富文本编辑框

*爱你&永不变心* 提交于 2019-12-03 22:56:18
django文件上传下载 上传 配置settings.py # 设定文件的访问路径,如:访问http://127.0.0.1:8000/media/就可以获取文件 MEDIA_URL = '/media/' # 设置文件的存储路径,全部存储在media目录下,会和model类中的upload_to属性值拼接 MEDIA_ROOT = os.path.join(BASE_DIR,'media') models.py class Img(models.Model): name = models.CharField(max_length=32) # upload_to拼接在MEDIA_ROOT后面,../media/img/article/,内容均存在该目录下 img = models.ImageField(upload_to='img/article/',verbose_name='图片') upload.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <!--enctype属性值修改成"multipart/form-data"--> <form action="" method="post" enctype=

Remove CKEdit Instance

馋奶兔 提交于 2019-12-03 20:35:06
问题 I can't seem to destroy instances of CKEdit per the documentation. Consider the following: <input name="txt1" type="text" id="txt1" /><br /> <a href="javascript:void(0);" onclick="create()">Create</a><br /> <a href="javascript:void(0);" onclick="destroy()">Destroy</a> <script type= "text/javascript" > <!-- function create() { var hEd = CKEDITOR.instances['txt1']; if (hEd) { CKEDITOR.remove(hEd); } hEd = CKEDITOR.replace('txt1'); } function destroy(){ var hEd = CKEDITOR.instances['txt1']; if

Compare TinyMCE and CKeditor for a Wiki

空扰寡人 提交于 2019-12-03 19:49:57
问题 For a custom wiki django-wakawaka, i want to be able to add a WYSIWYG support. TinyMCE is obviously the most popular plugin, used even by Wordpress. But CK-editor seems more feature full. Those who have used either of these or both, which is better and why. Are there some better packages, that I am missing? Is there something that I am missing when I conclude CKeditor is better, by going through them (because it is not as widely used). I want to use it with django and jquery, with multiple

Django项目使用ckeditor(不使用admin)

99封情书 提交于 2019-12-03 17:22:28
效果图: 1.安装django-ckeditor pip install django-ckeditor 如果需要上传图片或者文件,还需要安装pillow pip install pillow 2.配置模型字段 如果编辑器需要上传图片或者文件,需要引入 RichTextUploadingField ,否则只需要引入 RichTextField from ckeditor_uploader.fields import RichTextUploadingField class Activity(models.Model): desc = RichTextUploadingField(verbose_name="活动描述") 3.settings中配置 CKEDITOR_CONFIGS = { 'default': { 'toolbar': 'full', #工具栏全部功能 'height': 300, # 高度 'width': 730, # 宽度 }, } CKEDITOR_UPLOAD_PATH = 'ckeditor/' #上传文件的目录 CKEDITOR_IMAGE_BACKEND = 'pillow' #pillow做为backend 4.form表单配置 这里只需要使用modelForm,不需要配置 from django import forms from

ckeditor - onpaste event

南笙酒味 提交于 2019-12-03 17:13:00
问题 Does anyone know how I can attach an onpaste event in CKEditor 3.x? I basically want to grab CTRL + V data and add few text to it and then add it to the editor. I have looked around but have not found a definitive answer. CKEditor forum is of not much help. 回答1: This should do the trick var editor = CKEDITOR.instances.YourInputControlName; editor.on('paste', function(evt) { // Update the text evt.editor.setData(evt.editor.getData() + ' your additional comments.'); }, editor.element.$); 回答2:

Ckeditor character limitation with charcount plugin

[亡魂溺海] 提交于 2019-12-03 17:04:09
How can i prevent users to enter new characters after max character limit is reached ? Ckeditor charcount plugin just shows me the remaining characters, i want it to stop at 0. But it goes minus integers. Here's my html code. <textarea id="myTextEditor1" name="myTextEditor"></textarea> <script type="text/javascript"> CKEDITOR.replace('myTextEditor1', { height: 200, extraPlugins: 'charcount', maxLength: 10, toolbar: 'TinyBare', toolbar_TinyBare: [ ['Bold','Italic','Underline'], ['Undo','Redo'],['Cut','Copy','Paste'], ['NumberedList','BulletedList','Table'],['CharCount'] ] }); </script> Do i

CKEditor - have it return markdown syntax instead of HTML

喜你入骨 提交于 2019-12-03 16:52:08
I'm working on a CMS platform and I am planning to use CKEditor as it seems to offer everything I need. One thing that is a bit of a bother to me is that I want my content to be in markdown format instead of html and while I found a BBCode extension for this, I couldn't figure out how it can be remade to support markdown. I tried to find an editor that does markdown out of the box, but the ones I found are way too simple for what I need and CKEditor has the benefit of having a plugin system to adjust perfectly for me. Reinmar Using Markdown instead of HTML is a very bad idea for several

CKEditor 4 Inline: How to hide toolbar on demand?

爱⌒轻易说出口 提交于 2019-12-03 15:46:58
Normally when you click other place in the page other than the edit area, the toolbar will hide, now i need to hide the toolbar also on user command(such as user press a shortcut). I tried to call jQuery hide method on ckeditor toolbar div, but once hidden, it will never become visible even when user focus on the edit area. Any ideas on how to achieve this? Many thanks. did you try to do jQuery Show when the focus comes back in to the edit area? you can also attach to the focus and blur events to show and hide toolbar: // Call showToolBarDiv() when editor get the focus editor.on('focus',