@wordpress/block-editor 8.5.2 → 8.6.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 (186) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-list/block.native.js +3 -1
  3. package/build/components/block-list/block.native.js.map +1 -1
  4. package/build/components/block-mover/button.js +4 -4
  5. package/build/components/block-mover/button.js.map +1 -1
  6. package/build/components/block-mover/index.js +39 -65
  7. package/build/components/block-mover/index.js.map +1 -1
  8. package/build/components/block-popover/inbetween.js +183 -0
  9. package/build/components/block-popover/inbetween.js.map +1 -0
  10. package/build/components/block-popover/index.js +82 -0
  11. package/build/components/block-popover/index.js.map +1 -0
  12. package/build/components/{block-tools → block-popover}/use-popover-scroll.js +4 -1
  13. package/build/components/block-popover/use-popover-scroll.js.map +1 -0
  14. package/build/components/block-styles/index.js +1 -10
  15. package/build/components/block-styles/index.js.map +1 -1
  16. package/build/components/block-tools/back-compat.js +2 -2
  17. package/build/components/block-tools/back-compat.js.map +1 -1
  18. package/build/components/block-tools/block-selection-button.js +4 -2
  19. package/build/components/block-tools/block-selection-button.js.map +1 -1
  20. package/build/components/block-tools/index.js +5 -5
  21. package/build/components/block-tools/index.js.map +1 -1
  22. package/build/components/block-tools/insertion-point.js +14 -121
  23. package/build/components/block-tools/insertion-point.js.map +1 -1
  24. package/build/components/block-tools/{block-popover.js → selected-block-popover.js} +25 -108
  25. package/build/components/block-tools/selected-block-popover.js.map +1 -0
  26. package/build/components/duotone-control/index.js +5 -1
  27. package/build/components/duotone-control/index.js.map +1 -1
  28. package/build/components/inserter/index.native.js +30 -8
  29. package/build/components/inserter/index.native.js.map +1 -1
  30. package/build/components/rich-text/index.js +0 -5
  31. package/build/components/rich-text/index.js.map +1 -1
  32. package/build/components/rich-text/index.native.js +0 -4
  33. package/build/components/rich-text/index.native.js.map +1 -1
  34. package/build/components/use-block-display-information/index.js +3 -1
  35. package/build/components/use-block-display-information/index.js.map +1 -1
  36. package/build/hooks/border.js +468 -44
  37. package/build/hooks/border.js.map +1 -1
  38. package/build/hooks/duotone.js +66 -16
  39. package/build/hooks/duotone.js.map +1 -1
  40. package/build/hooks/index.js +8 -2
  41. package/build/hooks/index.js.map +1 -1
  42. package/build/hooks/use-border-props.js +22 -32
  43. package/build/hooks/use-border-props.js.map +1 -1
  44. package/build/index.js +7 -0
  45. package/build/index.js.map +1 -1
  46. package/build/store/actions.js +14 -2
  47. package/build/store/actions.js.map +1 -1
  48. package/build/store/reducer.js +0 -26
  49. package/build/store/reducer.js.map +1 -1
  50. package/build/store/selectors.js +9 -3
  51. package/build/store/selectors.js.map +1 -1
  52. package/build-module/components/block-list/block.native.js +3 -1
  53. package/build-module/components/block-list/block.native.js.map +1 -1
  54. package/build-module/components/block-mover/button.js +5 -5
  55. package/build-module/components/block-mover/button.js.map +1 -1
  56. package/build-module/components/block-mover/index.js +38 -63
  57. package/build-module/components/block-mover/index.js.map +1 -1
  58. package/build-module/components/block-popover/inbetween.js +165 -0
  59. package/build-module/components/block-popover/inbetween.js.map +1 -0
  60. package/build-module/components/block-popover/index.js +67 -0
  61. package/build-module/components/block-popover/index.js.map +1 -0
  62. package/build-module/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
  63. package/build-module/components/block-popover/use-popover-scroll.js.map +1 -0
  64. package/build-module/components/block-styles/index.js +1 -9
  65. package/build-module/components/block-styles/index.js.map +1 -1
  66. package/build-module/components/block-tools/back-compat.js +1 -1
  67. package/build-module/components/block-tools/back-compat.js.map +1 -1
  68. package/build-module/components/block-tools/block-selection-button.js +3 -2
  69. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  70. package/build-module/components/block-tools/index.js +3 -3
  71. package/build-module/components/block-tools/index.js.map +1 -1
  72. package/build-module/components/block-tools/insertion-point.js +16 -121
  73. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  74. package/build-module/components/block-tools/{block-popover.js → selected-block-popover.js} +25 -105
  75. package/build-module/components/block-tools/selected-block-popover.js.map +1 -0
  76. package/build-module/components/duotone-control/index.js +4 -1
  77. package/build-module/components/duotone-control/index.js.map +1 -1
  78. package/build-module/components/inserter/index.native.js +31 -10
  79. package/build-module/components/inserter/index.native.js.map +1 -1
  80. package/build-module/components/rich-text/index.js +0 -4
  81. package/build-module/components/rich-text/index.js.map +1 -1
  82. package/build-module/components/rich-text/index.native.js +0 -4
  83. package/build-module/components/rich-text/index.native.js.map +1 -1
  84. package/build-module/components/use-block-display-information/index.js +3 -1
  85. package/build-module/components/use-block-display-information/index.js.map +1 -1
  86. package/build-module/hooks/border.js +458 -44
  87. package/build-module/hooks/border.js.map +1 -1
  88. package/build-module/hooks/duotone.js +63 -16
  89. package/build-module/hooks/duotone.js.map +1 -1
  90. package/build-module/hooks/index.js +2 -1
  91. package/build-module/hooks/index.js.map +1 -1
  92. package/build-module/hooks/use-border-props.js +21 -30
  93. package/build-module/hooks/use-border-props.js.map +1 -1
  94. package/build-module/index.js +1 -1
  95. package/build-module/index.js.map +1 -1
  96. package/build-module/store/actions.js +14 -2
  97. package/build-module/store/actions.js.map +1 -1
  98. package/build-module/store/reducer.js +0 -24
  99. package/build-module/store/reducer.js.map +1 -1
  100. package/build-module/store/selectors.js +8 -3
  101. package/build-module/store/selectors.js.map +1 -1
  102. package/build-style/style-rtl.css +111 -246
  103. package/build-style/style.css +111 -246
  104. package/package.json +28 -28
  105. package/src/components/block-list/block.native.js +2 -0
  106. package/src/components/block-mover/button.js +5 -7
  107. package/src/components/block-mover/index.js +37 -60
  108. package/src/components/block-mover/stories/index.js +110 -0
  109. package/src/components/block-mover/style.scss +48 -138
  110. package/src/components/block-popover/README.md +41 -0
  111. package/src/components/block-popover/inbetween.js +180 -0
  112. package/src/components/block-popover/index.js +73 -0
  113. package/src/components/block-popover/style.scss +24 -0
  114. package/src/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
  115. package/src/components/block-styles/index.js +1 -12
  116. package/src/components/block-switcher/style.scss +0 -4
  117. package/src/components/block-toolbar/style.scss +0 -12
  118. package/src/components/block-tools/back-compat.js +1 -1
  119. package/src/components/block-tools/block-selection-button.js +3 -1
  120. package/src/components/block-tools/index.js +6 -4
  121. package/src/components/block-tools/insertion-point.js +19 -152
  122. package/src/components/block-tools/{block-popover.js → selected-block-popover.js} +24 -116
  123. package/src/components/block-tools/style.scss +11 -123
  124. package/src/components/border-radius-control/style.scss +5 -2
  125. package/src/components/default-block-appender/style.scss +1 -2
  126. package/src/components/duotone-control/index.js +8 -1
  127. package/src/components/gradients/README.md +29 -0
  128. package/src/components/inserter/index.native.js +60 -25
  129. package/src/components/inserter/style.native.scss +24 -3
  130. package/src/components/navigable-toolbar/README.md +16 -0
  131. package/src/components/rich-text/index.js +0 -2
  132. package/src/components/rich-text/index.native.js +0 -4
  133. package/src/components/use-block-display-information/index.js +2 -0
  134. package/src/hooks/border.js +438 -72
  135. package/src/hooks/border.scss +48 -0
  136. package/src/hooks/duotone.js +98 -62
  137. package/src/hooks/index.js +2 -1
  138. package/src/hooks/use-border-props.js +15 -32
  139. package/src/index.js +1 -0
  140. package/src/store/actions.js +14 -2
  141. package/src/store/reducer.js +0 -21
  142. package/src/store/selectors.js +12 -3
  143. package/src/store/test/actions.js +0 -18
  144. package/src/store/test/reducer.js +0 -19
  145. package/src/store/test/selectors.js +0 -19
  146. package/src/style.scss +1 -1
  147. package/build/components/block-mobile-toolbar/index.js +0 -42
  148. package/build/components/block-mobile-toolbar/index.js.map +0 -1
  149. package/build/components/block-tools/block-popover.js.map +0 -1
  150. package/build/components/block-tools/use-popover-scroll.js.map +0 -1
  151. package/build/components/list-view/appender.js +0 -93
  152. package/build/components/list-view/appender.js.map +0 -1
  153. package/build/components/list-view/list-item.js +0 -62
  154. package/build/components/list-view/list-item.js.map +0 -1
  155. package/build/components/rich-text/use-caret-in-format.js +0 -43
  156. package/build/components/rich-text/use-caret-in-format.js.map +0 -1
  157. package/build/hooks/border-color.js +0 -302
  158. package/build/hooks/border-color.js.map +0 -1
  159. package/build/hooks/border-style.js +0 -96
  160. package/build/hooks/border-style.js.map +0 -1
  161. package/build/hooks/border-width.js +0 -162
  162. package/build/hooks/border-width.js.map +0 -1
  163. package/build-module/components/block-mobile-toolbar/index.js +0 -31
  164. package/build-module/components/block-mobile-toolbar/index.js.map +0 -1
  165. package/build-module/components/block-tools/block-popover.js.map +0 -1
  166. package/build-module/components/block-tools/use-popover-scroll.js.map +0 -1
  167. package/build-module/components/list-view/appender.js +0 -76
  168. package/build-module/components/list-view/appender.js.map +0 -1
  169. package/build-module/components/list-view/list-item.js +0 -47
  170. package/build-module/components/list-view/list-item.js.map +0 -1
  171. package/build-module/components/rich-text/use-caret-in-format.js +0 -33
  172. package/build-module/components/rich-text/use-caret-in-format.js.map +0 -1
  173. package/build-module/hooks/border-color.js +0 -276
  174. package/build-module/hooks/border-color.js.map +0 -1
  175. package/build-module/hooks/border-style.js +0 -78
  176. package/build-module/hooks/border-style.js.map +0 -1
  177. package/build-module/hooks/border-width.js +0 -143
  178. package/build-module/hooks/border-width.js.map +0 -1
  179. package/src/components/block-mobile-toolbar/index.js +0 -24
  180. package/src/components/block-mobile-toolbar/style.scss +0 -29
  181. package/src/components/list-view/appender.js +0 -82
  182. package/src/components/list-view/list-item.js +0 -59
  183. package/src/components/rich-text/use-caret-in-format.js +0 -28
  184. package/src/hooks/border-color.js +0 -315
  185. package/src/hooks/border-style.js +0 -64
  186. package/src/hooks/border-width.js +0 -139
@@ -5,6 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.PresetDuotoneFilter = PresetDuotoneFilter;
8
9
  exports.getValuesFromColors = getValuesFromColors;
9
10
 
10
11
  var _element = require("@wordpress/element");
@@ -78,29 +79,45 @@ function getValuesFromColors() {
78
79
  */
79
80
 
80
81
  /**
81
- * SVG and stylesheet needed for rendering the duotone filter.
82
+ * Stylesheet for rendering the duotone filter.
82
83
  *
83
84
  * @param {Object} props Duotone props.
84
85
  * @param {string} props.selector Selector to apply the filter to.
85
86
  * @param {string} props.id Unique id for this duotone filter.
86
- * @param {Values} props.values R, G, B, and A values to filter with.
87
87
  *
88
88
  * @return {WPElement} Duotone element.
89
89
  */
90
90
 
91
91
 
92
- function DuotoneFilter(_ref) {
92
+ function DuotoneStylesheet(_ref) {
93
93
  let {
94
94
  selector,
95
- id,
96
- values
95
+ id
97
96
  } = _ref;
98
- const stylesheet = `
97
+ const css = `
99
98
  ${selector} {
100
99
  filter: url( #${id} );
101
100
  }
102
101
  `;
103
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.SVG, {
102
+ return (0, _element.createElement)("style", null, css);
103
+ }
104
+ /**
105
+ * SVG for rendering the duotone filter.
106
+ *
107
+ * @param {Object} props Duotone props.
108
+ * @param {string} props.id Unique id for this duotone filter.
109
+ * @param {Values} props.values R, G, B, and A values to filter with.
110
+ *
111
+ * @return {WPElement} Duotone element.
112
+ */
113
+
114
+
115
+ function DuotoneFilter(_ref2) {
116
+ let {
117
+ id,
118
+ values
119
+ } = _ref2;
120
+ return (0, _element.createElement)(_components.SVG, {
104
121
  xmlnsXlink: "http://www.w3.org/1999/xlink",
105
122
  viewBox: "0 0 0 0",
106
123
  width: "0",
@@ -140,18 +157,40 @@ ${selector} {
140
157
  // Re-mask the image with the original transparency since the feColorMatrix above loses that information.
141
158
  in2: "SourceGraphic",
142
159
  operator: "in"
143
- })))), (0, _element.createElement)("style", {
144
- dangerouslySetInnerHTML: {
145
- __html: stylesheet
146
- }
160
+ }))));
161
+ }
162
+ /**
163
+ * SVG and stylesheet needed for rendering the duotone filter.
164
+ *
165
+ * @param {Object} props Duotone props.
166
+ * @param {string} props.selector Selector to apply the filter to.
167
+ * @param {string} props.id Unique id for this duotone filter.
168
+ * @param {Values} props.values R, G, B, and A values to filter with.
169
+ *
170
+ * @return {WPElement} Duotone element.
171
+ */
172
+
173
+
174
+ function InlineDuotone(_ref3) {
175
+ let {
176
+ selector,
177
+ id,
178
+ values
179
+ } = _ref3;
180
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(DuotoneFilter, {
181
+ id: id,
182
+ values: values
183
+ }), (0, _element.createElement)(DuotoneStylesheet, {
184
+ id: id,
185
+ selector: selector
147
186
  }));
148
187
  }
149
188
 
150
- function useMultiOriginPresets(_ref2) {
189
+ function useMultiOriginPresets(_ref4) {
151
190
  let {
152
191
  presetSetting,
153
192
  defaultSetting
154
- } = _ref2;
193
+ } = _ref4;
155
194
  const disableDefault = !(0, _components2.useSetting)(defaultSetting);
156
195
  const userPresets = (0, _components2.useSetting)(`${presetSetting}.custom`) || EMPTY_ARRAY;
157
196
  const themePresets = (0, _components2.useSetting)(`${presetSetting}.theme`) || EMPTY_ARRAY;
@@ -159,13 +198,13 @@ function useMultiOriginPresets(_ref2) {
159
198
  return (0, _element.useMemo)(() => [...userPresets, ...themePresets, ...(disableDefault ? EMPTY_ARRAY : defaultPresets)], [disableDefault, userPresets, themePresets, defaultPresets]);
160
199
  }
161
200
 
162
- function DuotonePanel(_ref3) {
201
+ function DuotonePanel(_ref5) {
163
202
  var _style$color;
164
203
 
165
204
  let {
166
205
  attributes,
167
206
  setAttributes
168
- } = _ref3;
207
+ } = _ref5;
169
208
  const style = attributes === null || attributes === void 0 ? void 0 : attributes.style;
170
209
  const duotone = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.duotone;
171
210
  const duotonePalette = useMultiOriginPresets({
@@ -300,7 +339,7 @@ const withDuotoneStyles = (0, _compose.createHigherOrderComponent)(BlockListBloc
300
339
  const selectorsGroup = scopeSelector(`.editor-styles-wrapper .${id}`, duotoneSupport);
301
340
  const className = (0, _classnames.default)(props === null || props === void 0 ? void 0 : props.className, id);
302
341
  const element = (0, _element.useContext)(_blockList.default.__unstableElementContext);
303
- return (0, _element.createElement)(_element.Fragment, null, element && (0, _element.createPortal)((0, _element.createElement)(DuotoneFilter, {
342
+ return (0, _element.createElement)(_element.Fragment, null, element && (0, _element.createPortal)((0, _element.createElement)(InlineDuotone, {
304
343
  selector: selectorsGroup,
305
344
  id: id,
306
345
  values: getValuesFromColors(values)
@@ -308,6 +347,17 @@ const withDuotoneStyles = (0, _compose.createHigherOrderComponent)(BlockListBloc
308
347
  className: className
309
348
  })));
310
349
  }, 'withDuotoneStyles');
350
+
351
+ function PresetDuotoneFilter(_ref6) {
352
+ let {
353
+ preset
354
+ } = _ref6;
355
+ return (0, _element.createElement)(DuotoneFilter, {
356
+ id: `wp-duotone-${preset.slug}`,
357
+ values: getValuesFromColors(preset.colors)
358
+ });
359
+ }
360
+
311
361
  (0, _hooks.addFilter)('blocks.registerBlockType', 'core/editor/duotone/add-attributes', addDuotoneAttributes);
312
362
  (0, _hooks.addFilter)('editor.BlockEdit', 'core/editor/duotone/with-editor-controls', withDuotoneControls);
313
363
  (0, _hooks.addFilter)('editor.BlockListBlock', 'core/editor/duotone/with-styles', withDuotoneStyles);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["EMPTY_ARRAY","namesPlugin","getValuesFromColors","colors","values","r","g","b","a","forEach","color","rgbColor","toRgb","push","DuotoneFilter","selector","id","stylesheet","visibility","position","left","overflow","join","__html","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","DuotonePanel","attributes","setAttributes","style","duotone","duotonePalette","colorPalette","disableCustomColors","disableCustomDuotone","length","newDuotone","newStyle","addDuotoneAttributes","settings","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","name","scopeSelector","scope","scopes","split","selectors","selectorsScoped","outer","inner","trim","withDuotoneStyles","BlockListBlock","duotoneSupport","selectorsGroup","className","element","BlockList","__unstableElementContext"],"mappings":";;;;;;;;;AAcA;;;;AAXA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AAxBA;AACA;AACA;;AAKA;AACA;AACA;;A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AED,QAAMlC,EAAE,GAAI,cAAc,4BAAe+C,cAAf,CAAiC,EAA3D,CAXkC,CAalC;AACA;AACA;;AACA,QAAME,cAAc,GAAGZ,aAAa,CAClC,2BAA2BrC,EAAI,EADG,EAEnCgD,cAFmC,CAApC;AAKA,QAAME,SAAS,GAAG,yBAAYhB,KAAZ,aAAYA,KAAZ,uBAAYA,KAAK,CAAEgB,SAAnB,EAA8BlD,EAA9B,CAAlB;AAEA,QAAMmD,OAAO,GAAG,yBAAYC,mBAAUC,wBAAtB,CAAhB;AAEA,SACC,qDACGF,OAAO,IACR,2BACC,4BAAC,aAAD;AACC,IAAA,QAAQ,EAAGF,cADZ;AAEC,IAAA,EAAE,EAAGjD,EAFN;AAGC,IAAA,MAAM,EAAGd,mBAAmB,CAAEE,MAAF;AAH7B,IADD,EAMC+D,OAND,CAFF,EAUC,4BAAC,cAAD,6BAAqBjB,KAArB;AAA6B,IAAA,SAAS,EAAGgB;AAAzC,KAVD,CADD;AAcA,CAxCwB,EAyCzB,mBAzCyB,CAA1B;AA4CA,sBACC,0BADD,EAEC,oCAFD,EAGCvB,oBAHD;AAKA,sBACC,kBADD,EAEC,0CAFD,EAGCK,mBAHD;AAKA,sBACC,uBADD,EAEC,iCAFD,EAGCc,iBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { SVG } from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * Convert a list of colors to an object of R, G, and B values.\n *\n * @param {string[]} colors Array of RBG color strings.\n *\n * @return {Object} R, G, and B values.\n */\nexport function getValuesFromColors( colors = [] ) {\n\tconst values = { r: [], g: [], b: [], a: [] };\n\n\tcolors.forEach( ( color ) => {\n\t\tconst rgbColor = colord( color ).toRgb();\n\t\tvalues.r.push( rgbColor.r / 255 );\n\t\tvalues.g.push( rgbColor.g / 255 );\n\t\tvalues.b.push( rgbColor.b / 255 );\n\t\tvalues.a.push( rgbColor.a );\n\t} );\n\n\treturn values;\n}\n\n/**\n * Values for the SVG `feComponentTransfer`.\n *\n * @typedef Values {Object}\n * @property {number[]} r Red values.\n * @property {number[]} g Green values.\n * @property {number[]} b Blue values.\n * @property {number[]} a Alpha values.\n */\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {Values} props.values R, G, B, and A values to filter with.\n *\n * @return {WPElement} Duotone element.\n */\nfunction DuotoneFilter( { selector, id, values } ) {\n\tconst stylesheet = `\n${ selector } {\n\tfilter: url( #${ id } );\n}\n`;\n\n\treturn (\n\t\t<>\n\t\t\t<SVG\n\t\t\t\txmlnsXlink=\"http://www.w3.org/1999/xlink\"\n\t\t\t\tviewBox=\"0 0 0 0\"\n\t\t\t\twidth=\"0\"\n\t\t\t\theight=\"0\"\n\t\t\t\tfocusable=\"false\"\n\t\t\t\trole=\"none\"\n\t\t\t\tstyle={ {\n\t\t\t\t\tvisibility: 'hidden',\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\tleft: '-9999px',\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<defs>\n\t\t\t\t\t<filter id={ id }>\n\t\t\t\t\t\t<feColorMatrix\n\t\t\t\t\t\t\t// Use sRGB instead of linearRGB so transparency looks correct.\n\t\t\t\t\t\t\tcolorInterpolationFilters=\"sRGB\"\n\t\t\t\t\t\t\ttype=\"matrix\"\n\t\t\t\t\t\t\t// Use perceptual brightness to convert to grayscale.\n\t\t\t\t\t\t\tvalues=\"\n\t\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<feComponentTransfer\n\t\t\t\t\t\t\t// Use sRGB instead of linearRGB to be consistent with how CSS gradients work.\n\t\t\t\t\t\t\tcolorInterpolationFilters=\"sRGB\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<feFuncR\n\t\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\t\ttableValues={ values.r.join( ' ' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<feFuncG\n\t\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\t\ttableValues={ values.g.join( ' ' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<feFuncB\n\t\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\t\ttableValues={ values.b.join( ' ' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<feFuncA\n\t\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\t\ttableValues={ values.a.join( ' ' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</feComponentTransfer>\n\t\t\t\t\t\t<feComposite\n\t\t\t\t\t\t\t// Re-mask the image with the original transparency since the feColorMatrix above loses that information.\n\t\t\t\t\t\t\tin2=\"SourceGraphic\"\n\t\t\t\t\t\t\toperator=\"in\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</filter>\n\t\t\t\t</defs>\n\t\t\t</SVG>\n\t\t\t<style dangerouslySetInnerHTML={ { __html: stylesheet } } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nfunction DuotonePanel( { attributes, setAttributes } ) {\n\tconst style = attributes?.style;\n\tconst duotone = style?.color?.duotone;\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<DuotoneControl\n\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\tvalue={ duotone }\n\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\tduotone: newDuotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, 'color.__experimentalDuotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasDuotoneSupport && <DuotonePanel { ...props } /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nfunction scopeSelector( scope, selector ) {\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst duotoneSupport = getBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\t\tconst values = props?.attributes?.style?.color?.duotone;\n\n\t\tif ( ! duotoneSupport || ! values ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst id = `wp-duotone-${ useInstanceId( BlockListBlock ) }`;\n\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\t\tconst selectorsGroup = scopeSelector(\n\t\t\t`.editor-styles-wrapper .${ id }`,\n\t\t\tduotoneSupport\n\t\t);\n\n\t\tconst className = classnames( props?.className, id );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ element &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<DuotoneFilter\n\t\t\t\t\t\t\tselector={ selectorsGroup }\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tvalues={ getValuesFromColors( values ) }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["EMPTY_ARRAY","namesPlugin","getValuesFromColors","colors","values","r","g","b","a","forEach","color","rgbColor","toRgb","push","DuotoneStylesheet","selector","id","css","DuotoneFilter","visibility","position","left","overflow","join","InlineDuotone","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","DuotonePanel","attributes","setAttributes","style","duotone","duotonePalette","colorPalette","disableCustomColors","disableCustomDuotone","length","newDuotone","newStyle","addDuotoneAttributes","settings","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","name","scopeSelector","scope","scopes","split","selectors","selectorsScoped","outer","inner","trim","withDuotoneStyles","BlockListBlock","duotoneSupport","selectorsGroup","className","element","BlockList","__unstableElementContext","PresetDuotoneFilter","preset","slug"],"mappings":";;;;;;;;;;AAcA;;;;AAXA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AAxBA;AACA;AACA;;AAKA;AACA;AACA;;AAOA;AACA;AACA;AAQA,MAAMA,WAAW,GAAG,EAApB;AAEA,oBAAQ,CAAEC,cAAF,CAAR;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,mBAAT,GAA4C;AAAA,MAAdC,MAAc,uEAAL,EAAK;AAClD,QAAMC,MAAM,GAAG;AAAEC,IAAAA,CAAC,EAAE,EAAL;AAASC,IAAAA,CAAC,EAAE,EAAZ;AAAgBC,IAAAA,CAAC,EAAE,EAAnB;AAAuBC,IAAAA,CAAC,EAAE;AAA1B,GAAf;AAEAL,EAAAA,MAAM,CAACM,OAAP,CAAkBC,KAAF,IAAa;AAC5B,UAAMC,QAAQ,GAAG,oBAAQD,KAAR,EAAgBE,KAAhB,EAAjB;AACAR,IAAAA,MAAM,CAACC,CAAP,CAASQ,IAAT,CAAeF,QAA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ME,cAAc,GAAGZ,aAAa,CAClC,2BAA2BtC,EAAI,EADG,EAEnCiD,cAFmC,CAApC;AAKA,QAAME,SAAS,GAAG,yBAAYhB,KAAZ,aAAYA,KAAZ,uBAAYA,KAAK,CAAEgB,SAAnB,EAA8BnD,EAA9B,CAAlB;AAEA,QAAMoD,OAAO,GAAG,yBAAYC,mBAAUC,wBAAtB,CAAhB;AAEA,SACC,qDACGF,OAAO,IACR,2BACC,4BAAC,aAAD;AACC,IAAA,QAAQ,EAAGF,cADZ;AAEC,IAAA,EAAE,EAAGlD,EAFN;AAGC,IAAA,MAAM,EAAGd,mBAAmB,CAAEE,MAAF;AAH7B,IADD,EAMCgE,OAND,CAFF,EAUC,4BAAC,cAAD,6BAAqBjB,KAArB;AAA6B,IAAA,SAAS,EAAGgB;AAAzC,KAVD,CADD;AAcA,CAxCwB,EAyCzB,mBAzCyB,CAA1B;;AA4CO,SAASI,mBAAT,QAA2C;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AACjD,SACC,4BAAC,aAAD;AACC,IAAA,EAAE,EAAI,cAAcA,MAAM,CAACC,IAAM,EADlC;AAEC,IAAA,MAAM,EAAGvE,mBAAmB,CAAEsE,MAAM,CAACrE,MAAT;AAF7B,IADD;AAMA;;AAED,sBACC,0BADD,EAEC,oCAFD,EAGCyC,oBAHD;AAKA,sBACC,kBADD,EAEC,0CAFD,EAGCK,mBAHD;AAKA,sBACC,uBADD,EAEC,iCAFD,EAGCc,iBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { SVG } from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * Convert a list of colors to an object of R, G, and B values.\n *\n * @param {string[]} colors Array of RBG color strings.\n *\n * @return {Object} R, G, and B values.\n */\nexport function getValuesFromColors( colors = [] ) {\n\tconst values = { r: [], g: [], b: [], a: [] };\n\n\tcolors.forEach( ( color ) => {\n\t\tconst rgbColor = colord( color ).toRgb();\n\t\tvalues.r.push( rgbColor.r / 255 );\n\t\tvalues.g.push( rgbColor.g / 255 );\n\t\tvalues.b.push( rgbColor.b / 255 );\n\t\tvalues.a.push( rgbColor.a );\n\t} );\n\n\treturn values;\n}\n\n/**\n * Values for the SVG `feComponentTransfer`.\n *\n * @typedef Values {Object}\n * @property {number[]} r Red values.\n * @property {number[]} g Green values.\n * @property {number[]} b Blue values.\n * @property {number[]} a Alpha values.\n */\n\n/**\n * Stylesheet for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n *\n * @return {WPElement} Duotone element.\n */\nfunction DuotoneStylesheet( { selector, id } ) {\n\tconst css = `\n${ selector } {\n\tfilter: url( #${ id } );\n}\n`;\n\treturn <style>{ css }</style>;\n}\n\n/**\n * SVG for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {Values} props.values R, G, B, and A values to filter with.\n *\n * @return {WPElement} Duotone element.\n */\nfunction DuotoneFilter( { id, values } ) {\n\treturn (\n\t\t<SVG\n\t\t\txmlnsXlink=\"http://www.w3.org/1999/xlink\"\n\t\t\tviewBox=\"0 0 0 0\"\n\t\t\twidth=\"0\"\n\t\t\theight=\"0\"\n\t\t\tfocusable=\"false\"\n\t\t\trole=\"none\"\n\t\t\tstyle={ {\n\t\t\t\tvisibility: 'hidden',\n\t\t\t\tposition: 'absolute',\n\t\t\t\tleft: '-9999px',\n\t\t\t\toverflow: 'hidden',\n\t\t\t} }\n\t\t>\n\t\t\t<defs>\n\t\t\t\t<filter id={ id }>\n\t\t\t\t\t<feColorMatrix\n\t\t\t\t\t\t// Use sRGB instead of linearRGB so transparency looks correct.\n\t\t\t\t\t\tcolorInterpolationFilters=\"sRGB\"\n\t\t\t\t\t\ttype=\"matrix\"\n\t\t\t\t\t\t// Use perceptual brightness to convert to grayscale.\n\t\t\t\t\t\tvalues=\"\n\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\"\n\t\t\t\t\t/>\n\t\t\t\t\t<feComponentTransfer\n\t\t\t\t\t\t// Use sRGB instead of linearRGB to be consistent with how CSS gradients work.\n\t\t\t\t\t\tcolorInterpolationFilters=\"sRGB\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<feFuncR\n\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\ttableValues={ values.r.join( ' ' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<feFuncG\n\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\ttableValues={ values.g.join( ' ' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<feFuncB\n\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\ttableValues={ values.b.join( ' ' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<feFuncA\n\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\ttableValues={ values.a.join( ' ' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</feComponentTransfer>\n\t\t\t\t\t<feComposite\n\t\t\t\t\t\t// Re-mask the image with the original transparency since the feColorMatrix above loses that information.\n\t\t\t\t\t\tin2=\"SourceGraphic\"\n\t\t\t\t\t\toperator=\"in\"\n\t\t\t\t\t/>\n\t\t\t\t</filter>\n\t\t\t</defs>\n\t\t</SVG>\n\t);\n}\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {Values} props.values R, G, B, and A values to filter with.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, values } ) {\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } values={ values } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nfunction DuotonePanel( { attributes, setAttributes } ) {\n\tconst style = attributes?.style;\n\tconst duotone = style?.color?.duotone;\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<DuotoneControl\n\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\tvalue={ duotone }\n\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\tduotone: newDuotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, 'color.__experimentalDuotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasDuotoneSupport && <DuotonePanel { ...props } /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nfunction scopeSelector( scope, selector ) {\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst duotoneSupport = getBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\t\tconst values = props?.attributes?.style?.color?.duotone;\n\n\t\tif ( ! duotoneSupport || ! values ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst id = `wp-duotone-${ useInstanceId( BlockListBlock ) }`;\n\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\t\tconst selectorsGroup = scopeSelector(\n\t\t\t`.editor-styles-wrapper .${ id }`,\n\t\t\tduotoneSupport\n\t\t);\n\n\t\tconst className = classnames( props?.className, id );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ element &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<InlineDuotone\n\t\t\t\t\t\t\tselector={ selectorsGroup }\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tvalues={ getValuesFromColors( values ) }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\nexport function PresetDuotoneFilter( { preset } ) {\n\treturn (\n\t\t<DuotoneFilter\n\t\t\tid={ `wp-duotone-${ preset.slug }` }\n\t\t\tvalues={ getValuesFromColors( preset.colors ) }\n\t\t/>\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "PresetDuotoneFilter", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _duotone.PresetDuotoneFilter;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "getBorderClassesAndStyles", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -62,11 +68,11 @@ require("./style");
62
68
 
63
69
  require("./color");
64
70
 
65
- require("./duotone");
71
+ var _duotone = require("./duotone");
66
72
 
67
73
  require("./font-size");
68
74
 
69
- require("./border-color");
75
+ require("./border");
70
76
 
71
77
  require("./layout");
72
78
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border-color';\nimport './layout';\n\nexport { useCustomSides } from './dimensions';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border';\nimport './layout';\n\nexport { useCustomSides } from './dimensions';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\nexport { PresetDuotoneFilter } from './duotone';\n"]}
@@ -8,17 +8,11 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.getBorderClassesAndStyles = getBorderClassesAndStyles;
9
9
  exports.useBorderProps = useBorderProps;
10
10
 
11
- var _classnames = _interopRequireDefault(require("classnames"));
12
-
13
11
  var _style = require("./style");
14
12
 
15
- var _colors = require("../components/colors");
16
-
17
- var _useSetting = _interopRequireDefault(require("../components/use-setting"));
13
+ var _border = require("./border");
18
14
 
19
- /**
20
- * External dependencies
21
- */
15
+ var _useMultipleOriginColorsAndGradients = _interopRequireDefault(require("../components/colors-gradients/use-multiple-origin-colors-and-gradients"));
22
16
 
23
17
  /**
24
18
  * Internal dependencies
@@ -26,35 +20,23 @@ var _useSetting = _interopRequireDefault(require("../components/use-setting"));
26
20
  // This utility is intended to assist where the serialization of the border
27
21
  // block support is being skipped for a block but the border related CSS classes
28
22
  // & styles still need to be generated so they can be applied to inner elements.
29
- const EMPTY_ARRAY = [];
23
+
30
24
  /**
31
25
  * Provides the CSS class names and inline styles for a block's border support
32
26
  * attributes.
33
27
  *
34
- * @param {Object} attributes Block attributes.
35
- * @param {string} attributes.borderColor Selected named border color.
36
- * @param {Object} attributes.style Block's styles attribute.
37
- *
28
+ * @param {Object} attributes Block attributes.
38
29
  * @return {Object} Border block support derived CSS classes & styles.
39
30
  */
31
+ function getBorderClassesAndStyles(attributes) {
32
+ var _attributes$style;
40
33
 
41
- function getBorderClassesAndStyles(_ref) {
42
- var _style$border;
43
-
44
- let {
45
- borderColor,
46
- style
47
- } = _ref;
48
- const borderStyles = (style === null || style === void 0 ? void 0 : style.border) || {};
49
- const borderClass = (0, _colors.getColorClassName)('border-color', borderColor);
50
- const className = (0, _classnames.default)({
51
- [borderClass]: !!borderClass,
52
- 'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.color)
53
- });
34
+ const border = ((_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.border) || {};
35
+ const className = (0, _border.getBorderClasses)(attributes);
54
36
  return {
55
37
  className: className || undefined,
56
38
  style: (0, _style.getInlineStyles)({
57
- border: borderStyles
39
+ border
58
40
  })
59
41
  };
60
42
  }
@@ -72,12 +54,20 @@ function getBorderClassesAndStyles(_ref) {
72
54
 
73
55
 
74
56
  function useBorderProps(attributes) {
75
- const colors = (0, _useSetting.default)('color.palette') || EMPTY_ARRAY;
76
- const borderProps = getBorderClassesAndStyles(attributes); // Force inline style to apply border color when themes do not load their
77
- // color stylesheets in the editor.
57
+ const {
58
+ colors
59
+ } = (0, _useMultipleOriginColorsAndGradients.default)();
60
+ const borderProps = getBorderClassesAndStyles(attributes);
61
+ const {
62
+ borderColor
63
+ } = attributes; // Force inline styles to apply named border colors when themes do not load
64
+ // their color stylesheets in the editor.
78
65
 
79
- if (attributes.borderColor) {
80
- const borderColorObject = (0, _colors.getColorObjectByAttributeValues)(colors, attributes.borderColor);
66
+ if (borderColor) {
67
+ const borderColorObject = (0, _border.getMultiOriginColor)({
68
+ colors,
69
+ namedColor: borderColor
70
+ });
81
71
  borderProps.style.borderColor = borderColorObject.color;
82
72
  }
83
73
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/use-border-props.js"],"names":["EMPTY_ARRAY","getBorderClassesAndStyles","borderColor","style","borderStyles","border","borderClass","className","color","undefined","useBorderProps","attributes","colors","borderProps","borderColorObject"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AACA;;AAIA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQA;AACA;AACA;AAEA,MAAMA,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,yBAAT,OAA6D;AAAA;;AAAA,MAAzB;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAAyB;AACnE,QAAMC,YAAY,GAAG,CAAAD,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEE,MAAP,KAAiB,EAAtC;AACA,QAAMC,WAAW,GAAG,+BAAmB,cAAnB,EAAmCJ,WAAnC,CAApB;AAEA,QAAMK,SAAS,GAAG,yBAAY;AAC7B,KAAED,WAAF,GAAiB,CAAC,CAAEA,WADS;AAE7B,wBAAoBJ,WAAW,KAAIC,KAAJ,aAAIA,KAAJ,wCAAIA,KAAK,CAAEE,MAAX,kDAAI,cAAeG,KAAnB;AAFF,GAAZ,CAAlB;AAKA,SAAO;AACND,IAAAA,SAAS,EAAEA,SAAS,IAAIE,SADlB;AAENN,IAAAA,KAAK,EAAE,4BAAiB;AAAEE,MAAAA,MAAM,EAAED;AAAV,KAAjB;AAFD,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASM,cAAT,CAAyBC,UAAzB,EAAsC;AAC5C,QAAMC,MAAM,GAAG,yBAAY,eAAZ,KAAiCZ,WAAhD;AACA,QAAMa,WAAW,GAAGZ,yBAAyB,CAAEU,UAAF,CAA7C,CAF4C,CAI5C;AACA;;AACA,MAAKA,UAAU,CAACT,WAAhB,EAA8B;AAC7B,UAAMY,iBAAiB,GAAG,6CACzBF,MADyB,EAEzBD,UAAU,CAACT,WAFc,CAA1B;AAKAW,IAAAA,WAAW,CAACV,KAAZ,CAAkBD,WAAlB,GAAgCY,iBAAiB,CAACN,KAAlD;AACA;;AAED,SAAOK,WAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport useSetting from '../components/use-setting';\n\n// This utility is intended to assist where the serialization of the border\n// block support is being skipped for a block but the border related CSS classes\n// & styles still need to be generated so they can be applied to inner elements.\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Provides the CSS class names and inline styles for a block's border support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} attributes.borderColor Selected named border color.\n * @param {Object} attributes.style Block's styles attribute.\n *\n * @return {Object} Border block support derived CSS classes & styles.\n */\nexport function getBorderClassesAndStyles( { borderColor, style } ) {\n\tconst borderStyles = style?.border || {};\n\tconst borderClass = getColorClassName( 'border-color', borderColor );\n\n\tconst className = classnames( {\n\t\t[ borderClass ]: !! borderClass,\n\t\t'has-border-color': borderColor || style?.border?.color,\n\t} );\n\n\treturn {\n\t\tclassName: className || undefined,\n\t\tstyle: getInlineStyles( { border: borderStyles } ),\n\t};\n}\n\n/**\n * Derives the border related props for a block from its border block support\n * attributes.\n *\n * Inline styles are forced for named colors to ensure these selections are\n * reflected when themes do not load their color stylesheets in the editor.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} ClassName & style props from border block support.\n */\nexport function useBorderProps( attributes ) {\n\tconst colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\n\t// Force inline style to apply border color when themes do not load their\n\t// color stylesheets in the editor.\n\tif ( attributes.borderColor ) {\n\t\tconst borderColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\tattributes.borderColor\n\t\t);\n\n\t\tborderProps.style.borderColor = borderColorObject.color;\n\t}\n\n\treturn borderProps;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/use-border-props.js"],"names":["getBorderClassesAndStyles","attributes","border","style","className","undefined","useBorderProps","colors","borderProps","borderColor","borderColorObject","namedColor","color"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,yBAAT,CAAoCC,UAApC,EAAiD;AAAA;;AACvD,QAAMC,MAAM,GAAG,sBAAAD,UAAU,CAACE,KAAX,wEAAkBD,MAAlB,KAA4B,EAA3C;AACA,QAAME,SAAS,GAAG,8BAAkBH,UAAlB,CAAlB;AAEA,SAAO;AACNG,IAAAA,SAAS,EAAEA,SAAS,IAAIC,SADlB;AAENF,IAAAA,KAAK,EAAE,4BAAiB;AAAED,MAAAA;AAAF,KAAjB;AAFD,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,cAAT,CAAyBL,UAAzB,EAAsC;AAC5C,QAAM;AAAEM,IAAAA;AAAF,MAAa,mDAAnB;AACA,QAAMC,WAAW,GAAGR,yBAAyB,CAAEC,UAAF,CAA7C;AACA,QAAM;AAAEQ,IAAAA;AAAF,MAAkBR,UAAxB,CAH4C,CAK5C;AACA;;AACA,MAAKQ,WAAL,EAAmB;AAClB,UAAMC,iBAAiB,GAAG,iCAAqB;AAC9CH,MAAAA,MAD8C;AAE9CI,MAAAA,UAAU,EAAEF;AAFkC,KAArB,CAA1B;AAKAD,IAAAA,WAAW,CAACL,KAAZ,CAAkBM,WAAlB,GAAgCC,iBAAiB,CAACE,KAAlD;AACA;;AAED,SAAOJ,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getBorderClasses, getMultiOriginColor } from './border';\nimport useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';\n\n// This utility is intended to assist where the serialization of the border\n// block support is being skipped for a block but the border related CSS classes\n// & styles still need to be generated so they can be applied to inner elements.\n\n/**\n * Provides the CSS class names and inline styles for a block's border support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Border block support derived CSS classes & styles.\n */\nexport function getBorderClassesAndStyles( attributes ) {\n\tconst border = attributes.style?.border || {};\n\tconst className = getBorderClasses( attributes );\n\n\treturn {\n\t\tclassName: className || undefined,\n\t\tstyle: getInlineStyles( { border } ),\n\t};\n}\n\n/**\n * Derives the border related props for a block from its border block support\n * attributes.\n *\n * Inline styles are forced for named colors to ensure these selections are\n * reflected when themes do not load their color stylesheets in the editor.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} ClassName & style props from border block support.\n */\nexport function useBorderProps( attributes ) {\n\tconst { colors } = useMultipleOriginColorsAndGradients();\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst { borderColor } = attributes;\n\n\t// Force inline styles to apply named border colors when themes do not load\n\t// their color stylesheets in the editor.\n\tif ( borderColor ) {\n\t\tconst borderColorObject = getMultiOriginColor( {\n\t\t\tcolors,\n\t\t\tnamedColor: borderColor,\n\t\t} );\n\n\t\tborderProps.style.borderColor = borderColorObject.color;\n\t}\n\n\treturn borderProps;\n}\n"]}
package/build/index.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
+ __unstablePresetDuotoneFilter: true,
7
8
  __experimentalGetBorderClassesAndStyles: true,
8
9
  __experimentalUseBorderProps: true,
9
10
  __experimentalGetColorClassesAndStyles: true,
@@ -57,6 +58,12 @@ Object.defineProperty(exports, "__experimentalUseCustomSides", {
57
58
  return _hooks.useCustomSides;
58
59
  }
59
60
  });
61
+ Object.defineProperty(exports, "__unstablePresetDuotoneFilter", {
62
+ enumerable: true,
63
+ get: function () {
64
+ return _hooks.PresetDuotoneFilter;
65
+ }
66
+ });
60
67
  Object.defineProperty(exports, "store", {
61
68
  enumerable: true,
62
69
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAUA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\nexport {\n\tgetBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,\n\tuseBorderProps as __experimentalUseBorderProps,\n\tgetColorClassesAndStyles as __experimentalGetColorClassesAndStyles,\n\tuseColorProps as __experimentalUseColorProps,\n\tuseCustomSides as __experimentalUseCustomSides,\n\tgetSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,\n\tuseCachedTruthy,\n} from './hooks';\nexport * from './components';\nexport * from './utils';\nexport { storeConfig, store } from './store';\nexport { SETTINGS_DEFAULTS } from './store/defaults';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAWA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\nexport {\n\tPresetDuotoneFilter as __unstablePresetDuotoneFilter,\n\tgetBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,\n\tuseBorderProps as __experimentalUseBorderProps,\n\tgetColorClassesAndStyles as __experimentalGetColorClassesAndStyles,\n\tuseColorProps as __experimentalUseColorProps,\n\tuseCustomSides as __experimentalUseCustomSides,\n\tgetSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,\n\tuseCachedTruthy,\n} from './hooks';\nexport * from './components';\nexport * from './utils';\nexport { storeConfig, store } from './store';\nexport { SETTINGS_DEFAULTS } from './store/defaults';\n"]}
@@ -1274,25 +1274,37 @@ function stopDraggingBlocks() {
1274
1274
  /**
1275
1275
  * Returns an action object used in signalling that the caret has entered formatted text.
1276
1276
  *
1277
+ * @deprecated
1278
+ *
1277
1279
  * @return {Object} Action object.
1278
1280
  */
1279
1281
 
1280
1282
 
1281
1283
  function enterFormattedText() {
1284
+ (0, _deprecated.default)('wp.data.dispatch( "core/block-editor" ).enterFormattedText', {
1285
+ since: '6.1',
1286
+ version: '6.3'
1287
+ });
1282
1288
  return {
1283
- type: 'ENTER_FORMATTED_TEXT'
1289
+ type: 'DO_NOTHING'
1284
1290
  };
1285
1291
  }
1286
1292
  /**
1287
1293
  * Returns an action object used in signalling that the user caret has exited formatted text.
1288
1294
  *
1295
+ * @deprecated
1296
+ *
1289
1297
  * @return {Object} Action object.
1290
1298
  */
1291
1299
 
1292
1300
 
1293
1301
  function exitFormattedText() {
1302
+ (0, _deprecated.default)('wp.data.dispatch( "core/block-editor" ).exitFormattedText', {
1303
+ since: '6.1',
1304
+ version: '6.3'
1305
+ });
1294
1306
  return {
1295
- type: 'EXIT_FORMATTED_TEXT'
1307
+ type: 'DO_NOTHING'
1296
1308
  };
1297
1309
  }
1298
1310
  /**