Loading src/webedit/container/container.cpp +88 −0 Changes for src/webedit/container/container.cpp: 88 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -48,11 +48,20 @@ extern "C" { std::string padding = ""; std::string margin = ""; // Background image std::string backgroundImage = ""; std::string backgroundSize = "cover"; std::string backgroundPosition = "center"; std::string backgroundRepeat = "no-repeat"; // Light mode overrides (empty = inherit dark value) std::string l_backgroundColor = ""; // Mobile overrides (empty = inherit desktop value) std::string m_backgroundColor = ""; std::string m_backgroundImage = ""; std::string m_backgroundSize = ""; std::string m_backgroundPosition = ""; std::string m_borderRadius = ""; std::string m_borderStyle = ""; std::string m_opacity = ""; Loading Loading @@ -246,6 +255,10 @@ extern "C" { }; addField("background_color", "Background Color (Dark)", "color_var", nullptr, true); addField("l_background_color", "Background Color (Light)", "color_var"); addField("background_image", "Background Image URL", "text", "e.g. /media/img.webp", true); addField("background_size", "Background Size", "select", nullptr, true, mkOpts({"cover","contain","auto","100% 100%"})); addField("background_position", "Background Position", "select", nullptr, true, mkOpts({"center","top","bottom","left","right","top left","top right","bottom left","bottom right"})); addField("background_repeat", "Background Repeat", "select", nullptr, false, mkOpts({"no-repeat","repeat","repeat-x","repeat-y"})); addField("css_class", "CSS Class", "text", "e.g. my-container"); addField("border_radius", "Border Radius", "text", "e.g. 8px", true); addField("border_style", "Border", "text", "e.g. 1px solid #ccc", true); Loading Loading @@ -277,11 +290,20 @@ extern "C" { element->SetAttribute("padding", padding.c_str()); element->SetAttribute("margin", margin.c_str()); // Background image element->SetAttribute("background_image", backgroundImage.c_str()); element->SetAttribute("background_size", backgroundSize.c_str()); element->SetAttribute("background_position", backgroundPosition.c_str()); element->SetAttribute("background_repeat", backgroundRepeat.c_str()); // Light mode overrides element->SetAttribute("l_background_color", l_backgroundColor.c_str()); // Mobile overrides element->SetAttribute("m_background_color", m_backgroundColor.c_str()); element->SetAttribute("m_background_image", m_backgroundImage.c_str()); element->SetAttribute("m_background_size", m_backgroundSize.c_str()); element->SetAttribute("m_background_position", m_backgroundPosition.c_str()); element->SetAttribute("m_border_radius", m_borderRadius.c_str()); element->SetAttribute("m_border_style", m_borderStyle.c_str()); element->SetAttribute("m_opacity", m_opacity.c_str()); Loading Loading @@ -343,6 +365,16 @@ extern "C" { const char* loaded_mar = xml_data->Attribute("margin"); if (loaded_mar) margin = loaded_mar; // Background image const char* loaded_bi = xml_data->Attribute("background_image"); if (loaded_bi) backgroundImage = loaded_bi; const char* loaded_bsz = xml_data->Attribute("background_size"); if (loaded_bsz) backgroundSize = loaded_bsz; const char* loaded_bpos = xml_data->Attribute("background_position"); if (loaded_bpos) backgroundPosition = loaded_bpos; const char* loaded_brep = xml_data->Attribute("background_repeat"); if (loaded_brep) backgroundRepeat = loaded_brep; // Light mode overrides const char* loaded_l_bg = xml_data->Attribute("l_background_color"); if (loaded_l_bg) l_backgroundColor = loaded_l_bg; Loading @@ -350,6 +382,12 @@ extern "C" { // Mobile overrides const char* loaded_m_bg = xml_data->Attribute("m_background_color"); if (loaded_m_bg) m_backgroundColor = loaded_m_bg; const char* loaded_m_bi = xml_data->Attribute("m_background_image"); if (loaded_m_bi) m_backgroundImage = loaded_m_bi; const char* loaded_m_bsz = xml_data->Attribute("m_background_size"); if (loaded_m_bsz) m_backgroundSize = loaded_m_bsz; const char* loaded_m_bpos = xml_data->Attribute("m_background_position"); if (loaded_m_bpos) m_backgroundPosition = loaded_m_bpos; const char* loaded_m_br = xml_data->Attribute("m_border_radius"); if (loaded_m_br) m_borderRadius = loaded_m_br; const char* loaded_m_bs = xml_data->Attribute("m_border_style"); Loading Loading @@ -394,8 +432,15 @@ extern "C" { json_object_object_add(obj, "opacity", json_object_new_string(opacity.c_str())); json_object_object_add(obj, "padding", json_object_new_string(padding.c_str())); json_object_object_add(obj, "margin", json_object_new_string(margin.c_str())); json_object_object_add(obj, "background_image", json_object_new_string(backgroundImage.c_str())); json_object_object_add(obj, "background_size", json_object_new_string(backgroundSize.c_str())); 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, "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())); json_object_object_add(obj, "m_background_position", json_object_new_string(m_backgroundPosition.c_str())); json_object_object_add(obj, "m_border_radius", json_object_new_string(m_borderRadius.c_str())); json_object_object_add(obj, "m_border_style", json_object_new_string(m_borderStyle.c_str())); json_object_object_add(obj, "m_opacity", json_object_new_string(m_opacity.c_str())); Loading Loading @@ -438,6 +483,22 @@ extern "C" { val = json_object_get_string(val_obj); if (val) opacity = val; } if (json_object_object_get_ex(obj, "background_image", &val_obj)) { val = json_object_get_string(val_obj); if (val) backgroundImage = val; } if (json_object_object_get_ex(obj, "background_size", &val_obj)) { val = json_object_get_string(val_obj); if (val) backgroundSize = val; } if (json_object_object_get_ex(obj, "background_position", &val_obj)) { val = json_object_get_string(val_obj); if (val) backgroundPosition = val; } if (json_object_object_get_ex(obj, "background_repeat", &val_obj)) { val = json_object_get_string(val_obj); if (val) backgroundRepeat = val; } if (json_object_object_get_ex(obj, "l_background_color", &val_obj)) { val = json_object_get_string(val_obj); if (val) l_backgroundColor = val; Loading @@ -446,6 +507,18 @@ extern "C" { val = json_object_get_string(val_obj); if (val) m_backgroundColor = val; } if (json_object_object_get_ex(obj, "m_background_image", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_backgroundImage = val; } if (json_object_object_get_ex(obj, "m_background_size", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_backgroundSize = val; } if (json_object_object_get_ex(obj, "m_background_position", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_backgroundPosition = val; } if (json_object_object_get_ex(obj, "m_border_radius", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_borderRadius = val; Loading Loading @@ -511,6 +584,12 @@ extern "C" { if (!backgroundColor.empty() && backgroundColor != "none" && backgroundColor != "transparent") { style += " background-color: " + backgroundColor + ";"; } if (!backgroundImage.empty()) { style += " background-image: url('" + backgroundImage + "');"; style += " background-size: " + backgroundSize + ";"; style += " background-position: " + backgroundPosition + ";"; style += " background-repeat: " + backgroundRepeat + ";"; } if (!borderRadius.empty()) { style += " border-radius: " + borderRadius + ";"; } Loading Loading @@ -550,6 +629,15 @@ extern "C" { } else if (m_backgroundColor == "none" || m_backgroundColor == "transparent") { mobileCSS += " background-color: transparent !important;"; } if (!m_backgroundImage.empty()) { mobileCSS += " background-image: url('" + m_backgroundImage + "') !important;"; } if (!m_backgroundSize.empty()) { mobileCSS += " background-size: " + m_backgroundSize + " !important;"; } if (!m_backgroundPosition.empty()) { mobileCSS += " background-position: " + m_backgroundPosition + " !important;"; } if (!m_borderRadius.empty()) mobileCSS += " border-radius: " + m_borderRadius + " !important;"; if (!m_borderStyle.empty()) mobileCSS += " border: " + m_borderStyle + " !important;"; if (!m_opacity.empty()) mobileCSS += " opacity: " + m_opacity + " !important;"; Loading Loading
src/webedit/container/container.cpp +88 −0 Changes for src/webedit/container/container.cpp: 88 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -48,11 +48,20 @@ extern "C" { std::string padding = ""; std::string margin = ""; // Background image std::string backgroundImage = ""; std::string backgroundSize = "cover"; std::string backgroundPosition = "center"; std::string backgroundRepeat = "no-repeat"; // Light mode overrides (empty = inherit dark value) std::string l_backgroundColor = ""; // Mobile overrides (empty = inherit desktop value) std::string m_backgroundColor = ""; std::string m_backgroundImage = ""; std::string m_backgroundSize = ""; std::string m_backgroundPosition = ""; std::string m_borderRadius = ""; std::string m_borderStyle = ""; std::string m_opacity = ""; Loading Loading @@ -246,6 +255,10 @@ extern "C" { }; addField("background_color", "Background Color (Dark)", "color_var", nullptr, true); addField("l_background_color", "Background Color (Light)", "color_var"); addField("background_image", "Background Image URL", "text", "e.g. /media/img.webp", true); addField("background_size", "Background Size", "select", nullptr, true, mkOpts({"cover","contain","auto","100% 100%"})); addField("background_position", "Background Position", "select", nullptr, true, mkOpts({"center","top","bottom","left","right","top left","top right","bottom left","bottom right"})); addField("background_repeat", "Background Repeat", "select", nullptr, false, mkOpts({"no-repeat","repeat","repeat-x","repeat-y"})); addField("css_class", "CSS Class", "text", "e.g. my-container"); addField("border_radius", "Border Radius", "text", "e.g. 8px", true); addField("border_style", "Border", "text", "e.g. 1px solid #ccc", true); Loading Loading @@ -277,11 +290,20 @@ extern "C" { element->SetAttribute("padding", padding.c_str()); element->SetAttribute("margin", margin.c_str()); // Background image element->SetAttribute("background_image", backgroundImage.c_str()); element->SetAttribute("background_size", backgroundSize.c_str()); element->SetAttribute("background_position", backgroundPosition.c_str()); element->SetAttribute("background_repeat", backgroundRepeat.c_str()); // Light mode overrides element->SetAttribute("l_background_color", l_backgroundColor.c_str()); // Mobile overrides element->SetAttribute("m_background_color", m_backgroundColor.c_str()); element->SetAttribute("m_background_image", m_backgroundImage.c_str()); element->SetAttribute("m_background_size", m_backgroundSize.c_str()); element->SetAttribute("m_background_position", m_backgroundPosition.c_str()); element->SetAttribute("m_border_radius", m_borderRadius.c_str()); element->SetAttribute("m_border_style", m_borderStyle.c_str()); element->SetAttribute("m_opacity", m_opacity.c_str()); Loading Loading @@ -343,6 +365,16 @@ extern "C" { const char* loaded_mar = xml_data->Attribute("margin"); if (loaded_mar) margin = loaded_mar; // Background image const char* loaded_bi = xml_data->Attribute("background_image"); if (loaded_bi) backgroundImage = loaded_bi; const char* loaded_bsz = xml_data->Attribute("background_size"); if (loaded_bsz) backgroundSize = loaded_bsz; const char* loaded_bpos = xml_data->Attribute("background_position"); if (loaded_bpos) backgroundPosition = loaded_bpos; const char* loaded_brep = xml_data->Attribute("background_repeat"); if (loaded_brep) backgroundRepeat = loaded_brep; // Light mode overrides const char* loaded_l_bg = xml_data->Attribute("l_background_color"); if (loaded_l_bg) l_backgroundColor = loaded_l_bg; Loading @@ -350,6 +382,12 @@ extern "C" { // Mobile overrides const char* loaded_m_bg = xml_data->Attribute("m_background_color"); if (loaded_m_bg) m_backgroundColor = loaded_m_bg; const char* loaded_m_bi = xml_data->Attribute("m_background_image"); if (loaded_m_bi) m_backgroundImage = loaded_m_bi; const char* loaded_m_bsz = xml_data->Attribute("m_background_size"); if (loaded_m_bsz) m_backgroundSize = loaded_m_bsz; const char* loaded_m_bpos = xml_data->Attribute("m_background_position"); if (loaded_m_bpos) m_backgroundPosition = loaded_m_bpos; const char* loaded_m_br = xml_data->Attribute("m_border_radius"); if (loaded_m_br) m_borderRadius = loaded_m_br; const char* loaded_m_bs = xml_data->Attribute("m_border_style"); Loading Loading @@ -394,8 +432,15 @@ extern "C" { json_object_object_add(obj, "opacity", json_object_new_string(opacity.c_str())); json_object_object_add(obj, "padding", json_object_new_string(padding.c_str())); json_object_object_add(obj, "margin", json_object_new_string(margin.c_str())); json_object_object_add(obj, "background_image", json_object_new_string(backgroundImage.c_str())); json_object_object_add(obj, "background_size", json_object_new_string(backgroundSize.c_str())); 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, "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())); json_object_object_add(obj, "m_background_position", json_object_new_string(m_backgroundPosition.c_str())); json_object_object_add(obj, "m_border_radius", json_object_new_string(m_borderRadius.c_str())); json_object_object_add(obj, "m_border_style", json_object_new_string(m_borderStyle.c_str())); json_object_object_add(obj, "m_opacity", json_object_new_string(m_opacity.c_str())); Loading Loading @@ -438,6 +483,22 @@ extern "C" { val = json_object_get_string(val_obj); if (val) opacity = val; } if (json_object_object_get_ex(obj, "background_image", &val_obj)) { val = json_object_get_string(val_obj); if (val) backgroundImage = val; } if (json_object_object_get_ex(obj, "background_size", &val_obj)) { val = json_object_get_string(val_obj); if (val) backgroundSize = val; } if (json_object_object_get_ex(obj, "background_position", &val_obj)) { val = json_object_get_string(val_obj); if (val) backgroundPosition = val; } if (json_object_object_get_ex(obj, "background_repeat", &val_obj)) { val = json_object_get_string(val_obj); if (val) backgroundRepeat = val; } if (json_object_object_get_ex(obj, "l_background_color", &val_obj)) { val = json_object_get_string(val_obj); if (val) l_backgroundColor = val; Loading @@ -446,6 +507,18 @@ extern "C" { val = json_object_get_string(val_obj); if (val) m_backgroundColor = val; } if (json_object_object_get_ex(obj, "m_background_image", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_backgroundImage = val; } if (json_object_object_get_ex(obj, "m_background_size", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_backgroundSize = val; } if (json_object_object_get_ex(obj, "m_background_position", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_backgroundPosition = val; } if (json_object_object_get_ex(obj, "m_border_radius", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_borderRadius = val; Loading Loading @@ -511,6 +584,12 @@ extern "C" { if (!backgroundColor.empty() && backgroundColor != "none" && backgroundColor != "transparent") { style += " background-color: " + backgroundColor + ";"; } if (!backgroundImage.empty()) { style += " background-image: url('" + backgroundImage + "');"; style += " background-size: " + backgroundSize + ";"; style += " background-position: " + backgroundPosition + ";"; style += " background-repeat: " + backgroundRepeat + ";"; } if (!borderRadius.empty()) { style += " border-radius: " + borderRadius + ";"; } Loading Loading @@ -550,6 +629,15 @@ extern "C" { } else if (m_backgroundColor == "none" || m_backgroundColor == "transparent") { mobileCSS += " background-color: transparent !important;"; } if (!m_backgroundImage.empty()) { mobileCSS += " background-image: url('" + m_backgroundImage + "') !important;"; } if (!m_backgroundSize.empty()) { mobileCSS += " background-size: " + m_backgroundSize + " !important;"; } if (!m_backgroundPosition.empty()) { mobileCSS += " background-position: " + m_backgroundPosition + " !important;"; } if (!m_borderRadius.empty()) mobileCSS += " border-radius: " + m_borderRadius + " !important;"; if (!m_borderStyle.empty()) mobileCSS += " border: " + m_borderStyle + " !important;"; if (!m_opacity.empty()) mobileCSS += " opacity: " + m_opacity + " !important;"; Loading