Skip to content
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

Mark Link Creation Interface as Experimental #18110

Merged
merged 5 commits into from Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/block-editor/README.md
Expand Up @@ -302,10 +302,6 @@ _Related_

- <https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inspector-controls/README.md>

<a name="LinkControl" href="#LinkControl">#</a> **LinkControl**

Undocumented declaration.

getdave marked this conversation as resolved.
Show resolved Hide resolved
<a name="MediaPlaceholder" href="#MediaPlaceholder">#</a> **MediaPlaceholder**

_Related_
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/index.js
Expand Up @@ -22,7 +22,7 @@ export { default as __experimentalGradientPickerControl } from './gradient-picke
export { default as InnerBlocks } from './inner-blocks';
export { default as InspectorAdvancedControls } from './inspector-advanced-controls';
export { default as InspectorControls } from './inspector-controls';
export { default as LinkControl } from './link-control';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When was this component first introduced?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this component is not being used, yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are integrating the <LinkControl /> with the <NavigationMenuItem /> on this PR: #18062

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't mean it was not used by plugins. Did we check at least in the plugins repository? Do you know when we introduce it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch was based on try/unified-link-ui--experimental, and just merged with this one as well. The <LinkControl /> component is totally new.

Copy link
Contributor

@talldan talldan Oct 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, as @retrofox mentions this PR wasn't merged to master but another branch that still has an open PR (#17846). LinkControl has never been merged to master so all should be fine.

export { default as __experimentalLinkControl } from './link-control';
export { default as MediaPlaceholder } from './media-placeholder';
export { default as MediaUpload } from './media-upload';
export { default as MediaUploadCheck } from './media-upload/check';
Expand Down
Expand Up @@ -50,9 +50,9 @@ const LinkControlInputSearch = ( {
value={ value }
onChange={ selectItemHandler }
placeholder={ __( 'Search or type url' ) }
renderSuggestions={ renderSuggestions }
fetchLinkSuggestions={ fetchSuggestions }
handleURLSuggestions={ true }
__experimentalRenderSuggestions={ renderSuggestions }
__experimentalFetchLinkSuggestions={ fetchSuggestions }
talldan marked this conversation as resolved.
Show resolved Hide resolved
__experimentalHandleURLSuggestions={ true }
/>

<IconButton
Expand Down
13 changes: 8 additions & 5 deletions packages/block-editor/src/components/url-input/index.js
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { throttle, isFunction, noop } from 'lodash';
import { throttle, isFunction } from 'lodash';
import classnames from 'classnames';
import scrollIntoView from 'dom-scroll-into-view';

Expand Down Expand Up @@ -71,7 +71,10 @@ class URLInput extends Component {
}

updateSuggestions( value ) {
const { fetchLinkSuggestions, handleURLSuggestions } = this.props;
const {
__experimentalFetchLinkSuggestions: fetchLinkSuggestions,
__experimentalHandleURLSuggestions: handleURLSuggestions,
} = this.props;
if ( ! fetchLinkSuggestions ) {
return;
}
Expand Down Expand Up @@ -255,7 +258,7 @@ class URLInput extends Component {
id,
isFullWidth,
hasBorder,
renderSuggestions,
__experimentalRenderSuggestions: renderSuggestions,
placeholder = __( 'Paste URL or type to search' ),
value = '',
autoFocus = true,
Expand Down Expand Up @@ -368,12 +371,12 @@ export default compose(
withSelect( ( select, props ) => {
// If a link suggestions handler is already provided then
// bail
if ( isFunction( props.fetchLinkSuggestions ) ) {
if ( isFunction( props.__experimentalFetchLinkSuggestions ) ) {
return;
}
const { getSettings } = select( 'core/block-editor' );
return {
fetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions,
__experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions,
getdave marked this conversation as resolved.
Show resolved Hide resolved
};
} )
)( URLInput );
4 changes: 2 additions & 2 deletions playground/src/index.js
Expand Up @@ -16,7 +16,7 @@ import {
BlockList,
WritingFlow,
ObserveTyping,
LinkControl,
__experimentalLinkControl,
getdave marked this conversation as resolved.
Show resolved Hide resolved
} from '@wordpress/block-editor';
import {
Popover,
Expand Down Expand Up @@ -123,7 +123,7 @@ function App() {
<WritingFlow>
<ObserveTyping>
{ isVisible &&
<LinkControl
<__experimentalLinkControl
currentLink={ link }
currentSettings={ linkSettings }
onLinkChange={ ( theLink ) => {
Expand Down