@wordpress/edit-post 6.4.0 → 6.5.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/secondary-sidebar/list-view-sidebar.js +1 -5
  3. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  4. package/build/components/sidebar/post-visibility/index.js +16 -1
  5. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  6. package/build/components/start-page-options/index.js +0 -5
  7. package/build/components/start-page-options/index.js.map +1 -1
  8. package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -5
  9. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  10. package/build-module/components/sidebar/post-visibility/index.js +17 -1
  11. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  12. package/build-module/components/start-page-options/index.js +0 -5
  13. package/build-module/components/start-page-options/index.js.map +1 -1
  14. package/build-style/style-rtl.css +15 -70
  15. package/build-style/style.css +15 -70
  16. package/package.json +27 -27
  17. package/src/components/block-manager/style.scss +0 -4
  18. package/src/components/header/style.scss +12 -32
  19. package/src/components/secondary-sidebar/list-view-sidebar.js +1 -5
  20. package/src/components/sidebar/post-visibility/index.js +12 -2
  21. package/src/components/sidebar/post-visibility/style.scss +2 -30
  22. package/src/components/start-page-options/index.js +0 -5
  23. package/src/test/editor.native.js +8 -1
  24. package/build/components/admin-notices/index.js +0 -129
  25. package/build/components/admin-notices/index.js.map +0 -1
  26. package/build/components/block-manager/show-all.js +0 -39
  27. package/build/components/block-manager/show-all.js.map +0 -1
  28. package/build/components/editor-initialization/utils.js +0 -38
  29. package/build/components/editor-initialization/utils.js.map +0 -1
  30. package/build-module/components/admin-notices/index.js +0 -114
  31. package/build-module/components/admin-notices/index.js.map +0 -1
  32. package/build-module/components/block-manager/show-all.js +0 -29
  33. package/build-module/components/block-manager/show-all.js.map +0 -1
  34. package/build-module/components/editor-initialization/utils.js +0 -29
  35. package/build-module/components/editor-initialization/utils.js.map +0 -1
  36. package/src/components/admin-notices/index.js +0 -110
  37. package/src/components/admin-notices/test/index.js +0 -63
  38. package/src/components/block-manager/show-all.js +0 -30
  39. package/src/components/editor-initialization/utils.js +0 -24
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/show-all.js"],"names":["useInstanceId","FormToggle","__","BlockManagerShowAll","checked","onChange","instanceId","id","event","target"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,oBAA9B;AACA,SAASC,UAAT,QAA2B,uBAA3B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,eAAe,SAASC,mBAAT,OAAsD;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAAwB;AACpE,QAAMC,UAAU,GAAGN,aAAa,CAAEG,mBAAF,CAAhC;AACA,QAAMI,EAAE,GAAG,uCAAuCD,UAAlD;AAEA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,OAAO,EAAGC,EADX;AAEC,IAAA,SAAS,EAAC;AAFX;AAKE;AACAL,EAAAA,EAAE,CAAE,cAAF,CANJ,CADD,EAUC,cAAC,UAAD;AACC,IAAA,EAAE,EAAGK,EADN;AAEC,IAAA,OAAO,EAAGH,OAFX;AAGC,IAAA,QAAQ,EAAKI,KAAF,IAAaH,QAAQ,CAAEG,KAAK,CAACC,MAAN,CAAaL,OAAf;AAHjC,IAVD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { FormToggle } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function BlockManagerShowAll( { checked, onChange } ) {\n\tconst instanceId = useInstanceId( BlockManagerShowAll );\n\tconst id = 'edit-post-block-manager__show-all-' + instanceId;\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__show-all\">\n\t\t\t<label\n\t\t\t\thtmlFor={ id }\n\t\t\t\tclassName=\"edit-post-block-manager__show-all-label\"\n\t\t\t>\n\t\t\t\t{\n\t\t\t\t\t/* translators: Checkbox toggle label */\n\t\t\t\t\t__( 'Show section' )\n\t\t\t\t}\n\t\t\t</label>\n\t\t\t<FormToggle\n\t\t\t\tid={ id }\n\t\t\t\tchecked={ checked }\n\t\t\t\tonChange={ ( event ) => onChange( event.target.checked ) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
@@ -1,29 +0,0 @@
1
- /**
2
- * Given a selector returns a functions that returns the listener only
3
- * if the returned value from the selector changes.
4
- *
5
- * @param {Function} selector Selector.
6
- * @param {Function} listener Listener.
7
- * @param {boolean} initial Flags whether listener should be invoked on
8
- * initial call.
9
- *
10
- * @return {Function} Listener creator.
11
- */
12
- export const onChangeListener = function (selector, listener) {
13
- let initial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
14
- let previousValue = selector();
15
-
16
- if (initial) {
17
- listener(selector());
18
- }
19
-
20
- return () => {
21
- const selectedValue = selector();
22
-
23
- if (selectedValue !== previousValue) {
24
- previousValue = selectedValue;
25
- listener(selectedValue);
26
- }
27
- };
28
- };
29
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/editor-initialization/utils.js"],"names":["onChangeListener","selector","listener","initial","previousValue","selectedValue"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,GAAG,UAAEC,QAAF,EAAYC,QAAZ,EAA2C;AAAA,MAArBC,OAAqB,uEAAX,KAAW;AAC1E,MAAIC,aAAa,GAAGH,QAAQ,EAA5B;;AACA,MAAKE,OAAL,EAAe;AACdD,IAAAA,QAAQ,CAAED,QAAQ,EAAV,CAAR;AACA;;AACD,SAAO,MAAM;AACZ,UAAMI,aAAa,GAAGJ,QAAQ,EAA9B;;AACA,QAAKI,aAAa,KAAKD,aAAvB,EAAuC;AACtCA,MAAAA,aAAa,GAAGC,aAAhB;AACAH,MAAAA,QAAQ,CAAEG,aAAF,CAAR;AACA;AACD,GAND;AAOA,CAZM","sourcesContent":["/**\n * Given a selector returns a functions that returns the listener only\n * if the returned value from the selector changes.\n *\n * @param {Function} selector Selector.\n * @param {Function} listener Listener.\n * @param {boolean} initial Flags whether listener should be invoked on\n * initial call.\n *\n * @return {Function} Listener creator.\n */\nexport const onChangeListener = ( selector, listener, initial = false ) => {\n\tlet previousValue = selector();\n\tif ( initial ) {\n\t\tlistener( selector() );\n\t}\n\treturn () => {\n\t\tconst selectedValue = selector();\n\t\tif ( selectedValue !== previousValue ) {\n\t\t\tpreviousValue = selectedValue;\n\t\t\tlistener( selectedValue );\n\t\t}\n\t};\n};\n"]}
@@ -1,110 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { Component } from '@wordpress/element';
5
- import { withDispatch } from '@wordpress/data';
6
- import { store as noticesStore } from '@wordpress/notices';
7
-
8
- /**
9
- * Mapping of server-supported notice class names to an equivalent notices
10
- * module status.
11
- *
12
- * @type {Map}
13
- */
14
- const NOTICE_CLASS_STATUSES = {
15
- 'notice-success': 'success',
16
- updated: 'success',
17
- 'notice-warning': 'warning',
18
- 'notice-error': 'error',
19
- error: 'error',
20
- 'notice-info': 'info',
21
- };
22
-
23
- /**
24
- * Returns an array of admin notice Elements.
25
- *
26
- * @return {Element[]} Admin notice elements.
27
- */
28
- function getAdminNotices() {
29
- // The order is reversed to match expectations of rendered order, since a
30
- // NoticesList is itself rendered in reverse order (newest to oldest).
31
- return Array.from(
32
- document.querySelectorAll( '#wpbody-content > .notice' )
33
- ).reverse();
34
- }
35
-
36
- /**
37
- * Given an admin notice Element, returns the relevant notice content HTML.
38
- *
39
- * @param {Element} element Admin notice element.
40
- *
41
- * @return {Element} Upgraded notice HTML.
42
- */
43
- function getNoticeHTML( element ) {
44
- const fragments = [];
45
-
46
- for ( const child of element.childNodes ) {
47
- if ( child.nodeType !== child.ELEMENT_NODE ) {
48
- const value = child.nodeValue.trim();
49
- if ( value ) {
50
- fragments.push( child.nodeValue );
51
- }
52
- } else if ( ! child.classList.contains( 'notice-dismiss' ) ) {
53
- fragments.push( child.outerHTML );
54
- }
55
- }
56
-
57
- return fragments.join( '' );
58
- }
59
-
60
- /**
61
- * Given an admin notice Element, returns the upgraded status type, or
62
- * undefined if one cannot be determined (i.e. one is not assigned).
63
- *
64
- * @param {Element} element Admin notice element.
65
- *
66
- * @return {?string} Upgraded status type.
67
- */
68
- function getNoticeStatus( element ) {
69
- for ( const className of element.classList ) {
70
- if ( NOTICE_CLASS_STATUSES.hasOwnProperty( className ) ) {
71
- return NOTICE_CLASS_STATUSES[ className ];
72
- }
73
- }
74
- }
75
-
76
- export class AdminNotices extends Component {
77
- componentDidMount() {
78
- this.convertNotices();
79
- }
80
-
81
- convertNotices() {
82
- const { createNotice } = this.props;
83
- getAdminNotices().forEach( ( element ) => {
84
- // Convert and create.
85
- const status = getNoticeStatus( element );
86
- const content = getNoticeHTML( element );
87
- const isDismissible = element.classList.contains(
88
- 'is-dismissible'
89
- );
90
- createNotice( status, content, {
91
- speak: false,
92
- __unstableHTML: true,
93
- isDismissible,
94
- } );
95
-
96
- // Remove (now-redundant) admin notice element.
97
- element.parentNode.removeChild( element );
98
- } );
99
- }
100
-
101
- render() {
102
- return null;
103
- }
104
- }
105
-
106
- export default withDispatch( ( dispatch ) => {
107
- const { createNotice } = dispatch( noticesStore );
108
-
109
- return { createNotice };
110
- } )( AdminNotices );
@@ -1,63 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import renderer from 'react-test-renderer';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import { AdminNotices } from '../';
10
-
11
- describe( 'AdminNotices', () => {
12
- beforeEach( () => {
13
- // The superfluous whitespace is intentional in verifying expected
14
- // outputs of (a) non-element first child of the element (whitespace
15
- // text node) and (b) untrimmed content.
16
- document.body.innerHTML = `
17
- <div id="wpbody-content">
18
- <div class="notice updated is-dismissible">
19
- <p>My <strong>notice</strong> text</p>
20
- <p>My second line of text</p>
21
- <button type="button" class="notice-dismiss">
22
- <span class="screen-reader-text">Dismiss this notice.</span>
23
- </button>
24
- </div>
25
- <div class="notice notice-warning">Warning</div>
26
- <aside class="elsewhere">
27
- <div class="notice">Ignore me</div>
28
- </aside>
29
- </div>
30
- `;
31
- } );
32
-
33
- it( 'should upgrade notices', () => {
34
- const createNotice = jest.fn();
35
-
36
- renderer.create( <AdminNotices createNotice={ createNotice } /> );
37
-
38
- expect( createNotice ).toHaveBeenCalledTimes( 2 );
39
- expect( createNotice.mock.calls[ 0 ] ).toEqual( [
40
- 'warning',
41
- 'Warning',
42
- {
43
- speak: false,
44
- __unstableHTML: true,
45
- isDismissible: false,
46
- },
47
- ] );
48
- expect( createNotice.mock.calls[ 1 ] ).toEqual( [
49
- 'success',
50
- '<p>My <strong>notice</strong> text</p><p>My second line of text</p>',
51
- {
52
- speak: false,
53
- __unstableHTML: true,
54
- isDismissible: true,
55
- },
56
- ] );
57
-
58
- // Verify all but `<aside>` are removed.
59
- expect(
60
- document.getElementById( 'wpbody-content' ).childElementCount
61
- ).toBe( 1 );
62
- } );
63
- } );
@@ -1,30 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useInstanceId } from '@wordpress/compose';
5
- import { FormToggle } from '@wordpress/components';
6
- import { __ } from '@wordpress/i18n';
7
-
8
- export default function BlockManagerShowAll( { checked, onChange } ) {
9
- const instanceId = useInstanceId( BlockManagerShowAll );
10
- const id = 'edit-post-block-manager__show-all-' + instanceId;
11
-
12
- return (
13
- <div className="edit-post-block-manager__show-all">
14
- <label
15
- htmlFor={ id }
16
- className="edit-post-block-manager__show-all-label"
17
- >
18
- {
19
- /* translators: Checkbox toggle label */
20
- __( 'Show section' )
21
- }
22
- </label>
23
- <FormToggle
24
- id={ id }
25
- checked={ checked }
26
- onChange={ ( event ) => onChange( event.target.checked ) }
27
- />
28
- </div>
29
- );
30
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Given a selector returns a functions that returns the listener only
3
- * if the returned value from the selector changes.
4
- *
5
- * @param {Function} selector Selector.
6
- * @param {Function} listener Listener.
7
- * @param {boolean} initial Flags whether listener should be invoked on
8
- * initial call.
9
- *
10
- * @return {Function} Listener creator.
11
- */
12
- export const onChangeListener = ( selector, listener, initial = false ) => {
13
- let previousValue = selector();
14
- if ( initial ) {
15
- listener( selector() );
16
- }
17
- return () => {
18
- const selectedValue = selector();
19
- if ( selectedValue !== previousValue ) {
20
- previousValue = selectedValue;
21
- listener( selectedValue );
22
- }
23
- };
24
- };