@wordpress/edit-post 7.18.0 → 7.19.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 +2 -0
- package/build/components/header/index.js +6 -0
- package/build/components/header/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +4 -23
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +9 -3
- package/build/components/layout/index.js.map +1 -1
- package/build/components/start-page-options/index.js +2 -3
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/visual-editor/index.js +34 -44
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +2 -3
- package/build/editor.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +10 -4
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/store/actions.js +53 -7
- package/build/store/actions.js.map +1 -1
- package/build-module/components/header/index.js +6 -0
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +4 -23
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +9 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +2 -3
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +35 -45
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +2 -3
- package/build-module/editor.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +10 -4
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/store/actions.js +50 -5
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +94 -8
- package/build-style/style.css +94 -8
- package/package.json +32 -32
- package/src/components/header/index.js +2 -0
- package/src/components/keyboard-shortcut-help-modal/test/index.js +4 -5
- package/src/components/keyboard-shortcuts/index.js +5 -31
- package/src/components/layout/index.js +9 -2
- package/src/components/preferences-modal/test/index.js +35 -8
- package/src/components/start-page-options/index.js +4 -5
- package/src/components/visual-editor/index.js +49 -55
- package/src/components/visual-editor/style.scss +89 -0
- package/src/editor.js +17 -20
- package/src/hooks/commands/use-common-commands.js +10 -1
- package/src/store/actions.js +74 -7
- package/src/store/test/actions.js +75 -0
- package/src/store/test/reducer.js +21 -9
- package/src/style.scss +0 -9
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +0 -942
|
@@ -475,7 +475,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
475
475
|
display: none;
|
|
476
476
|
margin: 0;
|
|
477
477
|
}
|
|
478
|
-
.interface-pinned-items .components-button:
|
|
478
|
+
.interface-pinned-items .components-button[aria-controls="edit-post:document"], .interface-pinned-items .components-button[aria-controls="edit-post:block"], .interface-pinned-items .components-button[aria-controls="edit-site:template"], .interface-pinned-items .components-button[aria-controls="edit-site:block-inspector"], .interface-pinned-items .components-button[aria-controls="edit-site:global-styles"] {
|
|
479
479
|
display: flex;
|
|
480
480
|
}
|
|
481
481
|
.interface-pinned-items .components-button svg {
|
|
@@ -1877,6 +1877,99 @@ h2.edit-post-template-summary__title {
|
|
|
1877
1877
|
flex-grow: 1;
|
|
1878
1878
|
}
|
|
1879
1879
|
|
|
1880
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1881
|
+
/* Set left position when auto-fold is not on the body element. */
|
|
1882
|
+
right: 0;
|
|
1883
|
+
}
|
|
1884
|
+
@media (min-width: 783px) {
|
|
1885
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1886
|
+
right: 160px;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
.auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1891
|
+
/* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
|
|
1892
|
+
}
|
|
1893
|
+
@media (min-width: 783px) {
|
|
1894
|
+
.auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1895
|
+
right: 36px;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
@media (min-width: 961px) {
|
|
1899
|
+
.auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1900
|
+
right: 160px;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
/* Sidebar manually collapsed. */
|
|
1905
|
+
.folded .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1906
|
+
right: 0;
|
|
1907
|
+
}
|
|
1908
|
+
@media (min-width: 783px) {
|
|
1909
|
+
.folded .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1910
|
+
right: 36px;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
body.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1915
|
+
right: 0 !important;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1919
|
+
position: sticky;
|
|
1920
|
+
top: 0;
|
|
1921
|
+
z-index: 31;
|
|
1922
|
+
display: block;
|
|
1923
|
+
width: 100%;
|
|
1924
|
+
}
|
|
1925
|
+
@media (min-width: 782px) {
|
|
1926
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1927
|
+
margin-right: 180px;
|
|
1928
|
+
position: fixed;
|
|
1929
|
+
top: 32px;
|
|
1930
|
+
min-height: initial;
|
|
1931
|
+
border-bottom: none;
|
|
1932
|
+
display: flex;
|
|
1933
|
+
height: 60px;
|
|
1934
|
+
align-items: center;
|
|
1935
|
+
width: calc(100% - 180px);
|
|
1936
|
+
}
|
|
1937
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
|
|
1938
|
+
width: initial;
|
|
1939
|
+
}
|
|
1940
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed:empty {
|
|
1941
|
+
width: initial;
|
|
1942
|
+
}
|
|
1943
|
+
.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1944
|
+
margin-right: 240px;
|
|
1945
|
+
top: 0;
|
|
1946
|
+
}
|
|
1947
|
+
.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
|
|
1948
|
+
width: initial;
|
|
1949
|
+
}
|
|
1950
|
+
.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed:empty {
|
|
1951
|
+
width: initial;
|
|
1952
|
+
}
|
|
1953
|
+
.show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1954
|
+
width: calc(100% + 40px - 180px);
|
|
1955
|
+
margin-right: 80px;
|
|
1956
|
+
}
|
|
1957
|
+
.is-fullscreen-mode .show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1958
|
+
margin-right: 144px;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
@media (min-width: 960px) {
|
|
1962
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1963
|
+
width: auto;
|
|
1964
|
+
}
|
|
1965
|
+
.show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1966
|
+
width: auto;
|
|
1967
|
+
}
|
|
1968
|
+
.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1969
|
+
width: calc(100% - 280px - 256px);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1880
1973
|
.edit-post-welcome-guide,
|
|
1881
1974
|
.edit-template-welcome-guide {
|
|
1882
1975
|
width: 312px;
|
|
@@ -2168,13 +2261,6 @@ body.admin-color-sunrise {
|
|
|
2168
2261
|
}
|
|
2169
2262
|
}
|
|
2170
2263
|
|
|
2171
|
-
@supports (scrollbar-gutter: stable) {
|
|
2172
|
-
.interface-interface-skeleton__header .edit-post-header {
|
|
2173
|
-
scrollbar-gutter: stable;
|
|
2174
|
-
overflow: hidden;
|
|
2175
|
-
}
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
2264
|
.interface-interface-skeleton__sidebar {
|
|
2179
2265
|
border-right: none;
|
|
2180
2266
|
}
|
package/build-style/style.css
CHANGED
|
@@ -475,7 +475,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
475
475
|
display: none;
|
|
476
476
|
margin: 0;
|
|
477
477
|
}
|
|
478
|
-
.interface-pinned-items .components-button:
|
|
478
|
+
.interface-pinned-items .components-button[aria-controls="edit-post:document"], .interface-pinned-items .components-button[aria-controls="edit-post:block"], .interface-pinned-items .components-button[aria-controls="edit-site:template"], .interface-pinned-items .components-button[aria-controls="edit-site:block-inspector"], .interface-pinned-items .components-button[aria-controls="edit-site:global-styles"] {
|
|
479
479
|
display: flex;
|
|
480
480
|
}
|
|
481
481
|
.interface-pinned-items .components-button svg {
|
|
@@ -1877,6 +1877,99 @@ h2.edit-post-template-summary__title {
|
|
|
1877
1877
|
flex-grow: 1;
|
|
1878
1878
|
}
|
|
1879
1879
|
|
|
1880
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1881
|
+
/* Set left position when auto-fold is not on the body element. */
|
|
1882
|
+
left: 0;
|
|
1883
|
+
}
|
|
1884
|
+
@media (min-width: 783px) {
|
|
1885
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1886
|
+
left: 160px;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
.auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1891
|
+
/* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
|
|
1892
|
+
}
|
|
1893
|
+
@media (min-width: 783px) {
|
|
1894
|
+
.auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1895
|
+
left: 36px;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
@media (min-width: 961px) {
|
|
1899
|
+
.auto-fold .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1900
|
+
left: 160px;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
/* Sidebar manually collapsed. */
|
|
1905
|
+
.folded .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1906
|
+
left: 0;
|
|
1907
|
+
}
|
|
1908
|
+
@media (min-width: 783px) {
|
|
1909
|
+
.folded .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1910
|
+
left: 36px;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
body.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1915
|
+
left: 0 !important;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1919
|
+
position: sticky;
|
|
1920
|
+
top: 0;
|
|
1921
|
+
z-index: 31;
|
|
1922
|
+
display: block;
|
|
1923
|
+
width: 100%;
|
|
1924
|
+
}
|
|
1925
|
+
@media (min-width: 782px) {
|
|
1926
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1927
|
+
margin-left: 180px;
|
|
1928
|
+
position: fixed;
|
|
1929
|
+
top: 32px;
|
|
1930
|
+
min-height: initial;
|
|
1931
|
+
border-bottom: none;
|
|
1932
|
+
display: flex;
|
|
1933
|
+
height: 60px;
|
|
1934
|
+
align-items: center;
|
|
1935
|
+
width: calc(100% - 180px);
|
|
1936
|
+
}
|
|
1937
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
|
|
1938
|
+
width: initial;
|
|
1939
|
+
}
|
|
1940
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed:empty {
|
|
1941
|
+
width: initial;
|
|
1942
|
+
}
|
|
1943
|
+
.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1944
|
+
margin-left: 240px;
|
|
1945
|
+
top: 0;
|
|
1946
|
+
}
|
|
1947
|
+
.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
|
|
1948
|
+
width: initial;
|
|
1949
|
+
}
|
|
1950
|
+
.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed:empty {
|
|
1951
|
+
width: initial;
|
|
1952
|
+
}
|
|
1953
|
+
.show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1954
|
+
width: calc(100% + 40px - 180px);
|
|
1955
|
+
margin-left: 80px;
|
|
1956
|
+
}
|
|
1957
|
+
.is-fullscreen-mode .show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1958
|
+
margin-left: 144px;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
@media (min-width: 960px) {
|
|
1962
|
+
.edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1963
|
+
width: auto;
|
|
1964
|
+
}
|
|
1965
|
+
.show-icon-labels .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1966
|
+
width: auto;
|
|
1967
|
+
}
|
|
1968
|
+
.is-fullscreen-mode .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
|
|
1969
|
+
width: calc(100% - 280px - 256px);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1880
1973
|
.edit-post-welcome-guide,
|
|
1881
1974
|
.edit-template-welcome-guide {
|
|
1882
1975
|
width: 312px;
|
|
@@ -2168,13 +2261,6 @@ body.admin-color-sunrise {
|
|
|
2168
2261
|
}
|
|
2169
2262
|
}
|
|
2170
2263
|
|
|
2171
|
-
@supports (scrollbar-gutter: stable) {
|
|
2172
|
-
.interface-interface-skeleton__header .edit-post-header {
|
|
2173
|
-
scrollbar-gutter: stable;
|
|
2174
|
-
overflow: hidden;
|
|
2175
|
-
}
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
2264
|
.interface-interface-skeleton__sidebar {
|
|
2179
2265
|
border-left: none;
|
|
2180
2266
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.19.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,36 +27,36 @@
|
|
|
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": "^12.
|
|
33
|
-
"@wordpress/block-library": "^8.
|
|
34
|
-
"@wordpress/blocks": "^12.
|
|
35
|
-
"@wordpress/commands": "^0.
|
|
36
|
-
"@wordpress/components": "^25.
|
|
37
|
-
"@wordpress/compose": "^6.
|
|
38
|
-
"@wordpress/core-commands": "^0.
|
|
39
|
-
"@wordpress/core-data": "^6.
|
|
40
|
-
"@wordpress/data": "^9.
|
|
41
|
-
"@wordpress/deprecated": "^3.
|
|
42
|
-
"@wordpress/dom": "^3.
|
|
43
|
-
"@wordpress/editor": "^13.
|
|
44
|
-
"@wordpress/element": "^5.
|
|
45
|
-
"@wordpress/hooks": "^3.
|
|
46
|
-
"@wordpress/i18n": "^4.
|
|
47
|
-
"@wordpress/icons": "^9.
|
|
48
|
-
"@wordpress/interface": "^5.
|
|
49
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
50
|
-
"@wordpress/keycodes": "^3.
|
|
51
|
-
"@wordpress/media-utils": "^4.
|
|
52
|
-
"@wordpress/notices": "^4.
|
|
53
|
-
"@wordpress/plugins": "^6.
|
|
54
|
-
"@wordpress/preferences": "^3.
|
|
55
|
-
"@wordpress/private-apis": "^0.
|
|
56
|
-
"@wordpress/url": "^3.
|
|
57
|
-
"@wordpress/viewport": "^5.
|
|
58
|
-
"@wordpress/warning": "^2.
|
|
59
|
-
"@wordpress/widgets": "^3.
|
|
30
|
+
"@wordpress/a11y": "^3.42.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.39.0",
|
|
32
|
+
"@wordpress/block-editor": "^12.10.0",
|
|
33
|
+
"@wordpress/block-library": "^8.19.0",
|
|
34
|
+
"@wordpress/blocks": "^12.19.0",
|
|
35
|
+
"@wordpress/commands": "^0.13.0",
|
|
36
|
+
"@wordpress/components": "^25.8.0",
|
|
37
|
+
"@wordpress/compose": "^6.19.0",
|
|
38
|
+
"@wordpress/core-commands": "^0.11.0",
|
|
39
|
+
"@wordpress/core-data": "^6.19.0",
|
|
40
|
+
"@wordpress/data": "^9.12.0",
|
|
41
|
+
"@wordpress/deprecated": "^3.42.0",
|
|
42
|
+
"@wordpress/dom": "^3.42.0",
|
|
43
|
+
"@wordpress/editor": "^13.19.0",
|
|
44
|
+
"@wordpress/element": "^5.19.0",
|
|
45
|
+
"@wordpress/hooks": "^3.42.0",
|
|
46
|
+
"@wordpress/i18n": "^4.42.0",
|
|
47
|
+
"@wordpress/icons": "^9.33.0",
|
|
48
|
+
"@wordpress/interface": "^5.19.0",
|
|
49
|
+
"@wordpress/keyboard-shortcuts": "^4.19.0",
|
|
50
|
+
"@wordpress/keycodes": "^3.42.0",
|
|
51
|
+
"@wordpress/media-utils": "^4.33.0",
|
|
52
|
+
"@wordpress/notices": "^4.10.0",
|
|
53
|
+
"@wordpress/plugins": "^6.10.0",
|
|
54
|
+
"@wordpress/preferences": "^3.19.0",
|
|
55
|
+
"@wordpress/private-apis": "^0.24.0",
|
|
56
|
+
"@wordpress/url": "^3.43.0",
|
|
57
|
+
"@wordpress/viewport": "^5.19.0",
|
|
58
|
+
"@wordpress/warning": "^2.42.0",
|
|
59
|
+
"@wordpress/widgets": "^3.19.0",
|
|
60
60
|
"classnames": "^2.3.1",
|
|
61
61
|
"memize": "^2.1.0",
|
|
62
62
|
"rememo": "^4.0.2"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "cc35f517ed017ab7131319af3e87c359e8de175d"
|
|
72
72
|
}
|
|
@@ -22,11 +22,13 @@ import DocumentActions from './document-actions';
|
|
|
22
22
|
|
|
23
23
|
const slideY = {
|
|
24
24
|
hidden: { y: '-50px' },
|
|
25
|
+
distractionFreeInactive: { y: 0 },
|
|
25
26
|
hover: { y: 0, transition: { type: 'tween', delay: 0.2 } },
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
const slideX = {
|
|
29
30
|
hidden: { x: '-100%' },
|
|
31
|
+
distractionFreeInactive: { x: 0 },
|
|
30
32
|
hover: { x: 0, transition: { type: 'tween', delay: 0.2 } },
|
|
31
33
|
};
|
|
32
34
|
|
|
@@ -7,7 +7,6 @@ import { render, screen } from '@testing-library/react';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { EditorKeyboardShortcutsRegister } from '@wordpress/editor';
|
|
10
|
-
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Internal dependencies
|
|
@@ -19,10 +18,10 @@ const noop = () => {};
|
|
|
19
18
|
describe( 'KeyboardShortcutHelpModal', () => {
|
|
20
19
|
it( 'should match snapshot when the modal is active', () => {
|
|
21
20
|
render(
|
|
22
|
-
|
|
21
|
+
<>
|
|
23
22
|
<EditorKeyboardShortcutsRegister />
|
|
24
23
|
<KeyboardShortcutHelpModal isModalActive toggleModal={ noop } />
|
|
25
|
-
|
|
24
|
+
</>
|
|
26
25
|
);
|
|
27
26
|
|
|
28
27
|
expect(
|
|
@@ -34,13 +33,13 @@ describe( 'KeyboardShortcutHelpModal', () => {
|
|
|
34
33
|
|
|
35
34
|
it( 'should not render the modal when inactive', () => {
|
|
36
35
|
render(
|
|
37
|
-
|
|
36
|
+
<>
|
|
38
37
|
<EditorKeyboardShortcutsRegister />
|
|
39
38
|
<KeyboardShortcutHelpModal
|
|
40
39
|
isModalActive={ false }
|
|
41
40
|
toggleModal={ noop }
|
|
42
41
|
/>
|
|
43
|
-
|
|
42
|
+
</>
|
|
44
43
|
);
|
|
45
44
|
|
|
46
45
|
expect(
|
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
import { store as editorStore } from '@wordpress/editor';
|
|
12
12
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
13
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
14
|
-
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
13
|
import { createBlock } from '@wordpress/blocks';
|
|
16
14
|
|
|
17
15
|
/**
|
|
@@ -21,39 +19,24 @@ import { store as editPostStore } from '../../store';
|
|
|
21
19
|
|
|
22
20
|
function KeyboardShortcuts() {
|
|
23
21
|
const { getBlockSelectionStart } = useSelect( blockEditorStore );
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
isEditorSidebarOpened,
|
|
27
|
-
isListViewOpened,
|
|
28
|
-
isFeatureActive,
|
|
29
|
-
} = useSelect( editPostStore );
|
|
22
|
+
const { getEditorMode, isEditorSidebarOpened, isListViewOpened } =
|
|
23
|
+
useSelect( editPostStore );
|
|
30
24
|
const isModeToggleDisabled = useSelect( ( select ) => {
|
|
31
25
|
const { richEditingEnabled, codeEditingEnabled } =
|
|
32
26
|
select( editorStore ).getEditorSettings();
|
|
33
27
|
return ! richEditingEnabled || ! codeEditingEnabled;
|
|
34
28
|
}, [] );
|
|
35
29
|
|
|
36
|
-
const { createInfoNotice } = useDispatch( noticesStore );
|
|
37
|
-
|
|
38
30
|
const {
|
|
39
31
|
switchEditorMode,
|
|
40
32
|
openGeneralSidebar,
|
|
41
33
|
closeGeneralSidebar,
|
|
42
34
|
toggleFeature,
|
|
43
35
|
setIsListViewOpened,
|
|
44
|
-
|
|
36
|
+
toggleDistractionFree,
|
|
45
37
|
} = useDispatch( editPostStore );
|
|
46
38
|
const { registerShortcut } = useDispatch( keyboardShortcutsStore );
|
|
47
39
|
|
|
48
|
-
const { set: setPreference } = useDispatch( preferencesStore );
|
|
49
|
-
|
|
50
|
-
const toggleDistractionFree = () => {
|
|
51
|
-
setPreference( 'core/edit-post', 'fixedToolbar', false );
|
|
52
|
-
setIsInserterOpened( false );
|
|
53
|
-
setIsListViewOpened( false );
|
|
54
|
-
closeGeneralSidebar();
|
|
55
|
-
};
|
|
56
|
-
|
|
57
40
|
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
58
41
|
const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
|
|
59
42
|
useSelect( blockEditorStore );
|
|
@@ -224,16 +207,6 @@ function KeyboardShortcuts() {
|
|
|
224
207
|
|
|
225
208
|
useShortcut( 'core/edit-post/toggle-distraction-free', () => {
|
|
226
209
|
toggleDistractionFree();
|
|
227
|
-
toggleFeature( 'distractionFree' );
|
|
228
|
-
createInfoNotice(
|
|
229
|
-
isFeatureActive( 'distractionFree' )
|
|
230
|
-
? __( 'Distraction free on.' )
|
|
231
|
-
: __( 'Distraction free off.' ),
|
|
232
|
-
{
|
|
233
|
-
id: 'core/edit-post/distraction-free-mode/notice',
|
|
234
|
-
type: 'snackbar',
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
210
|
} );
|
|
238
211
|
|
|
239
212
|
useShortcut( 'core/edit-post/toggle-sidebar', ( event ) => {
|
|
@@ -252,8 +225,9 @@ function KeyboardShortcuts() {
|
|
|
252
225
|
} );
|
|
253
226
|
|
|
254
227
|
// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.
|
|
255
|
-
useShortcut( 'core/edit-post/toggle-list-view', () => {
|
|
228
|
+
useShortcut( 'core/edit-post/toggle-list-view', ( event ) => {
|
|
256
229
|
if ( ! isListViewOpened() ) {
|
|
230
|
+
event.preventDefault();
|
|
257
231
|
setIsListViewOpened( true );
|
|
258
232
|
}
|
|
259
233
|
} );
|
|
@@ -220,11 +220,17 @@ function Layout() {
|
|
|
220
220
|
[ entitiesSavedStatesCallback ]
|
|
221
221
|
);
|
|
222
222
|
|
|
223
|
+
// We need to add the show-icon-labels class to the body element so it is applied to modals.
|
|
224
|
+
if ( showIconLabels ) {
|
|
225
|
+
document.body.classList.add( 'show-icon-labels' );
|
|
226
|
+
} else {
|
|
227
|
+
document.body.classList.remove( 'show-icon-labels' );
|
|
228
|
+
}
|
|
229
|
+
|
|
223
230
|
const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
|
|
224
231
|
'is-sidebar-opened': sidebarIsOpened,
|
|
225
232
|
'has-fixed-toolbar': hasFixedToolbar,
|
|
226
233
|
'has-metaboxes': hasActiveMetaboxes,
|
|
227
|
-
'show-icon-labels': showIconLabels,
|
|
228
234
|
'is-distraction-free': isDistractionFree && isLargeViewport,
|
|
229
235
|
'is-entity-save-view-open': !! entitiesSavedStatesCallback,
|
|
230
236
|
} );
|
|
@@ -266,7 +272,7 @@ function Layout() {
|
|
|
266
272
|
<EditPostKeyboardShortcuts />
|
|
267
273
|
<EditorKeyboardShortcutsRegister />
|
|
268
274
|
<EditorKeyboardShortcuts />
|
|
269
|
-
|
|
275
|
+
|
|
270
276
|
<InterfaceSkeleton
|
|
271
277
|
isDistractionFree={ isDistractionFree && isLargeViewport }
|
|
272
278
|
className={ className }
|
|
@@ -358,6 +364,7 @@ function Layout() {
|
|
|
358
364
|
<PostSyncStatusModal />
|
|
359
365
|
<StartPageOptions />
|
|
360
366
|
<PluginArea onError={ onPluginAreaError } />
|
|
367
|
+
<SettingsSidebar />
|
|
361
368
|
</>
|
|
362
369
|
);
|
|
363
370
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { render, screen, within } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -20,25 +20,52 @@ jest.mock( '@wordpress/compose/src/hooks/use-viewport-match', () => jest.fn() );
|
|
|
20
20
|
|
|
21
21
|
describe( 'EditPostPreferencesModal', () => {
|
|
22
22
|
describe( 'should match snapshot when the modal is active', () => {
|
|
23
|
+
afterEach( () => {
|
|
24
|
+
useViewportMatch.mockClear();
|
|
25
|
+
} );
|
|
23
26
|
it( 'large viewports', async () => {
|
|
24
27
|
useSelect.mockImplementation( () => [ true, true, false ] );
|
|
25
28
|
useViewportMatch.mockImplementation( () => true );
|
|
26
29
|
render( <EditPostPreferencesModal /> );
|
|
27
|
-
await screen.findByRole( '
|
|
30
|
+
const tabPanel = await screen.findByRole( 'tabpanel', {
|
|
28
31
|
name: 'General',
|
|
29
|
-
selected: true,
|
|
30
32
|
} );
|
|
33
|
+
|
|
31
34
|
expect(
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
within( tabPanel ).getByLabelText(
|
|
36
|
+
'Include pre-publish checklist'
|
|
37
|
+
)
|
|
38
|
+
).toBeInTheDocument();
|
|
34
39
|
} );
|
|
35
|
-
it( 'small viewports', () => {
|
|
40
|
+
it( 'small viewports', async () => {
|
|
36
41
|
useSelect.mockImplementation( () => [ true, true, false ] );
|
|
37
42
|
useViewportMatch.mockImplementation( () => false );
|
|
38
43
|
render( <EditPostPreferencesModal /> );
|
|
44
|
+
|
|
45
|
+
// The tabpanel is not rendered in small viewports.
|
|
46
|
+
expect(
|
|
47
|
+
screen.queryByRole( 'tabpanel', {
|
|
48
|
+
name: 'General',
|
|
49
|
+
} )
|
|
50
|
+
).not.toBeInTheDocument();
|
|
51
|
+
|
|
52
|
+
const dialog = screen.getByRole( 'dialog', {
|
|
53
|
+
name: 'Preferences',
|
|
54
|
+
} );
|
|
55
|
+
|
|
56
|
+
// Checkbox toggle controls are not rendered in small viewports.
|
|
57
|
+
expect(
|
|
58
|
+
within( dialog ).queryByLabelText(
|
|
59
|
+
'Include pre-publish checklist'
|
|
60
|
+
)
|
|
61
|
+
).not.toBeInTheDocument();
|
|
62
|
+
|
|
63
|
+
// Individual preference nav buttons are rendered in small viewports.
|
|
39
64
|
expect(
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
within( dialog ).getByRole( 'button', {
|
|
66
|
+
name: 'General',
|
|
67
|
+
} )
|
|
68
|
+
).toBeInTheDocument();
|
|
42
69
|
} );
|
|
43
70
|
} );
|
|
44
71
|
|
|
@@ -97,14 +97,13 @@ function StartPageOptionsModal() {
|
|
|
97
97
|
|
|
98
98
|
export default function StartPageOptions() {
|
|
99
99
|
const shouldEnableModal = useSelect( ( select ) => {
|
|
100
|
-
const {
|
|
101
|
-
select( editorStore );
|
|
100
|
+
const { isCleanNewPost } = select( editorStore );
|
|
102
101
|
const { isEditingTemplate, isFeatureActive } = select( editPostStore );
|
|
102
|
+
|
|
103
103
|
return (
|
|
104
|
-
! isEditedPostSaveable() &&
|
|
105
|
-
'' === getEditedPostContent() &&
|
|
106
104
|
! isEditingTemplate() &&
|
|
107
|
-
! isFeatureActive( 'welcomeGuide' )
|
|
105
|
+
! isFeatureActive( 'welcomeGuide' ) &&
|
|
106
|
+
isCleanNewPost()
|
|
108
107
|
);
|
|
109
108
|
}, [] );
|
|
110
109
|
|