Skip to content
Prev Previous commit
Next Next commit
Merge branch 'trunk' into patterns/classic-theme-bc
  • Loading branch information
t-hamano committed Sep 21, 2023
commit 4a264b3a5413f790a1bc122dc89c85777d5797da
17 changes: 7 additions & 10 deletions packages/edit-site/lib/unbrotli.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,11 @@
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, /* UTF8 lead byte range. */
1, 0, 1, 0, 1, 0, 1 /* UTF8 lead byte range. */, 2, 3,
2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2,
3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3,
2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2,
3, 2, 3, 2, 3, 2, 3,
/* CONTEXT_UTF8 second last byte. */
3, 2, 3, 2, 3, /* CONTEXT_UTF8 second last byte. */
/* ASCII range. */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
Expand All @@ -351,11 +350,10 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, /* UTF8 lead byte range. */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2,
0, 0, 0, 0 /* UTF8 lead byte range. */, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* CONTEXT_SIGNED, second last byte. */
2, 2, 2, 2, 2, /* CONTEXT_SIGNED, second last byte. */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Expand Down Expand Up @@ -447,9 +445,8 @@

exports.lookupOffsets = new Uint16Array( [
/* CONTEXT_LSB6 */
1024, 1536, /* CONTEXT_MSB6 */
1280, 1536, /* CONTEXT_UTF8 */
0, 256, /* CONTEXT_SIGNED */
1024, 1536 /* CONTEXT_MSB6 */, 1280,
1536 /* CONTEXT_UTF8 */, 0, 256 /* CONTEXT_SIGNED */,
768, 512,
] );
},
Expand Down
12 changes: 11 additions & 1 deletion packages/edit-site/src/components/add-new-pattern/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,25 @@ import { __, sprintf } from '@wordpress/i18n';
import { plus, symbol, symbolFilled } from '@wordpress/icons';
import { useSelect, useDispatch } from '@wordpress/data';
import { privateApis as routerPrivateApis } from '@wordpress/router';
import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
import {
privateApis as editPatternsPrivateApis,
store as patternsStore,
} from '@wordpress/patterns';
import { store as coreStore } from '@wordpress/core-data';
import { store as noticesStore } from '@wordpress/notices';

/**
* Internal dependencies
*/
import CreateTemplatePartModal from '../create-template-part-modal';
import SidebarButton from '../sidebar-button';
import { unlock } from '../../lock-unlock';
import {
PATTERN_TYPES,
PATTERN_DEFAULT_CATEGORY,
TEMPLATE_PART_POST_TYPE,
} from '../../utils/constants';
import usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';

const { useHistory, useLocation } = unlock( routerPrivateApis );
const { CreatePatternModal } = unlock( editPatternsPrivateApis );
Expand Down
19 changes: 19 additions & 0 deletions packages/edit-site/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,25 @@ export const setEditorCanvasContainerView =
} );
};

/**
* Sets the type of page content focus. Can be one of:
*
* - `'disableTemplate'`: Disable the blocks belonging to the page's template.
* - `'hideTemplate'`: Hide the blocks belonging to the page's template.
*
* @param {'disableTemplate'|'hideTemplate'} pageContentFocusType The type of page content focus.
*
* @return {Object} Action object.
*/
export const setPageContentFocusType =
( pageContentFocusType ) =>
( { dispatch } ) => {
dispatch( {
type: 'SET_PAGE_CONTENT_FOCUS_TYPE',
pageContentFocusType,
} );
};

/**
* Action that set the Patterns page has been accessed.
*
Expand Down
17 changes: 17 additions & 0 deletions packages/edit-site/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ export function getEditorCanvasContainerView( state ) {
return state.editorCanvasContainerView;
}

/**
* Returns the type of the current page content focus, or null if there is no
* page content focus.
*
* Possible values are:
*
* - `'disableTemplate'`: Disable the blocks belonging to the page's template.
* - `'hideTemplate'`: Hide the blocks belonging to the page's template.
*
* @param {Object} state Global application state.
*
* @return {'disableTemplate'|'hideTemplate'|null} Type of the current page content focus.
*/
export function getPageContentFocusType( state ) {
return hasPageContentFocus( state ) ? state.pageContentFocusType : null;
}

/**
* Returns whether the Patterns page was accessed or not.
*
Expand Down
18 changes: 18 additions & 0 deletions packages/edit-site/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,23 @@ export function hasPageContentFocus( state = false, action ) {
return state;
}

/**
* Reducer used to track the type of page content focus.
*
* @param {string} state Current state.
* @param {Object} action Dispatched action.
*
* @return {string} Updated state.
*/
export function pageContentFocusType( state = 'disableTemplate', action ) {
switch ( action.type ) {
case 'SET_PAGE_CONTENT_FOCUS_TYPE':
return action.pageContentFocusType;
}

return state;
}

/**
* Reducer used to track whether the Patterns page was accessed or not.
*
Expand Down Expand Up @@ -204,5 +221,6 @@ export default combineReducers( {
canvasMode,
editorCanvasContainerView,
hasPageContentFocus,
pageContentFocusType,
didAccessPatternsPage,
} );
You are viewing a condensed version of this merge commit. You can view the full changes here.