@wordpress/edit-post 8.32.0 → 8.32.1-next.ff1cebbba.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 (184) hide show
  1. package/build/commands/use-commands.js +54 -47
  2. package/build/commands/use-commands.js.map +7 -1
  3. package/build/components/back-button/fullscreen-mode-close.js +127 -118
  4. package/build/components/back-button/fullscreen-mode-close.js.map +7 -1
  5. package/build/components/back-button/index.js +56 -54
  6. package/build/components/back-button/index.js.map +7 -1
  7. package/build/components/browser-url/index.js +45 -44
  8. package/build/components/browser-url/index.js.map +7 -1
  9. package/build/components/editor-initialization/index.js +24 -18
  10. package/build/components/editor-initialization/index.js.map +7 -1
  11. package/build/components/editor-initialization/listener-hooks.js +42 -43
  12. package/build/components/editor-initialization/listener-hooks.js.map +7 -1
  13. package/build/components/init-pattern-modal/index.js +100 -79
  14. package/build/components/init-pattern-modal/index.js.map +7 -1
  15. package/build/components/keyboard-shortcuts/index.js +37 -33
  16. package/build/components/keyboard-shortcuts/index.js.map +7 -1
  17. package/build/components/layout/index.js +447 -467
  18. package/build/components/layout/index.js.map +7 -1
  19. package/build/components/layout/use-padding-appender.js +66 -59
  20. package/build/components/layout/use-padding-appender.js.map +7 -1
  21. package/build/components/layout/use-should-iframe.js +36 -30
  22. package/build/components/layout/use-should-iframe.js.map +7 -1
  23. package/build/components/meta-boxes/index.js +46 -33
  24. package/build/components/meta-boxes/index.js.map +7 -1
  25. package/build/components/meta-boxes/meta-box-visibility.js +37 -22
  26. package/build/components/meta-boxes/meta-box-visibility.js.map +7 -1
  27. package/build/components/meta-boxes/meta-boxes-area/index.js +62 -53
  28. package/build/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
  29. package/build/components/meta-boxes/use-meta-box-initialization.js +37 -32
  30. package/build/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
  31. package/build/components/more-menu/index.js +64 -44
  32. package/build/components/more-menu/index.js.map +7 -1
  33. package/build/components/more-menu/manage-patterns-menu-item.js +39 -37
  34. package/build/components/more-menu/manage-patterns-menu-item.js.map +7 -1
  35. package/build/components/more-menu/welcome-guide-menu-item.js +39 -21
  36. package/build/components/more-menu/welcome-guide-menu-item.js.map +7 -1
  37. package/build/components/preferences-modal/enable-custom-fields.js +76 -66
  38. package/build/components/preferences-modal/enable-custom-fields.js.map +7 -1
  39. package/build/components/preferences-modal/enable-panel.js +47 -43
  40. package/build/components/preferences-modal/enable-panel.js.map +7 -1
  41. package/build/components/preferences-modal/index.js +51 -39
  42. package/build/components/preferences-modal/index.js.map +7 -1
  43. package/build/components/preferences-modal/meta-boxes-section.js +65 -52
  44. package/build/components/preferences-modal/meta-boxes-section.js.map +7 -1
  45. package/build/components/welcome-guide/default.js +134 -97
  46. package/build/components/welcome-guide/default.js.map +7 -1
  47. package/build/components/welcome-guide/image.js +34 -23
  48. package/build/components/welcome-guide/image.js.map +7 -1
  49. package/build/components/welcome-guide/index.js +51 -38
  50. package/build/components/welcome-guide/index.js.map +7 -1
  51. package/build/components/welcome-guide/template.js +65 -45
  52. package/build/components/welcome-guide/template.js.map +7 -1
  53. package/build/deprecated.js +84 -110
  54. package/build/deprecated.js.map +7 -1
  55. package/build/hooks/use-navigate-to-entity-record.js +60 -78
  56. package/build/hooks/use-navigate-to-entity-record.js.map +7 -1
  57. package/build/index.js +101 -136
  58. package/build/index.js.map +7 -1
  59. package/build/lock-unlock.js +31 -15
  60. package/build/lock-unlock.js.map +7 -1
  61. package/build/store/actions.js +239 -431
  62. package/build/store/actions.js.map +7 -1
  63. package/build/store/constants.js +33 -26
  64. package/build/store/constants.js.map +7 -1
  65. package/build/store/index.js +44 -32
  66. package/build/store/index.js.map +7 -1
  67. package/build/store/reducer.js +50 -57
  68. package/build/store/reducer.js.map +7 -1
  69. package/build/store/selectors.js +288 -459
  70. package/build/store/selectors.js.map +7 -1
  71. package/build/utils/meta-boxes.js +31 -19
  72. package/build/utils/meta-boxes.js.map +7 -1
  73. package/build-module/commands/use-commands.js +35 -40
  74. package/build-module/commands/use-commands.js.map +7 -1
  75. package/build-module/components/back-button/fullscreen-mode-close.js +102 -110
  76. package/build-module/components/back-button/fullscreen-mode-close.js.map +7 -1
  77. package/build-module/components/back-button/index.js +28 -47
  78. package/build-module/components/back-button/index.js.map +7 -1
  79. package/build-module/components/browser-url/index.js +23 -38
  80. package/build-module/components/browser-url/index.js.map +7 -1
  81. package/build-module/components/editor-initialization/index.js +6 -13
  82. package/build-module/components/editor-initialization/index.js.map +7 -1
  83. package/build-module/components/editor-initialization/listener-hooks.js +20 -34
  84. package/build-module/components/editor-initialization/listener-hooks.js.map +7 -1
  85. package/build-module/components/init-pattern-modal/index.js +90 -74
  86. package/build-module/components/init-pattern-modal/index.js.map +7 -1
  87. package/build-module/components/keyboard-shortcuts/index.js +21 -26
  88. package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
  89. package/build-module/components/layout/index.js +439 -448
  90. package/build-module/components/layout/index.js.map +7 -1
  91. package/build-module/components/layout/use-padding-appender.js +44 -54
  92. package/build-module/components/layout/use-padding-appender.js.map +7 -1
  93. package/build-module/components/layout/use-should-iframe.js +15 -25
  94. package/build-module/components/layout/use-should-iframe.js.map +7 -1
  95. package/build-module/components/meta-boxes/index.js +18 -26
  96. package/build-module/components/meta-boxes/index.js.map +7 -1
  97. package/build-module/components/meta-boxes/meta-box-visibility.js +18 -15
  98. package/build-module/components/meta-boxes/meta-box-visibility.js.map +7 -1
  99. package/build-module/components/meta-boxes/meta-boxes-area/index.js +30 -44
  100. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
  101. package/build-module/components/meta-boxes/use-meta-box-initialization.js +14 -25
  102. package/build-module/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
  103. package/build-module/components/more-menu/index.js +36 -37
  104. package/build-module/components/more-menu/index.js.map +7 -1
  105. package/build-module/components/more-menu/manage-patterns-menu-item.js +21 -31
  106. package/build-module/components/more-menu/manage-patterns-menu-item.js.map +7 -1
  107. package/build-module/components/more-menu/welcome-guide-menu-item.js +22 -16
  108. package/build-module/components/more-menu/welcome-guide-menu-item.js.map +7 -1
  109. package/build-module/components/preferences-modal/enable-custom-fields.js +51 -56
  110. package/build-module/components/preferences-modal/enable-custom-fields.js.map +7 -1
  111. package/build-module/components/preferences-modal/enable-panel.js +30 -38
  112. package/build-module/components/preferences-modal/enable-panel.js.map +7 -1
  113. package/build-module/components/preferences-modal/index.js +24 -34
  114. package/build-module/components/preferences-modal/index.js.map +7 -1
  115. package/build-module/components/preferences-modal/meta-boxes-section.js +34 -45
  116. package/build-module/components/preferences-modal/meta-boxes-section.js.map +7 -1
  117. package/build-module/components/welcome-guide/default.js +107 -91
  118. package/build-module/components/welcome-guide/default.js.map +7 -1
  119. package/build-module/components/welcome-guide/image.js +16 -18
  120. package/build-module/components/welcome-guide/image.js.map +7 -1
  121. package/build-module/components/welcome-guide/index.js +23 -31
  122. package/build-module/components/welcome-guide/index.js.map +7 -1
  123. package/build-module/components/welcome-guide/template.js +38 -39
  124. package/build-module/components/welcome-guide/template.js.map +7 -1
  125. package/build-module/deprecated.js +62 -103
  126. package/build-module/deprecated.js.map +7 -1
  127. package/build-module/hooks/use-navigate-to-entity-record.js +42 -73
  128. package/build-module/hooks/use-navigate-to-entity-record.js.map +7 -1
  129. package/build-module/index.js +70 -95
  130. package/build-module/index.js.map +7 -1
  131. package/build-module/lock-unlock.js +8 -7
  132. package/build-module/lock-unlock.js.map +7 -1
  133. package/build-module/store/actions.js +158 -368
  134. package/build-module/store/actions.js.map +7 -1
  135. package/build-module/store/constants.js +9 -21
  136. package/build-module/store/constants.js.map +7 -1
  137. package/build-module/store/index.js +10 -22
  138. package/build-module/store/index.js.map +7 -1
  139. package/build-module/store/reducer.js +28 -51
  140. package/build-module/store/reducer.js.map +7 -1
  141. package/build-module/store/selectors.js +232 -442
  142. package/build-module/store/selectors.js.map +7 -1
  143. package/build-module/utils/meta-boxes.js +9 -13
  144. package/build-module/utils/meta-boxes.js.map +7 -1
  145. package/build-style/classic-rtl.css +0 -154
  146. package/build-style/classic.css +0 -154
  147. package/build-style/style-rtl.css +135 -110
  148. package/build-style/style.css +135 -110
  149. package/package.json +39 -31
  150. package/src/classic.scss +3 -0
  151. package/src/components/back-button/style.scss +3 -0
  152. package/src/components/layout/index.js +3 -2
  153. package/src/components/layout/style.scss +4 -0
  154. package/src/components/meta-boxes/meta-boxes-area/style.scss +3 -0
  155. package/src/components/welcome-guide/style.scss +3 -0
  156. package/src/style.scss +8 -4
  157. package/build/components/header/header-toolbar/index.native.js +0 -204
  158. package/build/components/header/header-toolbar/index.native.js.map +0 -1
  159. package/build/components/header/index.native.js +0 -59
  160. package/build/components/header/index.native.js.map +0 -1
  161. package/build/components/layout/index.native.js +0 -166
  162. package/build/components/layout/index.native.js.map +0 -1
  163. package/build/components/visual-editor/header.native.js +0 -63
  164. package/build/components/visual-editor/header.native.js.map +0 -1
  165. package/build/components/visual-editor/index.native.js +0 -44
  166. package/build/components/visual-editor/index.native.js.map +0 -1
  167. package/build/editor.native.js +0 -157
  168. package/build/editor.native.js.map +0 -1
  169. package/build/index.native.js +0 -58
  170. package/build/index.native.js.map +0 -1
  171. package/build-module/components/header/header-toolbar/index.native.js +0 -196
  172. package/build-module/components/header/header-toolbar/index.native.js.map +0 -1
  173. package/build-module/components/header/index.native.js +0 -50
  174. package/build-module/components/header/index.native.js.map +0 -1
  175. package/build-module/components/layout/index.native.js +0 -158
  176. package/build-module/components/layout/index.native.js.map +0 -1
  177. package/build-module/components/visual-editor/header.native.js +0 -56
  178. package/build-module/components/visual-editor/header.native.js.map +0 -1
  179. package/build-module/components/visual-editor/index.native.js +0 -35
  180. package/build-module/components/visual-editor/index.native.js.map +0 -1
  181. package/build-module/editor.native.js +0 -149
  182. package/build-module/editor.native.js.map +0 -1
  183. package/build-module/index.native.js +0 -45
  184. package/build-module/index.native.js.map +0 -1
@@ -1,51 +1,32 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { privateApis as editorPrivateApis } from '@wordpress/editor';
5
- import { __unstableMotion as motion } from '@wordpress/components';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
- import FullscreenModeClose from './fullscreen-mode-close';
11
- import { unlock } from '../../lock-unlock';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- const {
14
- BackButton: BackButtonFill
15
- } = unlock(editorPrivateApis);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { privateApis as editorPrivateApis } from "@wordpress/editor";
3
+ import { __unstableMotion as motion } from "@wordpress/components";
4
+ import FullscreenModeClose from "./fullscreen-mode-close";
5
+ import { unlock } from "../../lock-unlock";
6
+ const { BackButton: BackButtonFill } = unlock(editorPrivateApis);
16
7
  const slideX = {
17
- hidden: {
18
- x: '-100%'
19
- },
20
- distractionFreeInactive: {
21
- x: 0
22
- },
23
- hover: {
24
- x: 0,
25
- transition: {
26
- type: 'tween',
27
- delay: 0.2
28
- }
29
- }
8
+ hidden: { x: "-100%" },
9
+ distractionFreeInactive: { x: 0 },
10
+ hover: { x: 0, transition: { type: "tween", delay: 0.2 } }
30
11
  };
31
- function BackButton({
32
- initialPost
33
- }) {
34
- return /*#__PURE__*/_jsx(BackButtonFill, {
35
- children: ({
36
- length
37
- }) => length <= 1 && /*#__PURE__*/_jsx(motion.div, {
12
+ function BackButton({ initialPost }) {
13
+ return /* @__PURE__ */ jsx(BackButtonFill, { children: ({ length }) => length <= 1 && /* @__PURE__ */ jsx(
14
+ motion.div,
15
+ {
38
16
  variants: slideX,
39
- transition: {
40
- type: 'tween',
41
- delay: 0.8
42
- },
43
- children: /*#__PURE__*/_jsx(FullscreenModeClose, {
44
- showTooltip: true,
45
- initialPost: initialPost
46
- })
47
- })
48
- });
17
+ transition: { type: "tween", delay: 0.8 },
18
+ children: /* @__PURE__ */ jsx(
19
+ FullscreenModeClose,
20
+ {
21
+ showTooltip: true,
22
+ initialPost
23
+ }
24
+ )
25
+ }
26
+ ) });
49
27
  }
50
- export default BackButton;
51
- //# sourceMappingURL=index.js.map
28
+ var back_button_default = BackButton;
29
+ export {
30
+ back_button_default as default
31
+ };
32
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["privateApis","editorPrivateApis","__unstableMotion","motion","FullscreenModeClose","unlock","jsx","_jsx","BackButton","BackButtonFill","slideX","hidden","x","distractionFreeInactive","hover","transition","type","delay","initialPost","children","length","div","variants","showTooltip"],"sources":["@wordpress/edit-post/src/components/back-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport { unlock } from '../../lock-unlock';\n\nconst { BackButton: BackButtonFill } = unlock( editorPrivateApis );\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction BackButton( { initialPost } ) {\n\treturn (\n\t\t<BackButtonFill>\n\t\t\t{ ( { length } ) =>\n\t\t\t\tlength <= 1 && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)\n\t\t\t}\n\t\t</BackButtonFill>\n\t);\n}\n\nexport default BackButton;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;;AAElE;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,MAAM;EAAEC,UAAU,EAAEC;AAAe,CAAC,GAAGJ,MAAM,CAAEJ,iBAAkB,CAAC;AAElE,MAAMS,MAAM,GAAG;EACdC,MAAM,EAAE;IAAEC,CAAC,EAAE;EAAQ,CAAC;EACtBC,uBAAuB,EAAE;IAAED,CAAC,EAAE;EAAE,CAAC;EACjCE,KAAK,EAAE;IAAEF,CAAC,EAAE,CAAC;IAAEG,UAAU,EAAE;MAAEC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE;IAAI;EAAE;AAC1D,CAAC;AAED,SAAST,UAAUA,CAAE;EAAEU;AAAY,CAAC,EAAG;EACtC,oBACCX,IAAA,CAACE,cAAc;IAAAU,QAAA,EACZA,CAAE;MAAEC;IAAO,CAAC,KACbA,MAAM,IAAI,CAAC,iBACVb,IAAA,CAACJ,MAAM,CAACkB,GAAG;MACVC,QAAQ,EAAGZ,MAAQ;MACnBK,UAAU,EAAG;QAAEC,IAAI,EAAE,OAAO;QAAEC,KAAK,EAAE;MAAI,CAAG;MAAAE,QAAA,eAE5CZ,IAAA,CAACH,mBAAmB;QACnBmB,WAAW;QACXL,WAAW,EAAGA;MAAa,CAC3B;IAAC,CACS;EACZ,CAEa,CAAC;AAEnB;AAEA,eAAeV,UAAU","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/back-button/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport { unlock } from '../../lock-unlock';\n\nconst { BackButton: BackButtonFill } = unlock( editorPrivateApis );\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction BackButton( { initialPost } ) {\n\treturn (\n\t\t<BackButtonFill>\n\t\t\t{ ( { length } ) =>\n\t\t\t\tlength <= 1 && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)\n\t\t\t}\n\t\t</BackButtonFill>\n\t);\n}\n\nexport default BackButton;\n"],
5
+ "mappings": "AA6BM;AA1BN,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB,cAAc;AAK3C,OAAO,yBAAyB;AAChC,SAAS,cAAc;AAEvB,MAAM,EAAE,YAAY,eAAe,IAAI,OAAQ,iBAAkB;AAEjE,MAAM,SAAS;AAAA,EACd,QAAQ,EAAE,GAAG,QAAQ;AAAA,EACrB,yBAAyB,EAAE,GAAG,EAAE;AAAA,EAChC,OAAO,EAAE,GAAG,GAAG,YAAY,EAAE,MAAM,SAAS,OAAO,IAAI,EAAE;AAC1D;AAEA,SAAS,WAAY,EAAE,YAAY,GAAI;AACtC,SACC,oBAAC,kBACE,WAAE,EAAE,OAAO,MACZ,UAAU,KACT;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACA,UAAW;AAAA,MACX,YAAa,EAAE,MAAM,SAAS,OAAO,IAAI;AAAA,MAEzC;AAAA,QAAC;AAAA;AAAA,UACA,aAAW;AAAA,UACX;AAAA;AAAA,MACD;AAAA;AAAA,EACD,GAGH;AAEF;AAEA,IAAO,sBAAQ;",
6
+ "names": []
7
+ }
@@ -1,40 +1,19 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useEffect, useState } from '@wordpress/element';
5
- import { useSelect } from '@wordpress/data';
6
- import { addQueryArgs } from '@wordpress/url';
7
- import { store as editorStore } from '@wordpress/editor';
8
-
9
- /**
10
- * Returns the Post's Edit URL.
11
- *
12
- * @param {number} postId Post ID.
13
- *
14
- * @return {string} Post edit URL.
15
- */
16
- export function getPostEditURL(postId) {
17
- return addQueryArgs('post.php', {
18
- post: postId,
19
- action: 'edit'
20
- });
1
+ import { useEffect, useState } from "@wordpress/element";
2
+ import { useSelect } from "@wordpress/data";
3
+ import { addQueryArgs } from "@wordpress/url";
4
+ import { store as editorStore } from "@wordpress/editor";
5
+ function getPostEditURL(postId) {
6
+ return addQueryArgs("post.php", { post: postId, action: "edit" });
21
7
  }
22
- export default function BrowserURL() {
8
+ function BrowserURL() {
23
9
  const [historyId, setHistoryId] = useState(null);
24
- const {
25
- postId,
26
- postStatus
27
- } = useSelect(select => {
28
- const {
29
- getCurrentPost
30
- } = select(editorStore);
10
+ const { postId, postStatus } = useSelect((select) => {
11
+ const { getCurrentPost } = select(editorStore);
31
12
  const post = getCurrentPost();
32
- let {
33
- id,
34
- status,
13
+ let { id, status, type } = post;
14
+ const isTemplate = ["wp_template", "wp_template_part"].includes(
35
15
  type
36
- } = post;
37
- const isTemplate = ['wp_template', 'wp_template_part'].includes(type);
16
+ );
38
17
  if (isTemplate) {
39
18
  id = post.wp_id;
40
19
  }
@@ -44,13 +23,19 @@ export default function BrowserURL() {
44
23
  };
45
24
  }, []);
46
25
  useEffect(() => {
47
- if (postId && postId !== historyId && postStatus !== 'auto-draft') {
48
- window.history.replaceState({
49
- id: postId
50
- }, 'Post ' + postId, getPostEditURL(postId));
26
+ if (postId && postId !== historyId && postStatus !== "auto-draft") {
27
+ window.history.replaceState(
28
+ { id: postId },
29
+ "Post " + postId,
30
+ getPostEditURL(postId)
31
+ );
51
32
  setHistoryId(postId);
52
33
  }
53
34
  }, [postId, postStatus, historyId]);
54
35
  return null;
55
36
  }
56
- //# sourceMappingURL=index.js.map
37
+ export {
38
+ BrowserURL as default,
39
+ getPostEditURL
40
+ };
41
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useEffect","useState","useSelect","addQueryArgs","store","editorStore","getPostEditURL","postId","post","action","BrowserURL","historyId","setHistoryId","postStatus","select","getCurrentPost","id","status","type","isTemplate","includes","wp_id","window","history","replaceState"],"sources":["@wordpress/edit-post/src/components/browser-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Returns the Post's Edit URL.\n *\n * @param {number} postId Post ID.\n *\n * @return {string} Post edit URL.\n */\nexport function getPostEditURL( postId ) {\n\treturn addQueryArgs( 'post.php', { post: postId, action: 'edit' } );\n}\n\nexport default function BrowserURL() {\n\tconst [ historyId, setHistoryId ] = useState( null );\n\tconst { postId, postStatus } = useSelect( ( select ) => {\n\t\tconst { getCurrentPost } = select( editorStore );\n\t\tconst post = getCurrentPost();\n\t\tlet { id, status, type } = post;\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\ttype\n\t\t);\n\t\tif ( isTemplate ) {\n\t\t\tid = post.wp_id;\n\t\t}\n\n\t\treturn {\n\t\t\tpostId: id,\n\t\t\tpostStatus: status,\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( postId && postId !== historyId && postStatus !== 'auto-draft' ) {\n\t\t\twindow.history.replaceState(\n\t\t\t\t{ id: postId },\n\t\t\t\t'Post ' + postId,\n\t\t\t\tgetPostEditURL( postId )\n\t\t\t);\n\t\t\tsetHistoryId( postId );\n\t\t}\n\t}, [ postId, postStatus, historyId ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,O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ress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Returns the Post's Edit URL.\n *\n * @param {number} postId Post ID.\n *\n * @return {string} Post edit URL.\n */\nexport function getPostEditURL( postId ) {\n\treturn addQueryArgs( 'post.php', { post: postId, action: 'edit' } );\n}\n\nexport default function BrowserURL() {\n\tconst [ historyId, setHistoryId ] = useState( null );\n\tconst { postId, postStatus } = useSelect( ( select ) => {\n\t\tconst { getCurrentPost } = select( editorStore );\n\t\tconst post = getCurrentPost();\n\t\tlet { id, status, type } = post;\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\ttype\n\t\t);\n\t\tif ( isTemplate ) {\n\t\t\tid = post.wp_id;\n\t\t}\n\n\t\treturn {\n\t\t\tpostId: id,\n\t\t\tpostStatus: status,\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( postId && postId !== historyId && postStatus !== 'auto-draft' ) {\n\t\t\twindow.history.replaceState(\n\t\t\t\t{ id: postId },\n\t\t\t\t'Post ' + postId,\n\t\t\t\tgetPostEditURL( postId )\n\t\t\t);\n\t\t\tsetHistoryId( postId );\n\t\t}\n\t}, [ postId, postStatus, historyId ] );\n\n\treturn null;\n}\n"],
5
+ "mappings": "AAGA,SAAS,WAAW,gBAAgB;AACpC,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,SAAS,mBAAmB;AAS9B,SAAS,eAAgB,QAAS;AACxC,SAAO,aAAc,YAAY,EAAE,MAAM,QAAQ,QAAQ,OAAO,CAAE;AACnE;AAEe,SAAR,aAA8B;AACpC,QAAM,CAAE,WAAW,YAAa,IAAI,SAAU,IAAK;AACnD,QAAM,EAAE,QAAQ,WAAW,IAAI,UAAW,CAAE,WAAY;AACvD,UAAM,EAAE,eAAe,IAAI,OAAQ,WAAY;AAC/C,UAAM,OAAO,eAAe;AAC5B,QAAI,EAAE,IAAI,QAAQ,KAAK,IAAI;AAC3B,UAAM,aAAa,CAAE,eAAe,kBAAmB,EAAE;AAAA,MACxD;AAAA,IACD;AACA,QAAK,YAAa;AACjB,WAAK,KAAK;AAAA,IACX;AAEA,WAAO;AAAA,MACN,QAAQ;AAAA,MACR,YAAY;AAAA,IACb;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,YAAW,MAAM;AAChB,QAAK,UAAU,WAAW,aAAa,eAAe,cAAe;AACpE,aAAO,QAAQ;AAAA,QACd,EAAE,IAAI,OAAO;AAAA,QACb,UAAU;AAAA,QACV,eAAgB,MAAO;AAAA,MACxB;AACA,mBAAc,MAAO;AAAA,IACtB;AAAA,EACD,GAAG,CAAE,QAAQ,YAAY,SAAU,CAAE;AAErC,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,16 +1,9 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { useUpdatePostLinkListener } from './listener-hooks';
5
-
6
- /**
7
- * Data component used for initializing the editor and re-initializes
8
- * when postId changes or on unmount.
9
- *
10
- * @return {null} This is a data component so does not render any ui.
11
- */
12
- export default function EditorInitialization() {
1
+ import { useUpdatePostLinkListener } from "./listener-hooks";
2
+ function EditorInitialization() {
13
3
  useUpdatePostLinkListener();
14
4
  return null;
15
5
  }
16
- //# sourceMappingURL=index.js.map
6
+ export {
7
+ EditorInitialization as default
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useUpdatePostLinkListener","EditorInitialization"],"sources":["@wordpress/edit-post/src/components/editor-initialization/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { useUpdatePostLinkListener } from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization() {\n\tuseUpdatePostLinkListener();\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,kBAAkB;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9CD,yBAAyB,CAAC,CAAC;EAC3B,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/editor-initialization/index.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { useUpdatePostLinkListener } from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization() {\n\tuseUpdatePostLinkListener();\n\treturn null;\n}\n"],
5
+ "mappings": "AAGA,SAAS,iCAAiC;AAQ3B,SAAR,uBAAwC;AAC9C,4BAA0B;AAC1B,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,33 +1,16 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect } from '@wordpress/data';
5
- import { useEffect, useRef } from '@wordpress/element';
6
- import { store as editorStore } from '@wordpress/editor';
7
- import { store as coreStore } from '@wordpress/core-data';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
- import { VIEW_AS_LINK_SELECTOR, VIEW_AS_PREVIEW_LINK_SELECTOR } from '../../store/constants';
13
-
14
- /**
15
- * This listener hook monitors any change in permalink and updates the view
16
- * post link in the admin bar.
17
- */
18
- export const useUpdatePostLinkListener = () => {
19
- const {
20
- isViewable,
21
- newPermalink
22
- } = useSelect(select => {
23
- const {
24
- getPostType
25
- } = select(coreStore);
26
- const {
27
- getCurrentPost,
28
- getEditedPostAttribute
29
- } = select(editorStore);
30
- const postType = getPostType(getEditedPostAttribute('type'));
1
+ import { useSelect } from "@wordpress/data";
2
+ import { useEffect, useRef } from "@wordpress/element";
3
+ import { store as editorStore } from "@wordpress/editor";
4
+ import { store as coreStore } from "@wordpress/core-data";
5
+ import {
6
+ VIEW_AS_LINK_SELECTOR,
7
+ VIEW_AS_PREVIEW_LINK_SELECTOR
8
+ } from "../../store/constants";
9
+ const useUpdatePostLinkListener = () => {
10
+ const { isViewable, newPermalink } = useSelect((select) => {
11
+ const { getPostType } = select(coreStore);
12
+ const { getCurrentPost, getEditedPostAttribute } = select(editorStore);
13
+ const postType = getPostType(getEditedPostAttribute("type"));
31
14
  return {
32
15
  isViewable: postType?.viewable,
33
16
  newPermalink: getCurrentPost().link
@@ -42,11 +25,14 @@ export const useUpdatePostLinkListener = () => {
42
25
  return;
43
26
  }
44
27
  if (!isViewable) {
45
- nodeToUpdateRef.current.style.display = 'none';
28
+ nodeToUpdateRef.current.style.display = "none";
46
29
  return;
47
30
  }
48
- nodeToUpdateRef.current.style.display = '';
49
- nodeToUpdateRef.current.setAttribute('href', newPermalink);
31
+ nodeToUpdateRef.current.style.display = "";
32
+ nodeToUpdateRef.current.setAttribute("href", newPermalink);
50
33
  }, [newPermalink, isViewable]);
51
34
  };
52
- //# sourceMappingURL=listener-hooks.js.map
35
+ export {
36
+ useUpdatePostLinkListener
37
+ };
38
+ //# sourceMappingURL=listener-hooks.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useSelect","useEffect","useRef","store","editorStore","coreStore","VIEW_AS_LINK_SELECTOR","VIEW_AS_PREVIEW_LINK_SELECTOR","useUpdatePostLinkListener","isViewable","newPermalink","select","getPostType","getCurrentPost","getEditedPostAttribute","postType","viewable","link","nodeToUpdateRef","current","document","querySelector","style","display","setAttribute"],"sources":["@wordpress/edit-post/src/components/editor-initialization/listener-hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tVIEW_AS_LINK_SELECTOR,\n\tVIEW_AS_PREVIEW_LINK_SELECTOR,\n} from '../../store/constants';\n\n/**\n * This listener hook monitors any change in permalink and updates the view\n * post link in the admin bar.\n */\nexport const useUpdatePostLinkListener = () => {\n\tconst { isViewable, newPermalink } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tisViewable: postType?.viewable,\n\t\t\tnewPermalink: getCurrentPost().link,\n\t\t};\n\t}, [] );\n\n\tconst nodeToUpdateRef = useRef();\n\n\tuseEffect( () => {\n\t\tnodeToUpdateRef.current =\n\t\t\tdocument.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||\n\t\t\tdocument.querySelector( VIEW_AS_LINK_SELECTOR );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! newPermalink || ! nodeToUpdateRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isViewable ) {\n\t\t\tnodeToUpdateRef.current.style.display = 'none';\n\t\t\treturn;\n\t\t}\n\n\t\tnodeToUpdateRef.current.style.display = '';\n\t\tnodeToUpdateRef.current.setAttribute( 'href', newPermalink );\n\t}, [ newPermalink, isViewable ] );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SACCC,qBAAqB,EACrBC,6BAA6B,QACvB,uBAAuB;;AAE9B;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAGA,CAAA,KAAM;EAC9C,MAAM;IAAEC,UAAU;IAAEC;EAAa,CAAC,GAAGV,SAAS,CAAIW,MAAM,IAAM;IAC7D,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEN,SAAU,CAAC;IAC3C,MAAM;MAAEQ,cAAc;MAAEC;IAAuB,CAAC,GAC/CH,MAAM,CAAEP,WAAY,CAAC;IACtB,MAAMW,QAAQ,GAAGH,WAAW,CAAEE,sBAAsB,CAAE,MAAO,CAAE,CAAC;IAChE,OAAO;MACNL,UAAU,EAAEM,QAAQ,EAAEC,QAAQ;MAC9BN,YAAY,EAAEG,cAAc,CAAC,CAAC,CAACI;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,eAAe,GAAGhB,MAAM,CAAC,CAAC;EAEhCD,SAAS,CAAE,MAAM;IAChBiB,eAAe,CAACC,OAAO,GACtBC,QAAQ,CAACC,aAAa,CAAEd,6BAA8B,CAAC,IACvDa,QAAQ,CAACC,aAAa,CAAEf,qBAAsB,CAAC;EACjD,CAAC,EAAE,EAAG,CAAC;EAEPL,SAAS,CAAE,MAAM;IAChB,IAAK,CAAES,YAAY,IAAI,CAAEQ,eAAe,CAACC,OAAO,EAAG;MAClD;IACD;IAEA,IAAK,CAAEV,UAAU,EAAG;MACnBS,eAAe,CAACC,OAAO,CAACG,KAAK,CAACC,OAAO,GAAG,MAAM;MAC9C;IACD;IAEAL,eAAe,CAACC,OAAO,CAACG,KAAK,CAACC,OAAO,GAAG,EAAE;IAC1CL,eAAe,CAACC,OAAO,CAACK,YAAY,CAAE,MAAM,EAAEd,YAAa,CAAC;EAC7D,CAAC,EAAE,CAAEA,YAAY,EAAED,UAAU,CAAG,CAAC;AAClC,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/editor-initialization/listener-hooks.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tVIEW_AS_LINK_SELECTOR,\n\tVIEW_AS_PREVIEW_LINK_SELECTOR,\n} from '../../store/constants';\n\n/**\n * This listener hook monitors any change in permalink and updates the view\n * post link in the admin bar.\n */\nexport const useUpdatePostLinkListener = () => {\n\tconst { isViewable, newPermalink } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tisViewable: postType?.viewable,\n\t\t\tnewPermalink: getCurrentPost().link,\n\t\t};\n\t}, [] );\n\n\tconst nodeToUpdateRef = useRef();\n\n\tuseEffect( () => {\n\t\tnodeToUpdateRef.current =\n\t\t\tdocument.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||\n\t\t\tdocument.querySelector( VIEW_AS_LINK_SELECTOR );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! newPermalink || ! nodeToUpdateRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isViewable ) {\n\t\t\tnodeToUpdateRef.current.style.display = 'none';\n\t\t\treturn;\n\t\t}\n\n\t\tnodeToUpdateRef.current.style.display = '';\n\t\tnodeToUpdateRef.current.setAttribute( 'href', newPermalink );\n\t}, [ newPermalink, isViewable ] );\n};\n"],
5
+ "mappings": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,WAAW,cAAc;AAClC,SAAS,SAAS,mBAAmB;AACrC,SAAS,SAAS,iBAAiB;AAKnC;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAMA,MAAM,4BAA4B,MAAM;AAC9C,QAAM,EAAE,YAAY,aAAa,IAAI,UAAW,CAAE,WAAY;AAC7D,UAAM,EAAE,YAAY,IAAI,OAAQ,SAAU;AAC1C,UAAM,EAAE,gBAAgB,uBAAuB,IAC9C,OAAQ,WAAY;AACrB,UAAM,WAAW,YAAa,uBAAwB,MAAO,CAAE;AAC/D,WAAO;AAAA,MACN,YAAY,UAAU;AAAA,MACtB,cAAc,eAAe,EAAE;AAAA,IAChC;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,kBAAkB,OAAO;AAE/B,YAAW,MAAM;AAChB,oBAAgB,UACf,SAAS,cAAe,6BAA8B,KACtD,SAAS,cAAe,qBAAsB;AAAA,EAChD,GAAG,CAAC,CAAE;AAEN,YAAW,MAAM;AAChB,QAAK,CAAE,gBAAgB,CAAE,gBAAgB,SAAU;AAClD;AAAA,IACD;AAEA,QAAK,CAAE,YAAa;AACnB,sBAAgB,QAAQ,MAAM,UAAU;AACxC;AAAA,IACD;AAEA,oBAAgB,QAAQ,MAAM,UAAU;AACxC,oBAAgB,QAAQ,aAAc,QAAQ,YAAa;AAAA,EAC5D,GAAG,CAAE,cAAc,UAAW,CAAE;AACjC;",
6
+ "names": []
7
+ }
@@ -1,85 +1,101 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect, useDispatch } from '@wordpress/data';
5
- import { __, _x } from '@wordpress/i18n';
6
- import { Modal, Button, __experimentalHStack as HStack, __experimentalVStack as VStack, ToggleControl, TextControl } from '@wordpress/components';
7
- import { useState } from '@wordpress/element';
8
- import { store as editorStore } from '@wordpress/editor';
9
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
10
- export default function InitPatternModal() {
11
- const {
12
- editPost
13
- } = useDispatch(editorStore);
14
- const [syncType, setSyncType] = useState(undefined);
15
- const [title, setTitle] = useState('');
16
- const {
17
- postType,
18
- isNewPost
19
- } = useSelect(select => {
20
- const {
21
- getEditedPostAttribute,
22
- isCleanNewPost
23
- } = select(editorStore);
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useSelect, useDispatch } from "@wordpress/data";
3
+ import { __, _x } from "@wordpress/i18n";
4
+ import {
5
+ Modal,
6
+ Button,
7
+ __experimentalHStack as HStack,
8
+ __experimentalVStack as VStack,
9
+ ToggleControl,
10
+ TextControl
11
+ } from "@wordpress/components";
12
+ import { useState } from "@wordpress/element";
13
+ import { store as editorStore } from "@wordpress/editor";
14
+ function InitPatternModal() {
15
+ const { editPost } = useDispatch(editorStore);
16
+ const [syncType, setSyncType] = useState(void 0);
17
+ const [title, setTitle] = useState("");
18
+ const { postType, isNewPost } = useSelect((select) => {
19
+ const { getEditedPostAttribute, isCleanNewPost } = select(editorStore);
24
20
  return {
25
- postType: getEditedPostAttribute('type'),
21
+ postType: getEditedPostAttribute("type"),
26
22
  isNewPost: isCleanNewPost()
27
23
  };
28
24
  }, []);
29
- const [isModalOpen, setIsModalOpen] = useState(() => isNewPost && postType === 'wp_block');
30
- if (postType !== 'wp_block' || !isNewPost) {
25
+ const [isModalOpen, setIsModalOpen] = useState(
26
+ () => isNewPost && postType === "wp_block"
27
+ );
28
+ if (postType !== "wp_block" || !isNewPost) {
31
29
  return null;
32
30
  }
33
- return /*#__PURE__*/_jsx(_Fragment, {
34
- children: isModalOpen && /*#__PURE__*/_jsx(Modal, {
35
- title: __('Create pattern'),
31
+ return /* @__PURE__ */ jsx(Fragment, { children: isModalOpen && /* @__PURE__ */ jsx(
32
+ Modal,
33
+ {
34
+ title: __("Create pattern"),
36
35
  onRequestClose: () => {
37
36
  setIsModalOpen(false);
38
37
  },
39
38
  overlayClassName: "reusable-blocks-menu-items__convert-modal",
40
- children: /*#__PURE__*/_jsx("form", {
41
- onSubmit: event => {
42
- event.preventDefault();
43
- setIsModalOpen(false);
44
- editPost({
45
- title,
46
- meta: {
47
- wp_pattern_sync_status: syncType
48
- }
49
- });
50
- },
51
- children: /*#__PURE__*/_jsxs(VStack, {
52
- spacing: "5",
53
- children: [/*#__PURE__*/_jsx(TextControl, {
54
- label: __('Name'),
55
- value: title,
56
- onChange: setTitle,
57
- placeholder: __('My pattern'),
58
- className: "patterns-create-modal__name-input",
59
- __nextHasNoMarginBottom: true,
60
- __next40pxDefaultSize: true
61
- }), /*#__PURE__*/_jsx(ToggleControl, {
62
- __nextHasNoMarginBottom: true,
63
- label: _x('Synced', 'pattern (singular)'),
64
- help: __('Sync this pattern across multiple locations.'),
65
- checked: !syncType,
66
- onChange: () => {
67
- setSyncType(!syncType ? 'unsynced' : undefined);
68
- }
69
- }), /*#__PURE__*/_jsx(HStack, {
70
- justify: "right",
71
- children: /*#__PURE__*/_jsx(Button, {
72
- __next40pxDefaultSize: true,
73
- variant: "primary",
74
- type: "submit",
75
- disabled: !title,
76
- accessibleWhenDisabled: true,
77
- children: __('Create')
78
- })
79
- })]
80
- })
81
- })
82
- })
83
- });
39
+ children: /* @__PURE__ */ jsx(
40
+ "form",
41
+ {
42
+ onSubmit: (event) => {
43
+ event.preventDefault();
44
+ setIsModalOpen(false);
45
+ editPost({
46
+ title,
47
+ meta: {
48
+ wp_pattern_sync_status: syncType
49
+ }
50
+ });
51
+ },
52
+ children: /* @__PURE__ */ jsxs(VStack, { spacing: "5", children: [
53
+ /* @__PURE__ */ jsx(
54
+ TextControl,
55
+ {
56
+ label: __("Name"),
57
+ value: title,
58
+ onChange: setTitle,
59
+ placeholder: __("My pattern"),
60
+ className: "patterns-create-modal__name-input",
61
+ __nextHasNoMarginBottom: true,
62
+ __next40pxDefaultSize: true
63
+ }
64
+ ),
65
+ /* @__PURE__ */ jsx(
66
+ ToggleControl,
67
+ {
68
+ __nextHasNoMarginBottom: true,
69
+ label: _x("Synced", "pattern (singular)"),
70
+ help: __(
71
+ "Sync this pattern across multiple locations."
72
+ ),
73
+ checked: !syncType,
74
+ onChange: () => {
75
+ setSyncType(
76
+ !syncType ? "unsynced" : void 0
77
+ );
78
+ }
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx(HStack, { justify: "right", children: /* @__PURE__ */ jsx(
82
+ Button,
83
+ {
84
+ __next40pxDefaultSize: true,
85
+ variant: "primary",
86
+ type: "submit",
87
+ disabled: !title,
88
+ accessibleWhenDisabled: true,
89
+ children: __("Create")
90
+ }
91
+ ) })
92
+ ] })
93
+ }
94
+ )
95
+ }
96
+ ) });
84
97
  }
85
- //# sourceMappingURL=index.js.map
98
+ export {
99
+ InitPatternModal as default
100
+ };
101
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useSelect","useDispatch","__","_x","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","TextControl","useState","store","editorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","InitPatternModal","editPost","syncType","setSyncType","undefined","title","setTitle","postType","isNewPost","select","getEditedPostAttribute","isCleanNewPost","isModalOpen","setIsModalOpen","children","onRequestClose","overlayClassName","onSubmit","event","preventDefault","meta","wp_pattern_sync_status","spacing","label","value","onChange","placeholder","className","__nextHasNoMarginBottom","__next40pxDefaultSize","help","checked","justify","variant","type","disabled","accessibleWhenDisabled"],"sources":["@wordpress/edit-post/src/components/init-pattern-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\tconst [ isModalOpen, setIsModalOpen ] = useState(\n\t\t() => isNewPost && postType === 'wp_block'\n\t);\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t\t\t},\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\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\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C,EAAE,CAAE,QAAQ,EAAE,oBAAqB,CAAG;YAC9CgD,IAAI,EAAGjD,EAAE,CACR,8CACD,CAAG;YACHkD,OAAO,EAAG,CAAE7B,QAAU;YACtBuB,QAAQ,EAAGA,CAAA,KAAM;cAChBtB,WAAW,CACV,CAAED,QAAQ,GAAG,UAAU,GAAGE,SAC3B,CAAC;YACF;UAAG,CACH,CAAC,eACFT,IAAA,CAACT,MAAM;YAAC8C,OAAO,EAAC,OAAO;YAAAlB,QAAA,eACtBnB,IAAA,CAACX,MAAM;cACN6C,qBAAqB;cACrBI,OAAO,EAAC,SAAS;cACjBC,IAAI,EAAC,QAAQ;cACbC,QAAQ,EAAG,CAAE9B,KAAO;cACpB+B,sBAAsB;cAAAtB,QAAA,EAEpBjC,EAAE,CAAE,QAAS;YAAC,CACT;UAAC,CACF,CAAC;QAAA,CACF;MAAC,CACJ;IAAC,CACD;EACP,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/init-pattern-modal/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\tconst [ isModalOpen, setIsModalOpen ] = useState(\n\t\t() => isNewPost && postType === 'wp_block'\n\t);\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t\t\t},\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\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": "AAsCE,mBAsBK,KADD,YArBJ;AAnCF,SAAS,WAAW,mBAAmB;AACvC,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,OACM;AACP,SAAS,gBAAgB;AACzB,SAAS,SAAS,mBAAmB;AAEtB,SAAR,mBAAoC;AAC1C,QAAM,EAAE,SAAS,IAAI,YAAa,WAAY;AAC9C,QAAM,CAAE,UAAU,WAAY,IAAI,SAAU,MAAU;AACtD,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,EAAG;AAEzC,QAAM,EAAE,UAAU,UAAU,IAAI,UAAW,CAAE,WAAY;AACxD,UAAM,EAAE,wBAAwB,eAAe,IAC9C,OAAQ,WAAY;AACrB,WAAO;AAAA,MACN,UAAU,uBAAwB,MAAO;AAAA,MACzC,WAAW,eAAe;AAAA,IAC3B;AAAA,EACD,GAAG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;AAAA,MACD;AAAA;AAAA,EACD,GAEF;AAEF;",
6
+ "names": []
7
+ }
@@ -1,37 +1,32 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useEffect } from '@wordpress/element';
5
- import { useDispatch } from '@wordpress/data';
6
- import { useShortcut, store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
7
- import { __ } from '@wordpress/i18n';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
- import { store as editPostStore } from '../../store';
1
+ import { useEffect } from "@wordpress/element";
2
+ import { useDispatch } from "@wordpress/data";
3
+ import {
4
+ useShortcut,
5
+ store as keyboardShortcutsStore
6
+ } from "@wordpress/keyboard-shortcuts";
7
+ import { __ } from "@wordpress/i18n";
8
+ import { store as editPostStore } from "../../store";
13
9
  function KeyboardShortcuts() {
14
- const {
15
- toggleFullscreenMode
16
- } = useDispatch(editPostStore);
17
- const {
18
- registerShortcut
19
- } = useDispatch(keyboardShortcutsStore);
10
+ const { toggleFullscreenMode } = useDispatch(editPostStore);
11
+ const { registerShortcut } = useDispatch(keyboardShortcutsStore);
20
12
  useEffect(() => {
21
13
  registerShortcut({
22
- name: 'core/edit-post/toggle-fullscreen',
23
- category: 'global',
24
- description: __('Enable or disable fullscreen mode.'),
14
+ name: "core/edit-post/toggle-fullscreen",
15
+ category: "global",
16
+ description: __("Enable or disable fullscreen mode."),
25
17
  keyCombination: {
26
- modifier: 'secondary',
27
- character: 'f'
18
+ modifier: "secondary",
19
+ character: "f"
28
20
  }
29
21
  });
30
22
  }, []);
31
- useShortcut('core/edit-post/toggle-fullscreen', () => {
23
+ useShortcut("core/edit-post/toggle-fullscreen", () => {
32
24
  toggleFullscreenMode();
33
25
  });
34
26
  return null;
35
27
  }
36
- export default KeyboardShortcuts;
37
- //# sourceMappingURL=index.js.map
28
+ var keyboard_shortcuts_default = KeyboardShortcuts;
29
+ export {
30
+ keyboard_shortcuts_default as default
31
+ };
32
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useEffect","useDispatch","useShortcut","store","keyboardShortcutsStore","__","editPostStore","KeyboardShortcuts","toggleFullscreenMode","registerShortcut","name","category","description","keyCombination","modifier","character"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { toggleFullscreenMode } = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-fullscreen',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Enable or disable fullscreen mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'f',\n\t\t\t},\n\t\t} );\n\t}, [] );\n\n\tuseShortcut( 'core/edit-post/toggle-fullscreen', () => {\n\t\ttoggleFullscreenMode();\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASF,KAAK,IAAIG,aAAa,QAAQ,aAAa;AAEpD,SAASC,iBAAiBA,CAAA,EAAG;EAC5B,MAAM;IAAEC;EAAqB,CAAC,GAAGP,WAAW,CAAEK,aAAc,CAAC;EAC7D,MAAM;IAAEG;EAAiB,CAAC,GAAGR,WAAW,CAAEG,sBAAuB,CAAC;EAElEJ,SAAS,CAAE,MAAM;IAChBS,gBAAgB,CAAE;MACjBC,IAAI,EAAE,kCAAkC;MACxCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAEP,EAAE,CAAE,oCAAqC,CAAC;MACvDQ,cAAc,EAAE;QACfC,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,EAAG,CAAC;EAEPb,WAAW,CAAE,kCAAkC,EAAE,MAAM;IACtDM,oBAAoB,CAAC,CAAC;EACvB,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAEA,eAAeD,iBAAiB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/keyboard-shortcuts/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { toggleFullscreenMode } = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-fullscreen',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Enable or disable fullscreen mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'f',\n\t\t\t},\n\t\t} );\n\t}, [] );\n\n\tuseShortcut( 'core/edit-post/toggle-fullscreen', () => {\n\t\ttoggleFullscreenMode();\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"],
5
+ "mappings": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,UAAU;AAKnB,SAAS,SAAS,qBAAqB;AAEvC,SAAS,oBAAoB;AAC5B,QAAM,EAAE,qBAAqB,IAAI,YAAa,aAAc;AAC5D,QAAM,EAAE,iBAAiB,IAAI,YAAa,sBAAuB;AAEjE,YAAW,MAAM;AAChB,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa,GAAI,oCAAqC;AAAA,MACtD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAC,CAAE;AAEN,cAAa,oCAAoC,MAAM;AACtD,yBAAqB;AAAA,EACtB,CAAE;AAEF,SAAO;AACR;AAEA,IAAO,6BAAQ;",
6
+ "names": []
7
+ }