-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Simplify insertion point #30301
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
Merged
Merged
Simplify insertion point #30301
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
46ff56d
Partial revert
ellatrix a7a3139
Pass position info directly to inserter
ellatrix 9d7387f
Fix typo
ellatrix f9f19ae
Remove getBlockInsertionPoint
ellatrix ff0a461
Remove dead prop
ellatrix db53bcd
Add for site editor
ellatrix b4817ab
Add fallback to selected block position
ellatrix 9237f37
Reuse existing experimental prop
ellatrix 50ce7ff
Pass to search results
ellatrix 98bb5aa
Create separate experimental selector and add docs
ellatrix 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
Next
Next commit
Partial revert
- Loading branch information
commit 46ff56dd9942e113f0dbe73cbaad5770ce46dc58
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
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 |
|---|---|---|
|
|
@@ -1393,32 +1393,9 @@ export function blocksMode( state = {}, action ) { | |
| } | ||
|
|
||
| /** | ||
| * A helper for resetting the insertion point state. | ||
| * | ||
| * @param {Object} state Current state. | ||
| * @param {Object} action Dispatched action. | ||
| * @param {*} defaultValue The default value for the reducer. | ||
| * | ||
| * @return {*} Either the default value if a reset is required, or the state. | ||
| */ | ||
| function resetInsertionPoint( state, action, defaultValue ) { | ||
| switch ( action.type ) { | ||
| case 'CLEAR_SELECTED_BLOCK': | ||
| case 'SELECT_BLOCK': | ||
| case 'SELECTION_CHANGE': | ||
| case 'REPLACE_INNER_BLOCKS': | ||
| case 'INSERT_BLOCKS': | ||
| case 'REMOVE_BLOCKS': | ||
| case 'REPLACE_BLOCKS': | ||
| return defaultValue; | ||
|
Member
Author
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. Note that this is no longer needed. The inserter state will be overwritten when the inserter closes or reopens. |
||
| } | ||
|
|
||
| return state; | ||
| } | ||
|
|
||
| /** | ||
| * Reducer returning the insertion point position, consisting of the | ||
| * rootClientId and an index. | ||
| * Reducer returning the block insertion point visibility, either null if there | ||
| * is not an explicit insertion point assigned, or an object of its `index` and | ||
| * `rootClientId`. | ||
| * | ||
| * @param {Object} state Current state. | ||
| * @param {Object} action Dispatched action. | ||
|
|
@@ -1427,33 +1404,15 @@ function resetInsertionPoint( state, action, defaultValue ) { | |
| */ | ||
| export function insertionPoint( state = null, action ) { | ||
| switch ( action.type ) { | ||
| case 'SET_INSERTION_POINT': | ||
| case 'SHOW_INSERTION_POINT': { | ||
| case 'SHOW_INSERTION_POINT': | ||
| const { rootClientId, index } = action; | ||
| return { rootClientId, index }; | ||
| } | ||
| } | ||
|
|
||
| return resetInsertionPoint( state, action, null ); | ||
| } | ||
|
|
||
| /** | ||
| * Reducer returning the visibility of the insertion point. | ||
| * | ||
| * @param {Object} state Current state. | ||
| * @param {Object} action Dispatched action. | ||
| * | ||
| * @return {Object} Updated state. | ||
| */ | ||
| export function insertionPointVisibility( state = false, action ) { | ||
| switch ( action.type ) { | ||
| case 'SHOW_INSERTION_POINT': | ||
| return true; | ||
| case 'HIDE_INSERTION_POINT': | ||
| return false; | ||
| return null; | ||
| } | ||
|
|
||
| return resetInsertionPoint( state, action, false ); | ||
| return state; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -1764,7 +1723,6 @@ export default combineReducers( { | |
| blocksMode, | ||
| blockListSettings, | ||
| insertionPoint, | ||
| insertionPointVisibility, | ||
| template, | ||
| settings, | ||
| preferences, | ||
|
|
||
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
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
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.
Please note that I did a partial revert of 7f1fac9.