Snippets: Unwanted P & BR added in Design tab

Hello,

I noticed an unwanted behavior in the snippets editor.

  1. I create a new Snippet.
  2. I paste html code into it
  3. I change from Source to Design tab

<p>
<br>
</p>

is automatically added at the top of the snippet code.

Can this behavior be deactivated or suppressed in some way? Because it breaks my snippets.

Thanks.

Can you let us know please:

  1. Which version of PlanetPress Connect have you installed?
  2. Which HTML code you have inserted?
  3. If you are inserting this HTML code when viewing the Snippet in Source mode?
  4. If the Snippet does contain no HTML code the moment just before you insert the HTML code?

The reason why I am asking all these questions is because I cannot reproduce this behaviour when I execute the following steps in the PReS Connect version 2023.1 Designer application:

  1. Create a new Print Template
  2. Add a new HTML snippet by clicking with the right mouse button on the Snippets folder and selecting New Snippet > HTML file
  3. View the snippet in Source mode
  4. Press CTRL+A and then DELETE to remove the existing HTML code <p><br></p>
  5. Insert the HTML code <div><h1>Hello World!</h1></div>
  6. View the snippet in Design mode
  7. View the snippet in Source mode to check the result

[Edited: Added an extra step after step 3 of the not able to reproduce steps]

  1. PlanetPress Connect Designer 2023.1

  2. A div containing multiple elements and subdivs

  3. yes

  4. A new Snippet contains <p><br></p> at the top from the start. I delete that. I insert my html code. I switch to Design view. <p><br></p> is reinserted at the top. Every time I do this.

Thank you for answering the asked questions.

Would it be possible for you to share the HTML code once sensitive data has been removed from it? Please try to keep the HTML code itself as accurate as possible.

<div id="header_BE" class="conditional-script" anchor="page_media_0"
style="position: absolute; overflow: hidden; box-sizing: border-box; width: 704px; height: 337px; font-family: Segoe UI; background-color: White;" offset-x="0" offset-y="-0.0000061035156022626325">
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <div anchor="page_media_0" style="position: relative; overflow: hidden; box-sizing: border-box; width: 169px; height: 59px; top: -99px; left: 532px;">
        <img src="images/img/logos/Buy-ern_Logo_2015.jpg" style="width: 124.08pt; height: 42.48pt;">
    </div>
    <br>
    <div class="" anchor="page_media_0"
    style="width: 230.117px; height: 58.5px; position: absolute; top: 23.3333px; left: 12px;" offset-x="93.79999923706055" offset-y="69.4829938964844">
        <table data-column-resize="" data-detail="" data-hide-when-empty="" cellpadding="0" cellspacing="0" style="width: 60mm;" data-expander="2019">
            <thead>
                <tr>
                    <th style="text-align: left; width: 100%; font-family: Segoe UI; font-size: 11pt;">
                        <span style="font-weight: normal; font-size: 11pt;">Retourenadresse:<br>
                        <span class="VertriebswegBezeichnung">@VertriebswegBezeichnung@</span><br>
                        </span>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr data-repeat="Retourenadresse">
                    <td style="text-align: left; font-family: Segoe UI; font-size: 11pt;" data-field="Text">
                        <span style="font-size: 11pt;">@Text@</span> 
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <table id="table" class="" data-column-resize="" cellpadding="0" anchor="page_media_0" cellspacing="0"
    style="width: 237.7px; position: absolute; top: 97px; left: 460px;" offset-x="1105.9999992370606" offset-y="161.89999389648438">
        <tbody>
            <tr>
                <td style="width: 45.53%;">
                    <b><span data-translate="Rechnung" style="font-size: 12pt;">RECHNUNG</span></b><br>
                </td>
                <td style="width: 54.47%;">
                    <br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td data-translate="">
                    Rechnungsnummer<br>
                </td>
                <td>
                    <span class="Rechnungsnummer ol-scripted">@Rechnungsnummer@</span><br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td data-translate="Rechnung">Datum</td> 
                <td>
                    <span class="Rechnungsdatum ol-scripted">@Rechnungsdatum@</span><br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td data-translate="">
                    Kundennummer<br>
                </td>
                <td>
                    <span class="Kundennummer ol-scripted">@Kundennummer@</span><br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td data-translate="">
                    Auftragsreferenz<br>
                </td>
                <td>
                    <br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td data-translate="Rechnung">Auftragsnummer</td> 
                <td>
                    <span class="Auftragsnummer ol-scripted">@Auftragsnummer@</span><br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="MarketingCode ol-scripted">@MarketingCode@</span><br>
                </td>
                <td>
                    <br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    @paketnummer@ <br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <br>
                </td>
                <td>
                    <br>
                </td>
            </tr>
            <tr>
                <td class="pagenumber pagecount" colspan="2" data-translate="" style="text-align: right;">Seite {#} von {##}</td> 
                <td>
                    <br>
                </td>
            </tr>
        </tbody>
    </table>
</div>
1 Like

I made a short video to demonstrate the behavior:

https://ars-consulendi.com/owncloud/index.php/s/ZRBfpZ5S7skkjXY

Thank you for sharing the HTML code. I am able to reproduce it when insert the HTML code of a Positioned Box element while viewing the snippet in Source mode and switch from Source mode to Design mode and back to Source mode again.

I have reported the issue internally in the meanwhile [internal reference: SHARED-90557].

[Edited: Wrong internal reference]

Thanks.

This makes Snippets unusable for our purposes. Is there a workaround?

Adding the CSS property and value display: none; to the <p>-element seems to be the simplest workaround.

Example

Before:

<p>
	<br>
</p>

After:

<p style="display: none">
	<br>
</p>

Frankly I don’t think this is a good solution, since it generates heaps of redundant unnecessary html code.

In case you’re using loadhtml() to fetch the snippet’s content, consider utilizing a selector to retrieve the desired content. Something like the following for example:

results.replaceWith(loadhtml("snippets/Snippet 1.html", "#header_BE"));

This looks good, thanks.