Jump to content

Editing CKEditor Config

Featured Replies

Posted

I'm trying to make some changes to CKEditor through the config file but struggling a bit. I'm looking to add:

config.forcePasteAsPlainText = true;

and

config.ignoreEmptyParagraph = false; (I'm thinking this will remove the extra empty paragraphs which are created when a user hits enter several times after a post)

I've added the lines to the config.js in applications > core > interface > ckeditor > ckeditor but neither work

/*
 Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig=function(a){a.toolbarGroups=[{name:"document",groups:["mode","document","doctools"]},{name:"clipboard",groups:["clipboard","undo"]},{name:"editing",groups:["find","selection","spellchecker"]},{name:"forms"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},{name:"links"},{name:"insert"},{name:"styles"},{name:"colors"},{name:"tools"},{name:"others"},{name:"about"}];a.removeButtons="Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";
a.removeDialogTabs="link:advanced"};

config.forcePasteAsPlainText = true;
config.ignoreEmptyParagraph = true;

 

At least for the plain text, that should work. It’s exactly how I do it. 

/*
 Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig=function(a){a.toolbarGroups=[{name:"document",groups:["mode","document","doctools"]},{name:"clipboard",groups:["clipboard","undo"]},{name:"editing",groups:["find","selection","spellchecker"]},{name:"forms"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},{name:"links"},{name:"insert"},{name:"styles"},{name:"colors"},{name:"tools"},{name:"others"},{name:"about"}];a.removeButtons="Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";
a.removeDialogTabs="link:advanced"};

CKEDITOR.config.forcePasteAsPlainText = true;

 

Oh, wait, you are missing the “CKEDITOR”.

  • Author

Thanks, that worked with the paste, empty paragraphs didn't but that's not a major. Appreciate it

Another option to use would be to move the items into the existing editorConfig function:

/*
 Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig=function(a){
    a.toolbarGroups=[{name:"document",groups:["mode","document","doctools"]},{name:"clipboard",groups:["clipboard","undo"]},{name:"editing",groups:["find","selection","spellchecker"]},{name:"forms"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"paragraph",groups:["list","indent","blocks","align","bidi"]},{name:"links"},{name:"insert"},{name:"styles"},{name:"colors"},{name:"tools"},{name:"others"},{name:"about"}];
    a.removeButtons="Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";
    a.removeDialogTabs="link:advanced",
    a.forcePasteAsPlainText = true;
    a.ignoreEmptyParagraph = true;
};

 

This works for me:

CKEDITOR.editorConfig = function( config )
{
    // config.uiColor = '#553360';
    config.forcePasteAsPlainText = true;
};

 

Yep - they are all ways of achieving the same thing. You can create a new config function, add to an existing one, or just go it alone with the single line entry.

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.