Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 07:09 am EST
Geeklog Forums
CKEditor removing empty tags automatically
Status: offline
alb3rt
Forum User
Regular Poster
Registered: 10/30/06
Posts: 71
Location:Mexico City
I insert html content contain the <i> elements. I do this with the CKEditor. Everything works when I add " " and the content shows up on the webpage. But when i want to edit the previously inserted content, the <i> elements are missing.
For example:
I tried add this lines to the config.js (/public_html/editors/ckeditor/ckeditor.js) but not works
D Web Studio - www.d-webstudio.net
For example:
Text Formatted Code
<i class="fa fa-map-marker fa-2x"> </i>I tried add this lines to the config.js (/public_html/editors/ckeditor/ckeditor.js) but not works
Text Formatted Code
CKEDITOR.dtd.$removeEmpty['i'] = false;Text Formatted Code
config.protectedSource.push(/<i[^>]*><\/i>/g);Text Formatted Code
CKEDITOR.dtd.$removeEmpty['b'] = false;D Web Studio - www.d-webstudio.net
12
10
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Do the solutions on any of these pages work?
https://stackoverflow.com/questions/18261198/ckeditor-removing-empty-span-automatically
https://drupal.stackexchange.com/questions/198783/ckeditor-strips-i-tags
One of the Geeklog Core Developers.
https://stackoverflow.com/questions/18261198/ckeditor-removing-empty-span-automatically
https://drupal.stackexchange.com/questions/198783/ckeditor-strips-i-tags
One of the Geeklog Core Developers.
10
9
Quote
Status: offline
alb3rt
Forum User
Regular Poster
Registered: 10/30/06
Posts: 71
Location:Mexico City
I solved it. It is necessary to add the following lines to the file (~/editors/ckeditor/config.js) between ... CKEDITOR.editorConfig = function( config ) { ... }
config.protectedSource.push(/<i[^>]*><\/i>/g); // <i></i>
config.protectedSource.push(/<span[^>]*><\/span>/g); //<span></span>
And clean the browser cache (Important).
D Web Studio - www.d-webstudio.net
Text Formatted Code
config.protectedSource.push(/<i[^>]*><\/i>/g); // <i></i>
config.protectedSource.push(/<span[^>]*><\/span>/g); //<span></span>
And clean the browser cache (Important).
D Web Studio - www.d-webstudio.net
10
6
Quote
Phil_69
Anonymous
I had the same problem with the <a> tag and resolved it. But in my case, the closing tag was on the next line. So I had to change the filter :
to
For the others tags this hack seems to work :
CKEDITOR.dtd.$removeEmpty[i] = false;
});
But not for the <a> tag !
Text Formatted Code
config.protectedSource.push(/<i[^>]*><\/i>/g);to
Text Formatted Code
config.protectedSource.push(/<i[^>]*>[\s]*<\/i>/g);For the others tags this hack seems to work :
Text Formatted Code
$j.each(CKEDITOR.dtd.$removeEmpty, function (i, value) {CKEDITOR.dtd.$removeEmpty[i] = false;
});
But not for the <a> tag !
11
30
Quote
All times are EST. The time is now 07:09 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content