voidlabs / mosaico

Mosaico - Responsive Email Template Editor
https://mosaico.io
GNU General Public License v3.0
1.68k stars 502 forks source link

boolean variable sets default to true instead of false #691

Closed InfGame closed 11 months ago

InfGame commented 11 months ago

I have a variable called flexibleHeader which I use in a block called Logo_Header to switch between a image upload field and some predefined logo. I have set flexibleHeader to default to false in the block properties:

Logo_Header {
        label: Header Block;
        properties: flexibleHeader=false;
      }

and use it in my bock like this:

<!-- Logo_Header -->
    <div data-ko-block="Logo_Header" style="background-color: #ffffff; margin-bottom:22px; width: 594px;">
      <!--[if (gte mso 9)|(lte ie 8)]>
        <table style="background-color: #ffffff; width:534px;display:inline-block;" role="presentation" border="0"
               cellspacing="0" cellpadding="0">
            <tr>
                <td valign="top">
        <![endif]-->
      <table align="center" border="0" cellpadding="0" cellspacing="0" class="vb-outer" style="margin-top: 27px; margin-bottom: 27px;margin-left:28px;margin-right:28px;">
        <tr>
          <td data-ko-display="flexibleHeader eq false" style="width:594px;vertical-align:middle; ">
            <!--predefined logo header-->
          </td>
        </tr>
        <tr>
          <td data-ko-display="flexibleHeader" style="width:594px; display: none;" valign="center" align="center">
            <!-- image upload field-->
          </td>
        </tr>
      </table>
      <!--[if (gte mso 9)|(lte ie 8)]>
        </td>
        </tr>
        </table>
        <![endif]-->
    </div>
<!-- /Logo_Header -->

The problem I have is that in the editor it still seems to default the flexibleHeadervariable to true instead of the defined false

bago commented 11 months ago

Have a look at #249 and try naming your variable flexibleHeaderVisible as, given we don't have a type declaration, the "Visible" postfix is currently what is used to know it is a boolean.

This is really ugly, but please let me know if this works.

InfGame commented 11 months ago

this has worked. thank you @bago