Commit 76ecfb1f authored by Jan Köster's avatar Jan Köster
Browse files

test

parent 147c3ce4
Loading
Loading
Loading
Loading
+49 −0
Changes for editor/widgets/accordion/accordion.cpp: 49 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -61,6 +61,12 @@ extern "C" {
            std::string l_contentBgColor   = "";
            std::string l_contentTextColor = "";

            // Mobile + Light mode overrides
            std::string ml_headerBgColor      = "";
            std::string ml_headerTextColor    = "";
            std::string ml_contentBgColor     = "";
            std::string ml_contentTextColor   = "";

            // Mobile overrides
            std::string m_headerFontSize   = "";
            std::string m_headerPadding    = "";
@@ -204,6 +210,22 @@ extern "C" {
                addField("border_color", "Border Color (Dark)", "color_var");
                addField("border_radius", "Border Radius", "text", "4px");

                // Mobile Light mode overrides
                addField("ml_header_bg_color", "Header Background (Mobile Light)", "color_var", nullptr, "mobile_light");
                addField("ml_header_text_color", "Header Text Color (Mobile Light)", "color_var", nullptr, "mobile_light");
                addField("ml_content_bg_color", "Content Background (Mobile Light)", "color_var", nullptr, "mobile_light");
                addField("ml_content_text_color", "Content Text Color (Mobile Light)", "color_var", nullptr, "mobile_light");

                // Mobile overrides
                addField("m_header_font_size", "Mobile Header Font Size", "text", "16px", "mobile");
                addField("m_header_padding", "Mobile Header Padding", "text", "12px 16px", "mobile");
                addField("m_content_padding", "Mobile Content Padding", "text", "16px", "mobile");
                addField("m_hidden", "Mobile Hidden", "checkbox", nullptr, "mobile");
                {
                    json_object *mhf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
                    json_object_object_add(mhf, "default", json_object_new_boolean(false));
                }

                // Behaviour
                addField("open_by_default", "Open by Default", "checkbox");
                addField("icon_position", "Toggle Icon Position", "select", nullptr, "all", mkOpts({"right", "left", "none"}));
@@ -244,6 +266,11 @@ extern "C" {
                element->SetAttribute("l_content_bg_color", l_contentBgColor.c_str());
                element->SetAttribute("l_content_text_color", l_contentTextColor.c_str());

                element->SetAttribute("ml_header_bg_color", ml_headerBgColor.c_str());
                element->SetAttribute("ml_header_text_color", ml_headerTextColor.c_str());
                element->SetAttribute("ml_content_bg_color", ml_contentBgColor.c_str());
                element->SetAttribute("ml_content_text_color", ml_contentTextColor.c_str());

                element->SetAttribute("m_header_font_size", m_headerFontSize.c_str());
                element->SetAttribute("m_header_padding", m_headerPadding.c_str());
                element->SetAttribute("m_content_padding", m_contentPadding.c_str());
@@ -293,6 +320,11 @@ extern "C" {
                val = xml_data->Attribute("l_content_bg_color");     if (val) l_contentBgColor = val;
                val = xml_data->Attribute("l_content_text_color");   if (val) l_contentTextColor = val;

                val = xml_data->Attribute("ml_header_bg_color");     if (val) ml_headerBgColor = val;
                val = xml_data->Attribute("ml_header_text_color");   if (val) ml_headerTextColor = val;
                val = xml_data->Attribute("ml_content_bg_color");    if (val) ml_contentBgColor = val;
                val = xml_data->Attribute("ml_content_text_color");  if (val) ml_contentTextColor = val;

                val = xml_data->Attribute("m_header_font_size");     if (val) m_headerFontSize = val;
                val = xml_data->Attribute("m_header_padding");       if (val) m_headerPadding = val;
                val = xml_data->Attribute("m_content_padding");      if (val) m_contentPadding = val;
@@ -337,6 +369,11 @@ extern "C" {
                json_object_object_add(obj, "l_content_bg_color", json_object_new_string(l_contentBgColor.c_str()));
                json_object_object_add(obj, "l_content_text_color", json_object_new_string(l_contentTextColor.c_str()));

                json_object_object_add(obj, "ml_header_bg_color", json_object_new_string(ml_headerBgColor.c_str()));
                json_object_object_add(obj, "ml_header_text_color", json_object_new_string(ml_headerTextColor.c_str()));
                json_object_object_add(obj, "ml_content_bg_color", json_object_new_string(ml_contentBgColor.c_str()));
                json_object_object_add(obj, "ml_content_text_color", json_object_new_string(ml_contentTextColor.c_str()));

                json_object_object_add(obj, "m_header_font_size", json_object_new_string(m_headerFontSize.c_str()));
                json_object_object_add(obj, "m_header_padding", json_object_new_string(m_headerPadding.c_str()));
                json_object_object_add(obj, "m_content_padding", json_object_new_string(m_contentPadding.c_str()));
@@ -408,6 +445,18 @@ extern "C" {
                if (json_object_object_get_ex(obj, "l_content_text_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) l_contentTextColor = val;
                }
                if (json_object_object_get_ex(obj, "ml_header_bg_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) ml_headerBgColor = val;
                }
                if (json_object_object_get_ex(obj, "ml_header_text_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) ml_headerTextColor = val;
                }
                if (json_object_object_get_ex(obj, "ml_content_bg_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) ml_contentBgColor = val;
                }
                if (json_object_object_get_ex(obj, "ml_content_text_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) ml_contentTextColor = val;
                }
                if (json_object_object_get_ex(obj, "m_header_font_size", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) m_headerFontSize = val;
                }
+37 −0
Changes for editor/widgets/button/button.cpp: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -65,6 +65,10 @@ extern "C" {
            std::string m_width         = "";
            std::string m_height        = "";

            // Mobile + Light mode overrides (empty = inherit mobile dark value)
            std::string ml_backgroundColor = "";
            std::string ml_textColor       = "";

            // Visibility
            bool hidden = false;
            bool m_hidden = false;
@@ -349,6 +353,8 @@ extern "C" {
                addField("l_background_color", "Background Color (Light)", "color_var", nullptr, "light");
                addField("text_color", "Text Color (Dark)", "color_var");
                addField("l_text_color", "Text Color (Light)", "color_var", nullptr, "light");
                addField("ml_background_color", "Background Color (Mobile Light)", "color_var", nullptr, "mobile_light");
                addField("ml_text_color", "Text Color (Mobile Light)", "color_var", nullptr, "mobile_light");
                addField("font_size", "Font Size", "text", "16px", "desktop");
                addField("border_radius", "Border Radius", "text", "4px", "desktop");
                addField("padding", "Padding", "text", "10px 20px", "desktop");
@@ -359,6 +365,16 @@ extern "C" {
                    json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
                    json_object_object_add(hf, "default", json_object_new_boolean(false));
                }
                addField("m_font_size", "Font Size (Mobile)", "text", "e.g. 14px", "mobile");
                addField("m_padding", "Padding (Mobile)", "text", "e.g. 8px 16px", "mobile");
                addField("m_border_radius", "Border Radius (Mobile)", "text", "e.g. 4px", "mobile");
                addField("m_width", "Width (Mobile)", "text", "e.g. 100%", "mobile");
                addField("m_height", "Height (Mobile)", "text", "e.g. auto", "mobile");
                addField("m_hidden", "Hidden (Mobile)", "checkbox", nullptr, "mobile");
                {
                    json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
                    json_object_object_add(hf, "default", json_object_new_boolean(false));
                }
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                addField("g_event_enabled", "Enable Google Event", "checkbox");
                addField("g_event_name", "Event Name", "text", "button_click", "all", nullptr, mkVisible("g_event_enabled", "true"));
@@ -392,6 +408,8 @@ extern "C" {
                // Light mode overrides
                element->SetAttribute("l_background_color", l_backgroundColor.c_str());
                element->SetAttribute("l_text_color", l_textColor.c_str());
                element->SetAttribute("ml_background_color", ml_backgroundColor.c_str());
                element->SetAttribute("ml_text_color", ml_textColor.c_str());

                // Mobile overrides
                element->SetAttribute("m_font_size", m_fontSize.c_str());
@@ -444,6 +462,10 @@ extern "C" {
                if (val) l_backgroundColor = val;
                val = xml_data->Attribute("l_text_color");
                if (val) l_textColor = val;
                val = xml_data->Attribute("ml_background_color");
                if (val) ml_backgroundColor = val;
                val = xml_data->Attribute("ml_text_color");
                if (val) ml_textColor = val;

                // Mobile overrides
                val = xml_data->Attribute("m_font_size");
@@ -503,6 +525,8 @@ extern "C" {
                json_object_object_add(obj, "open_new_tab", json_object_new_boolean(openInNewTab));
                json_object_object_add(obj, "l_background_color", json_object_new_string(l_backgroundColor.c_str()));
                json_object_object_add(obj, "l_text_color", json_object_new_string(l_textColor.c_str()));
                json_object_object_add(obj, "ml_background_color", json_object_new_string(ml_backgroundColor.c_str()));
                json_object_object_add(obj, "ml_text_color", json_object_new_string(ml_textColor.c_str()));
                json_object_object_add(obj, "m_font_size", json_object_new_string(m_fontSize.c_str()));
                json_object_object_add(obj, "m_padding", json_object_new_string(m_padding.c_str()));
                json_object_object_add(obj, "m_border_radius", json_object_new_string(m_borderRadius.c_str()));
@@ -582,6 +606,12 @@ extern "C" {
                if (json_object_object_get_ex(obj, "l_text_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) l_textColor = val;
                }
                if (json_object_object_get_ex(obj, "ml_background_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) ml_backgroundColor = val;
                }
                if (json_object_object_get_ex(obj, "ml_text_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) ml_textColor = val;
                }
                if (json_object_object_get_ex(obj, "m_font_size", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) m_fontSize = val;
                }
@@ -749,6 +779,10 @@ extern "C" {
                if (!l_backgroundColor.empty()) lightCSS += " background-color: " + l_backgroundColor + " !important;";
                if (!l_textColor.empty()) lightCSS += " color: " + l_textColor + " !important;";

                std::string mobileLightCSS;
                if (!ml_backgroundColor.empty()) mobileLightCSS += " background-color: " + ml_backgroundColor + " !important;";
                if (!ml_textColor.empty()) mobileLightCSS += " color: " + ml_textColor + " !important;";

                std::string allMediaCSS;
                if (!mobileCSS.empty()) {
                    allMediaCSS += "@media (max-width: 768px) { ." + responsiveClass + " {" + mobileCSS + " } } ";
@@ -756,6 +790,9 @@ extern "C" {
                if (!lightCSS.empty()) {
                    allMediaCSS += "@media (prefers-color-scheme: light) { ." + responsiveClass + " {" + lightCSS + " } }";
                }
                if (!mobileLightCSS.empty()) {
                    allMediaCSS += "@media (max-width: 768px) and (prefers-color-scheme: light) { ." + responsiveClass + " {" + mobileLightCSS + " } }";
                }

                if (!allMediaCSS.empty()) {
                    libhtmlpp::HtmlElement styleTag("style");
+36 −0
Changes for editor/widgets/container/container.cpp: 36 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ extern "C" {

            // Light mode overrides (empty = inherit dark value)
            std::string l_backgroundColor = "";
            std::string ml_backgroundColor = "";

            // Mobile overrides (empty = inherit desktop value)
            std::string m_backgroundColor = "";
@@ -277,6 +278,24 @@ extern "C" {
                    json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
                    json_object_object_add(hf, "default", json_object_new_boolean(false));
                }
                addField("m_background_color", "Mobile Background Color", "color_var", nullptr, "mobile");
                addField("m_background_image", "Mobile Background Image", "media_browse", "/media/getimage/...", "mobile");
                addField("m_background_size", "Mobile Background Size", "select", nullptr, "mobile", mkOpts({"cover","contain","auto","100% 100%"}));
                addField("m_background_position", "Mobile Background Position", "select", nullptr, "mobile", mkOpts({"center","top","bottom","left","right","top left","top right","bottom left","bottom right"}));
                addField("m_border_radius", "Mobile Border Radius", "text", "e.g. 8px", "mobile");
                addField("m_border_style", "Mobile Border Style", "text", "e.g. 1px solid #ccc", "mobile");
                addField("m_opacity", "Mobile Opacity", "text", "0.0 - 1.0", "mobile");
                addField("m_padding", "Mobile Padding", "text", "e.g. 10px 20px", "mobile");
                addField("m_margin", "Mobile Margin", "text", "e.g. 10px auto", "mobile");
                addField("m_width", "Mobile Width", "text", "e.g. 100%", "mobile");
                addField("m_height", "Mobile Height", "text", "e.g. auto", "mobile");
                addField("m_vertical_align", "Mobile Vertical Align", "select", nullptr, "mobile", mkOpts({"top","center","bottom"}));
                addField("m_hidden", "Mobile Hidden", "checkbox", nullptr, "mobile");
                {
                    json_object *mhf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
                    json_object_object_add(mhf, "default", json_object_new_boolean(false));
                }
                addField("ml_background_color", "Mobile Background Color (Light)", "color_var", nullptr, "mobile_light");
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }
@@ -310,6 +329,7 @@ extern "C" {

                // Light mode overrides
                element->SetAttribute("l_background_color", l_backgroundColor.c_str());
                element->SetAttribute("ml_background_color", ml_backgroundColor.c_str());

                // Mobile overrides
                element->SetAttribute("m_background_color", m_backgroundColor.c_str());
@@ -396,6 +416,8 @@ extern "C" {
                // Light mode overrides
                const char* loaded_l_bg = xml_data->Attribute("l_background_color");
                if (loaded_l_bg) l_backgroundColor = loaded_l_bg;
                const char* loaded_ml_bg = xml_data->Attribute("ml_background_color");
                if (loaded_ml_bg) ml_backgroundColor = loaded_ml_bg;

                // Mobile overrides
                const char* loaded_m_bg = xml_data->Attribute("m_background_color");
@@ -461,6 +483,7 @@ extern "C" {
                json_object_object_add(obj, "background_position", json_object_new_string(backgroundPosition.c_str()));
                json_object_object_add(obj, "background_repeat", json_object_new_string(backgroundRepeat.c_str()));
                json_object_object_add(obj, "l_background_color", json_object_new_string(l_backgroundColor.c_str()));
                json_object_object_add(obj, "ml_background_color", json_object_new_string(ml_backgroundColor.c_str()));
                json_object_object_add(obj, "m_background_color", json_object_new_string(m_backgroundColor.c_str()));
                json_object_object_add(obj, "m_background_image", json_object_new_string(m_backgroundImage.c_str()));
                json_object_object_add(obj, "m_background_size", json_object_new_string(m_backgroundSize.c_str()));
@@ -529,6 +552,10 @@ extern "C" {
                    val = json_object_get_string(val_obj);
                    if (val) l_backgroundColor = val;
                }
                if (json_object_object_get_ex(obj, "ml_background_color", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) ml_backgroundColor = val;
                }
                if (json_object_object_get_ex(obj, "m_background_color", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) m_backgroundColor = val;
@@ -738,6 +765,15 @@ extern "C" {
                    el.appendChild(lightStyle);
                }

                std::string mobileLightCSS;
                if (!ml_backgroundColor.empty()) mobileLightCSS += " background-color: " + ml_backgroundColor + " !important;";
                if (!mobileLightCSS.empty()) {
                    libhtmlpp::HtmlElement mobileLightStyle("style");
                    std::string mobileLightRule = "@media (max-width: 768px) and (prefers-color-scheme: light) { ." + responsiveClass + " {" + mobileLightCSS + " } }";
                    mobileLightStyle.appendChild(libhtmlpp::TextElement(mobileLightRule.c_str()));
                    el.appendChild(mobileLightStyle);
                }

                if (!customCss.empty()) {
                    libhtmlpp::HtmlElement cssStyle("style");
                    // Emit raw — user writes full selectors, e.g. .we-xxx { color: red; }
+41 −0
Changes for editor/widgets/grid/grid.cpp: 41 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@ extern "C" {
            // Light mode overrides (empty = inherit dark value)
            std::string l_backgroundColor = "";

            // Mobile Light overrides (empty = inherit mobile dark value)
            std::string ml_backgroundColor = "";

            // Mobile overrides (empty = inherit desktop value)
            std::string m_columns       = "";
            std::string m_rows          = "";
@@ -243,6 +246,7 @@ extern "C" {
                addField("gap", "Gap", "text", "10px", "desktop");
                addField("background_color", "Background Color (Dark)", "color_var", nullptr, "desktop");
                addField("l_background_color", "Background Color (Light)", "color_var", nullptr, "light");
                addField("ml_background_color", "Mobile Background Color (Light)", "color_var", nullptr, "mobile_light");
                addField("padding", "Padding", "text", "10px", "desktop");
                addField("width", "Width", "text", "e.g. 100%", "desktop");
                addField("height", "Height", "text", "e.g. auto", "desktop");
@@ -256,6 +260,22 @@ extern "C" {
                    json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
                    json_object_object_add(hf, "default", json_object_new_boolean(false));
                }
                addField("m_columns", "Mobile Columns", "text", "e.g. 1fr", "mobile");
                addField("m_rows", "Mobile Rows", "text", "e.g. auto", "mobile");
                addField("m_gap", "Mobile Gap", "text", "e.g. 10px", "mobile");
                addField("m_background_color", "Mobile Background Color", "color_var", nullptr, "mobile");
                addField("m_padding", "Mobile Padding", "text", "e.g. 10px", "mobile");
                addField("m_width", "Mobile Width", "text", "e.g. 100%", "mobile");
                addField("m_height", "Mobile Height", "text", "e.g. auto", "mobile");
                addField("m_border_radius", "Mobile Border Radius", "text", "e.g. 8px", "mobile");
                addField("m_border_style", "Mobile Border Style", "text", "e.g. 1px solid #ccc", "mobile");
                addField("m_opacity", "Mobile Opacity", "text", "0.0 - 1.0", "mobile");
                addField("m_vertical_align", "Mobile Vertical Align", "select", nullptr, "mobile", mkOpts({"top","center","bottom"}));
                addField("m_hidden", "Mobile Hidden", "checkbox", nullptr, "mobile");
                {
                    json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
                    json_object_object_add(hf, "default", json_object_new_boolean(false));
                }
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }
@@ -280,6 +300,9 @@ extern "C" {
                // Light mode overrides
                element->SetAttribute("l_background_color", l_backgroundColor.c_str());

                // Mobile Light overrides
                element->SetAttribute("ml_background_color", ml_backgroundColor.c_str());

                // Mobile overrides
                element->SetAttribute("m_columns", m_columns.c_str());
                element->SetAttribute("m_rows", m_rows.c_str());
@@ -355,6 +378,10 @@ extern "C" {
                val = xml_data->Attribute("l_background_color");
                if (val) l_backgroundColor = val;

                // Mobile Light overrides
                val = xml_data->Attribute("ml_background_color");
                if (val) ml_backgroundColor = val;

                // Mobile overrides
                val = xml_data->Attribute("m_columns");
                if (val) m_columns = val;
@@ -411,6 +438,7 @@ extern "C" {
                json_object_object_add(obj, "width", json_object_new_string(width.c_str()));
                json_object_object_add(obj, "height", json_object_new_string(height.c_str()));
                json_object_object_add(obj, "l_background_color", json_object_new_string(l_backgroundColor.c_str()));
                json_object_object_add(obj, "ml_background_color", json_object_new_string(ml_backgroundColor.c_str()));
                json_object_object_add(obj, "m_columns", json_object_new_string(m_columns.c_str()));
                json_object_object_add(obj, "m_rows", json_object_new_string(m_rows.c_str()));
                json_object_object_add(obj, "m_gap", json_object_new_string(m_gap.c_str()));
@@ -474,6 +502,9 @@ extern "C" {
                if (json_object_object_get_ex(obj, "l_background_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) l_backgroundColor = val;
                }
                if (json_object_object_get_ex(obj, "ml_background_color", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) ml_backgroundColor = val;
                }
                if (json_object_object_get_ex(obj, "m_columns", &val_obj)) {
                    val = json_object_get_string(val_obj); if (val) m_columns = val;
                }
@@ -625,6 +656,16 @@ extern "C" {
                    el.appendChild(lightStyle);
                }

                // Mobile Light overrides via combined media query
                std::string mobileLightCSS;
                if (!ml_backgroundColor.empty()) mobileLightCSS += " background-color: " + ml_backgroundColor + " !important;";
                if (!mobileLightCSS.empty()) {
                    libhtmlpp::HtmlElement mobileLightStyle("style");
                    std::string mobileLightRule = "@media (max-width: 768px) and (prefers-color-scheme: light) { ." + responsiveClass + " {" + mobileLightCSS + " } }";
                    mobileLightStyle.appendChild(libhtmlpp::TextElement(mobileLightRule.c_str()));
                    el.appendChild(mobileLightStyle);
                }

                if (!customCss.empty()) {
                    libhtmlpp::HtmlElement cssStyle("style");
                    cssStyle.appendChild(libhtmlpp::TextElement(customCss.c_str()));
+4 −0
Changes for editor/widgets/image/image.cpp: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -454,6 +454,10 @@ extern "C" {
                    json_object_object_add(hf, "default", json_object_new_boolean(false));
                }
                addField("m_hidden", "Hidden (Mobile)", "checkbox", nullptr, "mobile");
                {
                    json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
                    json_object_object_add(hf, "default", json_object_new_boolean(false));
                }
                addField("m_width", "Width (Mobile)", "text", "e.g. 100%", "mobile");
                addField("m_height", "Height (Mobile)", "text", "e.g. auto", "mobile");
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
Loading