fix(list-table): port ACF _acf-copyable.js for click-to-copy field keys - #520
Open
faisalahammad wants to merge 1 commit into
Open
fix(list-table): port ACF _acf-copyable.js for click-to-copy field keys#520faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
- Add _acf-copyable.js model gated on the four edit-acf-* list screens, wraps .column-acf-key in span.copyable and copies via navigator.clipboard. - Wire the partial into the acf.js entry bundle; CSS for hover icon and green-check already shipped in 6.9.2 via WordPress#506, so the markup completes the feature with no further CSS work. Fixes WordPress#508
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports upstream ACF 6.8.5's
assets/src/js/_acf-copyable.jsso the Key column on the Field Groups / Post Types / Taxonomies / Options Pages list tables becomes click-to-copy, matching the existing field-group editor behavior.The CSS for the hover copy icon and the green check on
.copiedwas already synced from ACF 6.8.5 in #506, but was inert because no JS was emitting the.copyablemarkup. This PR adds the JS half and wires it into theacf.jsentry bundle. Theacfscript handle is already enqueued on the fouredit-acf-*list screens, so no PHP or CSS change is required.Diff:
acf.Modelgated onpagenowmatchingedit-acf-field-group,edit-acf-post-type,edit-acf-taxonomy,edit-acf-ui-options-page. Finds.column-acf-keycells, wraps the key text in aspan.copyable(addscopy-unsupportedwhennavigator.clipboardis unavailable), and handles the copy click.import './_acf-copyable.js';after the_acf-tooltip.jsimport, matching upstream's entry ordering.The only behavioral deviation from upstream: the original guard reads
if ( ! $copyableElements ), which is dead because jQuery objects are always truthy; this port uses! $copyableElements.lengthso the early return actually fires for empty pages. Same net behavior, strict correctness improvement.How to test
acf.jsis checked in underassets/build/and shipped; verify locally withnpm run buildif needed).navigator.clipboardis unavailable in non-secure contexts; no JS errors.Use of AI Tools
AI tooling was used to research upstream ACF source, port the JS model, run validation checks (webpack build, lint, static analysis), and draft this description. The diff was reviewed and adjusted manually.
Screenshots