@wordpress/edit-site 5.12.15 → 5.12.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/header-edit-mode/document-actions/index.js +11 -25
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/page/index.js +3 -3
- package/build/components/page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +2 -2
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +147 -27
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +11 -26
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/page/index.js +3 -3
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +2 -2
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +148 -28
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-style/style-rtl.css +25 -11
- package/build-style/style.css +25 -11
- package/package.json +14 -14
- package/src/components/header-edit-mode/document-actions/index.js +13 -26
- package/src/components/header-edit-mode/document-actions/style.scss +14 -6
- package/src/components/page/index.js +8 -8
- package/src/components/page/style.scss +8 -5
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +11 -10
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +4 -2
- package/src/components/table/style.scss +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +152 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","GlobalStylesContext","useBlockEditingMode","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","useChangesToPush","name","attributes","supports","flatMap","key","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props","blockEditingMode","supportsStyles","some","feature"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASf,KAAK,IAAIgB,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AAC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D,eAAe,CAAEoD,KAAK,CAACtC,IAAR,EAAc0C,OAAd,CADO,CAAvB;AAIA,SACC,8BACC,cAAC,SAAD,OAAgBJ;AAAhB,IADD,EAEGC,gBAAgB,KAAK,SAArB,IAAkCC,cAAlC,IACD,cAAC,yBAAD,QACC,cAAC,gCAAD,OAAuCF;AAAvC,IADD,CAHF,CADD;AAUA,CAjB8D,CAAhE;AAoBAlE,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGRgE,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, useBlockEditingMode } = unlock(\n\tblockEditorPrivateApis\n);\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: get( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, name, attributes ]\n\t);\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","cleanEmptyObject","GlobalStylesContext","useBlockEditingMode","STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","forEach","side","push","path","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","blockUserConfig","styles","blocks","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props","blockEditingMode","supportsStyles","some","feature"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASd,KAAK,IAAIe,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASC,kBAAT,QAAmC,sCAAnC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA,mBAApB;AAAyCC,EAAAA;AAAzC,IAAiEH,MAAM,CAC5Ed,sBAD4E,CAA7E,C,CAIA;AACA;AACA;;AACA,MAAMkB,cAAc,GAAG,EACtB,GAAGb,6BADmB;AAEtBc,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,KAAK,EAAE,CAAE,SAAF,EAAa,UAAb;AAAT;AAFY,CAAvB,C,CAKA;AACA;AACA;;AACA,MAAMC,2BAA2B,GAAG;AACnC,kBAAgB,OADmB;AAEnC,sBAAoB,OAFe;AAGnC,gBAAc,OAHqB;AAInC,8BAA4B,OAJO;AAKnC,qCAAmC,OALA;AAMnC,yCAAuC,aANJ;AAOnC,uCAAq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oB,WAApB,CAAb;AAGA;;AARF,OADQ;AAFV,KANkB,CAAnB;AAsBA,GAvD8B,EAuD5B,CACFd,uCADE,EAEF7B,UAFE,EAGFd,OAHE,EAIF4C,mBAJE,EAKF/B,IALE,EAMF2B,aANE,EAOFE,aAPE,EAQF3B,UARE,CAvD4B,CAA/B;AAkEA,SACC,cAAC,WAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,IAAI,EAAGzC,OAAO,EACb;AACAD,IAAAA,EAAE,CACD,wFADC,CAFW,EAKbG,YAAY,CAAEqC,IAAF,CAAZ,CAAqB6C,KALR;AAFf,KAUC,cAAC,WAAD,CAAa,WAAb,QACGrF,EAAE,CAAE,QAAF,CADL,CAVD,EAaC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,QAAQ,EAAG2B,OAAO,CAAC8C,MAAR,KAAmB,CAF/B;AAGC,IAAA,OAAO,EAAGD;AAHX,KAKGxE,EAAE,CAAE,gBAAF,CALL,CAbD,CADD;AAuBA;;AAED,MAAM0F,6BAA6B,GAAGlG,0BAA0B,CAC7DmG,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAMC,gBAAgB,GAAG/E,mBAAmB,EAA5C;AACA,QAAMgF,cAAc,GAAG1E,gBAAgB,CAAC2E,IAAjB,CAAyBC,OAAF,IAC7C5F,eAAe,CAAEwF,KAAK,CAACpD,IAAR,EAAcwD,OAAd,CADO,CAAvB;AAIA,SACC,8BACC,cAAC,SAAD,OAAgBJ;AAAhB,IADD,EAEGC,gBAAgB,KAAK,SAArB,IAAkCC,cAAlC,IACD,cAAC,yBAAD,QACC,cAAC,gCAAD,OAAuCF;AAAvC,IADD,CAHF,CADD;AAUA,CAjB8D,CAAhE;AAoBArG,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGRmG,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\n\nconst { cleanEmptyObject, GlobalStylesContext, useBlockEditingMode } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: get( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = get( attributes.style, hoverPath );\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\tconst newBlockAttributes = {\n\t\t\tborderColor: undefined,\n\t\t\tbackgroundColor: undefined,\n\t\t\ttextColor: undefined,\n\t\t\tgradient: undefined,\n\t\t\tfontSize: undefined,\n\t\t\tfontFamily: undefined,\n\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t};\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( newBlockAttributes );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\t\thasBlockSupport( props.name, feature )\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ blockEditingMode === 'default' && supportsStyles && (\n\t\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t\t</InspectorAdvancedControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
|
|
@@ -320,6 +320,11 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
320
320
|
overflow: auto;
|
|
321
321
|
z-index: 20;
|
|
322
322
|
}
|
|
323
|
+
@media (min-width: 782px) {
|
|
324
|
+
.interface-interface-skeleton__content {
|
|
325
|
+
z-index: auto;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
323
328
|
|
|
324
329
|
.interface-interface-skeleton__secondary-sidebar,
|
|
325
330
|
.interface-interface-skeleton__sidebar {
|
|
@@ -1448,7 +1453,6 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1448
1453
|
.edit-site-document-actions {
|
|
1449
1454
|
display: flex;
|
|
1450
1455
|
align-items: center;
|
|
1451
|
-
gap: 8px;
|
|
1452
1456
|
height: 36px;
|
|
1453
1457
|
justify-content: space-between;
|
|
1454
1458
|
min-width: 0;
|
|
@@ -1459,15 +1463,16 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1459
1463
|
.has-fixed-toolbar .edit-site-document-actions {
|
|
1460
1464
|
width: min(100%, 380px);
|
|
1461
1465
|
}
|
|
1466
|
+
.edit-site-document-actions:hover {
|
|
1467
|
+
background-color: #e0e0e0;
|
|
1468
|
+
}
|
|
1469
|
+
.edit-site-document-actions .components-button {
|
|
1470
|
+
border-radius: 4px;
|
|
1471
|
+
}
|
|
1462
1472
|
.edit-site-document-actions .components-button:hover {
|
|
1463
1473
|
color: var(--wp-block-synced-color);
|
|
1464
1474
|
background: #e0e0e0;
|
|
1465
1475
|
}
|
|
1466
|
-
@media (min-width: 782px) {
|
|
1467
|
-
.edit-site-document-actions {
|
|
1468
|
-
width: 50%;
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
1476
|
@media (min-width: 960px) {
|
|
1472
1477
|
.edit-site-document-actions {
|
|
1473
1478
|
width: min(100%, 450px);
|
|
@@ -1484,6 +1489,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1484
1489
|
flex-grow: 1;
|
|
1485
1490
|
color: var(--wp-block-synced-color);
|
|
1486
1491
|
overflow: hidden;
|
|
1492
|
+
padding-right: 32px;
|
|
1487
1493
|
}
|
|
1488
1494
|
.edit-site-document-actions__title:hover {
|
|
1489
1495
|
color: var(--wp-block-synced-color);
|
|
@@ -1497,6 +1503,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1497
1503
|
overflow: hidden;
|
|
1498
1504
|
text-overflow: ellipsis;
|
|
1499
1505
|
color: var(--wp-block-synced-color);
|
|
1506
|
+
max-width: 50%;
|
|
1500
1507
|
}
|
|
1501
1508
|
.edit-site-document-actions.is-page .edit-site-document-actions__title {
|
|
1502
1509
|
color: #2f2f2f;
|
|
@@ -1525,6 +1532,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1525
1532
|
|
|
1526
1533
|
.edit-site-document-actions__shortcut {
|
|
1527
1534
|
color: #2f2f2f;
|
|
1535
|
+
min-width: 32px;
|
|
1528
1536
|
}
|
|
1529
1537
|
|
|
1530
1538
|
.edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
@@ -1533,9 +1541,11 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1533
1541
|
color: #757575;
|
|
1534
1542
|
gap: 0;
|
|
1535
1543
|
z-index: 1;
|
|
1544
|
+
position: absolute;
|
|
1536
1545
|
}
|
|
1537
1546
|
.edit-site-document-actions__back.components-button.has-icon.has-text:hover {
|
|
1538
1547
|
color: currentColor;
|
|
1548
|
+
background-color: transparent;
|
|
1539
1549
|
}
|
|
1540
1550
|
.edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
1541
1551
|
animation: edit-site-document-actions__slide-in-left 0.3s;
|
|
@@ -1746,7 +1756,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1746
1756
|
color: #2f2f2f;
|
|
1747
1757
|
background: #fff;
|
|
1748
1758
|
flex-grow: 1;
|
|
1749
|
-
overflow:
|
|
1759
|
+
overflow: hidden;
|
|
1750
1760
|
margin: 0;
|
|
1751
1761
|
margin-top: 60px;
|
|
1752
1762
|
}
|
|
@@ -1759,8 +1769,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1759
1769
|
|
|
1760
1770
|
.edit-site-page-header {
|
|
1761
1771
|
padding: 0 32px;
|
|
1762
|
-
height: 60px;
|
|
1763
|
-
padding-right: 32px;
|
|
1772
|
+
min-height: 60px;
|
|
1764
1773
|
border-bottom: 1px solid #f0f0f0;
|
|
1765
1774
|
background: #fff;
|
|
1766
1775
|
position: sticky;
|
|
@@ -1779,8 +1788,12 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1779
1788
|
}
|
|
1780
1789
|
|
|
1781
1790
|
.edit-site-page-content {
|
|
1782
|
-
|
|
1783
|
-
|
|
1791
|
+
height: 100%;
|
|
1792
|
+
display: flex;
|
|
1793
|
+
overflow: auto;
|
|
1794
|
+
flex-flow: column;
|
|
1795
|
+
position: relative;
|
|
1796
|
+
z-index: 1;
|
|
1784
1797
|
}
|
|
1785
1798
|
|
|
1786
1799
|
.edit-site-patterns {
|
|
@@ -1957,6 +1970,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1957
1970
|
|
|
1958
1971
|
.edit-site-table-wrapper {
|
|
1959
1972
|
width: 100%;
|
|
1973
|
+
padding: 32px;
|
|
1960
1974
|
}
|
|
1961
1975
|
|
|
1962
1976
|
.edit-site-table {
|
package/build-style/style.css
CHANGED
|
@@ -320,6 +320,11 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
320
320
|
overflow: auto;
|
|
321
321
|
z-index: 20;
|
|
322
322
|
}
|
|
323
|
+
@media (min-width: 782px) {
|
|
324
|
+
.interface-interface-skeleton__content {
|
|
325
|
+
z-index: auto;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
323
328
|
|
|
324
329
|
.interface-interface-skeleton__secondary-sidebar,
|
|
325
330
|
.interface-interface-skeleton__sidebar {
|
|
@@ -1449,7 +1454,6 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1449
1454
|
.edit-site-document-actions {
|
|
1450
1455
|
display: flex;
|
|
1451
1456
|
align-items: center;
|
|
1452
|
-
gap: 8px;
|
|
1453
1457
|
height: 36px;
|
|
1454
1458
|
justify-content: space-between;
|
|
1455
1459
|
min-width: 0;
|
|
@@ -1460,15 +1464,16 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1460
1464
|
.has-fixed-toolbar .edit-site-document-actions {
|
|
1461
1465
|
width: min(100%, 380px);
|
|
1462
1466
|
}
|
|
1467
|
+
.edit-site-document-actions:hover {
|
|
1468
|
+
background-color: #e0e0e0;
|
|
1469
|
+
}
|
|
1470
|
+
.edit-site-document-actions .components-button {
|
|
1471
|
+
border-radius: 4px;
|
|
1472
|
+
}
|
|
1463
1473
|
.edit-site-document-actions .components-button:hover {
|
|
1464
1474
|
color: var(--wp-block-synced-color);
|
|
1465
1475
|
background: #e0e0e0;
|
|
1466
1476
|
}
|
|
1467
|
-
@media (min-width: 782px) {
|
|
1468
|
-
.edit-site-document-actions {
|
|
1469
|
-
width: 50%;
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
1477
|
@media (min-width: 960px) {
|
|
1473
1478
|
.edit-site-document-actions {
|
|
1474
1479
|
width: min(100%, 450px);
|
|
@@ -1485,6 +1490,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1485
1490
|
flex-grow: 1;
|
|
1486
1491
|
color: var(--wp-block-synced-color);
|
|
1487
1492
|
overflow: hidden;
|
|
1493
|
+
padding-left: 32px;
|
|
1488
1494
|
}
|
|
1489
1495
|
.edit-site-document-actions__title:hover {
|
|
1490
1496
|
color: var(--wp-block-synced-color);
|
|
@@ -1498,6 +1504,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1498
1504
|
overflow: hidden;
|
|
1499
1505
|
text-overflow: ellipsis;
|
|
1500
1506
|
color: var(--wp-block-synced-color);
|
|
1507
|
+
max-width: 50%;
|
|
1501
1508
|
}
|
|
1502
1509
|
.edit-site-document-actions.is-page .edit-site-document-actions__title {
|
|
1503
1510
|
color: #2f2f2f;
|
|
@@ -1526,6 +1533,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1526
1533
|
|
|
1527
1534
|
.edit-site-document-actions__shortcut {
|
|
1528
1535
|
color: #2f2f2f;
|
|
1536
|
+
min-width: 32px;
|
|
1529
1537
|
}
|
|
1530
1538
|
|
|
1531
1539
|
.edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
@@ -1534,9 +1542,11 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1534
1542
|
color: #757575;
|
|
1535
1543
|
gap: 0;
|
|
1536
1544
|
z-index: 1;
|
|
1545
|
+
position: absolute;
|
|
1537
1546
|
}
|
|
1538
1547
|
.edit-site-document-actions__back.components-button.has-icon.has-text:hover {
|
|
1539
1548
|
color: currentColor;
|
|
1549
|
+
background-color: transparent;
|
|
1540
1550
|
}
|
|
1541
1551
|
.edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
1542
1552
|
animation: edit-site-document-actions__slide-in-left 0.3s;
|
|
@@ -1747,7 +1757,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1747
1757
|
color: #2f2f2f;
|
|
1748
1758
|
background: #fff;
|
|
1749
1759
|
flex-grow: 1;
|
|
1750
|
-
overflow:
|
|
1760
|
+
overflow: hidden;
|
|
1751
1761
|
margin: 0;
|
|
1752
1762
|
margin-top: 60px;
|
|
1753
1763
|
}
|
|
@@ -1760,8 +1770,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1760
1770
|
|
|
1761
1771
|
.edit-site-page-header {
|
|
1762
1772
|
padding: 0 32px;
|
|
1763
|
-
height: 60px;
|
|
1764
|
-
padding-left: 32px;
|
|
1773
|
+
min-height: 60px;
|
|
1765
1774
|
border-bottom: 1px solid #f0f0f0;
|
|
1766
1775
|
background: #fff;
|
|
1767
1776
|
position: sticky;
|
|
@@ -1780,8 +1789,12 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1780
1789
|
}
|
|
1781
1790
|
|
|
1782
1791
|
.edit-site-page-content {
|
|
1783
|
-
|
|
1784
|
-
|
|
1792
|
+
height: 100%;
|
|
1793
|
+
display: flex;
|
|
1794
|
+
overflow: auto;
|
|
1795
|
+
flex-flow: column;
|
|
1796
|
+
position: relative;
|
|
1797
|
+
z-index: 1;
|
|
1785
1798
|
}
|
|
1786
1799
|
|
|
1787
1800
|
.edit-site-patterns {
|
|
@@ -1958,6 +1971,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1958
1971
|
|
|
1959
1972
|
.edit-site-table-wrapper {
|
|
1960
1973
|
width: 100%;
|
|
1974
|
+
padding: 32px;
|
|
1961
1975
|
}
|
|
1962
1976
|
|
|
1963
1977
|
.edit-site-table {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.17",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,40 +29,40 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^3.35.1",
|
|
31
31
|
"@wordpress/api-fetch": "^6.32.1",
|
|
32
|
-
"@wordpress/block-editor": "^12.3.
|
|
33
|
-
"@wordpress/block-library": "^8.12.
|
|
32
|
+
"@wordpress/block-editor": "^12.3.14",
|
|
33
|
+
"@wordpress/block-library": "^8.12.17",
|
|
34
34
|
"@wordpress/blocks": "^12.12.7",
|
|
35
|
-
"@wordpress/commands": "^0.6.
|
|
36
|
-
"@wordpress/components": "^25.1.
|
|
35
|
+
"@wordpress/commands": "^0.6.12",
|
|
36
|
+
"@wordpress/components": "^25.1.11",
|
|
37
37
|
"@wordpress/compose": "^6.12.2",
|
|
38
|
-
"@wordpress/core-commands": "^0.4.
|
|
39
|
-
"@wordpress/core-data": "^6.12.
|
|
38
|
+
"@wordpress/core-commands": "^0.4.15",
|
|
39
|
+
"@wordpress/core-data": "^6.12.15",
|
|
40
40
|
"@wordpress/data": "^9.5.5",
|
|
41
41
|
"@wordpress/date": "^4.35.1",
|
|
42
42
|
"@wordpress/deprecated": "^3.35.1",
|
|
43
43
|
"@wordpress/dom": "^3.35.1",
|
|
44
|
-
"@wordpress/editor": "^13.12.
|
|
44
|
+
"@wordpress/editor": "^13.12.15",
|
|
45
45
|
"@wordpress/element": "^5.12.1",
|
|
46
46
|
"@wordpress/escape-html": "^2.35.1",
|
|
47
47
|
"@wordpress/hooks": "^3.35.1",
|
|
48
48
|
"@wordpress/html-entities": "^3.35.1",
|
|
49
49
|
"@wordpress/i18n": "^4.35.1",
|
|
50
50
|
"@wordpress/icons": "^9.26.2",
|
|
51
|
-
"@wordpress/interface": "^5.12.
|
|
51
|
+
"@wordpress/interface": "^5.12.11",
|
|
52
52
|
"@wordpress/keyboard-shortcuts": "^4.12.5",
|
|
53
53
|
"@wordpress/keycodes": "^3.35.1",
|
|
54
54
|
"@wordpress/media-utils": "^4.26.1",
|
|
55
55
|
"@wordpress/notices": "^4.3.5",
|
|
56
|
-
"@wordpress/plugins": "^6.3.
|
|
57
|
-
"@wordpress/preferences": "^3.12.
|
|
56
|
+
"@wordpress/plugins": "^6.3.11",
|
|
57
|
+
"@wordpress/preferences": "^3.12.11",
|
|
58
58
|
"@wordpress/primitives": "^3.33.1",
|
|
59
59
|
"@wordpress/private-apis": "^0.17.2",
|
|
60
|
-
"@wordpress/reusable-blocks": "^4.12.
|
|
60
|
+
"@wordpress/reusable-blocks": "^4.12.15",
|
|
61
61
|
"@wordpress/router": "^0.4.2",
|
|
62
62
|
"@wordpress/style-engine": "^1.18.1",
|
|
63
63
|
"@wordpress/url": "^3.36.1",
|
|
64
64
|
"@wordpress/viewport": "^5.12.5",
|
|
65
|
-
"@wordpress/widgets": "^3.12.
|
|
65
|
+
"@wordpress/widgets": "^3.12.15",
|
|
66
66
|
"@wordpress/wordcount": "^3.35.1",
|
|
67
67
|
"change-case": "^4.1.2",
|
|
68
68
|
"classnames": "^2.3.1",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "a5a32c1da19589a60d48ae793a3d0a5a48223db6"
|
|
88
88
|
}
|
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import {
|
|
12
12
|
Button,
|
|
@@ -33,8 +33,18 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
33
33
|
import useEditedEntityRecord from '../../use-edited-entity-record';
|
|
34
34
|
import { store as editSiteStore } from '../../../store';
|
|
35
35
|
|
|
36
|
+
const typeLabels = {
|
|
37
|
+
wp_block: __( 'Editing pattern:' ),
|
|
38
|
+
wp_navigation: __( 'Editing navigation menu:' ),
|
|
39
|
+
wp_template: __( 'Editing template:' ),
|
|
40
|
+
wp_template_part: __( 'Editing template part:' ),
|
|
41
|
+
};
|
|
42
|
+
|
|
36
43
|
export default function DocumentActions() {
|
|
37
|
-
const isPage = useSelect(
|
|
44
|
+
const isPage = useSelect(
|
|
45
|
+
( select ) => select( editSiteStore ).isPage(),
|
|
46
|
+
[]
|
|
47
|
+
);
|
|
38
48
|
return isPage ? <PageDocumentActions /> : <TemplateDocumentActions />;
|
|
39
49
|
}
|
|
40
50
|
|
|
@@ -118,8 +128,6 @@ function TemplateDocumentActions( { className, onBack } ) {
|
|
|
118
128
|
);
|
|
119
129
|
}
|
|
120
130
|
|
|
121
|
-
const entityLabel = getEntityLabel( record.type );
|
|
122
|
-
|
|
123
131
|
let typeIcon = icon;
|
|
124
132
|
if ( record.type === 'wp_navigation' ) {
|
|
125
133
|
typeIcon = navigationIcon;
|
|
@@ -134,11 +142,7 @@ function TemplateDocumentActions( { className, onBack } ) {
|
|
|
134
142
|
onBack={ onBack }
|
|
135
143
|
>
|
|
136
144
|
<VisuallyHidden as="span">
|
|
137
|
-
{
|
|
138
|
-
/* translators: %s: the entity being edited, like "template"*/
|
|
139
|
-
__( 'Editing %s: ' ),
|
|
140
|
-
entityLabel
|
|
141
|
-
) }
|
|
145
|
+
{ typeLabels[ record.type ] ?? typeLabels.wp_template }
|
|
142
146
|
</VisuallyHidden>
|
|
143
147
|
{ getTitle() }
|
|
144
148
|
</BaseDocumentActions>
|
|
@@ -184,20 +188,3 @@ function BaseDocumentActions( { className, icon, children, onBack } ) {
|
|
|
184
188
|
</div>
|
|
185
189
|
);
|
|
186
190
|
}
|
|
187
|
-
|
|
188
|
-
function getEntityLabel( entityType ) {
|
|
189
|
-
let label = '';
|
|
190
|
-
switch ( entityType ) {
|
|
191
|
-
case 'wp_navigation':
|
|
192
|
-
label = 'navigation menu';
|
|
193
|
-
break;
|
|
194
|
-
case 'wp_template_part':
|
|
195
|
-
label = 'template part';
|
|
196
|
-
break;
|
|
197
|
-
default:
|
|
198
|
-
label = 'template';
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return label;
|
|
203
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
.edit-site-document-actions {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
gap: $grid-unit;
|
|
5
4
|
height: $button-size;
|
|
6
5
|
justify-content: space-between;
|
|
7
6
|
// Flex items will, by default, refuse to shrink below a minimum
|
|
@@ -10,7 +9,7 @@
|
|
|
10
9
|
// See https://dev.w3.org/csswg/css-flexbox/#min-size-auto
|
|
11
10
|
min-width: 0;
|
|
12
11
|
background: $gray-100;
|
|
13
|
-
border-radius:
|
|
12
|
+
border-radius: $grid-unit-05;
|
|
14
13
|
width: min(100%, 450px);
|
|
15
14
|
|
|
16
15
|
// Make the document title shorter in top-toolbar mode, as it has to be covered.
|
|
@@ -18,17 +17,19 @@
|
|
|
18
17
|
width: min(100%, 380px);
|
|
19
18
|
}
|
|
20
19
|
|
|
20
|
+
&:hover {
|
|
21
|
+
background-color: $gray-200;
|
|
22
|
+
}
|
|
23
|
+
|
|
21
24
|
.components-button {
|
|
25
|
+
border-radius: $grid-unit-05;
|
|
26
|
+
|
|
22
27
|
&:hover {
|
|
23
28
|
color: var(--wp-block-synced-color);
|
|
24
29
|
background: $gray-200;
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
|
|
28
|
-
@include break-medium() {
|
|
29
|
-
width: 50%;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
33
|
@include break-large() {
|
|
33
34
|
width: min(100%, 450px);
|
|
34
35
|
}
|
|
@@ -45,6 +46,9 @@
|
|
|
45
46
|
color: var(--wp-block-synced-color);
|
|
46
47
|
overflow: hidden;
|
|
47
48
|
|
|
49
|
+
// Offset the layout based on the width of the ⌘K label. This ensures the title is centrally aligned.
|
|
50
|
+
padding-left: $grid-unit-40;
|
|
51
|
+
|
|
48
52
|
&:hover {
|
|
49
53
|
color: var(--wp-block-synced-color);
|
|
50
54
|
}
|
|
@@ -59,6 +63,7 @@
|
|
|
59
63
|
overflow: hidden;
|
|
60
64
|
text-overflow: ellipsis;
|
|
61
65
|
color: var(--wp-block-synced-color);
|
|
66
|
+
max-width: 50%;
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
.edit-site-document-actions.is-page & {
|
|
@@ -82,6 +87,7 @@
|
|
|
82
87
|
|
|
83
88
|
.edit-site-document-actions__shortcut {
|
|
84
89
|
color: $gray-800;
|
|
90
|
+
min-width: $grid-unit-40;
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
.edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
@@ -90,9 +96,11 @@
|
|
|
90
96
|
color: $gray-700;
|
|
91
97
|
gap: 0;
|
|
92
98
|
z-index: 1;
|
|
99
|
+
position: absolute;
|
|
93
100
|
|
|
94
101
|
&:hover {
|
|
95
102
|
color: currentColor;
|
|
103
|
+
background-color: transparent;
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
.edit-site-document-actions.is-animated & {
|
|
@@ -26,17 +26,17 @@ export default function Page( {
|
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<NavigableRegion className={ classes } ariaLabel={ title }>
|
|
29
|
-
{ ! hideTitleFromUI && title && (
|
|
30
|
-
<Header
|
|
31
|
-
title={ title }
|
|
32
|
-
subTitle={ subTitle }
|
|
33
|
-
actions={ actions }
|
|
34
|
-
/>
|
|
35
|
-
) }
|
|
36
29
|
<div className="edit-site-page-content">
|
|
30
|
+
{ ! hideTitleFromUI && title && (
|
|
31
|
+
<Header
|
|
32
|
+
title={ title }
|
|
33
|
+
subTitle={ subTitle }
|
|
34
|
+
actions={ actions }
|
|
35
|
+
/>
|
|
36
|
+
) }
|
|
37
37
|
{ children }
|
|
38
|
-
<EditorSnackbars />
|
|
39
38
|
</div>
|
|
39
|
+
<EditorSnackbars />
|
|
40
40
|
</NavigableRegion>
|
|
41
41
|
);
|
|
42
42
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
color: $gray-800;
|
|
3
3
|
background: $white;
|
|
4
4
|
flex-grow: 1;
|
|
5
|
-
overflow:
|
|
5
|
+
overflow: hidden;
|
|
6
6
|
margin: 0;
|
|
7
7
|
margin-top: $header-height;
|
|
8
8
|
@include break-medium() {
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
.edit-site-page-header {
|
|
15
15
|
padding: 0 $grid-unit-40;
|
|
16
|
-
height: $header-height;
|
|
17
|
-
padding-left: $grid-unit-40;
|
|
16
|
+
min-height: $header-height;
|
|
18
17
|
border-bottom: 1px solid $gray-100;
|
|
19
18
|
background: $white;
|
|
20
19
|
position: sticky;
|
|
@@ -33,6 +32,10 @@
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
.edit-site-page-content {
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
height: 100%;
|
|
36
|
+
display: flex;
|
|
37
|
+
overflow: auto;
|
|
38
|
+
flex-flow: column;
|
|
39
|
+
position: relative;
|
|
40
|
+
z-index: z-index(".edit-site-page-content");
|
|
38
41
|
}
|
|
@@ -126,16 +126,17 @@ export default function LeafMoreMenu( props ) {
|
|
|
126
126
|
>
|
|
127
127
|
{ __( 'Move down' ) }
|
|
128
128
|
</MenuItem>
|
|
129
|
-
{ block.attributes?.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
129
|
+
{ block.attributes?.type === 'page' &&
|
|
130
|
+
block.attributes?.id && (
|
|
131
|
+
<MenuItem
|
|
132
|
+
onClick={ () => {
|
|
133
|
+
onGoToPage( block );
|
|
134
|
+
onClose();
|
|
135
|
+
} }
|
|
136
|
+
>
|
|
137
|
+
{ goToLabel }
|
|
138
|
+
</MenuItem>
|
|
139
|
+
) }
|
|
139
140
|
</MenuGroup>
|
|
140
141
|
<MenuGroup>
|
|
141
142
|
<MenuItem
|
|
@@ -198,8 +198,10 @@ export default function HomeTemplateDetails() {
|
|
|
198
198
|
<SidebarNavigationScreenDetailsPanelRow>
|
|
199
199
|
<CheckboxControl
|
|
200
200
|
className="edit-site-sidebar-navigation-screen__input-control"
|
|
201
|
-
label=
|
|
202
|
-
help=
|
|
201
|
+
label={ __( 'Allow comments on new posts' ) }
|
|
202
|
+
help={ __(
|
|
203
|
+
'Changes will apply to new posts only. Individual posts may override these settings.'
|
|
204
|
+
) }
|
|
203
205
|
checked={ commentsOnNewPostsValue }
|
|
204
206
|
onChange={ setAllowCommentsOnNewPosts }
|
|
205
207
|
/>
|