ckeditor

Django 之 文本编辑器

烈酒焚心 提交于 2019-11-27 07:23:19
# django的文本编辑样式 接下来主要讲两个编辑器,一个是富文本编辑器,另一个是Markdown文本编辑器 ## Markdown文本编辑器 1. 首先安装`django-mdeditor`编辑器 ``` pip install django-mdeditor ``` 2. 然后在`settings.py`中将mdeidtor进行注册 ``` 'mdeditor', ``` 3. 将下面代码放入到`urls.py`的底部,用于指定图片传送的地方 ``` from django.conf.urls.static import static from django.conf import settings if settings.DEBUG: # static files (images, css, javascript, etc.) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ``` 4. 在Model中使用mdeditor ```python from mdeditor.fields import MDTextField context = MDTextField("文章内容") ``` 5. 在文章详情页中如何将Markdown渲染成正常的文本 ``` import

How to get data from CKEditor 5 instance

纵饮孤独 提交于 2019-11-27 06:59:00
问题 I know that for CKEditor 4, you can get the textarea data like this: var content = CKEDITOR.instances['comment'].getData(); How is this done for CKEditor 5? 回答1: You can find the answer in the Basic API guide. Basically, in CKEditor 5 there's no single global editors repository (like the old CKEDITOR.instances global variable). This means that you need to keep the reference to the editor that you created and use that reference once you'll want to retrieve the data: ClassicEditor .create(

Ckeditor update textarea

喜欢而已 提交于 2019-11-27 06:53:25
I am trying to get the ckeditor working. Obviously it doesn't make use of the textarea so on submit the form doesn't submit the text in the editor. Beceause I make use of polymorphic associations etc. I can't make a onsubmit function to get the value of the textarea (when the form is submitted) . So I found this question: Using jQuery to grab the content from CKEditor's iframe with some very good answers. The answers posted there keep the textarea up to date. That is very nice and just what I need! Unfortunately I can't get it to work. Does somebody know why (for example) this doesn't work? I

ckeditor and display users data as they type

自作多情 提交于 2019-11-27 06:23:59
问题 I have a textarea that as the user enters data into the textarea, the data is displayed at the bottom of the form as a display of how their data may appear (much in the same way that StackOverflow gives a preview display of the users question as the user types it). I have installed CKEditor 4.3.1 to this textarea and the preview display no longer appears. I assumed that this was because the id of the text area had been replaced by the id of the CKEditor, so I tried replacing the id of the

How to block editing on certain part of content in CKEDITOR textarea?

主宰稳场 提交于 2019-11-27 06:17:57
问题 I have my CKEDITOR form prepopulated with hidden table which is being submitted together with user inputed text. This works fine, but sometimes user presses backspace too many times and deletes the hidden table. Is there a way to block editing on this hidden table inside ckeditor textarea? So when user presses backspace the hidden table isn't affected and stays in. As soon as CKEDITOR instance is ready this source (bellow) is put inside CkEditor Textarea (using setData() attribute) and User

How to add a custom button to the toolbar that calls a JavaScript function?

醉酒当歌 提交于 2019-11-27 05:53:51
I'd like to add a button to the toolbar that calls a JavaScript function like Tada() ? Any ideas on how to add this? Pekka 웃 I am in the process of developing a number of custom Plugins for CKEditor and here's my survival pack of bookmarks: A StackOverflow post linking to and talking about a plugins tutorial that got me started (Tim Down already mentioned this) A number of ready-made plugins for FCK and CKEditor that may improve one's understanding of the system The Blog of AlfonsoML , one of the developers, lots of valuable stuff there, e.g. Plugin localization in CKEditor Interaction between

Get formatted HTML from CKEditor

寵の児 提交于 2019-11-27 05:48:39
问题 I'm using CKEditor in my web app, and I'm at a loss as to how to get the contents of the editor with HTML formatting. var objEditor = CKEDITOR.instances["sectionTextArea"]; var q = objEditor.getData(); This will get me the text entered in CKEditor, without any markup. However, var q = objEditor.getHTML(); will return a null value. What am I doing wrong? 回答1: getHTML isn't a method of a CKEditor object, so instead of null you should have a javascript error. The method defined by the api is

How do I save inline editor contents on the server? [duplicate]

十年热恋 提交于 2019-11-27 05:38:20
问题 This question already has an answer here: ckeditor inline save/submit 3 answers I'm using CKeditor to allow users to inline edit the content on a page once logged in. I know I can access the data using: var data = CKEDITOR.instances.editable.getData(); but I don't know how to send the data to a script so I can update the database. It would be cool if the script ran each time someone deselected a contenteditable element... but I don't know if thats even possible. Any tips would be great! :) My

How to define allowed tags in CKEditor?

丶灬走出姿态 提交于 2019-11-27 05:22:17
问题 Sometimes users copy and paste text from different sources to CKEditor, but I want to restrict what tags they can copy to CKEditor. I only need to use certain tags in CKEditor: The list tag, break tag, etc... Can I define them & disable the other tags in CKEditor? 回答1: There are some settings you can use. You define these settings editing the config.js file in the ckeditor's root directory. For example, if you want to be radical like me, you could put: config.forcePasteAsPlainText = true; If

Detecting onChange events from a CKEditor using Jquery

删除回忆录丶 提交于 2019-11-27 05:21:36
问题 I'm working with the CKEditor and jQuery and I'd like to toggle a flag to true whenever a user changes the value of a field. One of those fields is a CKEditor instance. All the textareas that have the "wysiwyg" class get converted to CKEditors but somehow the $('.wysiwyg').change() event never gets detected. I did some googling but the keyword combination seems to bring up nothing but irrelevant results (my google-fu sucks). Thanks for any help :) Edit: for (var i in CKEDITOR.instances) {