@wordpress/block-library 7.6.0 → 7.7.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 (152) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/deprecated.js +175 -35
  3. package/build/button/deprecated.js.map +1 -1
  4. package/build/button/edit.js +1 -1
  5. package/build/button/edit.js.map +1 -1
  6. package/build/button/save.js +1 -1
  7. package/build/button/save.js.map +1 -1
  8. package/build/columns/index.js +3 -1
  9. package/build/columns/index.js.map +1 -1
  10. package/build/cover/deprecated.js +212 -207
  11. package/build/cover/deprecated.js.map +1 -1
  12. package/build/cover/edit/index.js +13 -3
  13. package/build/cover/edit/index.js.map +1 -1
  14. package/build/cover/save.js +18 -5
  15. package/build/cover/save.js.map +1 -1
  16. package/build/cover/shared.js +14 -17
  17. package/build/cover/shared.js.map +1 -1
  18. package/build/file/edit.js +1 -1
  19. package/build/file/edit.js.map +1 -1
  20. package/build/file/save.js +9 -1
  21. package/build/file/save.js.map +1 -1
  22. package/build/gallery/gap-styles.js +14 -4
  23. package/build/gallery/gap-styles.js.map +1 -1
  24. package/build/gallery/index.js +1 -1
  25. package/build/image/edit.js +5 -59
  26. package/build/image/edit.js.map +1 -1
  27. package/build/image/edit.native.js +56 -3
  28. package/build/image/edit.native.js.map +1 -1
  29. package/build/image/image.js +3 -13
  30. package/build/image/image.js.map +1 -1
  31. package/build/list-item/hooks/use-split.js +17 -3
  32. package/build/list-item/hooks/use-split.js.map +1 -1
  33. package/build/navigation-link/edit.js +31 -5
  34. package/build/navigation-link/edit.js.map +1 -1
  35. package/build/post-author-name/index.js +3 -0
  36. package/build/post-author-name/index.js.map +1 -1
  37. package/build/post-author-name/transforms.js +41 -0
  38. package/build/post-author-name/transforms.js.map +1 -0
  39. package/build/post-comments-form/form.js +11 -1
  40. package/build/post-comments-form/form.js.map +1 -1
  41. package/build/post-date/edit.js +13 -7
  42. package/build/post-date/edit.js.map +1 -1
  43. package/build/search/edit.js +1 -1
  44. package/build/search/edit.js.map +1 -1
  45. package/build/search/index.js +4 -0
  46. package/build/search/index.js.map +1 -1
  47. package/build/shortcode/edit.native.js +16 -13
  48. package/build/shortcode/edit.native.js.map +1 -1
  49. package/build/social-links/edit.js +2 -2
  50. package/build/social-links/edit.js.map +1 -1
  51. package/build/table-of-contents/edit.js +11 -3
  52. package/build/table-of-contents/edit.js.map +1 -1
  53. package/build-module/button/deprecated.js +175 -35
  54. package/build-module/button/deprecated.js.map +1 -1
  55. package/build-module/button/edit.js +2 -2
  56. package/build-module/button/edit.js.map +1 -1
  57. package/build-module/button/save.js +2 -2
  58. package/build-module/button/save.js.map +1 -1
  59. package/build-module/columns/index.js +3 -1
  60. package/build-module/columns/index.js.map +1 -1
  61. package/build-module/cover/deprecated.js +206 -198
  62. package/build-module/cover/deprecated.js.map +1 -1
  63. package/build-module/cover/edit/index.js +14 -4
  64. package/build-module/cover/edit/index.js.map +1 -1
  65. package/build-module/cover/save.js +19 -6
  66. package/build-module/cover/save.js.map +1 -1
  67. package/build-module/cover/shared.js +11 -12
  68. package/build-module/cover/shared.js.map +1 -1
  69. package/build-module/file/edit.js +2 -2
  70. package/build-module/file/edit.js.map +1 -1
  71. package/build-module/file/save.js +7 -2
  72. package/build-module/file/save.js.map +1 -1
  73. package/build-module/gallery/gap-styles.js +14 -4
  74. package/build-module/gallery/gap-styles.js.map +1 -1
  75. package/build-module/gallery/index.js +1 -1
  76. package/build-module/image/edit.js +5 -56
  77. package/build-module/image/edit.js.map +1 -1
  78. package/build-module/image/edit.native.js +57 -5
  79. package/build-module/image/edit.native.js.map +1 -1
  80. package/build-module/image/image.js +4 -14
  81. package/build-module/image/image.js.map +1 -1
  82. package/build-module/list-item/hooks/use-split.js +19 -5
  83. package/build-module/list-item/hooks/use-split.js.map +1 -1
  84. package/build-module/navigation-link/edit.js +31 -6
  85. package/build-module/navigation-link/edit.js.map +1 -1
  86. package/build-module/post-author-name/index.js +2 -0
  87. package/build-module/post-author-name/index.js.map +1 -1
  88. package/build-module/post-author-name/transforms.js +32 -0
  89. package/build-module/post-author-name/transforms.js.map +1 -0
  90. package/build-module/post-comments-form/form.js +7 -1
  91. package/build-module/post-comments-form/form.js.map +1 -1
  92. package/build-module/post-date/edit.js +15 -9
  93. package/build-module/post-date/edit.js.map +1 -1
  94. package/build-module/search/edit.js +2 -2
  95. package/build-module/search/edit.js.map +1 -1
  96. package/build-module/search/index.js +4 -0
  97. package/build-module/search/index.js.map +1 -1
  98. package/build-module/shortcode/edit.native.js +17 -13
  99. package/build-module/shortcode/edit.native.js.map +1 -1
  100. package/build-module/social-links/edit.js +2 -2
  101. package/build-module/social-links/edit.js.map +1 -1
  102. package/build-module/table-of-contents/edit.js +12 -4
  103. package/build-module/table-of-contents/edit.js.map +1 -1
  104. package/build-style/cover/style-rtl.css +32 -23
  105. package/build-style/cover/style.css +32 -23
  106. package/build-style/site-logo/style-rtl.css +4 -0
  107. package/build-style/site-logo/style.css +4 -0
  108. package/build-style/style-rtl.css +36 -23
  109. package/build-style/style.css +36 -23
  110. package/package.json +28 -28
  111. package/src/button/deprecated.js +145 -0
  112. package/src/button/edit.js +3 -1
  113. package/src/button/save.js +3 -1
  114. package/src/buttons/test/__snapshots__/edit.native.js.snap +1 -1
  115. package/src/buttons/test/edit.native.js +1 -1
  116. package/src/columns/block.json +3 -1
  117. package/src/cover/deprecated.js +230 -183
  118. package/src/cover/edit/index.js +25 -13
  119. package/src/cover/save.js +26 -13
  120. package/src/cover/shared.js +5 -7
  121. package/src/cover/style.scss +27 -22
  122. package/src/file/edit.js +5 -1
  123. package/src/file/save.js +14 -2
  124. package/src/gallery/block.json +1 -1
  125. package/src/gallery/gap-styles.js +21 -6
  126. package/src/gallery/index.php +23 -12
  127. package/src/image/edit.js +1 -53
  128. package/src/image/edit.native.js +65 -3
  129. package/src/image/image.js +2 -11
  130. package/src/image/styles.native.scss +11 -0
  131. package/src/list-item/hooks/use-split.js +18 -9
  132. package/src/navigation-link/edit.js +35 -5
  133. package/src/navigation-link/test/edit.js +0 -20
  134. package/src/post-author/index.php +3 -2
  135. package/src/post-author-name/index.js +2 -0
  136. package/src/post-author-name/index.php +1 -1
  137. package/src/post-author-name/transforms.js +25 -0
  138. package/src/post-comments/index.php +1 -1
  139. package/src/post-comments-form/form.js +11 -1
  140. package/src/post-comments-form/index.php +1 -1
  141. package/src/post-date/edit.js +4 -3
  142. package/src/query-pagination/index.php +0 -1
  143. package/src/search/block.json +4 -0
  144. package/src/search/edit.js +3 -1
  145. package/src/search/index.php +28 -15
  146. package/src/shortcode/edit.native.js +29 -15
  147. package/src/shortcode/style.native.scss +11 -4
  148. package/src/shortcode/test/__snapshots__/edit.native.js.snap +9 -0
  149. package/src/shortcode/test/edit.native.js +58 -40
  150. package/src/site-logo/style.scss +6 -0
  151. package/src/social-links/edit.js +11 -10
  152. package/src/table-of-contents/edit.js +19 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/search/index.js"],"names":["name","metadata","settings","icon","example","variations","edit"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,aADuB;AAEvBC,EAAAA,OAAO,EAAE,EAFc;AAGvBC,EAAAA,UAAU,EAAVA,mBAHuB;AAIvBC,EAAAA,IAAI,EAAJA;AAJuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { search as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tvariations,\n\tedit,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/search/index.js"],"names":["name","metadata","settings","icon","example","variations","edit"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,aADuB;AAEvBC,EAAAA,OAAO,EAAE,EAFc;AAGvBC,EAAAA,UAAU,EAAVA,mBAHuB;AAIvBC,EAAAA,IAAI,EAAJA;AAJuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { search as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tvariations,\n\tedit,\n};\n"]}
@@ -37,30 +37,33 @@ function ShortcodeEdit(props) {
37
37
  setAttributes,
38
38
  onFocus,
39
39
  onBlur,
40
- getStylesFromColorScheme
40
+ getStylesFromColorScheme,
41
+ blockWidth
41
42
  } = props;
42
43
  const titleStyle = getStylesFromColorScheme(_style.default.blockTitle, _style.default.blockTitleDark);
44
+ const shortcodeContainerStyle = getStylesFromColorScheme(_style.default.blockShortcodeContainer, _style.default.blockShortcodeContainerDark);
43
45
  const shortcodeStyle = getStylesFromColorScheme(_style.default.blockShortcode, _style.default.blockShortcodeDark);
44
46
  const placeholderStyle = getStylesFromColorScheme(_style.default.placeholder, _style.default.placeholderDark);
47
+ const maxWidth = blockWidth - shortcodeContainerStyle.paddingLeft + shortcodeContainerStyle.paddingRight;
48
+ const onChange = (0, _element.useCallback)(text => setAttributes({
49
+ text
50
+ }), [setAttributes]);
45
51
  return (0, _element.createElement)(_reactNative.View, null, (0, _element.createElement)(_reactNative.Text, {
46
52
  style: titleStyle
47
- }, (0, _i18n.__)('Shortcode')), (0, _element.createElement)(_blockEditor.PlainText, {
53
+ }, (0, _i18n.__)('Shortcode')), (0, _element.createElement)(_reactNative.View, {
54
+ style: shortcodeContainerStyle
55
+ }, (0, _element.createElement)(_blockEditor.PlainText, {
56
+ __experimentalVersion: 2,
48
57
  value: attributes.text,
49
58
  style: shortcodeStyle,
50
- multiline: true,
51
- underlineColorAndroid: "transparent",
52
- onChange: text => setAttributes({
53
- text
54
- }),
59
+ onChange: onChange,
55
60
  placeholder: (0, _i18n.__)('Add a shortcode…'),
56
- "aria-label": (0, _i18n.__)('Shortcode'),
57
- isSelected: props.isSelected,
58
61
  onFocus: onFocus,
59
62
  onBlur: onBlur,
60
- autoCorrect: false,
61
- autoComplete: "off",
62
- placeholderTextColor: placeholderStyle.color
63
- }));
63
+ placeholderTextColor: placeholderStyle.color,
64
+ maxWidth: maxWidth,
65
+ disableAutocorrection: true
66
+ })));
64
67
  }
65
68
 
66
69
  var _default = (0, _compose.withPreferredColorScheme)(ShortcodeEdit);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/shortcode/edit.native.js"],"names":["ShortcodeEdit","props","attributes","setAttributes","onFocus","onBlur","getStylesFromColorScheme","titleStyle","styles","blockTitle","blockTitleDark","shortcodeStyle","blockShortcode","blockShortcodeDark","placeholderStyle","placeholder","placeholderDark","text","isSelected","color"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAMA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAIO,SAASA,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,aAFK;AAGLC,IAAAA,OAHK;AAILC,IAAAA,MAJK;AAKLC,IAAAA;AALK,MAMFL,KANJ;AAOA,QAAMM,UAAU,GAAGD,wBAAwB,CAC1CE,eAAOC,UADmC,EAE1CD,eAAOE,cAFmC,CAA3C;AAIA,QAAMC,cAAc,GAAGL,wBAAwB,CAC9CE,eAAOI,cADuC,EAE9CJ,eAAOK,kBAFuC,CAA/C;AAIA,QAAMC,gBAAgB,GAAGR,wBAAwB,CAChDE,eAAOO,WADyC,EAEhDP,eAAOQ,eAFyC,CAAjD;AAKA,SACC,4BAAC,iBAAD,QACC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGT;AAAd,KAA6B,cAAI,WAAJ,CAA7B,CADD,EAEC,4BAAC,sBAAD;AACC,IAAA,KAAK,EAAGL,UAAU,CAACe,IADpB;AAEC,IAAA,KAAK,EAAGN,cAFT;AAGC,IAAA,SAAS,EAAG,IAHb;AAIC,IAAA,qBAAqB,EAAC,aAJvB;AAKC,IAAA,QAAQ,EAAKM,IAAF,IAAYd,aAAa,CAAE;AAAEc,MAAAA;AAAF,KAAF,CALrC;AAMC,IAAA,WAAW,EAAG,cAAI,kBAAJ,CANf;AAOC,kBAAa,cAAI,WAAJ,CAPd;AAQC,IAAA,UAAU,EAAGhB,KAAK,CAACiB,UARpB;AASC,IAAA,OAAO,EAAGd,OATX;AAUC,IAAA,MAAM,EAAGC,MAVV;AAWC,IAAA,WAAW,EAAG,KAXf;AAYC,IAAA,YAAY,EAAC,KAZd;AAaC,IAAA,oBAAoB,EAAGS,gBAAgB,CAACK;AAbzC,IAFD,CADD;AAoBA;;eAEc,uCAA0BnB,aAA1B,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PlainText } from '@wordpress/block-editor';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\n\nimport styles from './style.scss';\n\nexport function ShortcodeEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tonFocus,\n\t\tonBlur,\n\t\tgetStylesFromColorScheme,\n\t} = props;\n\tconst titleStyle = getStylesFromColorScheme(\n\t\tstyles.blockTitle,\n\t\tstyles.blockTitleDark\n\t);\n\tconst shortcodeStyle = getStylesFromColorScheme(\n\t\tstyles.blockShortcode,\n\t\tstyles.blockShortcodeDark\n\t);\n\tconst placeholderStyle = getStylesFromColorScheme(\n\t\tstyles.placeholder,\n\t\tstyles.placeholderDark\n\t);\n\n\treturn (\n\t\t<View>\n\t\t\t<Text style={ titleStyle }>{ __( 'Shortcode' ) }</Text>\n\t\t\t<PlainText\n\t\t\t\tvalue={ attributes.text }\n\t\t\t\tstyle={ shortcodeStyle }\n\t\t\t\tmultiline={ true }\n\t\t\t\tunderlineColorAndroid=\"transparent\"\n\t\t\t\tonChange={ ( text ) => setAttributes( { text } ) }\n\t\t\t\tplaceholder={ __( 'Add a shortcode…' ) }\n\t\t\t\taria-label={ __( 'Shortcode' ) }\n\t\t\t\tisSelected={ props.isSelected }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonBlur={ onBlur }\n\t\t\t\tautoCorrect={ false }\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\tplaceholderTextColor={ placeholderStyle.color }\n\t\t\t/>\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( ShortcodeEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/shortcode/edit.native.js"],"names":["ShortcodeEdit","props","attributes","setAttributes","onFocus","onBlur","getStylesFromColorScheme","blockWidth","titleStyle","styles","blockTitle","blockTitleDark","shortcodeContainerStyle","blockShortcodeContainer","blockShortcodeContainerDark","shortcodeStyle","blockShortcode","blockShortcodeDark","placeholderStyle","placeholder","placeholderDark","maxWidth","paddingLeft","paddingRight","onChange","text","color"],"mappings":";;;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAOA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAIO,SAASA,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,aAFK;AAGLC,IAAAA,OAHK;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C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PlainText } from '@wordpress/block-editor';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport styles from './style.scss';\n\nexport function ShortcodeEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tonFocus,\n\t\tonBlur,\n\t\tgetStylesFromColorScheme,\n\t\tblockWidth,\n\t} = props;\n\tconst titleStyle = getStylesFromColorScheme(\n\t\tstyles.blockTitle,\n\t\tstyles.blockTitleDark\n\t);\n\tconst shortcodeContainerStyle = getStylesFromColorScheme(\n\t\tstyles.blockShortcodeContainer,\n\t\tstyles.blockShortcodeContainerDark\n\t);\n\tconst shortcodeStyle = getStylesFromColorScheme(\n\t\tstyles.blockShortcode,\n\t\tstyles.blockShortcodeDark\n\t);\n\tconst placeholderStyle = getStylesFromColorScheme(\n\t\tstyles.placeholder,\n\t\tstyles.placeholderDark\n\t);\n\n\tconst maxWidth =\n\t\tblockWidth -\n\t\tshortcodeContainerStyle.paddingLeft +\n\t\tshortcodeContainerStyle.paddingRight;\n\n\tconst onChange = useCallback( ( text ) => setAttributes( { text } ), [\n\t\tsetAttributes,\n\t] );\n\n\treturn (\n\t\t<View>\n\t\t\t<Text style={ titleStyle }>{ __( 'Shortcode' ) }</Text>\n\t\t\t<View style={ shortcodeContainerStyle }>\n\t\t\t\t<PlainText\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\tvalue={ attributes.text }\n\t\t\t\t\tstyle={ shortcodeStyle }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tplaceholder={ __( 'Add a shortcode…' ) }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\tplaceholderTextColor={ placeholderStyle.color }\n\t\t\t\t\tmaxWidth={ maxWidth }\n\t\t\t\t\tdisableAutocorrection\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( ShortcodeEdit );\n"]}
@@ -198,11 +198,11 @@ function SocialLinksEdit(props) {
198
198
  __experimentalIsRenderedInSidebar: true,
199
199
  title: (0, _i18n.__)('Color'),
200
200
  colorSettings: colorSettings
201
- }), !logosOnly && (0, _element.createElement)(_blockEditor.ContrastChecker, {
201
+ }, !logosOnly && (0, _element.createElement)(_blockEditor.ContrastChecker, {
202
202
  textColor: iconColorValue,
203
203
  backgroundColor: iconBackgroundColorValue,
204
204
  isLargeText: false
205
- })), (0, _element.createElement)("ul", innerBlocksProps));
205
+ }))), (0, _element.createElement)("ul", innerBlocksProps));
206
206
  }
207
207
 
208
208
  const iconColorAttributes = {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","customIconBackgroundColor","iconColorValue","openInNewTab","showLabels","size","layout","usedLayout","logosOnly","className","includes","backgroundBackup","current","undefined","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","push","onClose","map","entry","check","textColor","backgroundColor","iconColorAttributes"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AASA;;AAOA;;AACA;;AA3BA;AACA;AACA;;AAGA;AACA;AACA;AAsBA,MAAMA,cAAc,GAAG,CAAE,kBAAF,CAAvB;AAEA,MAAMC,WAAW,GAAG,CACnB;AAAEC,EAAAA,IAAI,EAAE,cAAI,OAAJ,CAAR;AAAuBC,EAAAA,KAAK,EAAE;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AA2EA;;AAED,MAAMmB,mBAAmB,GAAG;AAC3B1C,EAAAA,SAAS,EAAE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;;eAKe,6BAAY2C,mBAAZ,EAAmC9C,eAAnC,C","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { Fragment, useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\tPanelColorSettings,\n\twithColors,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\tcustomIconBackgroundColor,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tconst backgroundBackup = useRef( {} );\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tbackgroundBackup.current = {\n\t\t\t\ticonBackgroundColor,\n\t\t\t\ticonBackgroundColorValue,\n\t\t\t\tcustomIconBackgroundColor,\n\t\t\t};\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( { ...backgroundBackup.current } );\n\t\t}\n\t}, [ logosOnly ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show labels' ) }\n\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelColorSettings\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\t\tcolorSettings={ colorSettings }\n\t\t\t\t/>\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</Fragment>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","customIconBackgroundColor","iconColorValue","openInNewTab","showLabels","size","layout","usedLayout","logosOnly","className","includes","backgroundBackup","current","undefined","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","push","onClose","map","entry","check","textColor","backgroundColor","iconColorAttributes"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AASA;;AAOA;;AACA;;AA3BA;AACA;AACA;;AAGA;AACA;AACA;AAsBA,MAAMA,cAAc,GAAG,CAAE,kBAAF,CAAvB;AAEA,MAAMC,WAAW,GAAG,CACnB;AAAEC,EAAAA,IAAI,EAAE,cAAI,OAAJ,CAAR;AAAuBC,EAAAA,KAAK,EAAE;AAA9B,CADmB,EAEnB;AAAED,EAAAA,IAAI,EAAE,cAAI,QAAJ,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AE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;;eAKe,6BAAY2C,mBAAZ,EAAmC9C,eAAnC,C","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { Fragment, useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\tPanelColorSettings,\n\twithColors,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\tcustomIconBackgroundColor,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tconst backgroundBackup = useRef( {} );\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tbackgroundBackup.current = {\n\t\t\t\ticonBackgroundColor,\n\t\t\t\ticonBackgroundColorValue,\n\t\t\t\tcustomIconBackgroundColor,\n\t\t\t};\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( { ...backgroundBackup.current } );\n\t\t}\n\t}, [ logosOnly ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show labels' ) }\n\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelColorSettings\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\t\tcolorSettings={ colorSettings }\n\t\t\t\t>\n\t\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelColorSettings>\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</Fragment>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
@@ -70,7 +70,14 @@ function TableOfContentsEdit(_ref) {
70
70
  } = _ref;
71
71
  const blockProps = (0, _blockEditor.useBlockProps)();
72
72
  const disabledRef = (0, _compose.useDisabled)();
73
- const listBlockExists = (0, _data.useSelect)(select => !!select(_blocks.store).getBlockType('core/list'), []);
73
+ const canInsertList = (0, _data.useSelect)(select => {
74
+ const {
75
+ getBlockRootClientId,
76
+ canInsertBlockType
77
+ } = select(_blockEditor.store);
78
+ const rootClientId = getBlockRootClientId(clientId);
79
+ return canInsertBlockType('core/list', rootClientId);
80
+ }, [clientId]);
74
81
  const {
75
82
  __unstableMarkNextChangeAsNotPersistent,
76
83
  replaceBlocks
@@ -177,7 +184,8 @@ function TableOfContentsEdit(_ref) {
177
184
  const canBeLinked = typeof headingPageLink === 'string' && typeof headingAttributes.anchor === 'string' && headingAttributes.anchor !== '';
178
185
 
179
186
  _latestHeadings.push({
180
- content: (0, _dom.__unstableStripHTML)(headingAttributes.content),
187
+ // Convert line breaks to spaces, and get rid of HTML tags in the headings.
188
+ content: (0, _dom.__unstableStripHTML)(headingAttributes.content.replace(/(<br *\/?>)+/g, ' ')),
181
189
  level: headingAttributes.level,
182
190
  link: canBeLinked ? `${headingPageLink}#${headingAttributes.anchor}` : null
183
191
  });
@@ -203,7 +211,7 @@ function TableOfContentsEdit(_ref) {
203
211
  }
204
212
  }, [latestHeadings]);
205
213
  const headingTree = (0, _utils.linearToNestedHeadingList)(headings);
206
- const toolbarControls = listBlockExists && (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarButton, {
214
+ const toolbarControls = canInsertList && (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarButton, {
207
215
  onClick: () => replaceBlocks(clientId, (0, _blocks.createBlock)('core/list', {
208
216
  ordered: true,
209
217
  values: (0, _element.renderToString)((0, _element.createElement)(_list.default, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","disabledRef","listBlockExists","select","blocksStore","getBlockType","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","blockEditorStore","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value","icon"],"mappings":";;;;;;;;;AA0BA;;AAvBA;;AAKA;;AAOA;;AACA;;AAOA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAuBA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAT,OAIX;AAAA,MAJyC;AAC5CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,QAAQ,GAAG,EAAb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,EAAG,cAAI,UAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,2BAAJ,CADT;AAEC,IAAA,OAAO,EAAG/C,sBAFX;AAGC,IAAA,QAAQ,EAAKgD,KAAF,IACV9C,aAAa,CAAE;AAAEF,MAAAA,sBAAsB,EAAEgD;AAA1B,KAAF,CAJf;AAMC,IAAA,IAAI,EACHhD,sBAAsB,GACnB,cACA,2EADA,CADmB,GAInB,cACA,mFADA;AAXL,IADD,CADD,CADD,CA3LG,CAkNH;AACA;AACA;;AACA,MAAKD,QAAQ,CAACsB,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WACC,qDACC,mCAAUlB,UAAV,EACC,4BAAC,uBAAD;AACC,MAAA,IAAI,EAAG,4BAAC,sBAAD;AAAW,QAAA,IAAI,EAAG8C;AAAlB,QADR;AAEC,MAAA,KAAK,EAAC,mBAFP;AAGC,MAAA,YAAY,EAAG,cACd,4GADc;AAHhB,MADD,CADD,EAUGF,iBAVH,CADD;AAcA;;AAED,SACC,qDACC,mCAAU5C,UAAV,EACC;AAAI,IAAA,GAAG,EAAGC;AAAV,KACC,4BAAC,aAAD;AAAqB,IAAA,iBAAiB,EAAGuC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDisabled } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst disabledRef = useDisabled();\n\n\tconst listBlockExists = useSelect(\n\t\t( select ) => !! select( blocksStore ).getBlockType( 'core/list' ),\n\t\t[]\n\t);\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlocks,\n\t} = useDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes = getBlockAttributes(\n\t\t\t\t\t\t\tblockClientId\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\tcontent: stripHTML( headingAttributes.content ),\n\t\t\t\t\t\t\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = listBlockExists && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\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)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel=\"Table of Contents\"\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol ref={ disabledRef }>\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","disabledRef","canInsertList","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value","icon"],"mappings":";;;;;;;;;AA0BA;;AAvBA;;AAKA;;AAOA;;AACA;;AAOA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAuBA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAT,OAIX;AAAA,MAJyC;AAC5CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,QAAQ,GAAG,EAAb;AAAiBC,MAAAA;AAAjB,KADgC;AAE5CC,IAAAA,QAF4C;AAG5CC,IAAAA;AAH4C,GAIzC;AACH,QAAMC,UAAU,GAAG,iCAAnB;AACA,QAAMC,WAAW,GAAG,2BAApB;AAEA,QAAMC,aAAa,GAAG,qBACnBC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,oBAAF;AAAwBC,MAAAA;AAAxB,QAA+CF,MAAM,CAC1DG,kBAD0D,CAA3D;AAGA,UAAMC,YAAY,GAAGH,oBAAoB,CAAEN,QAAF,CAAzC;AAEA,WAAOO,kBAAkB,CAAE,WAAF,EAAeE,YAAf,CAAzB;AACA,GARoB,EASrB,CAAET,QAAF,CATqB,CAAtB;AAYA,QAAM;AACLU,IAAAA,uCADK;AAELC,IAAAA;AAFK,MAGF,uBAAaH,kBAAb,CAHJ;AAKA;AACD;AACA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NH;AACA;AACA;;AACA,MAAKD,QAAQ,CAACuB,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WACC,qDACC,mCAAUnB,UAAV,EACC,4BAAC,uBAAD;AACC,MAAA,IAAI,EAAG,4BAAC,sBAAD;AAAW,QAAA,IAAI,EAAGgD;AAAlB,QADR;AAEC,MAAA,KAAK,EAAC,mBAFP;AAGC,MAAA,YAAY,EAAG,cACd,4GADc;AAHhB,MADD,CADD,EAUGF,iBAVH,CADD;AAcA;;AAED,SACC,qDACC,mCAAU9C,UAAV,EACC;AAAI,IAAA,GAAG,EAAGC;AAAV,KACC,4BAAC,aAAD;AAAqB,IAAA,iBAAiB,EAAGyC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDisabled } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst disabledRef = useDisabled();\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlocks,\n\t} = useDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes = getBlockAttributes(\n\t\t\t\t\t\t\tblockClientId\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\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)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel=\"Table of Contents\"\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol ref={ disabledRef }>\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
@@ -95,7 +95,7 @@ const blockAttributes = {
95
95
  selector: 'a'
96
96
  }
97
97
  };
98
- const v10 = {
98
+ const v11 = {
99
99
  attributes: {
100
100
  url: {
101
101
  type: 'string',
@@ -148,11 +148,18 @@ const v10 = {
148
148
  alignWide: false,
149
149
  color: {
150
150
  __experimentalSkipSerialization: true,
151
- gradients: true
151
+ gradients: true,
152
+ __experimentalDefaultControls: {
153
+ background: true,
154
+ text: true
155
+ }
152
156
  },
153
157
  typography: {
154
158
  fontSize: true,
155
- __experimentalFontFamily: true
159
+ __experimentalFontFamily: true,
160
+ __experimentalDefaultControls: {
161
+ fontSize: true
162
+ }
156
163
  },
157
164
  reusable: false,
158
165
  spacing: {
@@ -164,7 +171,10 @@ const v10 = {
164
171
  },
165
172
  __experimentalBorder: {
166
173
  radius: true,
167
- __experimentalSkipSerialization: true
174
+ __experimentalSkipSerialization: true,
175
+ __experimentalDefaultControls: {
176
+ radius: true
177
+ }
168
178
  },
169
179
  __experimentalSelector: '.wp-block-button__link'
170
180
  },
@@ -222,21 +232,151 @@ const v10 = {
222
232
  target: linkTarget,
223
233
  rel: rel
224
234
  }));
235
+ }
236
+
237
+ };
238
+ const v10 = {
239
+ attributes: {
240
+ url: {
241
+ type: 'string',
242
+ source: 'attribute',
243
+ selector: 'a',
244
+ attribute: 'href'
245
+ },
246
+ title: {
247
+ type: 'string',
248
+ source: 'attribute',
249
+ selector: 'a',
250
+ attribute: 'title'
251
+ },
252
+ text: {
253
+ type: 'string',
254
+ source: 'html',
255
+ selector: 'a'
256
+ },
257
+ linkTarget: {
258
+ type: 'string',
259
+ source: 'attribute',
260
+ selector: 'a',
261
+ attribute: 'target'
262
+ },
263
+ rel: {
264
+ type: 'string',
265
+ source: 'attribute',
266
+ selector: 'a',
267
+ attribute: 'rel'
268
+ },
269
+ placeholder: {
270
+ type: 'string'
271
+ },
272
+ backgroundColor: {
273
+ type: 'string'
274
+ },
275
+ textColor: {
276
+ type: 'string'
277
+ },
278
+ gradient: {
279
+ type: 'string'
280
+ },
281
+ width: {
282
+ type: 'number'
283
+ }
284
+ },
285
+ supports: {
286
+ anchor: true,
287
+ align: true,
288
+ alignWide: false,
289
+ color: {
290
+ __experimentalSkipSerialization: true,
291
+ gradients: true
292
+ },
293
+ typography: {
294
+ fontSize: true,
295
+ __experimentalFontFamily: true
296
+ },
297
+ reusable: false,
298
+ spacing: {
299
+ __experimentalSkipSerialization: true,
300
+ padding: ['horizontal', 'vertical'],
301
+ __experimentalDefaultControls: {
302
+ padding: true
303
+ }
304
+ },
305
+ __experimentalBorder: {
306
+ radius: true,
307
+ __experimentalSkipSerialization: true
308
+ },
309
+ __experimentalSelector: '.wp-block-button__link'
310
+ },
311
+
312
+ save(_ref2) {
313
+ var _style$border2, _style$typography2;
314
+
315
+ let {
316
+ attributes,
317
+ className
318
+ } = _ref2;
319
+ const {
320
+ fontSize,
321
+ linkTarget,
322
+ rel,
323
+ style,
324
+ text,
325
+ title,
326
+ url,
327
+ width
328
+ } = attributes;
329
+
330
+ if (!text) {
331
+ return null;
332
+ }
333
+
334
+ const borderProps = getBorderClassesAndStyles(attributes);
335
+ const colorProps = getColorClassesAndStyles(attributes);
336
+ const spacingProps = getSpacingClassesAndStyles(attributes);
337
+ const buttonClasses = classnames('wp-block-button__link', colorProps.className, borderProps.className, {
338
+ // For backwards compatibility add style that isn't provided via
339
+ // block support.
340
+ 'no-border-radius': (style === null || style === void 0 ? void 0 : (_style$border2 = style.border) === null || _style$border2 === void 0 ? void 0 : _style$border2.radius) === 0
341
+ });
342
+ const buttonStyle = { ...borderProps.style,
343
+ ...colorProps.style,
344
+ ...spacingProps.style
345
+ }; // The use of a `title` attribute here is soft-deprecated, but still applied
346
+ // if it had already been assigned, for the sake of backward-compatibility.
347
+ // A title will no longer be assigned for new or updated button block links.
348
+
349
+ const wrapperClasses = classnames(className, {
350
+ [`has-custom-width wp-block-button__width-${width}`]: width,
351
+ [`has-custom-font-size`]: fontSize || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize)
352
+ });
353
+ return createElement("div", useBlockProps.save({
354
+ className: wrapperClasses
355
+ }), createElement(RichText.Content, {
356
+ tagName: "a",
357
+ className: buttonClasses,
358
+ href: url,
359
+ title: title,
360
+ style: buttonStyle,
361
+ value: text,
362
+ target: linkTarget,
363
+ rel: rel
364
+ }));
225
365
  },
226
366
 
227
367
  migrate: migrateFontFamily,
228
368
 
229
- isEligible(_ref2) {
230
- var _style$typography2;
369
+ isEligible(_ref3) {
370
+ var _style$typography3;
231
371
 
232
372
  let {
233
373
  style
234
- } = _ref2;
235
- return style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontFamily;
374
+ } = _ref3;
375
+ return style === null || style === void 0 ? void 0 : (_style$typography3 = style.typography) === null || _style$typography3 === void 0 ? void 0 : _style$typography3.fontFamily;
236
376
  }
237
377
 
238
378
  };
239
- const deprecated = [v10, {
379
+ const deprecated = [v11, v10, {
240
380
  supports: {
241
381
  anchor: true,
242
382
  align: true,
@@ -282,22 +422,22 @@ const deprecated = [v10, {
282
422
  }
283
423
  },
284
424
 
285
- isEligible(_ref3) {
286
- var _style$border2;
425
+ isEligible(_ref4) {
426
+ var _style$border3;
287
427
 
288
428
  let {
289
429
  style
290
- } = _ref3;
291
- return typeof (style === null || style === void 0 ? void 0 : (_style$border2 = style.border) === null || _style$border2 === void 0 ? void 0 : _style$border2.radius) === 'number';
430
+ } = _ref4;
431
+ return typeof (style === null || style === void 0 ? void 0 : (_style$border3 = style.border) === null || _style$border3 === void 0 ? void 0 : _style$border3.radius) === 'number';
292
432
  },
293
433
 
294
- save(_ref4) {
295
- var _style$border3, _style$border4, _style$typography3;
434
+ save(_ref5) {
435
+ var _style$border4, _style$border5, _style$typography4;
296
436
 
297
437
  let {
298
438
  attributes,
299
439
  className
300
- } = _ref4;
440
+ } = _ref5;
301
441
  const {
302
442
  fontSize,
303
443
  linkTarget,
@@ -313,10 +453,10 @@ const deprecated = [v10, {
313
453
  return null;
314
454
  }
315
455
 
316
- const borderRadius = style === null || style === void 0 ? void 0 : (_style$border3 = style.border) === null || _style$border3 === void 0 ? void 0 : _style$border3.radius;
456
+ const borderRadius = style === null || style === void 0 ? void 0 : (_style$border4 = style.border) === null || _style$border4 === void 0 ? void 0 : _style$border4.radius;
317
457
  const colorProps = getColorClassesAndStyles(attributes);
318
458
  const buttonClasses = classnames('wp-block-button__link', colorProps.className, {
319
- 'no-border-radius': (style === null || style === void 0 ? void 0 : (_style$border4 = style.border) === null || _style$border4 === void 0 ? void 0 : _style$border4.radius) === 0
459
+ 'no-border-radius': (style === null || style === void 0 ? void 0 : (_style$border5 = style.border) === null || _style$border5 === void 0 ? void 0 : _style$border5.radius) === 0
320
460
  });
321
461
  const buttonStyle = {
322
462
  borderRadius: borderRadius ? borderRadius : undefined,
@@ -327,7 +467,7 @@ const deprecated = [v10, {
327
467
 
328
468
  const wrapperClasses = classnames(className, {
329
469
  [`has-custom-width wp-block-button__width-${width}`]: width,
330
- [`has-custom-font-size`]: fontSize || (style === null || style === void 0 ? void 0 : (_style$typography3 = style.typography) === null || _style$typography3 === void 0 ? void 0 : _style$typography3.fontSize)
470
+ [`has-custom-font-size`]: fontSize || (style === null || style === void 0 ? void 0 : (_style$typography4 = style.typography) === null || _style$typography4 === void 0 ? void 0 : _style$typography4.fontSize)
331
471
  });
332
472
  return createElement("div", useBlockProps.save({
333
473
  className: wrapperClasses
@@ -391,11 +531,11 @@ const deprecated = [v10, {
391
531
  }
392
532
  },
393
533
 
394
- save(_ref5) {
534
+ save(_ref6) {
395
535
  let {
396
536
  attributes,
397
537
  className
398
- } = _ref5;
538
+ } = _ref6;
399
539
  const {
400
540
  borderRadius,
401
541
  linkTarget,
@@ -481,11 +621,11 @@ const deprecated = [v10, {
481
621
  }
482
622
  },
483
623
 
484
- save(_ref6) {
624
+ save(_ref7) {
485
625
  let {
486
626
  attributes,
487
627
  className
488
- } = _ref6;
628
+ } = _ref7;
489
629
  const {
490
630
  borderRadius,
491
631
  linkTarget,
@@ -565,10 +705,10 @@ const deprecated = [v10, {
565
705
  }
566
706
  },
567
707
 
568
- save(_ref7) {
708
+ save(_ref8) {
569
709
  let {
570
710
  attributes
571
- } = _ref7;
711
+ } = _ref8;
572
712
  const {
573
713
  borderRadius,
574
714
  linkTarget,
@@ -642,10 +782,10 @@ const deprecated = [v10, {
642
782
  isEligible: attributes => !!attributes.customTextColor || !!attributes.customBackgroundColor || !!attributes.customGradient,
643
783
  migrate: compose(migrateBorderRadius, migrateCustomColorsAndGradients),
644
784
 
645
- save(_ref8) {
785
+ save(_ref9) {
646
786
  let {
647
787
  attributes
648
- } = _ref8;
788
+ } = _ref9;
649
789
  const {
650
790
  backgroundColor,
651
791
  borderRadius,
@@ -746,10 +886,10 @@ const deprecated = [v10, {
746
886
  }));
747
887
  },
748
888
 
749
- save(_ref9) {
889
+ save(_ref10) {
750
890
  let {
751
891
  attributes
752
- } = _ref9;
892
+ } = _ref10;
753
893
  const {
754
894
  backgroundColor,
755
895
  customBackgroundColor,
@@ -806,10 +946,10 @@ const deprecated = [v10, {
806
946
  },
807
947
  migrate: oldColorsMigration,
808
948
 
809
- save(_ref10) {
949
+ save(_ref11) {
810
950
  let {
811
951
  attributes
812
- } = _ref10;
952
+ } = _ref11;
813
953
  const {
814
954
  url,
815
955
  text,
@@ -855,10 +995,10 @@ const deprecated = [v10, {
855
995
  }
856
996
  },
857
997
 
858
- save(_ref11) {
998
+ save(_ref12) {
859
999
  let {
860
1000
  attributes
861
- } = _ref11;
1001
+ } = _ref12;
862
1002
  const {
863
1003
  url,
864
1004
  text,
@@ -899,10 +1039,10 @@ const deprecated = [v10, {
899
1039
  }
900
1040
  },
901
1041
 
902
- save(_ref12) {
1042
+ save(_ref13) {
903
1043
  let {
904
1044
  attributes
905
- } = _ref12;
1045
+ } = _ref13;
906
1046
  const {
907
1047
  url,
908
1048
  text,