@wordpress/edit-site 4.6.0 → 4.9.0
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/CHANGELOG.md +6 -0
- package/build/components/add-new-template/add-custom-template-modal.js +185 -0
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -0
- package/build/components/add-new-template/new-template.js +92 -32
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +139 -0
- package/build/components/add-new-template/utils.js.map +1 -0
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/code-editor/code-editor-text-area.js +11 -9
- package/build/components/code-editor/code-editor-text-area.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/context-menu.js +6 -3
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +3 -7
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +2 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +13 -2
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +80 -0
- package/build/components/global-styles/screen-button-color.js.map +1 -0
- package/build/components/global-styles/screen-colors.js +47 -7
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +4 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +9 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +4 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +9 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +11 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +40 -9
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +3 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/header/index.js +28 -10
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/header/more-menu/copy-content-menu-item.js +1 -1
- package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -1
- package/build/components/header/more-menu/site-export.js +4 -1
- package/build/components/header/more-menu/site-export.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +13 -4
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +13 -4
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +17 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build/components/sidebar/template-card/index.js +19 -7
- package/build/components/sidebar/template-card/index.js.map +1 -1
- package/build/components/sidebar/template-card/template-actions.js +64 -0
- package/build/components/sidebar/template-card/template-actions.js.map +1 -0
- package/build/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +170 -0
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -0
- package/build-module/components/add-new-template/new-template.js +92 -35
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +119 -0
- package/build-module/components/add-new-template/utils.js.map +1 -0
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/code-editor/code-editor-text-area.js +12 -10
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +6 -3
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +3 -5
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +2 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +14 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +4 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +67 -0
- package/build-module/components/global-styles/screen-button-color.js.map +1 -0
- package/build-module/components/global-styles/screen-colors.js +48 -8
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +4 -2
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +9 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +4 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +10 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +10 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +39 -9
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +3 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/header/index.js +29 -11
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js.map +1 -1
- package/build-module/components/header/more-menu/copy-content-menu-item.js +1 -1
- package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -1
- package/build-module/components/header/more-menu/site-export.js +4 -1
- package/build-module/components/header/more-menu/site-export.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +9 -3
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +9 -3
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +17 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build-module/components/sidebar/template-card/index.js +18 -7
- package/build-module/components/sidebar/template-card/index.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-actions.js +49 -0
- package/build-module/components/sidebar/template-card/template-actions.js.map +1 -0
- package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +170 -23
- package/build-style/style.css +170 -23
- package/package.json +30 -30
- package/src/components/add-new-template/add-custom-template-modal.js +231 -0
- package/src/components/add-new-template/new-template.js +135 -59
- package/src/components/add-new-template/style.scss +116 -0
- package/src/components/add-new-template/utils.js +125 -0
- package/src/components/block-editor/block-inspector-button.js +2 -3
- package/src/components/block-editor/index.js +4 -9
- package/src/components/code-editor/code-editor-text-area.js +12 -7
- package/src/components/edit-template-part-menu-button/index.js +2 -3
- package/src/components/editor/index.js +4 -5
- package/src/components/global-styles/context-menu.js +3 -0
- package/src/components/global-styles/global-styles-provider.js +4 -8
- package/src/components/global-styles/gradients-palette-panel.js +2 -5
- package/src/components/global-styles/hooks.js +5 -3
- package/src/components/global-styles/palette.js +4 -1
- package/src/components/global-styles/preview.js +17 -2
- package/src/components/global-styles/screen-block-list.js +14 -5
- package/src/components/global-styles/screen-button-color.js +102 -0
- package/src/components/global-styles/screen-colors.js +49 -4
- package/src/components/global-styles/screen-root.js +12 -5
- package/src/components/global-styles/screen-style-variations.js +10 -4
- package/src/components/global-styles/screen-typography-element.js +4 -0
- package/src/components/global-styles/screen-typography.js +17 -2
- package/src/components/global-styles/style.scss +10 -0
- package/src/components/global-styles/test/use-global-styles-output.js +82 -16
- package/src/components/global-styles/ui.js +13 -0
- package/src/components/global-styles/use-global-styles-output.js +43 -4
- package/src/components/global-styles/utils.js +3 -0
- package/src/components/header/index.js +38 -13
- package/src/components/header/mode-switcher/index.js +4 -4
- package/src/components/header/more-menu/copy-content-menu-item.js +3 -4
- package/src/components/header/more-menu/site-export.js +5 -3
- package/src/components/header/style.scss +53 -5
- package/src/components/header/undo-redo/redo.js +6 -1
- package/src/components/header/undo-redo/undo.js +6 -1
- package/src/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/src/components/keyboard-shortcuts/index.js +6 -10
- package/src/components/list/actions/index.js +2 -3
- package/src/components/list/actions/rename-menu-item.js +4 -6
- package/src/components/list/added-by.js +4 -3
- package/src/components/navigation-sidebar/index.js +2 -4
- package/src/components/save-button/index.js +2 -4
- package/src/components/sidebar/index.js +6 -6
- package/src/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +6 -9
- package/src/components/sidebar/navigation-menu-sidebar/style.scss +0 -1
- package/src/components/sidebar/template-card/index.js +17 -9
- package/src/components/sidebar/template-card/style.scss +49 -35
- package/src/components/sidebar/template-card/template-actions.js +43 -0
- package/src/components/sidebar/template-card/template-areas.js +6 -6
- package/src/components/template-details/template-areas.js +6 -6
- package/src/components/template-part-converter/index.js +2 -3
- package/src/components/url-query-controller/index.js +2 -3
- package/src/store/actions.js +257 -233
- package/src/store/selectors.js +9 -10
package/build-style/style.css
CHANGED
|
@@ -758,6 +758,15 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
758
758
|
font-size: 11px !important;
|
|
759
759
|
}
|
|
760
760
|
|
|
761
|
+
.edit-site-global-styles-section-title {
|
|
762
|
+
color: #2f2f2f;
|
|
763
|
+
font-weight: 600;
|
|
764
|
+
line-height: 1.2;
|
|
765
|
+
padding: 16px;
|
|
766
|
+
padding-bottom: 0;
|
|
767
|
+
margin: 0;
|
|
768
|
+
}
|
|
769
|
+
|
|
761
770
|
.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle {
|
|
762
771
|
margin-right: 16px;
|
|
763
772
|
margin-left: 16px;
|
|
@@ -769,6 +778,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
769
778
|
|
|
770
779
|
.edit-site-screen-text-color__control,
|
|
771
780
|
.edit-site-screen-link-color__control,
|
|
781
|
+
.edit-site-screen-button-color__control,
|
|
772
782
|
.edit-site-screen-background-color__control {
|
|
773
783
|
padding: 16px;
|
|
774
784
|
}
|
|
@@ -819,9 +829,13 @@ body.is-fullscreen-mode .edit-site-header {
|
|
|
819
829
|
transition-delay: 0s;
|
|
820
830
|
}
|
|
821
831
|
}
|
|
822
|
-
.edit-site-header .edit-site-header_start
|
|
832
|
+
.edit-site-header .edit-site-header_start {
|
|
833
|
+
display: flex;
|
|
834
|
+
border: none;
|
|
835
|
+
}
|
|
823
836
|
.edit-site-header .edit-site-header_end {
|
|
824
837
|
display: flex;
|
|
838
|
+
justify-content: flex-end;
|
|
825
839
|
}
|
|
826
840
|
.edit-site-header .edit-site-header_center {
|
|
827
841
|
display: flex;
|
|
@@ -831,9 +845,6 @@ body.is-fullscreen-mode .edit-site-header {
|
|
|
831
845
|
justify-content: center;
|
|
832
846
|
min-width: 0;
|
|
833
847
|
}
|
|
834
|
-
.edit-site-header .edit-site-header_end {
|
|
835
|
-
justify-content: flex-end;
|
|
836
|
-
}
|
|
837
848
|
|
|
838
849
|
body.is-navigation-sidebar-open .edit-site-header {
|
|
839
850
|
padding-left: 0;
|
|
@@ -944,6 +955,41 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
944
955
|
}
|
|
945
956
|
}
|
|
946
957
|
|
|
958
|
+
.edit-site-header_start {
|
|
959
|
+
display: flex;
|
|
960
|
+
border: none;
|
|
961
|
+
}
|
|
962
|
+
.edit-site-header_start .edit-site-header__toolbar > .components-button.has-icon,
|
|
963
|
+
.edit-site-header_start .edit-site-header__toolbar > .components-dropdown > .components-button.has-icon {
|
|
964
|
+
height: 36px;
|
|
965
|
+
min-width: 36px;
|
|
966
|
+
padding: 6px;
|
|
967
|
+
}
|
|
968
|
+
.edit-site-header_start .edit-site-header__toolbar > .components-button.has-icon.is-pressed,
|
|
969
|
+
.edit-site-header_start .edit-site-header__toolbar > .components-dropdown > .components-button.has-icon.is-pressed {
|
|
970
|
+
background: #1e1e1e;
|
|
971
|
+
}
|
|
972
|
+
.edit-site-header_start .edit-site-header__toolbar > .components-button.has-icon:focus:not(:disabled),
|
|
973
|
+
.edit-site-header_start .edit-site-header__toolbar > .components-dropdown > .components-button.has-icon:focus:not(:disabled) {
|
|
974
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 1px #fff;
|
|
975
|
+
outline: 1px solid transparent;
|
|
976
|
+
}
|
|
977
|
+
.edit-site-header_start .edit-site-header__toolbar > .components-button.has-icon::before,
|
|
978
|
+
.edit-site-header_start .edit-site-header__toolbar > .components-dropdown > .components-button.has-icon::before {
|
|
979
|
+
display: none;
|
|
980
|
+
}
|
|
981
|
+
.edit-site-header_start .edit-site-header__toolbar > .edit-site-header-toolbar__inserter-toggle.has-icon {
|
|
982
|
+
margin-right: 8px;
|
|
983
|
+
min-width: 32px;
|
|
984
|
+
width: 32px;
|
|
985
|
+
height: 32px;
|
|
986
|
+
padding: 0;
|
|
987
|
+
}
|
|
988
|
+
.edit-site-header_start .edit-site-header__toolbar > .edit-site-header-toolbar__inserter-toggle.has-text.has-icon {
|
|
989
|
+
width: auto;
|
|
990
|
+
padding: 0 8px;
|
|
991
|
+
}
|
|
992
|
+
|
|
947
993
|
.show-icon-labels .edit-site-header .components-button.has-icon {
|
|
948
994
|
width: auto;
|
|
949
995
|
}
|
|
@@ -973,6 +1019,9 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
973
1019
|
.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info::after {
|
|
974
1020
|
content: none;
|
|
975
1021
|
}
|
|
1022
|
+
.show-icon-labels .edit-site-header .edit-site-header_start .edit-site-header__toolbar > * + * {
|
|
1023
|
+
margin-left: 8px;
|
|
1024
|
+
}
|
|
976
1025
|
|
|
977
1026
|
.edit-site-document-actions {
|
|
978
1027
|
display: flex;
|
|
@@ -1094,8 +1143,7 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
1094
1143
|
width: 36px;
|
|
1095
1144
|
height: 36px;
|
|
1096
1145
|
border-radius: 2px;
|
|
1097
|
-
|
|
1098
|
-
object-fit: cover;
|
|
1146
|
+
object-fit: cover;
|
|
1099
1147
|
margin-top: -1px;
|
|
1100
1148
|
}
|
|
1101
1149
|
|
|
@@ -1434,8 +1482,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1434
1482
|
.edit-site-list-added-by__avatar img {
|
|
1435
1483
|
width: 32px;
|
|
1436
1484
|
height: 32px;
|
|
1437
|
-
|
|
1438
|
-
object-fit: cover;
|
|
1485
|
+
object-fit: cover;
|
|
1439
1486
|
opacity: 0;
|
|
1440
1487
|
transition: opacity 0.1s linear;
|
|
1441
1488
|
}
|
|
@@ -1458,6 +1505,102 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1458
1505
|
}
|
|
1459
1506
|
}
|
|
1460
1507
|
|
|
1508
|
+
.edit-site-custom-template-modal__contents > div {
|
|
1509
|
+
text-align: center;
|
|
1510
|
+
cursor: pointer;
|
|
1511
|
+
padding: 24px;
|
|
1512
|
+
border: 1px solid #ddd;
|
|
1513
|
+
border-radius: 2px;
|
|
1514
|
+
width: 256px;
|
|
1515
|
+
display: flex;
|
|
1516
|
+
flex-direction: column;
|
|
1517
|
+
gap: 8px;
|
|
1518
|
+
align-items: center;
|
|
1519
|
+
justify-content: center;
|
|
1520
|
+
}
|
|
1521
|
+
.edit-site-custom-template-modal__contents > div span {
|
|
1522
|
+
color: #757575;
|
|
1523
|
+
}
|
|
1524
|
+
.edit-site-custom-template-modal__contents > div:hover {
|
|
1525
|
+
border-color: var(--wp-admin-theme-color);
|
|
1526
|
+
}
|
|
1527
|
+
.edit-site-custom-template-modal__contents > div:hover h5 {
|
|
1528
|
+
color: var(--wp-admin-theme-color);
|
|
1529
|
+
}
|
|
1530
|
+
.edit-site-custom-template-modal__contents > div:focus {
|
|
1531
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1532
|
+
}
|
|
1533
|
+
.edit-site-custom-template-modal .components-search-control input[type=search].components-search-control__input {
|
|
1534
|
+
background: #fff;
|
|
1535
|
+
border: 1px solid #ddd;
|
|
1536
|
+
}
|
|
1537
|
+
.edit-site-custom-template-modal .components-search-control input[type=search].components-search-control__input:focus {
|
|
1538
|
+
border-color: var(--wp-admin-theme-color);
|
|
1539
|
+
box-shadow: 0 0 0 1px var(--wp-admin-theme-color);
|
|
1540
|
+
}
|
|
1541
|
+
@media (min-width: 782px) {
|
|
1542
|
+
.edit-site-custom-template-modal {
|
|
1543
|
+
width: 456px;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
.edit-site-custom-template-modal__suggestions_list {
|
|
1548
|
+
margin-top: 16px;
|
|
1549
|
+
}
|
|
1550
|
+
@media (min-width: 600px) {
|
|
1551
|
+
.edit-site-custom-template-modal__suggestions_list {
|
|
1552
|
+
height: 232px;
|
|
1553
|
+
overflow: scroll;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
.edit-site-custom-template-modal__suggestions_list__list-item {
|
|
1557
|
+
display: block;
|
|
1558
|
+
width: 100%;
|
|
1559
|
+
text-align: left;
|
|
1560
|
+
white-space: pre-wrap;
|
|
1561
|
+
overflow-wrap: break-word;
|
|
1562
|
+
height: auto;
|
|
1563
|
+
}
|
|
1564
|
+
.edit-site-custom-template-modal__suggestions_list__list-item mark {
|
|
1565
|
+
font-weight: 700;
|
|
1566
|
+
background: none;
|
|
1567
|
+
}
|
|
1568
|
+
.edit-site-custom-template-modal__suggestions_list__list-item:hover {
|
|
1569
|
+
background-color: #f0f0f0;
|
|
1570
|
+
}
|
|
1571
|
+
.edit-site-custom-template-modal__suggestions_list__list-item:hover mark {
|
|
1572
|
+
color: var(--wp-admin-theme-color);
|
|
1573
|
+
}
|
|
1574
|
+
.edit-site-custom-template-modal__suggestions_list__list-item:focus {
|
|
1575
|
+
background-color: #f0f0f0;
|
|
1576
|
+
}
|
|
1577
|
+
.edit-site-custom-template-modal__suggestions_list__list-item:focus:not(:disabled) {
|
|
1578
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color) inset;
|
|
1579
|
+
}
|
|
1580
|
+
.edit-site-custom-template-modal__suggestions_list__list-item__title, .edit-site-custom-template-modal__suggestions_list__list-item__info {
|
|
1581
|
+
overflow: hidden;
|
|
1582
|
+
text-overflow: ellipsis;
|
|
1583
|
+
display: block;
|
|
1584
|
+
}
|
|
1585
|
+
.edit-site-custom-template-modal__suggestions_list__list-item__title {
|
|
1586
|
+
font-weight: 500;
|
|
1587
|
+
margin-bottom: 0.2em;
|
|
1588
|
+
}
|
|
1589
|
+
.edit-site-custom-template-modal__suggestions_list__list-item__info {
|
|
1590
|
+
color: #757575;
|
|
1591
|
+
font-size: 0.9em;
|
|
1592
|
+
line-height: 1.3;
|
|
1593
|
+
word-break: break-all;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
.edit-site-custom-template-modal__no-results {
|
|
1597
|
+
border: 1px solid #ccc;
|
|
1598
|
+
border-radius: 2px;
|
|
1599
|
+
padding: 16px;
|
|
1600
|
+
margin-bottom: 0;
|
|
1601
|
+
margin-top: 16px;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1461
1604
|
.edit-site-sidebar {
|
|
1462
1605
|
width: 280px;
|
|
1463
1606
|
}
|
|
@@ -1631,7 +1774,6 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1631
1774
|
padding: 16px;
|
|
1632
1775
|
}
|
|
1633
1776
|
.edit-site-navigation-inspector .block-editor-list-view-leaf .block-editor-list-view-block-contents {
|
|
1634
|
-
align-items: flex-start;
|
|
1635
1777
|
white-space: normal;
|
|
1636
1778
|
}
|
|
1637
1779
|
.edit-site-navigation-inspector .block-editor-list-view-block__title {
|
|
@@ -1657,50 +1799,56 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1657
1799
|
display: flex;
|
|
1658
1800
|
align-items: flex-start;
|
|
1659
1801
|
}
|
|
1660
|
-
|
|
1661
1802
|
.edit-site-template-card__content {
|
|
1662
1803
|
flex-grow: 1;
|
|
1663
1804
|
margin-bottom: 4px;
|
|
1664
1805
|
}
|
|
1665
|
-
|
|
1666
1806
|
.edit-site-template-card__title {
|
|
1667
1807
|
font-weight: 500;
|
|
1668
1808
|
line-height: 24px;
|
|
1669
1809
|
}
|
|
1670
1810
|
.edit-site-template-card__title.edit-site-template-card__title {
|
|
1671
|
-
margin: 0
|
|
1811
|
+
margin: 0;
|
|
1672
1812
|
}
|
|
1673
|
-
|
|
1674
1813
|
.edit-site-template-card__description {
|
|
1675
1814
|
font-size: 13px;
|
|
1676
1815
|
margin: 0 0 16px;
|
|
1677
1816
|
}
|
|
1678
|
-
|
|
1679
1817
|
.edit-site-template-card__icon {
|
|
1680
1818
|
flex: 0 0 24px;
|
|
1681
1819
|
margin-right: 12px;
|
|
1682
1820
|
width: 24px;
|
|
1683
1821
|
height: 24px;
|
|
1684
1822
|
}
|
|
1685
|
-
|
|
1686
|
-
h3.edit-site-template-card__template-areas-title {
|
|
1687
|
-
font-weight: 500;
|
|
1688
|
-
margin: 0 0 8px;
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
1823
|
.edit-site-template-card__template-areas-list {
|
|
1692
1824
|
margin: 0;
|
|
1693
1825
|
}
|
|
1694
1826
|
.edit-site-template-card__template-areas-list > li {
|
|
1695
1827
|
margin: 0;
|
|
1696
1828
|
}
|
|
1697
|
-
|
|
1698
1829
|
.edit-site-template-card__template-areas-item {
|
|
1699
1830
|
width: 100%;
|
|
1700
1831
|
}
|
|
1701
1832
|
.edit-site-template-card__template-areas-item.components-button.has-icon {
|
|
1702
1833
|
padding: 0;
|
|
1703
1834
|
}
|
|
1835
|
+
.edit-site-template-card__header {
|
|
1836
|
+
display: flex;
|
|
1837
|
+
justify-content: space-between;
|
|
1838
|
+
margin: 0 0 4px;
|
|
1839
|
+
}
|
|
1840
|
+
.edit-site-template-card__actions {
|
|
1841
|
+
line-height: 0;
|
|
1842
|
+
}
|
|
1843
|
+
.edit-site-template-card__actions > .components-button.is-small.has-icon {
|
|
1844
|
+
padding: 0;
|
|
1845
|
+
min-width: auto;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
h3.edit-site-template-card__template-areas-title {
|
|
1849
|
+
font-weight: 500;
|
|
1850
|
+
margin: 0 0 8px;
|
|
1851
|
+
}
|
|
1704
1852
|
|
|
1705
1853
|
html #wpadminbar {
|
|
1706
1854
|
display: none;
|
|
@@ -1964,8 +2112,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
|
|
|
1964
2112
|
.edit-site-welcome-guide__image > img {
|
|
1965
2113
|
display: block;
|
|
1966
2114
|
max-width: 100%;
|
|
1967
|
-
|
|
1968
|
-
object-fit: cover;
|
|
2115
|
+
object-fit: cover;
|
|
1969
2116
|
}
|
|
1970
2117
|
.edit-site-welcome-guide__heading {
|
|
1971
2118
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,39 +27,39 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^9.
|
|
33
|
-
"@wordpress/block-library": "^7.
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^4.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/editor": "^12.
|
|
41
|
-
"@wordpress/element": "^4.
|
|
42
|
-
"@wordpress/hooks": "^3.
|
|
43
|
-
"@wordpress/html-entities": "^3.
|
|
44
|
-
"@wordpress/i18n": "^4.
|
|
45
|
-
"@wordpress/icons": "^9.
|
|
46
|
-
"@wordpress/interface": "^4.
|
|
47
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
48
|
-
"@wordpress/keycodes": "^3.
|
|
49
|
-
"@wordpress/media-utils": "^4.
|
|
50
|
-
"@wordpress/notices": "^3.
|
|
51
|
-
"@wordpress/plugins": "^4.
|
|
52
|
-
"@wordpress/preferences": "^2.
|
|
53
|
-
"@wordpress/reusable-blocks": "^3.
|
|
54
|
-
"@wordpress/style-engine": "^0.
|
|
55
|
-
"@wordpress/url": "^3.
|
|
56
|
-
"@wordpress/viewport": "^4.
|
|
30
|
+
"@wordpress/a11y": "^3.12.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.9.0",
|
|
32
|
+
"@wordpress/block-editor": "^9.4.0",
|
|
33
|
+
"@wordpress/block-library": "^7.9.0",
|
|
34
|
+
"@wordpress/blocks": "^11.11.0",
|
|
35
|
+
"@wordpress/components": "^19.14.0",
|
|
36
|
+
"@wordpress/compose": "^5.10.0",
|
|
37
|
+
"@wordpress/core-data": "^4.10.0",
|
|
38
|
+
"@wordpress/data": "^6.12.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.12.0",
|
|
40
|
+
"@wordpress/editor": "^12.11.0",
|
|
41
|
+
"@wordpress/element": "^4.10.0",
|
|
42
|
+
"@wordpress/hooks": "^3.12.0",
|
|
43
|
+
"@wordpress/html-entities": "^3.12.0",
|
|
44
|
+
"@wordpress/i18n": "^4.12.0",
|
|
45
|
+
"@wordpress/icons": "^9.3.0",
|
|
46
|
+
"@wordpress/interface": "^4.11.0",
|
|
47
|
+
"@wordpress/keyboard-shortcuts": "^3.10.0",
|
|
48
|
+
"@wordpress/keycodes": "^3.12.0",
|
|
49
|
+
"@wordpress/media-utils": "^4.3.0",
|
|
50
|
+
"@wordpress/notices": "^3.12.0",
|
|
51
|
+
"@wordpress/plugins": "^4.10.0",
|
|
52
|
+
"@wordpress/preferences": "^2.4.0",
|
|
53
|
+
"@wordpress/reusable-blocks": "^3.10.0",
|
|
54
|
+
"@wordpress/style-engine": "^0.11.0",
|
|
55
|
+
"@wordpress/url": "^3.13.0",
|
|
56
|
+
"@wordpress/viewport": "^4.10.0",
|
|
57
57
|
"classnames": "^2.3.1",
|
|
58
58
|
"downloadjs": "^1.4.7",
|
|
59
59
|
"history": "^5.1.0",
|
|
60
60
|
"lodash": "^4.17.21",
|
|
61
61
|
"react-autosize-textarea": "^7.1.0",
|
|
62
|
-
"rememo": "^
|
|
62
|
+
"rememo": "^4.0.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"react": "^17.0.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "a80eeb62ec7cb1418b9915c277e084a29d6665e3"
|
|
72
72
|
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState, useMemo, useEffect } from '@wordpress/element';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
Flex,
|
|
9
|
+
FlexItem,
|
|
10
|
+
Modal,
|
|
11
|
+
SearchControl,
|
|
12
|
+
TextHighlight,
|
|
13
|
+
__experimentalText as Text,
|
|
14
|
+
__experimentalHeading as Heading,
|
|
15
|
+
__unstableComposite as Composite,
|
|
16
|
+
__unstableUseCompositeState as useCompositeState,
|
|
17
|
+
__unstableCompositeItem as CompositeItem,
|
|
18
|
+
} from '@wordpress/components';
|
|
19
|
+
import { useDebounce } from '@wordpress/compose';
|
|
20
|
+
import { useEntityRecords } from '@wordpress/core-data';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
import { mapToIHasNameAndId } from './utils';
|
|
26
|
+
|
|
27
|
+
const EMPTY_ARRAY = [];
|
|
28
|
+
const BASE_QUERY = {
|
|
29
|
+
order: 'asc',
|
|
30
|
+
_fields: 'id,title,slug,link',
|
|
31
|
+
context: 'view',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function SuggestionListItem( {
|
|
35
|
+
suggestion,
|
|
36
|
+
search,
|
|
37
|
+
onSelect,
|
|
38
|
+
entityForSuggestions,
|
|
39
|
+
composite,
|
|
40
|
+
} ) {
|
|
41
|
+
const baseCssClass =
|
|
42
|
+
'edit-site-custom-template-modal__suggestions_list__list-item';
|
|
43
|
+
return (
|
|
44
|
+
<CompositeItem
|
|
45
|
+
role="option"
|
|
46
|
+
as={ Button }
|
|
47
|
+
{ ...composite }
|
|
48
|
+
className={ baseCssClass }
|
|
49
|
+
onClick={ () => {
|
|
50
|
+
const title = sprintf(
|
|
51
|
+
// translators: Represents the title of a user's custom template in the Site Editor, where %1$s is the singular name of a post type and %2$s is the name of the post, e.g. "Post: Hello, WordPress"
|
|
52
|
+
__( '%1$s: %2$s' ),
|
|
53
|
+
entityForSuggestions.labels.singular_name,
|
|
54
|
+
suggestion.name
|
|
55
|
+
);
|
|
56
|
+
onSelect( {
|
|
57
|
+
title,
|
|
58
|
+
description: sprintf(
|
|
59
|
+
// translators: Represents the description of a user's custom template in the Site Editor, e.g. "Template for Post: Hello, WordPress"
|
|
60
|
+
__( 'Template for %1$s' ),
|
|
61
|
+
title
|
|
62
|
+
),
|
|
63
|
+
slug: `single-${ entityForSuggestions.slug }-${ suggestion.slug }`,
|
|
64
|
+
} );
|
|
65
|
+
} }
|
|
66
|
+
>
|
|
67
|
+
<span className={ `${ baseCssClass }__title` }>
|
|
68
|
+
<TextHighlight text={ suggestion.name } highlight={ search } />
|
|
69
|
+
</span>
|
|
70
|
+
{ suggestion.link && (
|
|
71
|
+
<span className={ `${ baseCssClass }__info` }>
|
|
72
|
+
{ suggestion.link }
|
|
73
|
+
</span>
|
|
74
|
+
) }
|
|
75
|
+
</CompositeItem>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function SuggestionList( { entityForSuggestions, onSelect } ) {
|
|
80
|
+
const composite = useCompositeState( { orientation: 'vertical' } );
|
|
81
|
+
const [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );
|
|
82
|
+
// We need to track two values, the search input's value(searchInputValue)
|
|
83
|
+
// and the one we want to debounce(search) and make REST API requests.
|
|
84
|
+
const [ searchInputValue, setSearchInputValue ] = useState( '' );
|
|
85
|
+
const [ search, setSearch ] = useState( '' );
|
|
86
|
+
const debouncedSearch = useDebounce( setSearch, 250 );
|
|
87
|
+
const query = {
|
|
88
|
+
...BASE_QUERY,
|
|
89
|
+
search,
|
|
90
|
+
orderby: search ? 'relevance' : 'modified',
|
|
91
|
+
exclude: entityForSuggestions.postsToExclude,
|
|
92
|
+
per_page: search ? 20 : 10,
|
|
93
|
+
};
|
|
94
|
+
const { records: searchResults, hasResolved: searchHasResolved } =
|
|
95
|
+
useEntityRecords(
|
|
96
|
+
entityForSuggestions.type,
|
|
97
|
+
entityForSuggestions.slug,
|
|
98
|
+
query
|
|
99
|
+
);
|
|
100
|
+
useEffect( () => {
|
|
101
|
+
if ( search !== searchInputValue ) {
|
|
102
|
+
debouncedSearch( searchInputValue );
|
|
103
|
+
}
|
|
104
|
+
}, [ search, searchInputValue ] );
|
|
105
|
+
const entitiesInfo = useMemo( () => {
|
|
106
|
+
if ( ! searchResults?.length ) return EMPTY_ARRAY;
|
|
107
|
+
return mapToIHasNameAndId( searchResults, 'title.rendered' );
|
|
108
|
+
}, [ searchResults ] );
|
|
109
|
+
// Update suggestions only when the query has resolved.
|
|
110
|
+
useEffect( () => {
|
|
111
|
+
if ( ! searchHasResolved ) return;
|
|
112
|
+
setSuggestions( entitiesInfo );
|
|
113
|
+
}, [ entitiesInfo, searchHasResolved ] );
|
|
114
|
+
return (
|
|
115
|
+
<>
|
|
116
|
+
<SearchControl
|
|
117
|
+
onChange={ setSearchInputValue }
|
|
118
|
+
value={ searchInputValue }
|
|
119
|
+
label={ entityForSuggestions.labels.search_items }
|
|
120
|
+
placeholder={ entityForSuggestions.labels.search_items }
|
|
121
|
+
/>
|
|
122
|
+
{ !! suggestions?.length && (
|
|
123
|
+
<Composite
|
|
124
|
+
{ ...composite }
|
|
125
|
+
role="listbox"
|
|
126
|
+
className="edit-site-custom-template-modal__suggestions_list"
|
|
127
|
+
>
|
|
128
|
+
{ suggestions.map( ( suggestion ) => (
|
|
129
|
+
<SuggestionListItem
|
|
130
|
+
key={ suggestion.slug }
|
|
131
|
+
suggestion={ suggestion }
|
|
132
|
+
search={ search }
|
|
133
|
+
onSelect={ onSelect }
|
|
134
|
+
entityForSuggestions={ entityForSuggestions }
|
|
135
|
+
composite={ composite }
|
|
136
|
+
/>
|
|
137
|
+
) ) }
|
|
138
|
+
</Composite>
|
|
139
|
+
) }
|
|
140
|
+
{ search && ! suggestions?.length && (
|
|
141
|
+
<p className="edit-site-custom-template-modal__no-results">
|
|
142
|
+
{ entityForSuggestions.labels.not_found }
|
|
143
|
+
</p>
|
|
144
|
+
) }
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function AddCustomTemplateModal( { onClose, onSelect, entityForSuggestions } ) {
|
|
150
|
+
const [ showSearchEntities, setShowSearchEntities ] = useState(
|
|
151
|
+
entityForSuggestions.hasGeneralTemplate
|
|
152
|
+
);
|
|
153
|
+
const baseCssClass = 'edit-site-custom-template-modal';
|
|
154
|
+
return (
|
|
155
|
+
<Modal
|
|
156
|
+
title={ sprintf(
|
|
157
|
+
// translators: %s: Name of the post type e.g: "Post".
|
|
158
|
+
__( 'Add template: %s' ),
|
|
159
|
+
entityForSuggestions.labels.singular_name
|
|
160
|
+
) }
|
|
161
|
+
className={ baseCssClass }
|
|
162
|
+
closeLabel={ __( 'Close' ) }
|
|
163
|
+
onRequestClose={ onClose }
|
|
164
|
+
>
|
|
165
|
+
{ ! showSearchEntities && (
|
|
166
|
+
<>
|
|
167
|
+
<p>
|
|
168
|
+
{ __(
|
|
169
|
+
'Select whether to create a single template for all items or a specific one.'
|
|
170
|
+
) }
|
|
171
|
+
</p>
|
|
172
|
+
<Flex
|
|
173
|
+
className={ `${ baseCssClass }__contents` }
|
|
174
|
+
gap="4"
|
|
175
|
+
align="initial"
|
|
176
|
+
>
|
|
177
|
+
<FlexItem
|
|
178
|
+
isBlock
|
|
179
|
+
onClick={ () => {
|
|
180
|
+
const { slug, title, description } =
|
|
181
|
+
entityForSuggestions.template;
|
|
182
|
+
onSelect( { slug, title, description } );
|
|
183
|
+
} }
|
|
184
|
+
>
|
|
185
|
+
<Heading level={ 5 }>
|
|
186
|
+
{ entityForSuggestions.labels.all_items }
|
|
187
|
+
</Heading>
|
|
188
|
+
<Text as="span">
|
|
189
|
+
{
|
|
190
|
+
// translators: The user is given the choice to set up a template for all items of a post type, or just a specific one.
|
|
191
|
+
__( 'For all items' )
|
|
192
|
+
}
|
|
193
|
+
</Text>
|
|
194
|
+
</FlexItem>
|
|
195
|
+
<FlexItem
|
|
196
|
+
isBlock
|
|
197
|
+
onClick={ () => {
|
|
198
|
+
setShowSearchEntities( true );
|
|
199
|
+
} }
|
|
200
|
+
>
|
|
201
|
+
<Heading level={ 5 }>
|
|
202
|
+
{ entityForSuggestions.labels.singular_name }
|
|
203
|
+
</Heading>
|
|
204
|
+
<Text as="span">
|
|
205
|
+
{
|
|
206
|
+
// translators: The user is given the choice to set up a template for all items of a post type, or just a specific one.
|
|
207
|
+
__( 'For a specific item' )
|
|
208
|
+
}
|
|
209
|
+
</Text>
|
|
210
|
+
</FlexItem>
|
|
211
|
+
</Flex>
|
|
212
|
+
</>
|
|
213
|
+
) }
|
|
214
|
+
{ showSearchEntities && (
|
|
215
|
+
<>
|
|
216
|
+
<p>
|
|
217
|
+
{ __(
|
|
218
|
+
'This template will be used only for the specific item chosen.'
|
|
219
|
+
) }
|
|
220
|
+
</p>
|
|
221
|
+
<SuggestionList
|
|
222
|
+
entityForSuggestions={ entityForSuggestions }
|
|
223
|
+
onSelect={ onSelect }
|
|
224
|
+
/>
|
|
225
|
+
</>
|
|
226
|
+
) }
|
|
227
|
+
</Modal>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export default AddCustomTemplateModal;
|