ckeditor

Removing unwanted newline characters when adding <p> in CKEditor

放肆的年华 提交于 2019-11-28 05:05:59
When loading content with a set of paragraphs in CKEditor, it replaces my <p> tags with <p> That means the editor converts this: <p>paragraph 1</p> <p>paragraph 2</p> <p>paragraph 3</p> into what ends up like this: <p> paragraph 1</p> <p> paragraph 2</p> <p> paragraph 3</p> How do I fix it so that CKEditor doesn't add the extra newline characters when it sees the paragraph tags? Paolo Add this line to the ckeditor.js configuration file: n.setRules('p',{indent:false,breakAfterOpen:false}); More about the formatting of the HTML Writer can be found in Developers Guide: Output Formatting at

adding @font-face to CKEditor

南楼画角 提交于 2019-11-28 05:02:22
I would like to add a font to the CKEditor font combo box. This in itself is easy enough. However the font I would like to add is a custom font that I use with the @font-face CSS3 attribute. I managed to do that but the editor itself does not show the custom font. If I just take the html created by CKEditor and show it in a div on the page, the custom font show nicely. I would also like to somehow add the @font-face attribute to the text area of CKEditor, so my users can see the custom font as they type. Is this possible? add the following line to ckeditor/config.js config.contentsCss = 'fonts

How to programatically insert link at current position in CKEditor 5

匆匆过客 提交于 2019-11-28 04:51:37
问题 In my app, I have a specific dialog to create internal links. After user finishes filling the dialog I want to programatically insert generated link to current caret position in the editor. So far I've been using SummerNote and there it is easy: editor.summernote('createLink', { text: linkTitle, url: url }); In CKEditor 5 I found this method which seems like it could do what I need: doc.enqueueChanges(() => { editor.data.insertContent(content, doc.selection); }); My problem is that I don't

How to define allowed tags in CKEditor?

烂漫一生 提交于 2019-11-28 04:32:36
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? 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 you want to restrict only certain tags exactly like you said, I found the setting bellow: config

How to add data to CKEditor using JQuery

让人想犯罪 __ 提交于 2019-11-28 04:31:26
Everytime a page loads I need to load text into the CK Editor using JQuery, in order to get data from CK Editor I use var editor_data = CKEDITOR.instances['editor1'].getData(); now is there a similar function I could use to put the data back into the editor? I'm using ajax to set the data like this $.ajax({ type: "POST", url: "/inc/ajax/basic.php?menu_id="+menu_id+"&info=3", success: function(msg){ CKEDITOR.instances['editor1'].setData(msg); } }); What am I doing wrong Try this: CKEDITOR.instances['editor1'].setData(html) Where 'html' is a string containing content to edit. Because its not an

Detecting onChange events from a CKEditor using Jquery

喜你入骨 提交于 2019-11-28 04:29:48
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) { CKEDITOR.instances[i].on('click', function() {alert('test 1 2 3')}); } I tried the code above and it doesn

Adding multiple CKEditor instances in jquery

♀尐吖头ヾ 提交于 2019-11-28 03:49:51
问题 I'm experimenting with various WYSIWYG javascript text areas. If I try to put a CKEditor on every <textarea> on my screen with jquery, the editors all show up fine, but they don't save. I've tried: $(function() { $('.editors').ckeditor(); }); and $(function() { $('.editors').each(function(index, element){ $(element).ckeditor(); }); }); In both instances, every text area has a CKEditor on it, but it doesn't save. If I manually add all the editors with $(function() { CKEDITOR.replace(

Is there a way to set the default font and font-size in CKEditor?

こ雲淡風輕ζ 提交于 2019-11-28 03:45:18
问题 I've been looking for a solution for this for a while now and the only fixes I found only affect the way the text is displayed in the editor itself and not how the generated text will look when sent/saved somewhere else. I'm talking CSS fixes and stuff like that. I'm using CKEditor to compose and send emails trough our web application and while the css fixes change the font shown in the editor itself, the recieved emails are still displayed in TNR or whatever is inherited from the email

How do you define the path which CKEditor uses to search for config / language files?

℡╲_俬逩灬. 提交于 2019-11-28 02:29:42
问题 CKEditor seems to look for its configuration files relative to the location it was loaded from, not the location of ckeditor.js. So loading CKEditor on the page http://www.example.com/articles/1 causes it to look for the language files in http://www.example.com/articles/1/lang/ The config file contains an attribute for baseHref, but it doesn't affect the editor resources themselves. How do I set the path which CKEditor uses for its own resources? 回答1: That behavior that you describe isn't

How to set default font-size on CKEditor

守給你的承諾、 提交于 2019-11-28 02:17:35
问题 I am having a problem setting a default font-size for a CKEditor Instance. I have tried googling but found nothing that answers my question. I have a page which takes an input for a website. There are 3 Editor instances and I have to make the default font-size of the first instance to, say about 20 to 30px. I have tried modifying contents.css found inside CKEDITOR folder and changing the font-size there but it affects all the 3 editor instances /* Copyright (c) 2003-2011, CKSource - Frederico