Commit 773ea8e8 authored by jan.koester's avatar jan.koester
Browse files

test

parent fd4c571c
Loading
Loading
Loading
Loading
+13 −3
Changes for src/edit.cpp: 13 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -681,7 +681,7 @@ void blogi::webedit::WebEditor::htmlElementToWidgetXml(

            // Skip structural HTML tags, process their children instead
            if (tag == "html" || tag == "body" || tag == "head" || tag == "main" ||
                tag == "header" || tag == "footer" || tag == "nav" || tag == "article" ||
                tag == "header" || tag == "footer" || tag == "nav" ||
                tag == "aside") {
                libhtmlpp::Element *child = el->firstChild();
                if (child) {
@@ -714,6 +714,7 @@ void blogi::webedit::WebEditor::htmlElementToWidgetXml(
                if (cssProps.count("max-width")) w->SetAttribute("max_width", cssProps["max-width"].c_str());
                if (cssProps.count("min-height")) w->SetAttribute("min_height", cssProps["min-height"].c_str());
                if (!cssClass.empty()) w->SetAttribute("css_class", cssClass.c_str());
                if (!elemId.empty()) w->SetAttribute("css_id", elemId.c_str());

                std::vector<std::string> knownCss = {"background-color","border-radius","border","opacity",
                    "padding","margin","max-width","min-height","display","flex-direction","justify-content"};
@@ -727,7 +728,7 @@ void blogi::webedit::WebEditor::htmlElementToWidgetXml(
                libhtmlpp::Element *child = el->firstChild();
                if (child) childFrames.push_back({child, w});

            } else if (tag == "div") {
            } else if (tag == "div" || tag == "article") {
                tinyxml2::XMLElement *w = doc.NewElement("Container");
                if (cssProps.count("background-color")) w->SetAttribute("background_color", cssProps["background-color"].c_str());
                if (cssProps.count("border-radius")) w->SetAttribute("border_radius", cssProps["border-radius"].c_str());
@@ -736,6 +737,7 @@ void blogi::webedit::WebEditor::htmlElementToWidgetXml(
                if (cssProps.count("padding")) w->SetAttribute("padding", cssProps["padding"].c_str());
                if (cssProps.count("margin")) w->SetAttribute("margin", cssProps["margin"].c_str());
                if (!cssClass.empty()) w->SetAttribute("css_class", cssClass.c_str());
                if (!elemId.empty()) w->SetAttribute("css_id", elemId.c_str());

                bool isGrid = cssProps.count("display") && cssProps["display"] == "grid";

@@ -1008,6 +1010,8 @@ void blogi::webedit::WebEditor::htmlElementToWidgetXml(
                if (cssProps.count("text-align")) w->SetAttribute("text_align", cssProps["text-align"].c_str());
                if (cssProps.count("font-weight")) w->SetAttribute("font_weight", cssProps["font-weight"].c_str());
                if (cssProps.count("font-style")) w->SetAttribute("font_style", cssProps["font-style"].c_str());
                if (!cssClass.empty()) w->SetAttribute("css_class", cssClass.c_str());
                if (!elemId.empty()) w->SetAttribute("css_id", elemId.c_str());

                std::vector<std::string> knownCss = {"font-family","font-size","color","text-align",
                    "font-weight","font-style","padding","margin","line-height"};
@@ -1020,7 +1024,13 @@ void blogi::webedit::WebEditor::htmlElementToWidgetXml(
                pXml->InsertEndChild(w);

            } else if (tag == "style") {
                // Already collected during preprocessing — skip
                // Preserve full <style> block as CustomHtml so CSS rules apply at render time
                tinyxml2::XMLElement *w = doc.NewElement("CustomHtml");
                tinyxml2::XMLElement *htmlContent = doc.NewElement("HtmlContent");
                std::string styleHtml = "<style>" + serializeInnerHtml(el) + "</style>";
                htmlContent->SetText(styleHtml.c_str());
                w->InsertEndChild(htmlContent);
                pXml->InsertEndChild(w);

            } else if (tag == "br" || tag == "hr") {
                tinyxml2::XMLElement *w = doc.NewElement("CustomHtml");