-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
FIX - Improve Link Entry #2779
Closed
Closed
FIX - Improve Link Entry #2779
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f3a8d8f
Make inline link entry same as image block
tg-ephox f69e1c8
Fix wrapping on long url, dont show settings for image link
tg-ephox e81c4f0
Adding tests
tg-ephox c714b95
Finished tests
tg-ephox ad724e9
Fix button border z-index
tg-ephox ccda5e3
modify image block toolbars, increase speed of link entry animation
tg-ephox 00b357c
Fixed link button URL not being added
tg-ephox 8d00a6f
Fix linting
tg-ephox f29ed5e
Merge branch 'master' into try/2715-improve-link-entry
tg-ephox 1ff418f
ImageBlock - differentiate focus between image and caption
tg-ephox 75bc17f
Make caption toolbar consistent on video and embed blocks
tg-ephox 3d886b2
Address review issues
tg-ephox 218de2f
Resize link entry based on toolbar group size
tg-ephox 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 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 |
---|---|---|
@@ -1,43 +1,3 @@ | ||
.blocks-format-toolbar { | ||
display: inline-flex; | ||
} | ||
|
||
.blocks-format-toolbar__link-modal { | ||
position: absolute; | ||
box-shadow: 0px 3px 20px rgba( 18, 24, 30, .1 ), 0px 1px 3px rgba( 18, 24, 30, .1 ); | ||
border: 1px solid #e0e5e9; | ||
background: #fff; | ||
width: 305px; | ||
display: inline-flex; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
font-family: $default-font; | ||
font-size: $default-font-size; | ||
line-height: $default-line-height; | ||
z-index: z-index( '.blocks-format-toolbar__link-modal' ); | ||
|
||
.blocks-url-input { | ||
width: auto; | ||
} | ||
} | ||
|
||
.blocks-format-toolbar__link-value { | ||
padding: 10px; | ||
flex-grow: 1; | ||
overflow: hidden; | ||
position: relative; | ||
|
||
&:after { | ||
@include long-content-fade( $size: 40% ); | ||
} | ||
} | ||
|
||
.blocks-format-toolbar__link-settings { | ||
border-top: 1px solid $light-gray-500; | ||
width: 100%; | ||
padding: 10px 8px; | ||
|
||
.blocks-base-control { | ||
margin: 0; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { IconButton } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
|
@@ -11,7 +10,7 @@ import './editor.scss'; | |
import './style.scss'; | ||
import { registerBlockType, source } from '../../api'; | ||
import Editable from '../../editable'; | ||
import UrlInput from '../../url-input'; | ||
import UrlInputButton from '../../url-input/button'; | ||
import BlockControls from '../../block-controls'; | ||
import BlockAlignmentToolbar from '../../block-alignment-toolbar'; | ||
import ColorPalette from '../../color-palette'; | ||
|
@@ -58,6 +57,7 @@ registerBlockType( 'core/button', { | |
edit( { attributes, setAttributes, focus, setFocus, className } ) { | ||
const { text, url, title, align, color } = attributes; | ||
const updateAlignment = ( nextAlign ) => setAttributes( { align: nextAlign } ); | ||
const updateUrl = ( urlSettings ) => setAttributes( { url: urlSettings.url } ); | ||
|
||
return [ | ||
focus && ( | ||
|
@@ -75,18 +75,8 @@ registerBlockType( 'core/button', { | |
onChange={ ( value ) => setAttributes( { text: value } ) } | ||
formattingControls={ [ 'bold', 'italic', 'strikethrough' ] } | ||
keepPlaceholderOnFocus | ||
extraToolbarButtons={ <UrlInputButton showSettings={ false } url={ url } onChange={ updateUrl } /> } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this prop? Can't we just put this putting in the |
||
/> | ||
{ focus && | ||
<form | ||
className="blocks-format-toolbar__link-modal" | ||
onSubmit={ ( event ) => event.preventDefault() }> | ||
<UrlInput | ||
value={ url } | ||
onChange={ ( value ) => setAttributes( { url: value } ) } | ||
/> | ||
<IconButton icon="editor-break" label={ __( 'Apply' ) } type="submit" /> | ||
</form> | ||
} | ||
{ focus && | ||
<InspectorControls key="inspector"> | ||
<ColorPalette | ||
|
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could refactor this component to be just a functional component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can as it needs the lifecycle methods?