Add server-side copy/cut/paste/duplicate for blocks - #71
Conversation
Each block item gets a single toolbar (collapse, copy, cut, paste, duplicate, config, delete). Copy/cut/duplicate serialize the item's full saved data server-side via a new onCopyItem handler (Form widget + getSaveData()), which correctly captures switches, mediafinders and nested repeaters that a client-side DOM scrape would miss. The clipboard (sessionStorage) round-trips through onAddItem's new _paste_data/_paste_config params, which seed the new item via an overridden getValueFromIndex() before it's rendered, so pasted blocks arrive fully populated - including populating any nested repeaters - without rebuilding the rest of the existing items. Richeditor/codeeditor widgets are refreshed after a paste fill since they bypass their own client-side init. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Split out of #68 (closed in favor of smaller, focused PRs).
Summary
onCopyItem) that builds the block's form widget and callsgetSaveData(); pasting renders the new item server-side, pre-populated from the captured payload (stored client-side insessionStoragefor the duration of the browser session).allow/ignore/tagsconstraints.See the README section "Cut, paste and duplicate blocks" for usage.
Test plan
tests/formwidgets/BlocksTest.phpverifying copy preserves nested/switch/text field values, and that pasting seeds a new item without clobbering existing onesphp artisan winter:test -p Winter.Blocks)