-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
774 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,10 @@ | |
width: 100%; | ||
max-height: 100%; | ||
overflow: auto; | ||
|
||
img { | ||
display: inline; | ||
} | ||
} | ||
} | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createSlotFill, PanelBody } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ItemList from './item-list'; | ||
|
||
const { Fill, Slot } = createSlotFill( 'InserterResultsPortal' ); | ||
|
||
const InserterResultsPortal = ( { items, title, onSelect } ) => { | ||
return ( | ||
<Fill> | ||
<PanelBody | ||
title={ title } | ||
> | ||
<ItemList items={ items } onSelect={ onSelect } onHover={ () => {} } /> | ||
</PanelBody> | ||
</Fill> | ||
); | ||
}; | ||
|
||
InserterResultsPortal.Slot = Slot; | ||
|
||
export default InserterResultsPortal; |
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,45 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import MediaUpload from '../../../media-upload'; | ||
|
||
export const name = 'core/image'; | ||
|
||
export const settings = { | ||
id: 'image', | ||
|
||
title: __( 'Inline Image' ), | ||
|
||
type: 'image', | ||
|
||
icon: 'format-image', | ||
|
||
category: 'inline', | ||
|
||
edit( { onSave } ) { | ||
return ( | ||
<MediaUpload | ||
type="image" | ||
onSelect={ ( media ) => onSave( media ) } | ||
onClose={ () => onSave( null ) } | ||
render={ ( { open } ) => { | ||
open(); | ||
return null; | ||
} } | ||
/> | ||
); | ||
}, | ||
|
||
save( { id, url, alt, width } ) { | ||
return ( | ||
<img | ||
className={ `wp-image-${ id }` } | ||
// set width in style attribute to prevent Block CSS from overriding it | ||
style={ { width: `${ Math.min( width, 150 ) }px` } } | ||
src={ url } | ||
alt={ alt } | ||
/> | ||
); | ||
}, | ||
}; |
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,10 @@ | ||
import { registerToken } from '../tokens/registration'; | ||
import * as image from './image'; | ||
|
||
export const registerCoreTokens = () => { | ||
[ | ||
image, | ||
].forEach( ( { name, settings } ) => { | ||
registerToken( name, settings ); | ||
} ); | ||
}; |
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
Oops, something went wrong.