-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK: Enable Inline editing in text fields for React SDK #28944
Labels
Comments
Passed IQATested in Screen.Recording.2024-09-03.at.11.49.02.AM.mov |
3 tasks
Fixed, tested on trunk // Docker // FF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
As a author, I want to be able to enable inline editing in text fields for pages being in Universal Visual Editor, so that users can easily edit text content directly on the page.
Acceptance Criteria
Proposed Objective
Core Features
Proposed Priority
Priority 3 - Average
External Links... Slack Conversations, Support Tickets, Figma Designs, etc.:
The way that this works in the traditional approach is that developers needs to "mark" the sections of the contentlet being rendered that can be inline edited.
The way that is marked is like this:
This will show a blue border around the text to indicate to the user that this is editable and when the user clicks it will start TinyMCE floating on top of the element.
Warning
If the contentlet lives in more than one page, it will pop up the corresponding dialog.
Developers needs to pass 4 data attributes to their HTML in the container:
language
: well, you knowmode
: this will set up the TinyMCE toolbar, big or small, see image here.inode
: you knowfield-name
: the var name of the field of the contentlet user can edit.With this information, we can trigger a workflow action (REST) to save/update the corresponding contentlet field, like this:
And this will edit the contentlet and save the new text.
Headless
Since we should not inject anything yo our customer headless implementations, we need to write a component in our SDK that allow developers to "mark" the text they want to be editable.
We need to provide a
<EditableText / >
component.It should work the same BUT we have a new mode:
plain
which is no TinyMCE but to use the attribute contenteditable, alsoplain
should be default, meaning if nomode
is passed, it defaults toplain
. So now we will have 3 modes:full
: TinyMCE big toolbarminimal
: TinyMCE small toolbarplain
: NO TinyMCE andcontenteditable
(this is the default mode)And in our React application, developers can use like this:
EditableText
ComponentOnClick
, it will initialize TinyMCE if the mode is full or minimal, or use the contenteditable attribute for plain.OnBlur
, it will save the content by posting a message with the required information to the UVE.Loading TinyMCE
LIVE_MODE
no trace of TinyMCE should be in the bundleAssumptions & Initiation Needs
Quality Assurance Notes & Workarounds
N/A
The text was updated successfully, but these errors were encountered: