Loading src/webedit/textbox/textbox.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ extern "C" { std::string textAlign = "left"; std::string fontWeight = "normal"; std::string fontStyle = "normal"; std::string whiteSpace = "normal"; // Dimensions std::string width = ""; Loading Loading @@ -233,6 +234,7 @@ extern "C" { addField("text_align", "Text Align", "select", nullptr, true, mkOpts({"left","center","right","justify"})); addField("font_weight", "Font Weight", "select", nullptr, false, mkOpts({"normal","bold","lighter","bolder"})); addField("font_style", "Font Style", "select", nullptr, false, mkOpts({"normal","italic","oblique"})); addField("white_space", "Zeilenumbruch", "select", nullptr, false, mkOpts({"normal","nowrap","pre","pre-wrap","pre-line","break-spaces"})); addField("hidden", "Hidden", "checkbox", nullptr, true); addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }"); return arr; Loading @@ -249,6 +251,7 @@ extern "C" { element->SetAttribute("text_align", textAlign.c_str()); element->SetAttribute("font_weight", fontWeight.c_str()); element->SetAttribute("font_style", fontStyle.c_str()); element->SetAttribute("white_space", whiteSpace.c_str()); // Dimensions element->SetAttribute("width", width.c_str()); Loading Loading @@ -305,6 +308,9 @@ extern "C" { val = xml_data->Attribute("font_style"); if (val) fontStyle = val; val = xml_data->Attribute("white_space"); if (val) whiteSpace = val; // Dimensions val = xml_data->Attribute("width"); if (val) width = val; Loading Loading @@ -350,6 +356,7 @@ extern "C" { json_object_object_add(obj, "text_align", json_object_new_string(textAlign.c_str())); json_object_object_add(obj, "font_weight", json_object_new_string(fontWeight.c_str())); json_object_object_add(obj, "font_style", json_object_new_string(fontStyle.c_str())); json_object_object_add(obj, "white_space", json_object_new_string(whiteSpace.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, "content", json_object_new_string(content.c_str())); Loading Loading @@ -400,6 +407,10 @@ extern "C" { val = json_object_get_string(val_obj); if (val && val[0]) fontStyle = val; } if (json_object_object_get_ex(obj, "white_space", &val_obj)) { val = json_object_get_string(val_obj); if (val && val[0]) whiteSpace = val; } if (json_object_object_get_ex(obj, "width", &val_obj)) { val = json_object_get_string(val_obj); if (val) width = val; } Loading Loading @@ -462,6 +473,7 @@ extern "C" { if (!textAlign.empty()) style += " text-align: " + textAlign + ";"; if (fontWeight != "normal") style += " font-weight: " + fontWeight + ";"; if (fontStyle != "normal") style += " font-style: " + fontStyle + ";"; if (whiteSpace != "normal") style += " white-space: " + whiteSpace + ";"; if (hidden) style += " display: none;"; box.setAttribute("style", style.c_str()); Loading Loading
src/webedit/textbox/textbox.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ extern "C" { std::string textAlign = "left"; std::string fontWeight = "normal"; std::string fontStyle = "normal"; std::string whiteSpace = "normal"; // Dimensions std::string width = ""; Loading Loading @@ -233,6 +234,7 @@ extern "C" { addField("text_align", "Text Align", "select", nullptr, true, mkOpts({"left","center","right","justify"})); addField("font_weight", "Font Weight", "select", nullptr, false, mkOpts({"normal","bold","lighter","bolder"})); addField("font_style", "Font Style", "select", nullptr, false, mkOpts({"normal","italic","oblique"})); addField("white_space", "Zeilenumbruch", "select", nullptr, false, mkOpts({"normal","nowrap","pre","pre-wrap","pre-line","break-spaces"})); addField("hidden", "Hidden", "checkbox", nullptr, true); addField("custom_css", "Custom CSS", "textarea", ".we-xxx { color: red; }"); return arr; Loading @@ -249,6 +251,7 @@ extern "C" { element->SetAttribute("text_align", textAlign.c_str()); element->SetAttribute("font_weight", fontWeight.c_str()); element->SetAttribute("font_style", fontStyle.c_str()); element->SetAttribute("white_space", whiteSpace.c_str()); // Dimensions element->SetAttribute("width", width.c_str()); Loading Loading @@ -305,6 +308,9 @@ extern "C" { val = xml_data->Attribute("font_style"); if (val) fontStyle = val; val = xml_data->Attribute("white_space"); if (val) whiteSpace = val; // Dimensions val = xml_data->Attribute("width"); if (val) width = val; Loading Loading @@ -350,6 +356,7 @@ extern "C" { json_object_object_add(obj, "text_align", json_object_new_string(textAlign.c_str())); json_object_object_add(obj, "font_weight", json_object_new_string(fontWeight.c_str())); json_object_object_add(obj, "font_style", json_object_new_string(fontStyle.c_str())); json_object_object_add(obj, "white_space", json_object_new_string(whiteSpace.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, "content", json_object_new_string(content.c_str())); Loading Loading @@ -400,6 +407,10 @@ extern "C" { val = json_object_get_string(val_obj); if (val && val[0]) fontStyle = val; } if (json_object_object_get_ex(obj, "white_space", &val_obj)) { val = json_object_get_string(val_obj); if (val && val[0]) whiteSpace = val; } if (json_object_object_get_ex(obj, "width", &val_obj)) { val = json_object_get_string(val_obj); if (val) width = val; } Loading Loading @@ -462,6 +473,7 @@ extern "C" { if (!textAlign.empty()) style += " text-align: " + textAlign + ";"; if (fontWeight != "normal") style += " font-weight: " + fontWeight + ";"; if (fontStyle != "normal") style += " font-style: " + fontStyle + ";"; if (whiteSpace != "normal") style += " white-space: " + whiteSpace + ";"; if (hidden) style += " display: none;"; box.setAttribute("style", style.c_str()); Loading