add script for style editor in the BE side#34927
Conversation
|
Claude finished @dario-daza's task in 2m 56s —— View job PR Review
SummaryThe logic is straightforward and mostly correct. A few things worth flagging: Issues1. No double-injection guard
// HTMLPageAssetRenderedBuilder.java:364
private String injectUVEScript(final String html) {
if (!UtilMethods.isSet(html)) {
return html;
}
// Missing: if (html.contains(SDK_EDITOR_SCRIPT_SOURCE)) return html;
final int closingBodyIndex = html.toLowerCase().lastIndexOf("</body>");2. Script injected for all non-LIVE modes, not just ADMIN/EDIT The commit message says "add script just in ADMIN and EDIT mode" but the final condition is // line 197-199
final String pageHTML = mode != PageMode.LIVE
? injectUVEScript(this.getPageHTML(mode))
: this.getPageHTML(mode);There is also no test covering 3. Script URL is hardcoded — no config fallback public static final String SDK_EDITOR_SCRIPT_SOURCE = "<script src=\"/ext/uve/dot-uve.js\"></script>";If this path ever changes or needs to vary by environment (CDN, versioned asset), it requires a code change. Consider 4. Minor: unnecessary In return new PageLivePreviewVersionBean(
renderLive.replace(HTMLPageAssetRenderedBuilder.SDK_EDITOR_SCRIPT_SOURCE, ""), // no-op
renderWorking.replace(HTMLPageAssetRenderedBuilder.SDK_EDITOR_SCRIPT_SOURCE, ""));What looks good
|
### Proposed Changes The UVE script inserted from the Frontend side now is included in the `entity.page.rendered` attribute that comes from the Backend. This will lighten the load on the frontend and reduce client-side code manipulation. This PR just include the FE changes it depends on this PR [add script for style editor in the BE side](#34927) ### Checklist - [ ] Delete the `SDK_EDITOR_SCRIPT_SOURCE` const and remove the script injection from the FE. - [ ] fix unit test in the FE. This PR fixes: #34905
### Proposed Changes The UVE script inserted from the Frontend side now is included in the `entity.page.rendered` attribute that comes from the Backend. This will lighten the load on the frontend and reduce client-side code manipulation. This PR just include the BE changes to include the UVE script in the page.rendered ### Checklist - [ ] Add `SDK_EDITOR_SCRIPT_SOURCE` const in the BE for non LIVE mode, and include it in the `page.rendered` variable. - [ ] Add and fix test. This PR fixes: #34905
### Proposed Changes The UVE script inserted from the Frontend side now is included in the `entity.page.rendered` attribute that comes from the Backend. This will lighten the load on the frontend and reduce client-side code manipulation. This PR just include the FE changes it depends on this PR [add script for style editor in the BE side](#34927) ### Checklist - [ ] Delete the `SDK_EDITOR_SCRIPT_SOURCE` const and remove the script injection from the FE. - [ ] fix unit test in the FE. This PR fixes: #34905
Proposed Changes
The UVE script inserted from the Frontend side now is included in the
entity.page.renderedattribute that comes from the Backend. This will lighten the load on the frontend and reduce client-side code manipulation.This PR just include the BE changes to include the UVE script in the page.rendered
Checklist
SDK_EDITOR_SCRIPT_SOURCEconst in the BE for non LIVE mode, and include it in thepage.renderedvariable.This PR fixes: #34905
This PR fixes: #34905