-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: visual editing (click-to-edit) #7374
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
Conversation
First, thanks again for a very cool feature! I've tried it and it works with objects and lists, but not with Variable type lists. These are a bit of a special case anyway and I only figured this out because I was reviewing #7296 right before this. Since this will be a beta feature anyway (@martinjagodic correct me if I'm wrong) and until now, we didn't even have proper previews for these lists, I don't think this is really a blocker. Maybe just something to keep in mind. If you have time, you can have a quick peek at #7296 to see if you see any possible conflicts of interest (I don't think I do). I'm looking to release both of these on Tuesday. @martinjagodic could you advise on how to approach the docs update for this? |
* feat(nested collections): allow non-index files (decaporg#7359) * feat(nested collections): allow non-index files This commit fixes decaporg#4972 to allow nested folders with additional content beyond an index file. Side effect: To keep the feature simple, this will now show index files as pages within a folder in NetlifyCMS. This enables creating additional files alongside the given index, but is a change in behavior from the current implementation. Co-authored-by: Eric Gade <[email protected]> * test(e2e): adapt to new way nested collections work We use regexps as otherwise .contains("Sub Directory") would also match "Another Sub Directory" --------- Co-authored-by: Andrew Dunkman <[email protected]> Co-authored-by: Eric Gade <[email protected]> Co-authored-by: Anze Demsar <[email protected]> * fix(markdown): convert inline CSS from Google Docs to Markdown (decaporg#7351) Extends the HTML to Markdown conversion to better support bold and italic formatting from Google Docs, which generates inline styles on a `span` element instead of strong/b/em/i type elements. Co-authored-by: Anze Demsar <[email protected]> * feat: visual editing (click-to-edit) (decaporg#7374) * refactor: clean up controlRef handling * feat: add click-to-edit * test: update snapshots --------- Co-authored-by: Anze Demsar <[email protected]> * fix(widgetsFor): return widgets for variable type lists (decaporg#7296) When using a Variable Type list widget and a custom preview component, the `widgetsFor` helper would only return a `data` list with each of the items in the list, not a `widgets` list, e.g. {"data" => {"markdown" => "# Title"} {"type" => "block_body"} } {"widgets" => undefined} 🚫 The `widgets` list should also be supplied, particularly for nested Markdown widgets, so a fully formatted preview can be rendered: {"data" => {"markdown" => "# Title"} {"type" => "block_body"} } {"widgets" => {"markdown" => Object} ✅ } This extends support in `widgetsFor` to detect variable type list widgets and correctly construct the `widgets` return value. As reported at decaporg#2307 (comment) Co-authored-by: Anze Demsar <[email protected]> * chore(release): publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * fix(ObjectControl): hotfix nested object validation (decaporg#7385) * chore(release): publish - [email protected] - [email protected] - [email protected] * chore: update to upload-artifact@v4 (decaporg#7388) * feat(nested collections) legacy mode (decaporg#7387) * feat(nested-collections): opt-in to legacy nested folder behaviour * style: lint * feat(nested-collection): default subfolders to true * test(nested-collections): keep the tests in the subfolders: false scenario * chore(release): publish - [email protected] - [email protected] - [email protected] * fix(nested-i18n): pass newPath only when customPath differs from current path (decaporg#7418) * fix(decaporg#7371): Duplicate Localized Content When Duplicating Entries with i18n Enabled (decaporg#7372) * chore: add i18n to EntryObject type * fix: draftDuplicateEntry function duplicate i18n data --------- Co-authored-by: Anze Demsar <[email protected]> * chore(release): publish - [email protected] - [email protected] - [email protected] * Update README.md, fix spelling error (decaporg#7472) * PNW-2564 - duplicate workflow (#21) * Merge with feature/PNW-2564_duplicate--wip * feat: duplicate workflow wip * feat: duplicate workflow wip * feat: added local empty draft * feat: added isCustomEntry to edit state with data * feat: added function to retrieve current unpublished entries * feat: added enty and avoid problems if empty is missing * feat: refactor context structure and error name with integration --------- Co-authored-by: Felix Gnass <[email protected]> Co-authored-by: Andrew Dunkman <[email protected]> Co-authored-by: Eric Gade <[email protected]> Co-authored-by: Anze Demsar <[email protected]> Co-authored-by: Dominic Cleal <[email protected]> Co-authored-by: Anze Demsar <[email protected]> Co-authored-by: starkovio <[email protected]> Co-authored-by: kare-rentelligent <[email protected]>
Summary
This PR introduces a new visual editing mode that allows users to click directly on content in the preview pane to edit fields, like in Storyblok or TinaCMS. This works for preview widgets as well as for custom full-page preview templates.
The preview templates themselves don't need to do anything in order to support this feature. This is made possible by using @vercel/stega to invisibly encode information about the origin of the values directly in the rendered text.
visual-editing.mov
The new visual editing mode is offered as an alternative to scroll sync, providing a more direct way to interact with content. When enabled, scroll sync is automatically disabled to prevent interference.
Note: Currently, all strings get encoded. It would probably make sense to allow fields to opt-out of this behavior, so that things like dates or URLs which might get further processed don't break. I left this out as the change set is already quite big and the feature as a whole is already opt-in.
Technical Details
This PR builds on top of a major refactoring (60040b8) that simplified widget reference handling, which was already in place for validation purposes.
These foundational changes were necessary to implement reliable field focusing and scrolling behavior.
Test plan
Enable visual editing for a collection in the config by adding:
editor.visualEditing: true to your collection configuration
Create or edit a post with markdown content
Click on any text in the preview pane
Verify that:
Test with custom widgets and preview templates:
Checklist
Please add a
x
inside each checkbox:A picture of a cute animal (not mandatory but encouraged)
🐨