Jump to content

ckeditor extra allowed content not work properly


adrianmak
 Share

Recommended Posts

I agree, thats a bit tricky. There is a default setting in CKEditor which overrides the <i> tag with <em>.
Luckily CKEditor is highly configurable, even in ProcessWire.

If you don't want to disable ACF (Allowed Content Filtering) generally there is this specified solution:
Create a config file: /site/modules/InputfieldCKEditor/config.js (if its not already there)
with the following content to allow empty <i> tags as used for font-awesome icons

CKEDITOR.config.protectedSource.push(/<i[a-z0-9\=\'\"_\- ]*><\/i>/g);

 

  • Like 1
Link to comment
Share on other sites

17 hours ago, kixe said:

I agree, thats a bit tricky. There is a default setting in CKEditor which overrides the <i> tag with <em>.
Luckily CKEditor is highly configurable, even in ProcessWire.

If you don't want to disable ACF (Allowed Content Filtering) generally there is this specified solution:
Create a config file: /site/modules/InputfieldCKEditor/config.js (if its not already there)
with the following content to allow empty <i> tags as used for font-awesome icons


CKEDITOR.config.protectedSource.push(/<i[a-z0-9\=\'\"_\- ]*><\/i>/g);

 

Not quite working...

config.js is existed under the  /site/modules/InputfieldCKEditor/ folder
original config.js

/**
 * CKEditor custom config file for ProcessWire
 * 
 * Use this file to specify additional config options to all CKEditor instances, 
 * except those that have field-specific config files, i.e. config-body.js for 
 * config specific to a field named "body". 
 * 
 */

/**
 * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.html or http://ckeditor.com/license
 */

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here. For example:
	// config.uiColor = '#AADC6E';
};


I tried adding  in

 

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here. For example:
	// config.uiColor = '#AADC6E';
    config.protectedSource.push(/<i[a-z0-9\=\'\"_\- ]*><\/i>/g);
};

or  outside the function
 

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here. For example:
	// config.uiColor = '#AADC6E';    
};

CKEDITOR.config.protectedSource.push(/<i[a-z0-9\=\'\"_\- ]*><\/i>/g);




Both location are not working at all.

Link to comment
Share on other sites

@adrianmak

  1. I didn't say you should put something inside another function. Did I? You can remove all the other stuff from the file, because it is not needed.
  2. What did you try to put inside your field? Please post here! The setting allows you to use exactly what I described. Nothing else!


For example

<i class="fa fa-awesome"></i> // allowed
<i class="fa fa-awesome">nobreakspace-or-whatever</i> // NOT allowed

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...