-
Notifications
You must be signed in to change notification settings - Fork 1
Review fixes #11
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
Open
aristath
wants to merge
10
commits into
main
Choose a base branch
from
ari/review-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+819
−243
Open
Review fixes #11
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
876f8ed
fix textdomain issues
aristath e856bfb
Rename .inc file to .php
aristath 6226e63
WIP - more fixes
aristath 68b5383
Update readme files - props @claude
aristath a7fde12
CS fixes
aristath 1078f0e
JS linting fixes
aristath ac689fb
Update assets/copy-color.js
aristath 878fc39
Update assets/admin.js
aristath 80e01a2
Add contributors
aristath fc082bb
Use ob_start() & ob_get_clean() to get the pattern contents
aristath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /** | ||
| * Brand Assets Admin JavaScript | ||
| * | ||
| * Handles admin settings page functionality including: | ||
| * - Color picker initialization | ||
| * - CSS loading mode toggle for popover styling section | ||
| * | ||
| * @package | ||
| * @since 0.1.0 | ||
| */ | ||
|
|
||
| /* global jQuery */ | ||
|
|
||
| jQuery( document ).ready( function ( $ ) { | ||
| // Initialize WordPress color pickers | ||
| $( '.brand-assets-color-picker' ).wpColorPicker(); | ||
|
|
||
| /** | ||
| * Toggle popover styling section visibility based on CSS loading mode | ||
| * | ||
| * When "Load no CSS" is selected, hide the styling options and show | ||
| * an informational notice instead, since CSS variables won't be output. | ||
| */ | ||
| function togglePopoverStyling() { | ||
| if ( $( '#css_loading_mode' ).val() === 'none' ) { | ||
| $( '#popover-styling-section' ).hide(); | ||
| $( '#popover-styling-notice' ).show(); | ||
| } else { | ||
| $( '#popover-styling-section' ).show(); | ||
| $( '#popover-styling-notice' ).hide(); | ||
| } | ||
| } | ||
|
|
||
| // Run on page load | ||
| togglePopoverStyling(); | ||
|
|
||
| // Run when CSS loading mode changes | ||
| $( '#css_loading_mode' ).on( 'change', togglePopoverStyling ); | ||
| } ); | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /** | ||
| * Copy color values to clipboard when clicking color swatches | ||
| * | ||
| * @package | ||
aristath marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * @since 0.1.0 | ||
| */ | ||
|
|
||
| /* global navigator */ | ||
|
|
||
| document.addEventListener( 'DOMContentLoaded', function () { | ||
| // Copy the color value to clipboard when clicking the color swatch. | ||
| const colorElements = document.querySelectorAll( | ||
| '.wp-block-brand-assets-brand-assets .swatch code' | ||
| ); | ||
|
|
||
| if ( 0 < colorElements.length ) { | ||
| colorElements.forEach( ( element ) => { | ||
| element.addEventListener( 'click', async function ( event ) { | ||
| event.preventDefault(); | ||
| let color = element.textContent; | ||
|
|
||
| // Remove the "CMYK: " prefix if it exists. | ||
| if ( color.startsWith( 'CMYK:' ) ) { | ||
| color = color.substring( 5 ); | ||
| } | ||
|
|
||
| color = color.trim(); | ||
|
|
||
| // Try modern Clipboard API first | ||
| try { | ||
| await navigator.clipboard.writeText( color ); | ||
|
|
||
| // Add visual feedback | ||
| element.classList.add( 'copied' ); | ||
| setTimeout( () => { | ||
| element.classList.remove( 'copied' ); | ||
| }, 500 ); | ||
| } catch ( err ) { | ||
| // Fallback to execCommand | ||
| const textArea = document.createElement( 'textarea' ); | ||
| textArea.value = color; | ||
| textArea.style.position = 'fixed'; | ||
| textArea.style.left = '-999999px'; | ||
| document.body.appendChild( textArea ); | ||
| textArea.select(); | ||
|
|
||
| try { | ||
| document.execCommand( 'copy' ); | ||
|
|
||
| // Add visual feedback | ||
| element.classList.add( 'copied' ); | ||
| setTimeout( () => { | ||
| element.classList.remove( 'copied' ); | ||
| }, 500 ); | ||
| } catch ( fallbackErr ) { | ||
| console.error( 'Fallback copy failed:', fallbackErr ); // eslint-disable-line no-console | ||
| } | ||
|
|
||
| document.body.removeChild( textArea ); | ||
| } | ||
| } ); | ||
| } ); | ||
| } | ||
| } ); | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,64 @@ | ||
| #brand_assets_logo_popover { | ||
| padding: 30px; | ||
| border-radius: 10px; | ||
| /* CSS Custom Properties - can be overridden via plugin settings */ | ||
| --ba-popover-bg: #ffffff; | ||
| --ba-popover-text-color: #000000; | ||
| --ba-popover-link-color: #0073aa; | ||
| --ba-popover-border-color: #cccccc; | ||
| --ba-popover-border-width: 1px; | ||
| --ba-popover-border-radius: 8px; | ||
| --ba-popover-padding: 20px; | ||
| --ba-popover-max-width: 400px; | ||
| --ba-popover-font-size: 16px; | ||
| --ba-close-btn-color: #666666; | ||
|
|
||
| /* Apply custom properties */ | ||
| background: var(--ba-popover-bg); | ||
| color: var(--ba-popover-text-color); | ||
| border: var(--ba-popover-border-width) solid var(--ba-popover-border-color); | ||
| border-radius: var(--ba-popover-border-radius); | ||
| padding: var(--ba-popover-padding); | ||
| max-width: var(--ba-popover-max-width); | ||
| font-size: var(--ba-popover-font-size); | ||
|
|
||
| &::backdrop { | ||
| background: rgba(0, 0, 0, 0.75); | ||
| } | ||
| h1 { | ||
| font-size: 1.2em; | ||
| color: var(--ba-popover-text-color); | ||
| margin: 0 0 15px 0; | ||
| } | ||
| p { | ||
| margin: 20px 0; | ||
| margin: 10px 0; | ||
| line-height: 1.5; | ||
| color: var(--ba-popover-text-color); | ||
| } | ||
| a { | ||
| color: var(--ba-popover-link-color); | ||
| font-weight: bold; | ||
| text-decoration: underline; | ||
|
|
||
| &:hover { | ||
| opacity: 0.8; | ||
| } | ||
| } | ||
| button.close { | ||
| border: none; | ||
| background-color: #fff; | ||
| color: #ddd; | ||
| font-size: 1em; | ||
| background-color: transparent; | ||
| color: var(--ba-close-btn-color); | ||
| font-size: 1.5em; | ||
| font-weight: bold; | ||
| position: absolute; | ||
| right: 8px; | ||
| top: 5px; | ||
| padding: 5px; | ||
| line-height: 1; | ||
| width: 30px; | ||
| height: 30px; | ||
| cursor: pointer; | ||
|
|
||
| &:hover { | ||
| cursor: pointer; | ||
| color: #000; | ||
| opacity: 0.7; | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'ce375e68084c33fab22b'); | ||
| <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '39a3599e4610c02caf8e'); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.