Editing an SPA from Page Composer
You can enable contextual editing of an SPA to allow content contributors to browse to the app for editing in Page Composer, navigate inside the app, and edit content directly in the app.
If your SPA resides on a standalone application, you should move or embed the SPA inside a Jahia module. For example, move the SPA directly inside your
To create a page template:
- Create a template view ( for example, jnt_template/html/template.spa_name.jsp) which will contain the HTML code.
- In Jahia Studio, add a new page template using this view.
- Then, create a page from the new template in your site. Verify that the SPA correctly displays.
After creating your page template, modify the application so that you can open it for editing in Jahia.
The app can detect that is in an edit frame by checking for the presence of
window.parent.jahiaGWTParameters. If Page Composer is detected, you should switch the router to memory or hash to avoid conflicts with the edit frame.
Finally, you can add Edit buttons to specific sections of the application. Modify the button so that it calls:
window.parent.authoringApi.editContent(path, displayableName, type, inheritedTypes, uuid)
window.parent.authoringApi.editContent('/sites/digitall/contents/destinations/xyz', 'XYZ xyz', ['jnt:content'], ['gant:destination'], 'f9fa345e-a579-4d69-a896-4a69e7aa33f1')
paththe path of the content
displayableNamethe displayable name of the content
typethe base type of the content
inheritedTypesthe inherited types of the content
uuidthe identifier of the content
We can also call directly the API of the content editor to modify the content, you can refer to this link Open Content Editor UI