Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I click out of "Source" mode and then back to it, my code changes to the example below. This renders the AddThis widget incorrectly
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style"></div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fbe53be7786769b"></script>
<!-- AddThis Button END -->
This is the original code before it got changed:
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fbe53be7786769b"></script>
<!-- AddThis Button END -->
Comment | File | Size | Author |
---|---|---|---|
#4 | missing.jpg | 12.28 KB | krymp |
Comments
Comment #1
krymp CreditAttribution: krymp commentedbump
Comment #2
mkesicki CreditAttribution: mkesicki commentedIt looks that CKEditor 'strips' invalid
a
tags. CKEditor always validate code to proper HTML.This option can not disabled. I will consult this case with CKEditor developers.
Comment #3
mkesicki CreditAttribution: mkesicki commentedOne more thing:
As a workaround you can change
<a class="addthis_button_tweet"></a>
to
<a class="addthis_button_tweet"> </a>
Than editor will not remove your code.
Comment #4
krymp CreditAttribution: krymp commentedI've tried adding
But it still renders the section incorrectly. Part of the widget is missing now. See attached image.
I suspect it may have something to do with the 2 class names here:
<a class="addthis_counter addthis_pill_style"> </a>
Comment #5
mkesicki CreditAttribution: mkesicki commented@krymp this code from attached image is from 'inside' CKEditor or after save a node with your code ?
Can you try paste your code (with
) into source mode and than check what happens after change to wysiwyg mode ?Comment #6
krymp CreditAttribution: krymp commentedBefore:
After
It looks like it retains the code, but it fails to display the last a class correctly. (see screenshot from previous post)
Comment #7
Yuri CreditAttribution: Yuri commentedIt still happens, ckeditor just deletes any content when switching in and out of source mode.
Any progress here??
Comment #8
wooody CreditAttribution: wooody commentedHi,
Try to Go to modules/ckeditor/ckeditor.config.js file and add this line :
config.allowedContent = true;
and check your textformat if you allow the tags there.
Comment #8.0
wooody CreditAttribution: wooody commentedadded code tags
Comment #9
bdombro CreditAttribution: bdombro commentedAgree with Wooody, but here are some more instructions I got from this question:
https://drupal.org/comment/7706699#comment-7706699
Posted by John Carbone on July 31, 2013 at 5:41pm
I didn't see anyone mention this method but you can customize CKEditor in the module's settings like so. Use this for any filter format you need to adjust. This assumes you just want to ignore the new feature in CK and let Drupal handle stripping tags using the filter system as usual.
admin/config/content/ckeditor/edit/Full
->
ADVANCED OPTIONS
->
Custom JavaScript configuration
->
Paste in:
config.allowedContent = true;
SAVE
Comment #10
kenorb CreditAttribution: kenorb commentedSee also:
http://drupal.stackexchange.com/questions/74778/ckeditor-removes-class-n...
Comment #11
cabplan CreditAttribution: cabplan commented#9 suggestion worked for me, thank you!!!
Comment #12
my_super_username CreditAttribution: my_super_username commentedi have something strange also...
using fresh install of D7, wysiwyg + wysiwyg_ckeditor modules and insert module and colorbox module.
when im trying to insert some picture with insert module feature using some colorbox styles in ckeditor - it does nothing. it works only if im inserting some picture with no styles. seems strange cause few years ago it worked well, i tested it :)
so im editing my text with ckeditor, then switching to "Plain text" mode, inserting image with colorbox styles and then back to "Full HTML" mode and save. too complicated, dont you think so? :) especially for my content manager who is not so familiar with html (telling honest i need ckeditor features just for this person)
and even after that if i rightclick at image to edit something like text alignment or so, and all styles that were before - will gone :)
i think its because insert module inserts something like
<a hreff=original_image><img src=colorbox_thumbnail></a>
sorry if i choose the wrong issue branch or something... just commented the most similar i found :)
Comment #13
jatorresdev CreditAttribution: jatorresdev commented#9 Work for me thanks