Commit 2fb40cb0 authored by jan.koester's avatar jan.koester
Browse files

test

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

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

        public:
            Section() {
                Type = "be6ba833-c0be-4906-b97a-78045302d1d2";
@@ -180,6 +183,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;
            }

@@ -222,6 +226,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);
                }

                // Content
                if (!content.empty()) {
                    element->SetText(content.c_str());
@@ -297,6 +307,12 @@ extern "C" {
                if (loaded_hidden) hidden = (strcmp(loaded_hidden, "true") == 0);
                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;
                }
            }

            // --- JSON Properties ---
@@ -325,6 +341,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;
@@ -423,6 +440,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);
            }
@@ -529,6 +550,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);
                }

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

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

        public:

            // --- UI Settings ---
@@ -223,6 +226,7 @@ extern "C" {
                addField("font_weight", "Font Weight", "select", nullptr, false, mkOpts({"normal","bold","lighter","bolder"}));
                addField("font_style", "Font Style", "select", nullptr, false, mkOpts({"normal","italic","oblique"}));
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }

@@ -250,6 +254,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);
                }

                if (!content.empty()) {
                    element->SetText(content.c_str());
                }
@@ -298,6 +308,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 ---
@@ -317,6 +333,7 @@ extern "C" {
                json_object_object_add(obj, "m_text_align", json_object_new_string(m_textAlign.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()));
                const char *result = json_object_to_json_string_ext(obj, JSON_C_TO_STRING_NOSLASHESCAPE);
                std::string out(result);
                json_object_put(obj);
@@ -381,6 +398,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);
            }
@@ -431,6 +452,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);
                }

                if (!content.empty()) {
                    // Content contains HTML markup from the rich text editor;
                    // parse it into an element tree and append to the box.
+28 −0
Changes for src/webedit/video/video.cpp: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ extern "C" {
            bool hidden   = false;
            bool m_hidden  = false;

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

        public:
            Video() {
                Type = "a77fbcd4-5i98-7h6i-d7f9-2i89g4e989f7";
@@ -207,6 +210,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;
            }

@@ -234,6 +243,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 ---
@@ -250,6 +265,7 @@ extern "C" {
                json_object_object_add(obj, "m_height", json_object_new_string(m_height.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;
@@ -295,6 +311,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);
            }
@@ -326,6 +346,7 @@ extern "C" {
                addField("controls", "Show Play Controls", "checkbox");
                addField("play_on_hover", "Play on Mouse Over", "checkbox");
                addField("hidden", "Hidden", "checkbox", nullptr, true);
                addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }");
                return arr;
            }

@@ -389,6 +410,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(video);
                el.appendChild(wrapper);
            }