When you have more than one < !--break-- > inputed into a node, you can save the node with the content, but when you edit the node, the data after the second < !--break--> is lost.
Steps to reproduce
- Fresh Drupal install
- Create a new node (page or story)
- Input the following for the content:
This is the teaser! < !--break--> This appears in the full story! < !--break--> This appears after the full story! < !--break--> This is the afterlife of the node....Of course, you'll remove the space between the < and the ! in that example.
- Save the node and you'll see that all content appears as expected
- Now edit the node and instead of being able to edit all content, you're only able to edit up to the second < !--break-->.
Expected outcome is being able to edit all content in the node.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | teaser-break-weirdness-D6.patch | 979 bytes | andypost |
| #4 | 193577-teaser-break-weirdness.patch | 972 bytes | damien tournoud |
Comments
Comment #1
LAsan commentedConfirmed in 6.x-dev.
Still happening in 7.x-dev.
Comment #2
JeremyFrench commentedShould we strip instances of < !--break --> after the first, or honour them somehow?
Comment #3
damien tournoud commentedConfirmed.
This should be a simple bug into the teaser splitter javascript.
Comment #4
damien tournoud commentedThe source of the bug is that the following javascript code:
... doesn't behave as you would expect (at least it behaves differently then the PHP explode() function) [1]. Javascript will return only the first two components, ignoring the remaining of the string, so:
will return
{ 'a', 'b' }instead of{ 'a', 'b,c' }The attached patch fixes the issue (tested on Firefox 3).
[1] http://www.w3schools.com/jsref/jsref_split.asp
Comment #5
netsensei commentedI've noticed the same issue in drupal 7.
Tested the patch. It works on these browsers:
- Safari 3.2.1 (osx)
- Camino 1.6.7 (osx)
- Firefox 3.0.9 and 3.0.10 (osx)
Comment #6
akahn commented#1 indicates a use case where
<!--break-->is used more than twice. Shouldn't this patch allow more than two breaks (not that I have ever needed to do this on a site)?Comment #7
damien tournoud commented@akahn: it does, the text between the beginning of the content and the first
<!--break-->is going in the teaser, the part after that (including subsequents<!--break-->) is going to the body.Comment #8
akahn commentedAh, of course.
Comment #9
burningdog commentedDoesn't apply against D6. D7 works fine - tested on:
Firefox 3.0.8
SeaMonkey 1.1.16
Safari 3.2.1
Camino 1.6.5
Flock 1.2.7
Opera 9.6.2
Mozilla 1.7.3
Comment #10
webchickLots of exotic browsers mentioned here, but let's test in a non-exotic one: IE. :)
Comment #11
burningdog commentedWhat?! People still use IE?! You're kidding!
Ok, I've fired up Doze and the patch works for:
IE 6.0
IE 7.0
IE 8.0
Comment #12
burningdog commentedAre there other browsers that need to be tested, or is this sufficient?
Comment #13
dries commentedCommitted to CVS HEAD. Changing version to DRUPAL-6. Thanks!
Comment #14
andypostPatch for D6
Tested on IE6, IE7, FF3, safari 3.2.3
Comment #15
damien tournoud commentedSame patch, same conclusion. Thanks @andypost.
Comment #16
gábor hojtsyThanks, committed to Drupal 6.