Loading editor/widgets/faq/faq.cpp +18 −2 Changes for editor/widgets/faq/faq.cpp: 18 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -92,6 +92,9 @@ extern "C" { bool hidden = false; bool m_hidden = false; // Behavior bool openByDefault = false; std::string customCss = ""; public: Loading Loading @@ -218,6 +221,11 @@ extern "C" { addField("padding", "Padding", "text", "0", "desktop"); addField("max_width", "Max Width", "text", "e.g. 800px"); addField("columns", "Spalten", "select", nullptr, "desktop", mkOpts({"1","2","3","4"})); addField("open_by_default", "Standardmäßig geöffnet", "checkbox", nullptr, "desktop"); { json_object *f = json_object_array_get_idx(arr, json_object_array_length(arr) - 1); json_object_object_add(f, "default", json_object_new_boolean(false)); } // Question row styling addField("question_bg_color", "Question Background (Dark)", "color_var"); Loading Loading @@ -320,6 +328,7 @@ extern "C" { element->SetAttribute("hidden", hidden ? "true" : "false"); element->SetAttribute("m_hidden", m_hidden ? "true" : "false"); element->SetAttribute("open_by_default", openByDefault ? "true" : "false"); if (!customCss.empty()) { tinyxml2::XMLElement *cssEl = doc->NewElement("CustomCss"); Loading Loading @@ -378,6 +387,8 @@ extern "C" { if (val) hidden = (strcmp(val, "true") == 0); val = xml_data->Attribute("m_hidden"); if (val) m_hidden = (strcmp(val, "true") == 0); val = xml_data->Attribute("open_by_default"); if (val) openByDefault = (strcmp(val, "true") == 0); tinyxml2::XMLElement *cssEl = xml_data->FirstChildElement("CustomCss"); if (cssEl) { Loading Loading @@ -435,6 +446,7 @@ extern "C" { 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, "open_by_default", json_object_new_boolean(openByDefault)); json_object_object_add(obj, "custom_css", json_object_new_string(customCss.c_str())); // FAQ items as JSON array Loading Loading @@ -518,6 +530,7 @@ extern "C" { boolField("hidden", hidden); boolField("m_hidden", m_hidden); boolField("open_by_default", openByDefault); if (json_object_object_get_ex(obj, "custom_css", &v)) { s = json_object_get_string(v); Loading Loading @@ -670,7 +683,9 @@ extern "C" { libhtmlpp::HtmlElement icon("span"); icon.setAttribute("class", "faq-ic"); icon.setAttribute("style", "transition:transform 0.25s;display:inline-block;"); std::string iconStyle = "transition:transform 0.25s;display:inline-block;"; if (openByDefault) iconStyle += "transform:rotate(180deg);"; icon.setAttribute("style", iconStyle.c_str()); icon.appendChild(libhtmlpp::TextElement("\xe2\x96\xbe")); qBtn.appendChild(icon); Loading @@ -686,7 +701,8 @@ extern "C" { std::string aStyle; aStyle += "overflow:hidden;transition:max-height 0.3s ease,opacity 0.3s ease;"; aStyle += "max-height:0px;opacity:0;"; if (openByDefault) aStyle += "max-height:none;opacity:1;"; else aStyle += "max-height:0px;opacity:0;"; if (validCss(answerBgColor)) aStyle += " background: " + answerBgColor + ";"; if (validCss(answerTextColor)) aStyle += " color: " + answerTextColor + ";"; if (validCss(answerPadding)) aStyle += " padding: " + answerPadding + ";"; Loading Loading
editor/widgets/faq/faq.cpp +18 −2 Changes for editor/widgets/faq/faq.cpp: 18 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -92,6 +92,9 @@ extern "C" { bool hidden = false; bool m_hidden = false; // Behavior bool openByDefault = false; std::string customCss = ""; public: Loading Loading @@ -218,6 +221,11 @@ extern "C" { addField("padding", "Padding", "text", "0", "desktop"); addField("max_width", "Max Width", "text", "e.g. 800px"); addField("columns", "Spalten", "select", nullptr, "desktop", mkOpts({"1","2","3","4"})); addField("open_by_default", "Standardmäßig geöffnet", "checkbox", nullptr, "desktop"); { json_object *f = json_object_array_get_idx(arr, json_object_array_length(arr) - 1); json_object_object_add(f, "default", json_object_new_boolean(false)); } // Question row styling addField("question_bg_color", "Question Background (Dark)", "color_var"); Loading Loading @@ -320,6 +328,7 @@ extern "C" { element->SetAttribute("hidden", hidden ? "true" : "false"); element->SetAttribute("m_hidden", m_hidden ? "true" : "false"); element->SetAttribute("open_by_default", openByDefault ? "true" : "false"); if (!customCss.empty()) { tinyxml2::XMLElement *cssEl = doc->NewElement("CustomCss"); Loading Loading @@ -378,6 +387,8 @@ extern "C" { if (val) hidden = (strcmp(val, "true") == 0); val = xml_data->Attribute("m_hidden"); if (val) m_hidden = (strcmp(val, "true") == 0); val = xml_data->Attribute("open_by_default"); if (val) openByDefault = (strcmp(val, "true") == 0); tinyxml2::XMLElement *cssEl = xml_data->FirstChildElement("CustomCss"); if (cssEl) { Loading Loading @@ -435,6 +446,7 @@ extern "C" { 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, "open_by_default", json_object_new_boolean(openByDefault)); json_object_object_add(obj, "custom_css", json_object_new_string(customCss.c_str())); // FAQ items as JSON array Loading Loading @@ -518,6 +530,7 @@ extern "C" { boolField("hidden", hidden); boolField("m_hidden", m_hidden); boolField("open_by_default", openByDefault); if (json_object_object_get_ex(obj, "custom_css", &v)) { s = json_object_get_string(v); Loading Loading @@ -670,7 +683,9 @@ extern "C" { libhtmlpp::HtmlElement icon("span"); icon.setAttribute("class", "faq-ic"); icon.setAttribute("style", "transition:transform 0.25s;display:inline-block;"); std::string iconStyle = "transition:transform 0.25s;display:inline-block;"; if (openByDefault) iconStyle += "transform:rotate(180deg);"; icon.setAttribute("style", iconStyle.c_str()); icon.appendChild(libhtmlpp::TextElement("\xe2\x96\xbe")); qBtn.appendChild(icon); Loading @@ -686,7 +701,8 @@ extern "C" { std::string aStyle; aStyle += "overflow:hidden;transition:max-height 0.3s ease,opacity 0.3s ease;"; aStyle += "max-height:0px;opacity:0;"; if (openByDefault) aStyle += "max-height:none;opacity:1;"; else aStyle += "max-height:0px;opacity:0;"; if (validCss(answerBgColor)) aStyle += " background: " + answerBgColor + ";"; if (validCss(answerTextColor)) aStyle += " color: " + answerTextColor + ";"; if (validCss(answerPadding)) aStyle += " padding: " + answerPadding + ";"; Loading