Loading src/webedit/container/container.cpp +46 −0 Changes for src/webedit/container/container.cpp: 46 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ extern "C" { std::string opacity = ""; std::string padding = ""; std::string margin = ""; std::string width = ""; std::string height = ""; // Background image std::string backgroundImage = ""; Loading @@ -67,6 +69,8 @@ extern "C" { std::string m_opacity = ""; std::string m_padding = ""; std::string m_margin = ""; std::string m_width = ""; std::string m_height = ""; // Vertical alignment std::string verticalAlign = ""; Loading Loading @@ -259,6 +263,8 @@ extern "C" { 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("width", "Width", "text", "e.g. 100%", true); addField("height", "Height", "text", "e.g. auto", true); 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 @@ -289,6 +295,8 @@ extern "C" { element->SetAttribute("opacity", opacity.c_str()); element->SetAttribute("padding", padding.c_str()); element->SetAttribute("margin", margin.c_str()); element->SetAttribute("width", width.c_str()); element->SetAttribute("height", height.c_str()); // Background image element->SetAttribute("background_image", backgroundImage.c_str()); Loading @@ -309,6 +317,8 @@ extern "C" { element->SetAttribute("m_opacity", m_opacity.c_str()); element->SetAttribute("m_padding", m_padding.c_str()); element->SetAttribute("m_margin", m_margin.c_str()); element->SetAttribute("m_width", m_width.c_str()); element->SetAttribute("m_height", m_height.c_str()); // Vertical alignment element->SetAttribute("vertical_align", verticalAlign.c_str()); Loading Loading @@ -364,6 +374,10 @@ extern "C" { if (loaded_pad) padding = loaded_pad; const char* loaded_mar = xml_data->Attribute("margin"); if (loaded_mar) margin = loaded_mar; const char* loaded_w = xml_data->Attribute("width"); if (loaded_w) width = loaded_w; const char* loaded_h = xml_data->Attribute("height"); if (loaded_h) height = loaded_h; // Background image const char* loaded_bi = xml_data->Attribute("background_image"); Loading Loading @@ -398,6 +412,10 @@ extern "C" { if (loaded_m_pad) m_padding = loaded_m_pad; const char* loaded_m_mar = xml_data->Attribute("m_margin"); if (loaded_m_mar) m_margin = loaded_m_mar; const char* loaded_m_w = xml_data->Attribute("m_width"); if (loaded_m_w) m_width = loaded_m_w; const char* loaded_m_h = xml_data->Attribute("m_height"); if (loaded_m_h) m_height = loaded_m_h; // Vertical alignment const char* loaded_va = xml_data->Attribute("vertical_align"); Loading Loading @@ -432,6 +450,8 @@ 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, "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, "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())); Loading @@ -446,6 +466,8 @@ extern "C" { json_object_object_add(obj, "m_opacity", json_object_new_string(m_opacity.c_str())); json_object_object_add(obj, "m_padding", json_object_new_string(m_padding.c_str())); json_object_object_add(obj, "m_margin", json_object_new_string(m_margin.c_str())); json_object_object_add(obj, "m_width", json_object_new_string(m_width.c_str())); json_object_object_add(obj, "m_height", json_object_new_string(m_height.c_str())); json_object_object_add(obj, "vertical_align", json_object_new_string(verticalAlign.c_str())); 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)); Loading Loading @@ -539,6 +561,14 @@ extern "C" { val = json_object_get_string(val_obj); if (val) margin = val; } if (json_object_object_get_ex(obj, "width", &val_obj)) { val = json_object_get_string(val_obj); if (val) width = val; } if (json_object_object_get_ex(obj, "height", &val_obj)) { val = json_object_get_string(val_obj); if (val) height = val; } if (json_object_object_get_ex(obj, "m_padding", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_padding = val; Loading @@ -547,6 +577,14 @@ extern "C" { val = json_object_get_string(val_obj); if (val) m_margin = val; } if (json_object_object_get_ex(obj, "m_width", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_width = val; } if (json_object_object_get_ex(obj, "m_height", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_height = val; } if (json_object_object_get_ex(obj, "vertical_align", &val_obj)) { val = json_object_get_string(val_obj); if (val) verticalAlign = val; Loading Loading @@ -605,6 +643,12 @@ extern "C" { if (!margin.empty()) { style += " margin: " + margin + ";"; } if (!width.empty()) { style += " width: " + width + ";"; } if (!height.empty()) { style += " height: " + height + ";"; } if (!verticalAlign.empty()) { style += " display: flex; flex-direction: column;"; if (verticalAlign == "top") style += " justify-content: flex-start;"; Loading Loading @@ -643,6 +687,8 @@ extern "C" { if (!m_opacity.empty()) mobileCSS += " opacity: " + m_opacity + " !important;"; if (!m_padding.empty()) mobileCSS += " padding: " + m_padding + " !important;"; if (!m_margin.empty()) mobileCSS += " margin: " + m_margin + " !important;"; if (!m_width.empty()) mobileCSS += " width: " + m_width + " !important;"; if (!m_height.empty()) mobileCSS += " height: " + m_height + " !important;"; if (!m_verticalAlign.empty()) { mobileCSS += " display: flex !important; flex-direction: column !important;"; if (m_verticalAlign == "top") mobileCSS += " justify-content: flex-start !important;"; Loading Loading
src/webedit/container/container.cpp +46 −0 Changes for src/webedit/container/container.cpp: 46 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ extern "C" { std::string opacity = ""; std::string padding = ""; std::string margin = ""; std::string width = ""; std::string height = ""; // Background image std::string backgroundImage = ""; Loading @@ -67,6 +69,8 @@ extern "C" { std::string m_opacity = ""; std::string m_padding = ""; std::string m_margin = ""; std::string m_width = ""; std::string m_height = ""; // Vertical alignment std::string verticalAlign = ""; Loading Loading @@ -259,6 +263,8 @@ extern "C" { 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("width", "Width", "text", "e.g. 100%", true); addField("height", "Height", "text", "e.g. auto", true); 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 @@ -289,6 +295,8 @@ extern "C" { element->SetAttribute("opacity", opacity.c_str()); element->SetAttribute("padding", padding.c_str()); element->SetAttribute("margin", margin.c_str()); element->SetAttribute("width", width.c_str()); element->SetAttribute("height", height.c_str()); // Background image element->SetAttribute("background_image", backgroundImage.c_str()); Loading @@ -309,6 +317,8 @@ extern "C" { element->SetAttribute("m_opacity", m_opacity.c_str()); element->SetAttribute("m_padding", m_padding.c_str()); element->SetAttribute("m_margin", m_margin.c_str()); element->SetAttribute("m_width", m_width.c_str()); element->SetAttribute("m_height", m_height.c_str()); // Vertical alignment element->SetAttribute("vertical_align", verticalAlign.c_str()); Loading Loading @@ -364,6 +374,10 @@ extern "C" { if (loaded_pad) padding = loaded_pad; const char* loaded_mar = xml_data->Attribute("margin"); if (loaded_mar) margin = loaded_mar; const char* loaded_w = xml_data->Attribute("width"); if (loaded_w) width = loaded_w; const char* loaded_h = xml_data->Attribute("height"); if (loaded_h) height = loaded_h; // Background image const char* loaded_bi = xml_data->Attribute("background_image"); Loading Loading @@ -398,6 +412,10 @@ extern "C" { if (loaded_m_pad) m_padding = loaded_m_pad; const char* loaded_m_mar = xml_data->Attribute("m_margin"); if (loaded_m_mar) m_margin = loaded_m_mar; const char* loaded_m_w = xml_data->Attribute("m_width"); if (loaded_m_w) m_width = loaded_m_w; const char* loaded_m_h = xml_data->Attribute("m_height"); if (loaded_m_h) m_height = loaded_m_h; // Vertical alignment const char* loaded_va = xml_data->Attribute("vertical_align"); Loading Loading @@ -432,6 +450,8 @@ 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, "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, "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())); Loading @@ -446,6 +466,8 @@ extern "C" { json_object_object_add(obj, "m_opacity", json_object_new_string(m_opacity.c_str())); json_object_object_add(obj, "m_padding", json_object_new_string(m_padding.c_str())); json_object_object_add(obj, "m_margin", json_object_new_string(m_margin.c_str())); json_object_object_add(obj, "m_width", json_object_new_string(m_width.c_str())); json_object_object_add(obj, "m_height", json_object_new_string(m_height.c_str())); json_object_object_add(obj, "vertical_align", json_object_new_string(verticalAlign.c_str())); 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)); Loading Loading @@ -539,6 +561,14 @@ extern "C" { val = json_object_get_string(val_obj); if (val) margin = val; } if (json_object_object_get_ex(obj, "width", &val_obj)) { val = json_object_get_string(val_obj); if (val) width = val; } if (json_object_object_get_ex(obj, "height", &val_obj)) { val = json_object_get_string(val_obj); if (val) height = val; } if (json_object_object_get_ex(obj, "m_padding", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_padding = val; Loading @@ -547,6 +577,14 @@ extern "C" { val = json_object_get_string(val_obj); if (val) m_margin = val; } if (json_object_object_get_ex(obj, "m_width", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_width = val; } if (json_object_object_get_ex(obj, "m_height", &val_obj)) { val = json_object_get_string(val_obj); if (val) m_height = val; } if (json_object_object_get_ex(obj, "vertical_align", &val_obj)) { val = json_object_get_string(val_obj); if (val) verticalAlign = val; Loading Loading @@ -605,6 +643,12 @@ extern "C" { if (!margin.empty()) { style += " margin: " + margin + ";"; } if (!width.empty()) { style += " width: " + width + ";"; } if (!height.empty()) { style += " height: " + height + ";"; } if (!verticalAlign.empty()) { style += " display: flex; flex-direction: column;"; if (verticalAlign == "top") style += " justify-content: flex-start;"; Loading Loading @@ -643,6 +687,8 @@ extern "C" { if (!m_opacity.empty()) mobileCSS += " opacity: " + m_opacity + " !important;"; if (!m_padding.empty()) mobileCSS += " padding: " + m_padding + " !important;"; if (!m_margin.empty()) mobileCSS += " margin: " + m_margin + " !important;"; if (!m_width.empty()) mobileCSS += " width: " + m_width + " !important;"; if (!m_height.empty()) mobileCSS += " height: " + m_height + " !important;"; if (!m_verticalAlign.empty()) { mobileCSS += " display: flex !important; flex-direction: column !important;"; if (m_verticalAlign == "top") mobileCSS += " justify-content: flex-start !important;"; Loading