ckeditor

CKEditor is escaping html elements

杀马特。学长 韩版系。学妹 提交于 2019-11-28 10:32:30
I am using CKEditor to insert text into a MySQL database. I have noticed that my installed CKEditor is escaping all HTML elements when the data reaches the database. Therefore the following is what I am getting in the database after I have inserted the text with CKEditor: '&' (ampersand) becomes '&' '"' (double quote) becomes '" "'" (single quote) becomes '' '<' (less than) becomes '<' '>' (greater than) becomes '>' I would rather disable the CKEditor HTML escaping completely, and rely on my PHP script to handle the HTML escaping using PHP's htmlspecialchars . Another good reason for me to

How can I add(programatically) google fonts to ckeditor

拜拜、爱过 提交于 2019-11-28 10:19:53
I have just download CKEditor and its great. Although I have noticed that it slacks fonts. So I thought it would be a good idea to be able to add Google Web Fonts to CKEditor to add to its functionality. I have searched online but I could only find how to manually go in and add each font in config.js file. Can someone please help me add all Google Web Fonts to CKEditor programatically and show how. Ok I found the answer. I am posting it here so it could be helpful for anyone else who's looking for the same. So here it is: myFonts = ['Aclonica', 'Allan', 'Allerta', 'Allerta Stencil', 'Amaranth'

How to listen to basic events in CKEditor?

爱⌒轻易说出口 提交于 2019-11-28 09:47:21
I can't figure out how to listen to focus, click, onKeyUp and other basic dom events in ckeditor. In the events summary there is only a few events regarding the lifecycle of ckeditor. And the "textArea" of ckeditor is an iframe, and it's html itself, so it is not clear on what dom node to listen. It's not a big deal, just do the following, works for focus, blur, click etc. var ckeditor = CKEDITOR.instances['textArea_id']; ckeditor.on('focus', fnHandler, context, data, priority); or a jQuery example : $(document).ready(function () { $('#YOUR_TEXTAREA_ID').ckeditor(ckeditor_config); CKEDITOR

Get formatted HTML from CKEditor

限于喜欢 提交于 2019-11-28 09:37:38
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? 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 getData() if that doesn't work then you have some other problem in your code, try to use an alert to verify the

CKEditor format class

我的梦境 提交于 2019-11-28 09:30:21
I am writing a CKEditor plugin to apply a specific class to an element. Basically this class is setting the text colour to a specific redish colour. Anyways, I am not getting how to define a class for the wrapped text. Please look at my plugin code: CKEDITOR.plugins.add( 'red', { init: function( editor ) { editor.addCommand( 'red', { exec : function( editor ) { var format = { element : 'span' }; var style = new CKEDITOR.style(format); style.apply(editor.document); } }); editor.ui.addButton( 'red', { label: 'red', command: 'red', icon: this.path + 'images/red.png' } ); } } ); Basically I want

Using JQuery to set CKEditor Value

一笑奈何 提交于 2019-11-28 09:22:45
I have a CKEditor textarea: <textarea cols="80" id="taBody" name="taBody" class="ckeditor" rows="10" runat="server"></textarea> I have jQuery trying to set the value from the database: $('#ContentPlaceHolder_taBody').val(substr[5]); Don't worry about the substring I already tested that it is returning a string. For testing purposes I replaced the substring with 'test' and was receiving the same issue. I know that the jquery surrounding this line doesn't affect it because the other textfields I'm trying to populate work. Just when it comes to the ckeditor. Here is the script in whole: function

Image dialog — extend onOk, instead of total overwrite

江枫思渺然 提交于 2019-11-28 08:27:43
问题 I have found out that I can hook into onOk with this: editor.on('dialogShow', function (ev) { var name = ev.data.getName(); var definition = ev.data.definition; if (name == 'image') { definition.onOk = function(e) { console.log( e ); }; } }); Awesome, unless now the default behavior is dropped, resulting in no image being added to the CK content. Checking up on CK's source, I do not want to break 74 lines worth of functionality provided by default. My goal is to simply run the image through a

How do I add a placeholder attribute to an instance of CKEditor?

一曲冷凌霜 提交于 2019-11-28 08:18:12
问题 Right now, using Alfonso's plugin, I'm able to add the placeholder attribute in config.js. However, since I'm adding into config.js, that means all instances will have the same placeholder text, right? Well, I don't want all instances of my ckeditor to have the same placeholder text because I also noticed he also said : The value can be set in the configuration or as an attribute of the replaced element I figured this means that we can put "Type something..." as placeholder text for ckeditor1

How to disable CKEditor context menu?

杀马特。学长 韩版系。学妹 提交于 2019-11-28 08:16:20
Does anybody know how to disable CKEditor's context (right click) menu? I would expect a configuration option, but I can't find one. I am using v3.1. Thanks. You need to remove the contextmenu plugin. See here for 3.1. As of version 3.6.4, the other answers in this question don't work anymore. See bug #9284 The three plugins that need to be disabled (using the means discussed in this question), are contextmenu , liststyle and tabletools . So for example, using config files: CKEDITOR.editorConfig = function(config) { /* Your config options */ ... config.removePlugins = 'contextmenu,liststyle

How to properly destroy CKEditor instance?

风格不统一 提交于 2019-11-28 07:21:07
I am running CKeditor 3.4 on a pretty simple page. I am having a problem (sometimes) where when I call document.main_form.submit(), it will not send along the contents of the textarea. After some reading, it sounds like CKeditor is not destroying properly. I tried to manually destroy it before I save the form, but wasn't able to call it. The weird thing is, it works sometimes, but not others. I'm on Chrome, so that may be screwing with things, but the same thing happens in Firefox. How can I properly destroy the CKeditor so that it always sends the textarea data in POST. Thanks! I had this