-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into add/sharing-safeguard-post
- Loading branch information
Showing
81 changed files
with
823 additions
and
215 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
5 changes: 5 additions & 0 deletions
5
projects/packages/classic-theme-helper/changelog/update-broken-phpdoc
This file contains 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,5 @@ | ||
Significance: patch | ||
Type: fixed | ||
Comment: Updated a comment, not changing any logic. | ||
|
||
|
This file contains 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
4 changes: 4 additions & 0 deletions
4
projects/packages/external-media/changelog/feat-external-media-import-button
This file contains 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,4 @@ | ||
Significance: minor | ||
Type: added | ||
|
||
External Media: Add Import button in Media Library |
4 changes: 4 additions & 0 deletions
4
projects/packages/external-media/changelog/feat-external-media-track-events
This file contains 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,4 @@ | ||
Significance: minor | ||
Type: added | ||
|
||
External Media: Add track events to the Import page and modal |
4 changes: 4 additions & 0 deletions
4
projects/packages/external-media/changelog/media-library-tracks-2
This file contains 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,4 @@ | ||
Significance: patch | ||
Type: added | ||
|
||
Media Library: add track event to the Import Media button |
This file contains 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,4 @@ | ||
Significance: patch | ||
Type: added | ||
|
||
Media Library: add track events for upload from URL feature |
29 changes: 29 additions & 0 deletions
29
projects/packages/external-media/src/features/admin/external-media-import-button.js
This file contains 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,29 @@ | ||
import jetpackAnalytics from '@automattic/jetpack-analytics'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
document.addEventListener( 'DOMContentLoaded', function () { | ||
const addNewButton = document.querySelector( 'a.page-title-action' ); | ||
if ( addNewButton ) { | ||
const buttonContainer = document.createElement( 'div' ); | ||
buttonContainer.className = 'wpcom-media-library-action-buttons'; | ||
|
||
const importButton = document.createElement( 'a' ); | ||
importButton.className = 'button'; | ||
importButton.role = 'button'; | ||
importButton.innerHTML = __( 'Import Media', 'jetpack-external-media' ); | ||
importButton.href = window.JETPACK_EXTERNAL_MEDIA_IMPORT_BUTTON?.href; | ||
importButton.onclick = function () { | ||
jetpackAnalytics.tracks.recordEvent( 'jetpack_external_media_import_media_button_click', { | ||
page: 'media-library', | ||
} ); | ||
}; | ||
|
||
const parentNode = addNewButton.parentNode; | ||
const nextSibling = addNewButton.nextSibling; | ||
|
||
buttonContainer.appendChild( addNewButton ); | ||
buttonContainer.appendChild( importButton ); | ||
|
||
parentNode.insertBefore( buttonContainer, nextSibling ); | ||
} | ||
} ); |
12 changes: 12 additions & 0 deletions
12
projects/packages/external-media/src/features/admin/external-media-import-button.scss
This file contains 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,12 @@ | ||
.wpcom-media-library-action-buttons { | ||
display: inline-flex; | ||
flex-wrap: wrap; | ||
gap: 4px; | ||
|
||
> a { | ||
position: relative; | ||
top: -3px; | ||
margin-left: 0; | ||
vertical-align: baseline; | ||
} | ||
} |
This file contains 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 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 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
24 changes: 24 additions & 0 deletions
24
projects/packages/external-media/src/shared/media-browser/media-browser-select-button.js
This file contains 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,24 @@ | ||
import { Button } from '@wordpress/components'; | ||
import React from 'react'; | ||
|
||
/** | ||
* MediaBrowserSelectButton component | ||
* | ||
* @param {object} props - The component props | ||
* @param {string} props.label - The label of the button | ||
* @param {boolean} props.isLoading - Whether the button is loading | ||
* @param {boolean} props.disabled - Whether the button is disabled | ||
* @param {Function} props.onClick - To handle the click | ||
* @return {React.ReactElement} - JSX element | ||
*/ | ||
const MediaBrowserSelectButton = ( { label, isLoading, disabled, onClick } ) => { | ||
return ( | ||
<div className="jetpack-external-media-browser__media__toolbar"> | ||
<Button variant="primary" isBusy={ isLoading } disabled={ disabled } onClick={ onClick }> | ||
{ label } | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MediaBrowserSelectButton; |
12 changes: 12 additions & 0 deletions
12
projects/packages/external-media/src/shared/media-browser/use-page-source.js
This file contains 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,12 @@ | ||
import { useSelect } from '@wordpress/data'; | ||
|
||
const usePageSource = () => { | ||
const isEditor = useSelect( select => !! select( 'core/editor' ), [] ); | ||
|
||
if ( isEditor ) { | ||
return 'editor'; | ||
} | ||
return 'media-library'; | ||
}; | ||
|
||
export default usePageSource; |
Oops, something went wrong.