Repository navigation
fix(rte): insert image selected from Assets folder (#11) - #13
Merged
Merged
Conversation
The percadvimage TinyMCE plugin assumed pathItem.PathItem.folderPaths
returned by PercPathService.getPathItemById was a string and called
String.prototype.replace on it. The REST service now returns an array,
so the call threw 'pathItem.PathItem.folderPaths.replace is not a
function' and aborted getImageData before the inline image element was
populated with sys_dependentvariantid / sys_dependentid. The resulting
<IMG> was missing those attributes, causing the server-side
PSInlineLinkField to throw 'Missing required inline link parameter:
sys_dependentvariantid' on save, and a subsequent
createAssetWidgetRelationship call was made with the unresolved id
'-1-101-undefined' (java.lang.NumberFormatException).
Normalize folderPaths to a string (handling both string and array
responses, matching the pattern already used by PercSiteTemplatesWidget
and PercTemplateView) so the inline link element is written correctly
and the image is inserted into the Rich Text widget. Also remove the
stray console.log('Hello') debug line in the updateFileSelection
command handler.
natechadwick
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11.
Bug
When editing a Rich Text widget in the CMS UI, clicking Insert/Edit Image, browsing the Assets folder, and selecting an image produces no visible change in the editor. After clicking Save, the server throws:
In the browser console:
Root cause
modules/perc-tinymce/.../plugins/percadvimage/plugin.jsinvokedpathItem.PathItem.folderPaths.replace('/Folders/$System$/','')insidegetImageData.PercPathService.getPathItemByIdnow returnsfolderPathsas an array, so.replaceis undefined on the returned value. The thrown TypeError aborted the rest ofgetImageData, leavingcm1LinkData.fullUrl,fullVarId, andjcrpathunset. The resulting<img>element was therefore inserted withoutsys_dependentvariantid/sys_dependentid, which causes the server-side failure during inline-link processing and a malformed asset-widget relationship creation downstream.Fix
Normalize
folderPathsto a string before calling.replace, handling both the legacy string format and the new array format (same pattern already used byPercSiteTemplatesWidget.jsandPercTemplateView.js). Also remove the strayconsole.log("Hello")debug line in theupdateFileSelectioncommand handler.Files
modules/perc-tinymce/src/main/resources/META-INF/resources/sys_resources/tinymce/plugins/percadvimage/plugin.js— handle arrayfolderPaths, drop debug logCHANGELOG.md—### Fixedentry under the[8.1.7 Build GH_POST_PR_COMMIT_RUN_ID]section perAGENTS.md