Commit e77dc688 authored by jan.koester's avatar jan.koester
Browse files

test

parent 226e8314
Loading
Loading
Loading
Loading
+28 −0
Changes for src/webedit/button/button.cpp: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ extern "C" {
            bool hidden = false;
            bool m_hidden = false;

            // Custom CSS
            std::string customCss = "";

        public:
            Button() {
                Type = "f77fcdg4-5i98-7h6i-d7f9-2i89g4e989f7";
@@ -279,6 +282,7 @@ extern "C" {
                addField("border_radius", "Border Radius", "text", "4px", true);
                addField("padding", "Padding", "text", "10px 20px", true);
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }

@@ -312,6 +316,12 @@ extern "C" {
                // Visibility
                element->SetAttribute("hidden", hidden ? "true" : "false");
                element->SetAttribute("m_hidden", m_hidden ? "true" : "false");

                if (!customCss.empty()) {
                    tinyxml2::XMLElement* cssEl = doc->NewElement("CustomCss");
                    cssEl->SetText(customCss.c_str());
                    element->InsertEndChild(cssEl);
                }
                return element;
            }

@@ -351,6 +361,12 @@ extern "C" {
                if (val) hidden = (strcmp(val, "true") == 0);
                val = xml_data->Attribute("m_hidden");
                if (val) m_hidden = (strcmp(val, "true") == 0);

                tinyxml2::XMLElement* cssEl = xml_data->FirstChildElement("CustomCss");
                if (cssEl) {
                    const char* cssVal = cssEl->GetText();
                    if (cssVal) customCss = cssVal;
                }
            }

            // --- JSON Properties Helpers ---
@@ -375,6 +391,7 @@ extern "C" {
                json_object_object_add(obj, "m_border_radius", json_object_new_string(m_borderRadius.c_str()));
                json_object_object_add(obj, "hidden", json_object_new_boolean(hidden));
                json_object_object_add(obj, "m_hidden", json_object_new_boolean(m_hidden));
                json_object_object_add(obj, "custom_css", json_object_new_string(customCss.c_str()));
                std::string result = json_object_to_json_string_ext(obj, JSON_C_TO_STRING_NOSLASHESCAPE);
                json_object_put(obj);
                return result;
@@ -444,6 +461,10 @@ extern "C" {
                if (json_object_object_get_ex(obj, "m_hidden", &val_obj)) {
                    m_hidden = json_object_get_boolean(val_obj);
                }
                if (json_object_object_get_ex(obj, "custom_css", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) customCss = val;
                }

                json_object_put(obj);
            }
@@ -517,6 +538,13 @@ extern "C" {
                    el.appendChild(styleTag);
                }

                if (!customCss.empty()) {
                    libhtmlpp::HtmlElement cssStyle("style");
                    std::string scopedCSS = "." + responsiveClass + " { " + customCss + " }";
                    cssStyle.appendChild(libhtmlpp::TextElement(scopedCSS.c_str()));
                    el.appendChild(cssStyle);
                }

                wrapper.appendChild(a);
                el.appendChild(wrapper);
            }
+28 −0
Changes for src/webedit/container/container.cpp: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@ extern "C" {
            bool hidden = false;
            bool m_hidden = false;

            // Custom CSS
            std::string customCss = "";

        public:
            Container() {
                // NOTE: The base EditPlugin constructor handles ID generation.
@@ -251,6 +254,7 @@ extern "C" {
                addField("margin", "Margin", "text", "e.g. 10px auto", true);
                addField("vertical_align", "Vertical Align", "select", nullptr, true, mkOpts({"top","center","bottom"}));
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }

@@ -292,6 +296,12 @@ extern "C" {
                element->SetAttribute("hidden", hidden ? "true" : "false");
                element->SetAttribute("m_hidden", m_hidden ? "true" : "false");

                if (!customCss.empty()) {
                    tinyxml2::XMLElement* cssEl = doc->NewElement("CustomCss");
                    cssEl->SetText(customCss.c_str());
                    element->InsertEndChild(cssEl);
                }

                // Add content
                if (!content.empty()) {
                    element->SetText(content.c_str());
@@ -363,6 +373,12 @@ extern "C" {
                const char* loaded_m_hidden = xml_data->Attribute("m_hidden");
                if (loaded_m_hidden) m_hidden = (strcmp(loaded_m_hidden, "true") == 0);

                tinyxml2::XMLElement* cssEl = xml_data->FirstChildElement("CustomCss");
                if (cssEl) {
                    const char* cssVal = cssEl->GetText();
                    if (cssVal) customCss = cssVal;
                }

                // NOTE: Loading children from XML requires an EditPluginFactory which is not available here.
            }

@@ -389,6 +405,7 @@ extern "C" {
                json_object_object_add(obj, "m_vertical_align", json_object_new_string(m_verticalAlign.c_str()));
                json_object_object_add(obj, "hidden", json_object_new_boolean(hidden));
                json_object_object_add(obj, "m_hidden", json_object_new_boolean(m_hidden));
                json_object_object_add(obj, "custom_css", json_object_new_string(customCss.c_str()));
                std::string result = json_object_to_json_string_ext(obj, JSON_C_TO_STRING_NOSLASHESCAPE);
                json_object_put(obj);
                return result;
@@ -471,6 +488,10 @@ extern "C" {
                if (json_object_object_get_ex(obj, "m_hidden", &val_obj)) {
                    m_hidden = json_object_get_boolean(val_obj);
                }
                if (json_object_object_get_ex(obj, "custom_css", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) customCss = val;
                }

                json_object_put(obj);
            }
@@ -569,6 +590,13 @@ extern "C" {
                    el.appendChild(lightStyle);
                }

                if (!customCss.empty()) {
                    libhtmlpp::HtmlElement cssStyle("style");
                    std::string scopedCSS = "." + responsiveClass + " { " + customCss + " }";
                    cssStyle.appendChild(libhtmlpp::TextElement(scopedCSS.c_str()));
                    el.appendChild(cssStyle);
                }

                // Placeholder: Add content if any
                if (!content.empty()) {
                    cnt.appendChild(libhtmlpp::TextElement(content.c_str()));
+28 −0
Changes for src/webedit/grid/grid.cpp: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -70,6 +70,9 @@ extern "C" {
            bool hidden = false;
            bool m_hidden = false;

            // Custom CSS
            std::string customCss = "";

        public:
            Grid() {
                Type = "c44c9af1-2f65-4e3f-a4c6-9f56d1b656c4";
@@ -243,6 +246,7 @@ extern "C" {
                addField("opacity", "Opacity", "text", "0.0 - 1.0", true);
                addField("vertical_align", "Vertical Align", "select", nullptr, true, mkOpts({"top","center","bottom"}));
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }

@@ -282,6 +286,12 @@ extern "C" {
                element->SetAttribute("hidden", hidden ? "true" : "false");
                element->SetAttribute("m_hidden", m_hidden ? "true" : "false");

                if (!customCss.empty()) {
                    tinyxml2::XMLElement* cssEl = doc->NewElement("CustomCss");
                    cssEl->SetText(customCss.c_str());
                    element->InsertEndChild(cssEl);
                }

                // Serialize children
                const EditPlugin *cur = child;
                while (cur) {
@@ -355,6 +365,12 @@ extern "C" {
                if (val) hidden = (strcmp(val, "true") == 0);
                val = xml_data->Attribute("m_hidden");
                if (val) m_hidden = (strcmp(val, "true") == 0);

                tinyxml2::XMLElement* cssEl = xml_data->FirstChildElement("CustomCss");
                if (cssEl) {
                    const char* cssVal = cssEl->GetText();
                    if (cssVal) customCss = cssVal;
                }
            }

            // --- JSON Properties Helpers ---
@@ -382,6 +398,7 @@ extern "C" {
                json_object_object_add(obj, "m_vertical_align", json_object_new_string(m_verticalAlign.c_str()));
                json_object_object_add(obj, "hidden", json_object_new_boolean(hidden));
                json_object_object_add(obj, "m_hidden", json_object_new_boolean(m_hidden));
                json_object_object_add(obj, "custom_css", json_object_new_string(customCss.c_str()));
                std::string result = json_object_to_json_string_ext(obj, JSON_C_TO_STRING_NOSLASHESCAPE);
                json_object_put(obj);
                return result;
@@ -460,6 +477,10 @@ extern "C" {
                if (json_object_object_get_ex(obj, "m_hidden", &val_obj)) {
                    m_hidden = json_object_get_boolean(val_obj);
                }
                if (json_object_object_get_ex(obj, "custom_css", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) customCss = val;
                }

                json_object_put(obj);
            }
@@ -547,6 +568,13 @@ extern "C" {
                    el.appendChild(lightStyle);
                }

                if (!customCss.empty()) {
                    libhtmlpp::HtmlElement cssStyle("style");
                    std::string scopedCSS = "." + responsiveClass + " { " + customCss + " }";
                    cssStyle.appendChild(libhtmlpp::TextElement(scopedCSS.c_str()));
                    el.appendChild(cssStyle);
                }

                // Render children into grid cells
                const EditPlugin *cur = child;
                while (cur) {
+28 −0
Changes for src/webedit/image/image.cpp: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -62,6 +62,9 @@ extern "C" {
            // Fullscreen
            bool fullscreen = false;

            // Custom CSS
            std::string customCss = "";

        public:
            Image() {
                Type = "e66ebcf3-4h87-6g5h-c6e8-1h78f3d878e6";
@@ -257,6 +260,12 @@ extern "C" {

                // Fullscreen
                element->SetAttribute("fullscreen", fullscreen ? "true" : "false");

                if (!customCss.empty()) {
                    tinyxml2::XMLElement* cssEl = doc->NewElement("CustomCss");
                    cssEl->SetText(customCss.c_str());
                    element->InsertEndChild(cssEl);
                }
                return element;
            }

@@ -288,6 +297,12 @@ extern "C" {
                // Fullscreen
                val = xml_data->Attribute("fullscreen");
                if (val) fullscreen = (strcmp(val, "true") == 0);

                tinyxml2::XMLElement* cssEl = xml_data->FirstChildElement("CustomCss");
                if (cssEl) {
                    const char* cssVal = cssEl->GetText();
                    if (cssVal) customCss = cssVal;
                }
            }

            // --- JSON Properties Helpers ---
@@ -309,6 +324,7 @@ extern "C" {
                json_object_object_add(obj, "hidden", json_object_new_boolean(hidden));
                json_object_object_add(obj, "m_hidden", json_object_new_boolean(m_hidden));
                json_object_object_add(obj, "fullscreen", json_object_new_boolean(fullscreen));
                json_object_object_add(obj, "custom_css", json_object_new_string(customCss.c_str()));
                std::string result = json_object_to_json_string_ext(obj, JSON_C_TO_STRING_NOSLASHESCAPE);
                json_object_put(obj);
                return result;
@@ -369,6 +385,10 @@ extern "C" {
                if (json_object_object_get_ex(obj, "fullscreen", &val_obj)) {
                    fullscreen = json_object_get_boolean(val_obj);
                }
                if (json_object_object_get_ex(obj, "custom_css", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) customCss = val;
                }

                json_object_put(obj);
            }
@@ -409,6 +429,7 @@ extern "C" {
                addField("link_url", "Link URL", "text", "/page or https://...");
                addField("fullscreen", "Show in Fullscreen", "checkbox");
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }

@@ -455,6 +476,13 @@ extern "C" {
                    el.appendChild(styleTag);
                }

                if (!customCss.empty()) {
                    libhtmlpp::HtmlElement cssStyle("style");
                    std::string scopedCSS = "." + responsiveClass + " { " + customCss + " }";
                    cssStyle.appendChild(libhtmlpp::TextElement(scopedCSS.c_str()));
                    el.appendChild(cssStyle);
                }

                if (!linkUrl.empty()) {
                    libhtmlpp::HtmlElement a("a");
                    a.setAttribute("href", linkUrl.c_str());
+28 −0
Changes for src/webedit/list/list.cpp: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -70,6 +70,9 @@ extern "C" {
            bool hidden   = false;
            bool m_hidden = false;

            // Custom CSS
            std::string customCss = "";

            // Helper: join items to a single string for XML storage
            std::string joinItems(const std::string &sep) const {
                std::string result;
@@ -211,6 +214,7 @@ extern "C" {
                addField("padding", "Padding", "text", "0 0 0 20px", true);
                addField("margin", "Margin", "text", "8px 0");
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }

@@ -240,6 +244,12 @@ extern "C" {
                element->SetAttribute("hidden", hidden ? "true" : "false");
                element->SetAttribute("m_hidden", m_hidden ? "true" : "false");

                if (!customCss.empty()) {
                    tinyxml2::XMLElement* cssEl = doc->NewElement("CustomCss");
                    cssEl->SetText(customCss.c_str());
                    element->InsertEndChild(cssEl);
                }

                // Store items as child <Item> elements
                for (const auto &item : items) {
                    tinyxml2::XMLElement *li = doc->NewElement("Item");
@@ -280,6 +290,12 @@ extern "C" {
                val = xml_data->Attribute("m_hidden");
                if (val) m_hidden = (strcmp(val, "true") == 0);

                tinyxml2::XMLElement* cssEl = xml_data->FirstChildElement("CustomCss");
                if (cssEl) {
                    const char* cssVal = cssEl->GetText();
                    if (cssVal) customCss = cssVal;
                }

                // Read items from child <Item> elements
                items.clear();
                for (tinyxml2::XMLElement *li = xml_data->FirstChildElement("Item"); li; li = li->NextSiblingElement("Item")) {
@@ -308,6 +324,7 @@ extern "C" {
                json_object_object_add(obj, "m_direction", json_object_new_string(m_direction.c_str()));
                json_object_object_add(obj, "hidden", json_object_new_boolean(hidden));
                json_object_object_add(obj, "m_hidden", json_object_new_boolean(m_hidden));
                json_object_object_add(obj, "custom_css", json_object_new_string(customCss.c_str()));

                // Items as newline-separated string for textarea editing
                std::string itemsStr;
@@ -380,6 +397,10 @@ extern "C" {
                if (json_object_object_get_ex(obj, "m_hidden", &val_obj)) {
                    m_hidden = json_object_get_boolean(val_obj);
                }
                if (json_object_object_get_ex(obj, "custom_css", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) customCss = val;
                }

                // Items from newline-separated string
                if (json_object_object_get_ex(obj, "items", &val_obj)) {
@@ -478,6 +499,13 @@ extern "C" {
                    el.appendChild(styleTag);
                }

                if (!customCss.empty()) {
                    libhtmlpp::HtmlElement cssStyle("style");
                    std::string scopedCSS = "." + responsiveClass + " { " + customCss + " }";
                    cssStyle.appendChild(libhtmlpp::TextElement(scopedCSS.c_str()));
                    el.appendChild(cssStyle);
                }

                el.appendChild(list);
            }