Loading src/webedit/table/table.cpp +21 −0 Changes for src/webedit/table/table.cpp: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ extern "C" { bool hidden = false; bool m_hidden = false; // Custom CSS std::string customCss = ""; // Cell data stored as row-major flat vector std::vector<std::string> cellData; Loading Loading @@ -280,6 +283,7 @@ extern "C" { addField("l_background_color", "Background Color (Light)", "color_var"); 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; } Loading Loading @@ -310,6 +314,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 cell data as nested XML ensureCellData(); for (int r = 0; r < numRows; ++r) { Loading Loading @@ -367,6 +377,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; } ensureCellData(); // Load cell data from XML Loading Loading @@ -404,6 +420,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; Loading Loading @@ -455,6 +472,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); ensureCellData(); Loading Loading
src/webedit/table/table.cpp +21 −0 Changes for src/webedit/table/table.cpp: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ extern "C" { bool hidden = false; bool m_hidden = false; // Custom CSS std::string customCss = ""; // Cell data stored as row-major flat vector std::vector<std::string> cellData; Loading Loading @@ -280,6 +283,7 @@ extern "C" { addField("l_background_color", "Background Color (Light)", "color_var"); 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; } Loading Loading @@ -310,6 +314,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 cell data as nested XML ensureCellData(); for (int r = 0; r < numRows; ++r) { Loading Loading @@ -367,6 +377,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; } ensureCellData(); // Load cell data from XML Loading Loading @@ -404,6 +420,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; Loading Loading @@ -455,6 +472,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); ensureCellData(); Loading