It seems that if a break exists in the content when the content is edited that when saved another break is added right at the top of the content stopping the teaser from showing.

I'm using a copy of -dev that corrected the issue of the teaser not working.

Here's a copy and paste example of what happens:

<!--break-->
<p>
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu laoreet nulla. Suspendisse interdum facilisis est a commodo. Etiam pulvinar accumsan tempus. Fusce ipsum leo, iaculis sed pellentesque ut, ullamcorper at nisl. Fusce mollis volutpat orci vel hendrerit. Donec venenatis felis vitae metus accumsan id placerat nunc volutpat. Integer vel massa nibh. Nam eget ligula lectus, facilisis elementum magna. Vestibulum a leo sit amet sapien blandit varius et id sapien. Morbi at arcu id est ullamcorper eleifend aliquet id ipsum. In metus neque, sodales ac molestie quis, imperdiet nec nisi.</p>
<!--break-->
<p>
	Suspendisse potenti. Nullam rutrum turpis justo. Aliquam erat volutpat. Nulla luctus arcu id augue euismod interdum. Pellentesque quis erat at lectus dapibus convallis at in dui. Proin quis mauris risus, quis pharetra purus. Sed ETC...
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mtpultz’s picture

Here's a reason to preview your post before hand (the breaks were removed). I added an extra space to get the breaks to show.

< !--break-- >
<p>
	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu laoreet nulla. Suspendisse interdum facilisis est a commodo. Etiam pulvinar accumsan tempus. Fusce ipsum leo, iaculis sed pellentesque ut, ullamcorper at nisl. Fusce mollis volutpat orci vel hendrerit. Donec venenatis felis vitae metus accumsan id placerat nunc volutpat. Integer vel massa nibh. Nam eget ligula lectus, facilisis elementum magna. Vestibulum a leo sit amet sapien blandit varius et id sapien. Morbi at arcu id est ullamcorper eleifend aliquet id ipsum. In metus neque, sodales ac molestie quis, imperdiet nec nisi.</p>
< !--break-- >
<p>
	Suspendisse potenti. Nullam rutrum turpis justo. Aliquam erat volutpat. Nulla luctus arcu id augue euismod interdum. Pellentesque quis erat at lectus dapibus convallis at in dui. Proin quis mauris risus, quis pharetra purus.
mtpultz’s picture

The most annoying thing about this bug is, once the extra break is added you can't get rid of it. You can try but it always remains, whether you remove it using the editor or flipping to plain text and remove it.

mtpultz’s picture

Only way to get rid of the extra break is to copy the content to a new node and delete the old one. I have this happening on two separate sites now. It doesn't seem to happen every time you edit but it is definitely reproducible.

jcisio’s picture

Could you give more detail on how to reproduce the bug? As most of my nodes have the break, and I never have problem editting them.

Can't you get rid of the break event when you switching to the HTML source mode?

mtpultz’s picture

No, once it's placed another break right at the start of the content it there for good. It only happens when there is one break in place already, and not all the time. You can sometimes get the one you added to disappear but the one that just appears at the start of the content always returns after saving. I'll try and nail down something more for you in the way of an explanation but that's what happens and when.

jcisio’s picture

If you export/import the node that has problem into another Drupal site, does it still happen? Or it just happens now and then and independant on the node content?

mtpultz’s picture

Do you mean copy and paste the content. If you copy and paste out of the editor into another site the issue persists.

One way I find I can get it to happen is by just clicking the added break and pressing the delete key, after I've saved the page node the mystery break has appeared at the start of the content and it won't go away.

The exact process:
Create page node
Add some content
Save
Edit page node
Add a break
Save
Edit page node
Select and press delete key on break
Save
No teasers show up now
Edit page node
See break at start of content

jcisio’s picture

I can't reproduce the bug. When I select the break and press Delete, the break goes away. It's all. No break in the node content.

OS X 10.5, Firefox 3.6.8. I'll test with another Windows browser.

dczepierga’s picture

I can't reproduce this bug too.

Windows 7, Chrome 5.0.375.127 & Firefox 3.6.8 & Opera 10.61 & Safari 5.0.1

Can anyone else confirm that bug??

dczepierga’s picture

Status: Active » Closed (cannot reproduce)
mtpultz’s picture

Sorry I don't know what's wrong then. Here's a example of it happening. I just updated the blog entry to show a nodereference to a gallery. So didn't even change the blog body just selected from a drop down, saved and now the teasers don't show up. Happened to both of the most recent nodes one after the other.

http://www.climbtheboulders.com/news-and-events

Here's one of the nodes with two breaks in it. The original is after 11am but now there's one at the start and after 11am. I can give you permissions to see it happening if you want.

http://www.climbtheboulders.com/node/57

jcisio’s picture

Status: Closed (cannot reproduce) » Active

You can in some measure check it yourself, to see how to reproduce this bug.

- Copy the whole node body into another node in your site. Does problem persist? (you answered "yes", but then I can't verify)
- Copy the whole node body into a new site, with only CKEditor enabled. Does problem persist? If yes, put your node body somewhere so that other can check.

mtpultz’s picture

Here's a link to a couple nodes I added following your request
http://www.climbtheboulders.com/ckeditor/test

On a clean install the only thing that happens is:
- both breaks exist on paste
- both breaks exist after save
- deleting the break at the start and saving at any time doesn't cause it to come back

jcisio’s picture

I don't know what to do with your link. There is no teaser break in display mode.

The 3 symptoms you describe are not anormal. CKEditor does not modify the HTML source on paste/save.

mtpultz’s picture

I'm not sure what that means, I put a view together showing the blog entries I have with the pieces being title, teaser, link for the view.
- The first example, third down in view has the extra break from the paste and after I save it, if I try to edit and remove it will never go away
- The second example, second down in view has no break, it was removed as the node was created
- The third example, first in view is the same as the second example except I edited the newly created node and saved it again, and the extra break is added, and it will never go away.
In only one of the three does the teaser show up, the second and only if I don't edit the node ever again.

Oh I know, I'm telling you what happened so you can confirm that this works with a clean install and only CKEditor.

If you need more just tell me what it is you need and I'm happy to help as long as I understand what you need. Seems module based in nature. I have three modules of my own that are just forms I include as blocks and the rest are from drupal.org and fairly regular modules for the average site.

mtpultz’s picture

FileSize
28.97 KB

Seems to all happen when you save here's a node that I just opened to copy out the content and recreate the blog entry to get rid of the extra break and it has two at the start. I attached an image. I only want to help so let me know if there is more that I can do.

jochovitch’s picture

same problem, really annoying, everytime I add new content,

is placed before the content...

mtpultz’s picture

Honestly I'm glad you're having this issue as it makes me less crazy :) and I agree very annoying.

I've only been able to get around it by:
- creating a new node
- copy and pasting the old node content (minus all breaks) into it, including the authored date to preserve position in the blog
- adding in a teaser only when I'm completely satisfied with the page
- then deleting the old node

Haven't heard back in awhile so I'm not sure what's happening.

Want to compare modules, see if it's an incompatibility? If you can post a list of your installed modules (maybe your theme... I don't know). I'll do the work of comparing, installing similar, and testing to see when the problem is introduced (if an incompatibility is the issue). I only suggest this since a clean install with just CKEditor installed doesn't have this happening.

johan2’s picture

Hi,

Subscribing,
I have the same issue, each time I create a new node the ckeditor adds a br / in the beginning.
I noticed that even if I didn't enter something the br / is still added. It creates in this way a string in my translations.
Nothing helps to turn them off, only when switching to plain text and deleting this is the solution. My custom settings are off and don't cause this problem, so something must be wrong. I know that ckeditor can be excluded from the node in the exclude settings but this is a pour solution.

greetings, Johan

marianojofre’s picture

This worked for me:

In the "Edit CKEditor profile page", Cleanup and output, I checked "Yes" in the "Use custom formatting options". Then I unchecked this option "break line after the opener tag"

When I came back to create a Node, I typed some text in the CKEditor. I Switch to plain text editor, and the line has dissapaired after the first "p" tag.

iperez_genius’s picture

I dont know if this is the same bug that everyone is speaking about...
The bug i get is as follows.
I created a block and put html in the block. every single time i view the block a

 

is added between other tags, like

  • tags...

    every time i click the source button a

     

    is added. If i click the source button 7 times 7

     

    are added. You get picture. This is of course very annoying as it prevents me
    1. viewing the block without having to clean up the code
    2. If i want to edit the block content i need to clean up the html

    I have turned off break conversion in the input filter

    Any help would be greatly appreciated.

    Ilan

  • dcrsys’s picture

    This is a bug.

    I create content via CK editor (this is in the body col of my node_revisions table):

    <div>
    	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut euismod magna. Suspendisse id quam sem, sit amet ultrices leo. Donec eleifend, justo quis pretium lacinia, felis metus semper diam, ac consectetur turpis orci nec purus. Donec non turpis nec justo sagittis egestas vitae sed orci. Suspendisse potenti. Nam turpis tellus, vehicula a gravida nec, molestie sit amet mauris. Cras lorem purus, pretium eget egestas ac, imperdiet eget sem. Quisque id ipsum erat. Etiam rutrum lectus id nisl imperdiet eget volutpat augue interdum. Aenean congue vulputate pellentesque. Integer eget est mi, vel volutpat urna. Suspendisse non leo nulla. Suspendisse sapien sapien, hendrerit in dictum et, gravida sed justo. Nullam eget sollicitudin lectus. Pellentesque cursus, est vel aliquet auctor, leo neque dictum nibh, non rhoncus quam massa nec erat.</div>
    

    This is my teaser col:

    <div>
    
    

    if I use plain text every thing works fine.

    CK has broken a bunch of HTML that I've fed it over the past couple of months. It seems to think it's smarter than it really is. I'm probably one issue away from dumping it and going back to MCE - and that sucks - but I need something that works reliably.

    jcisio’s picture

    Category: bug » support
    Status: Active » Closed (works as designed)

    This is not a bug. There are two way to have it worked:
    a) Use output formatting options as described in #20
    b) Disable the "Line break converter" filter in your input format.

    This may be a feature request: by default disable the output formatting option. But it won't work, either, as line break (br) will be inserted into <pre> tags for example.

    We can emphasize in the doc that "Line break converter" should not be enabled when a richtext editor is in used.

    medieval111’s picture

    Category: support » bug
    Status: Closed (works as designed) » Active
    FileSize
    4.4 KB

    I have the same problem, using the latest version. If I save a node with a teaser break and I edit and save it again, there is an extra teaser break added at the top! If I delete the teaser break and save again, the extra teaser break is added again....

    I tried what jcisio said in #23:
    - ... disabling the line break converter;
    - ... using the output formatting options as described in #20.

    Didn't work.... so I think it is a bug......

    jcisio’s picture

    Sorry, I read only the comment #22 and mistook this bug with another one. Even #19 told about a different thing.

    The problem with this issue is that we don't know how to reproduce it!

    puzl’s picture

    I stumbled upon this and was able to fix it by going into the 'code mode' and removing unnecessary spaces and breaks. I also made sure to keep the tag between two empty lines. This time the tag wasn't added again after a save. Then I removed the two empty lines again and the tag was added again. I suspect the break tag isn't properly recognized. Maybe a faulty regular expression?

    medieval111’s picture

    Hmm the strange thing is that if I save in "code mode" (even without changing anything), everything works fine. But if I save when the WYSIWYG editor is shown, the extra teaser break is added....

    copini’s picture

    A possible cause for this issue is hiding the "Split Summary at Cursor" button. We used the Node Form Settings module to achieve this, but this also caused the extra teaser break when saving an existing node.

    mtpultz’s picture

    #28 seems to fix this issue at least for me. I use that module too and I stopped hiding "Split Summary at Cursor" button and the breaks stop showing up. I checked this with all my clients sites that were experiencing this and that fixed them all. Thanks Copini this has been driving me crazy for a couple months now.

    carlop’s picture

    I tried disabling "Split Summary at Cursor" but still have the bug. Maybe disabling the module?

    EDIT: Sorry, it works enabling the "Split Summary at Cursor" button.

    BBC’s picture

    Subscribing. I'm experiencing this issue as well, despite the suggestions in #23 and elsewhere above. For me, I can successfully insert a teaser break as long as "Show summary in full view" is unchecked. Any subsequent attempts to edit the node with the rich text editor mode enabled results in a node body with a teaser break at the very top and only the teaser content from the previous version intact.

    tobiberlin’s picture

    Hi all,

    I had the same problem.... it dissappeared when I clicked on "Join summary" and deleted the autmatically included break-placeholdert at the top of the text. Don't know if this influenced this result but I also used the tipp of comment #20 before but it did not really had a result directly/ alone. Just when I clicked on "Join summary" the deleted first teaser break did not appear again.

    Greez,
    Tobias

    generalelektrix’s picture

    Been wasting 2 days or work on this damn thing. I installed Wysiwyg 2.2 recently and it totally broke FCKEditor 2.6.5. So I installed CKEditor as a module as a replacement. However, I stumbled on this problem.

    This Editor just want to do too much work. Why do they need to mess with my source code? Just leave it as I decided to indent it? Do i really need an editor that messes up with the line breaks I inserted? NO WAY!

    There should be an option called "Don't mess with my source code". I would get rid of all the others and only check this one.

    jcisio’s picture

    +1 on #33. However current the editor has no way for that option :( Indent or not, line break or not, CKEditor will always format html code in a way :( I don't know why :( Currently what we can do is:
    - The module, by default, tells CKEditor not to add line break or indent to any tag.
    - Use protect source option to keep your line breaks.

    generalelektrix’s picture

    Indeed.

    There are options you can uncheck so CKEditor won't add any line breaks after or before tags.

    However, when you uncheck them, CKEditor actually REMOVES all the line breaks you manually inserted rendering the source code all on a single line. Isn't that the summit of annoyance?

    Thanks for reading and sorry to be so bitter about that, since all the time I wasted on this is due to a minor update of another module (Wysiwyg from 2.1 to 2.2) which broke another editor.

    To be constructive, here's an improvement suggestion:

    In the Cleanup and output section of profiles configuration, selecting "No" for "Use custom formatting options:" should have the effect of ignoring totally what has been checked or not in the "Custom formatting options" and simply let the *source code* of the node as is; that is exactly as the programmer typed or copy/pasted it, with all the original line breaks and indentation untouched.

    kehan’s picture

    subscribing, and CKEditor no longer has the "Custom formatting options" configuration.

    jmseigneur’s picture

    Subscribing

    crew.im’s picture

    All is maybe this bug Wysiwyg always insert

    before text in textarea after submit edited node

    http://drupal.org/node/945910

    jessebeach’s picture

    We (at Acquia) had a Drupal Gardens user report extra line breaks when saving a post with CKEditor. We narrowed the issue down to Internet Explorer 8. Here's a screenshot that illustrates the issue.

    https://skitch.com/jesse.beach/fmicb/windows-xp-sp2-ie8-native-running

    When the node is saved in IE8, extra
    tags are inserted. When the same node is resaved in Firefox 3.6, the line breaks disappear.

    https://skitch.com/jesse.beach/fmicq/windows-xp-sp2-ie8-native-running

    When the node is re-re-saved in IE8, the extra line breaks reappear.

    Looking in the database, we see that the p tags are saved as

    rather than

    in IE8:

    https://skitch.com/jesse.beach/fmip2/localhost-localhost-gardens-field-d...

    But not when the node is saved in Firefox 3.6

    https://skitch.com/jesse.beach/fmic5/localhost-localhost-gardens-field-d...

    Is the

    triggering the insertion of a line break? That seems to be the only difference between the two db entries.

    Throughout these tests, I was using a Full HTML text formatter. Here are the configurations associated with it.

    https://skitch.com/jesse.beach/fmiqp/windows-xp-sp2-ie8-native-running

    mrbubbs’s picture

    I'm still having the issue as in post #1. I found that post #21 from #653498: Empty teasers when editing content helps get rid of the teaser break inserted at the top of the post.

    The teaser break is inserted even at the top of the post, even if there is another teaser break elsewhere in the text.

    Switching to the plain text editor reveals a blank line above the rest of the text in the teaser textarea. If I switch to the plain text editor, remove the blank line at the top of the teaser text, switch back to ckeditor, then back to plain text editor, the blank line is there again. I don't know if this blank line in the teaser text has anything to do with the extra teaser break being added to the top of the text or not.

    At the moment, I use ckeditor to generate the HTML, then I switch to the plain text editor, paste the HTML, remove the top teaser break, and save the page. Only then is my content the way I expect it. If I then edit the page, ckeditor does NOT show a teaser break at the top, but it does show the appropriate teaser break where I manually placed it before. This is good. Unfortunately, even if I don't change anything then save the page while ckeditor is displaying the content, when I go to edit the content again, the dreaded top teaser break shows up once more.

    If I repeatedly edit the page, do nothing and just save the content, then edit the page again, additional teaser breaks are added to the top of the content. If I were to save the content with ckeditor showing 5 times, then I'd have 5 breaks above the content. However, if I'm careful to switch to the plain text editor and save the content, upon editing the page again, then the page looks as expected, without the teaser break at the top.

    mrbubbs’s picture

    There was another module removing the "Show summary in full view" checkbox, causing teaser_js to not get set on save. Now that the checkbox is displayed on the edit form, no additional teaser break is added to the beginning of the content.

    castawaybcn’s picture

    Thanks for this mrbubbs, I had the same problem and unhiding the "Show summary in full view" option through Node and comments form settings module fixed the double teaser break.
    Edit
    If anybody encountered the same problem you can still make the summary option invisible through css:

    body.whatever-your-node-type-name-is #node-form #edit-teaser-include-wrapper {
    display: none;
    }
    AlexisWilke’s picture

    CANCELED -- do not use this patch, it is not the solution, see #45 instead.

    When a programmer tells you he cannot fix it, just ask another and he'll provide you with the fix... 8-)

    I ran into that one today and obviously it was easy to fix once you determined where the problem was.

    See the patch tested on two sites: one with the teaser checkbox and one without it. (i.e. the "Show summary in full view" checkbox).

    I'm not too sure which module removes the checkbox for others, in my case it is this one file:

    nodeformsettings/includes/option_nfs_splitsummary.inc

    You may just install that module and make sure that the "Show summary in full view" flag disappears then you can replicate this bug.

    Thank you.
    Alexis Wilke

    IMPORTANT NOTE

    I do not use the Pop-up version, but that one makes a similar assumption, therefore, you most certainly want to test that one too and see whether a fix is required there too. It will certainly be very similar.

          var textarea_id=get_element_id();
          $(".content_editor").attr("id", textarea_id);
          if (teaser=Drupal.ckeditorTeaserInfo(textarea_id)) {
            if(teaser.textarea.val().length > 0){
              $(".content_editor").val(
                teaser.textarea.val() + '\n<!--break-->\n' + window.opener.$("#"+textarea_id).val()
              );
            } else {
              $(".content_editor").val(window.opener.$("#"+textarea_id).val());
            }
          } else {
            $(".content_editor").val(window.opener.$("#"+textarea_id).val());
          }
    

    CANCELED -- do not use this patch, it is not the solution, see #45 instead.

    AlexisWilke’s picture

    Assigned: Unassigned » AlexisWilke
    Status: Active » Needs review
    FileSize
    601 bytes

    Darn! I left my debug in the previous patch... 8-}

    CANCELED -- do not use this patch, it is not the solution, see #45 instead.

    AlexisWilke’s picture

    Argh! That patch fixes what you see in the editor, but not the core of the problem... That is, the node module will do the exact same thing as the CKEditor and add the "missing" break as shown below. In other words, the teaser ends up being empty anyway.

    Instead, I can see that in CKEditor and in the Node code, the 'teaser_js' field is checked and that means that field can be removed instead of the include (or both fields.) So I changed the nodeformsettings module as shown here: #1776188: CKEditor and "Split Summary at Cursor"

    That fixes the problem for good! 8-)

      if (isset($form['#post']['teaser_js'])) {
        // Glue the teaser to the body.
        if (trim($form_state['values']['teaser_js'])) {
          // Space the teaser from the body
          $body = trim($form_state['values']['teaser_js']) ."\r\n<!--break-->\r\n". trim($form_state['values']['body']);
        }
        else {
          // Empty teaser, no spaces.
          $body = '<!--break-->'. $form_state['values']['body'];
        }
        [...]
    

    So... in other words this is not directly a CKEditor problem, it exacerbate a problem that other modules generate by only removing the "Show summary in full view" checkbox.

    Thank you.
    Alexis Wilke

    mkesicki’s picture

    Assigned: AlexisWilke » Unassigned
    Status: Needs review » Active

    @AlexisWilke,
    thank you for your investigation and informations.