You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To improve the usability and extensibility of our SDK, we will introduce a new function, uveState(). This function will provide a structured object representing the current state of the User View Environment (UVE). The state will include the mode of the UVE (EDIT, PREVIEW, or LIVE) and return null if it is outside the editor. This approach allows for future enhancements without breaking existing client implementations.
Background
While working on the Future Time Machine (FTM), we encountered difficulties in distinguishing between various UVE modes (EDIT, PREVIEW, LIVE) and in determining when custom Edit tools should be displayed or hidden.
The existing isInsideEditor function, originally designed for Edit Mode only, is now insufficient. To address this, we propose replacing it with uveState(). This function provides a structured and extensible way to retrieve UVE-related information, making the SDK more robust and developer-friendly.
Task
Implement uveState():
The function should return an object in the following format:
Explain its purpose and how it improves over isInsideEditor().
Include examples for retrieving the UVE state and handling various modes.
Update the isInsideEditor() documentation to highlight its deprecation and recommend using uveState().
Notes
Extensibility: The structured object returned by uveState() allows for future additions (e.g., adding properties like userRole, siteId, etc.) without breaking existing implementations.
Developer Clarity: Explicitly differentiating between UVE modes (Edit, Preview, Live) simplifies the developer experience and reduces potential for errors.
The text was updated successfully, but these errors were encountered:
How this will affect the #30957 and #31134? Should this happen before? also... now that we will officially have EDIT, PREVIEW, LIVE mode... isn't that will affect this?
This should be part of the public API; so users can hide any custom implementation if they want to; NOT PART of Frameworks SDK; so it should not affect this ticket: #30957
rjvelazco
changed the title
SDK: Add isEditMode() and isPreviewMode() Functions
SDK: Add uveState() function
Jan 23, 2025
Parent Issue
#30943
Overview
To improve the usability and extensibility of our SDK, we will introduce a new function,
uveState()
. This function will provide a structured object representing the current state of the User View Environment (UVE). The state will include themode
of the UVE (EDIT
,PREVIEW
, orLIVE
) and returnnull
if it is outside the editor. This approach allows for future enhancements without breaking existing client implementations.Background
While working on the Future Time Machine (FTM), we encountered difficulties in distinguishing between various UVE modes (
EDIT
,PREVIEW
,LIVE
) and in determining when custom Edit tools should be displayed or hidden.The existing
isInsideEditor
function, originally designed for Edit Mode only, is now insufficient. To address this, we propose replacing it withuveState()
. This function provides a structured and extensible way to retrieve UVE-related information, making the SDK more robust and developer-friendly.Task
Implement
uveState()
:null
.Update
isInsideEditor()
:isInsideEditor()
and update its description to referenceuveState()
as the recommended approach.Documentation:
uveState()
, including examples of how to use it.isInsideEditor()
to recommend the use ofuveState()
instead.Update Examples:
uveState()
instead ofisInsideEditor()
.Testing:
uveState()
function to ensure it returns the correct state under different scenarios (Edit, Preview, Live, Outside Editor).Proposed Objective
Core Features
Proposed Priority
Priority 3 - Average
Acceptance Criteria
Tasks
Use case
core/examples/nextjs/src/components/shared/contentlets.js
Lines 19 to 36 in 6a4e03c
We can use this new
uveState
to show the edit button only in Edit Mode. Example:Documentation
uveState()
:isInsideEditor()
.isInsideEditor()
documentation to highlight its deprecation and recommend usinguveState()
.Notes
uveState()
allows for future additions (e.g., adding properties likeuserRole
,siteId
, etc.) without breaking existing implementations.The text was updated successfully, but these errors were encountered: