Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
Sep 21, 2018
Jan 07, 2022
CMS UI
Closed, Acceptance tests pass
A new message will be published with topic "beta/epiReady", similar to the already existing "beta/contentSaved". The message will contain information regarding if the current content is editable. Together with a new beta field on the global window.epi object, a developer can know if a content is editable or not in their client side rendering code. An example of how to use this feature could be something like this:
// Listen to the `beta/epiReady` event to update the `context` property. window.addEventListener('load', () => { // Expect `epi` to be there after the `load` event. If it's not then we're // not in any editing context. if (!window.epi) { return; } function logContext() { // The event only has `isEditable`, but the epi object has both properties. var context = { inEditMode: window.epi.beta.inEditMode, isEditable: window.epi.beta.isEditable }; console.log(context); } // Check for beta and that ready is an actual true value (not just truthy). if (window.epi.beta && window.epi.beta.ready === true) { // `beta/epiReady` already fired, so just grab the `isEditable` from the window.epi object. logContext(); } else if (window.epi.subscribe) { // The subscribe method won't be available in View mode, so we need to check for it. // If the `beta/epiReady` event hasn't happened yet, then subscribe to it. window.epi.subscribe('beta/epiReady', () => logContext()); } });