Loading editor/src/webedit_api.cpp +21 −1 Original line number Diff line number Diff line Loading @@ -209,12 +209,32 @@ std::vector<NodeWidgetDescriptor> nodeWidgetCatalog() { } bool findNodeWidgetByName(const std::string &name, NodeWidgetDescriptor &out) { auto lower = [](std::string value) { std::transform(value.begin(), value.end(), value.begin(), [](unsigned char c) { return static_cast<char>(std::tolower(c)); }); return value; }; const auto catalog = nodeWidgetCatalog(); // Fast path: exact match. auto it = std::find_if(catalog.begin(), catalog.end(), [&](const NodeWidgetDescriptor &d) { return name == d.name; }); if (it == catalog.end()) // Compatibility path: older templates often store capitalized metadata names // (e.g. "TextBox") while the script file is lower-case ("textbox.js"). if (it == catalog.end()) { const std::string wanted = lower(name); it = std::find_if(catalog.begin(), catalog.end(), [&](const NodeWidgetDescriptor &d) { return lower(d.name) == wanted; }); } if (it == catalog.end()) { return false; } out = *it; return true; } Loading Loading
editor/src/webedit_api.cpp +21 −1 Original line number Diff line number Diff line Loading @@ -209,12 +209,32 @@ std::vector<NodeWidgetDescriptor> nodeWidgetCatalog() { } bool findNodeWidgetByName(const std::string &name, NodeWidgetDescriptor &out) { auto lower = [](std::string value) { std::transform(value.begin(), value.end(), value.begin(), [](unsigned char c) { return static_cast<char>(std::tolower(c)); }); return value; }; const auto catalog = nodeWidgetCatalog(); // Fast path: exact match. auto it = std::find_if(catalog.begin(), catalog.end(), [&](const NodeWidgetDescriptor &d) { return name == d.name; }); if (it == catalog.end()) // Compatibility path: older templates often store capitalized metadata names // (e.g. "TextBox") while the script file is lower-case ("textbox.js"). if (it == catalog.end()) { const std::string wanted = lower(name); it = std::find_if(catalog.begin(), catalog.end(), [&](const NodeWidgetDescriptor &d) { return lower(d.name) == wanted; }); } if (it == catalog.end()) { return false; } out = *it; return true; } Loading