Api: Let legacy custom JS return

Legacy JS in the form app.appname.function where we _couldn't_ find the actual function now return.  Fixes some custom click handlers couldn't submit
This commit is contained in:
nathan 2023-10-10 15:23:19 -06:00
parent 9cc0e6506b
commit 04ad3651a4

View File

@ -99,6 +99,11 @@ export function et2_compileLegacyJS(_code, _widget, _context)
}
// Code is app.appname.function, add the arguments so it can be executed
_code += '(ev,widget)';
// Return what the function returns
if(_code.indexOf("return") == -1)
{
_code = "return " + _code;
}
}
// use app object from etemplate2, which might be private and not just window.app
_code = _code.replace(/(window\.)?app\./, 'widget.getInstanceManager().app_obj.');