I have been annoyed by something for a long time.
Using the extended body, I have noticed that if you use the htmlarea editor and enter a few blank lines at the beginning of the extended body, the first blank line is removed when the entry is saved.
So, lets say I create an entry, using the html (non-wysiwyg) editor.... you are counting on the nl2br plugin to add <br /> markup for blank lines.
Continuing the example, I add a single blank line to the beginning of the extended body to provide separation from the entry body in detailed view. If I save the entry, this single blank line is removed.
If I enter 2 blank lines, the first is removed on save. If I continue to edit, then save again, the remaining blank line (originally the second) is now removed.
Can this behavior be changed so as not to remove the first blank line from the extended body?
HTMLAREA editor - removed first blank line
-
Don Chambers
- Regular
- Posts: 3659
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
-
kleinerChemiker
- Regular
- Posts: 765
- Joined: Tue Oct 17, 2006 2:36 pm
- Location: Vienna/Austria
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: HTMLAREA editor - removed first blank line
Hi!
Does that happen without WYSIWYG editor as well? I don't think so, right?
Regards,
Garvin
Does that happen without WYSIWYG editor as well? I don't think so, right?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
Don Chambers
- Regular
- Posts: 3659
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
This fix is required because in some browser the WYSIYWGT editor inserts a break or empty space into a body field, and then s9y will recognize it as "filled". Thus, in include/functions_entries.inc.php this can be found:
However that only changed the extended entry, it should not be applied to the usual body. But if we change this, we will re-introduce the glitch that this portion fixes.
IMHO pre-seperation with newlines is bad and should not be done; CSS should be used for general distance, and in cases where you absolutely need it, manual <br>'s should do?
Regards,
Garvin
This fix is required because in some browser the WYSIYWGT editor inserts a break or empty space into a body field, and then s9y will recognize it as "filled". Thus, in include/functions_entries.inc.php this can be found:
Code: Select all
/* WYSIWYG-editor inserts empty ' ' for extended body; this is reversed here */
if (isset($entry['extended']) && (trim($entry['extended']) == '' ||
trim($entry['extended']) == '<br />' || trim($entry['extended']) == '<p></p>' ||
str_replace(array("\r", "\n", "\t", "\0", "<br />", "<p>", "</p>", "<br>"), array('', '', '', '', '', '', '', ''), trim($entry['extended'])) == '')) {
$entry['extended'] = '';
}
IMHO pre-seperation with newlines is bad and should not be done; CSS should be used for general distance, and in cases where you absolutely need it, manual <br>'s should do?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
Don Chambers
- Regular
- Posts: 3659
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
CSS is not really a solution unless the editor (wysiwyg or html) is known. The wysiwyg editor wraps all paragraphs in <p> tags, whereas the html editor does not. If the entry body is separated by, say a top margin on the extended body, it will look fine if an entry was created by the html editor, but will have too much space is both entry and extended have <p>aragraphs.
One "line" of height is also subject to css defined line height and font size, so setting that to exactly one line is also trial and error.
Leaving an extra line in the entry body is also a solution, but a visually unappealing one for a layout looking to minimize lines on an overview page.
Correct me if I am wrong here, but isn't this fix not really required as long as the user is not using the NL2BR plugin *AND* the wysiwyg editor?
One "line" of height is also subject to css defined line height and font size, so setting that to exactly one line is also trial and error.
Leaving an extra line in the entry body is also a solution, but a visually unappealing one for a layout looking to minimize lines on an overview page.
Correct me if I am wrong here, but isn't this fix not really required as long as the user is not using the NL2BR plugin *AND* the wysiwyg editor?
=Don=
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
What about giving the <p> a top-margin of 0 and only work with bottom-margin? Then the spacing of the extended element will not vary if it contains a <p> and be the same like without.
Regards,
Garvin
What about giving the <p> a top-margin of 0 and only work with bottom-margin? Then the spacing of the extended element will not vary if it contains a <p> and be the same like without.
I believe this problem is not related to nl2br (the code I pasted happens before nl2br is executed), but simply to what htmlarea sometimes gives you as first line/content even if it's empty...Correct me if I am wrong here, but isn't this fix not really required as long as the user is not using the NL2BR plugin *AND* the wysiwyg editor?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
Don Chambers
- Regular
- Posts: 3659
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Bottom-only margin on <p>'s would create an undesireable increase in length/height to an entry when only the entry body is showing...... this is why you really want the separation to be applied at the beginning of the extended body - it never shows without entry body.
I suppose, using smarty, one could test the extended body, and if the first 3 characters are NOT <p>, then print <br />.... but that sounds like a lot of overhead.... is it?
I suppose, using smarty, one could test the extended body, and if the first 3 characters are NOT <p>, then print <br />.... but that sounds like a lot of overhead.... is it?
=Don=
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
You could use top-margin for the entry body, and only bottom-margin for the extended entry?
Maybe I'm not getting the whole picture, could you show an example of entries with undesirable margins so that I could understand why it's not solvable with CSS?
Regards,
Garvin
You could use top-margin for the entry body, and only bottom-margin for the extended entry?
True, that can be done, but it's also an overhead...I suppose, using smarty, one could test the extended body, and if the first 3 characters are NOT <p>, then print <br />.... but that sounds like a lot of overhead.... is it?
Maybe I'm not getting the whole picture, could you show an example of entries with undesirable margins so that I could understand why it's not solvable with CSS?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/