Problem with additional spaces between HTML wrappers and fields
Permalink Browser Info Environment
Hi Ramon,
I have a small problem with additional space characters that appear in the output of a custom block created by BlockDesigner.
An example: i want to create a simple divider with a custom height, to be set by the editor. The output should be like this:
In BlockDesigner, i use the number field, wrapped by these HTML segments:
and
After having finished and installed the block, i insert it between two text blocks and set the number to "60".
Unfortunately, the HTML output of the block is:
The number is now surrounded by additional space characters, which of course results in a wrong CCS value.
While it's possible to correct this in the view.php of the created block, it would be nice, if these spaces could be avoided before the block is made. By the way, i have tried the same with text field, but no difference, these spaces are always added.
Actually i cannot see a need for spaces between wrapped HTML and even fields, but maybe this behavior is even intentionally, and i'm using the fields in a way they are not intended to? In this case, it would be great, if there were field types for an input of CSS related values such as numbers or text.
Thank you,
Michael
I have a small problem with additional space characters that appear in the output of a custom block created by BlockDesigner.
An example: i want to create a simple divider with a custom height, to be set by the editor. The output should be like this:
<div class="divider" style="60px;"> </div>
In BlockDesigner, i use the number field, wrapped by these HTML segments:
<div class="divider" style="height:
and
px;"> </div>
After having finished and installed the block, i insert it between two text blocks and set the number to "60".
Unfortunately, the HTML output of the block is:
<div class="divider" style="height: 60 px;"> </div>
The number is now surrounded by additional space characters, which of course results in a wrong CCS value.
While it's possible to correct this in the view.php of the created block, it would be nice, if these spaces could be avoided before the block is made. By the way, i have tried the same with text field, but no difference, these spaces are always added.
Actually i cannot see a need for spaces between wrapped HTML and even fields, but maybe this behavior is even intentionally, and i'm using the fields in a way they are not intended to? In this case, it would be great, if there were field types for an input of CSS related values such as numbers or text.
Thank you,
Michael
Type: | Discussion |
---|---|
Status: | Resolved |
Hi Ramon,
that's great, thank you!
Since no one has noted this before, it looks like the way i'm using the HTML-wrappers is not the default way they were intended for :)
But i think it is a great option for styling some aspects of blocks, so i'm looking forward to the next version!
Kind regards,
Michael
that's great, thank you!
Since no one has noted this before, it looks like the way i'm using the HTML-wrappers is not the default way they were intended for :)
But i think it is a great option for styling some aspects of blocks, so i'm looking forward to the next version!
Kind regards,
Michael
What was the fix for this additional space issue, I'm having the same problem. I can remove the <p></p> that automatically wrap my content by going to the HTML part of the WYSWYG field and save it, but when I go back in to edit it again it comes back. So how can I fix it where there's no extra spacing added unless I add it.
You mean in the WYSIWYG editor itself? So you created a block with a WYSIWYG field, and enter some text into your WYSIWYG field, and it saves extra paragrahps like this:
Instead of this?
Or are you having other issues?
<p>This is your text</p>
Instead of this?
This is your text
Or are you having other issues?
that's correct
Sorry, but that's not what i was trying to describe. It's not about paragraphs surrounding the WYSIWYG field (that might be another subject), but it's about the number field and its HTML wrappers. The problem is that the addon creates an extra space character between the number and its HTML wrappers.
In fact, the example described above should look like this.
Structure:
1) HTML wrapper of the number field (leading)
2) Number field
3) HTML wrapper of the number field (trailing)
4) WYSIWYG field or text field for content
5) HTML field
Code:
1)
2)
3)
4)
5)
All together, it should generate this HTML code:
but the output is:
Which results in an invalid inline style.
Generally i think, for most flexibility, no field should output any additional tags or characters. This means, no leading or trailing spaces, no <p> tags etc.
In fact, the example described above should look like this.
Structure:
1) HTML wrapper of the number field (leading)
2) Number field
3) HTML wrapper of the number field (trailing)
4) WYSIWYG field or text field for content
5) HTML field
Code:
1)
<div class="divider" style="height:
2)
[Output of the number field, e.g. 60]
3)
px;">
4)
[Output of the WYSIWYG field or text field, e.g. Some content]
5)
</div>
All together, it should generate this HTML code:
<div style="height:60px;">Some content</div>
but the output is:
<div style="height:60 px;">Some content</div>
Which results in an invalid inline style.
Generally i think, for most flexibility, no field should output any additional tags or characters. This means, no leading or trailing spaces, no <p> tags etc.
Okapi, I figured "shatay" means something else here. That's why I specifically asked about the WYSIWYG and the paragraph. That's something with the editor, not with Concrete5. So, unfortunately, I can't do anything about that. I'm not sure if there's an editor option for that, will have to investigate that or perhaps you can already post an issue on the forum already shatay?
About your problem @Okapi, not sure if this problem arose again with the v.1.x.x version, can you let me know if you still have this issue? If so, I will fix it again in the new version. If it's still working, then I will close this issue :)
About your problem @Okapi, not sure if this problem arose again with the v.1.x.x version, can you let me know if you still have this issue? If so, I will fix it again in the new version. If it's still working, then I will close this issue :)
Thanks for the quick reply, the problem is gone, sorry for not having checked that before posting!
Fixed this one, although it will remove indenting in the view.php file (obviously). Will release this in the next version if you don't mind :)
Kind regards,
Ramon