-
diff --git src/bp-activity/bp-activity-blocks.php src/bp-activity/bp-activity-blocks.php
index 655362a92..116badd6a 100644
|
|
|
11 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
12 | 12 | exit; |
13 | 13 | } |
14 | | |
15 | | /** |
16 | | * Add BP Activity blocks specific settings to the BP Blocks Editor ones. |
17 | | * |
18 | | * @since 7.0.0 |
19 | | * |
20 | | * @param array $bp_editor_settings BP blocks editor settings. |
21 | | * @return array BP Activity blocks editor settings. |
22 | | */ |
23 | | function bp_activity_editor_settings( $bp_editor_settings = array() ) { |
24 | | return array_merge( |
25 | | $bp_editor_settings, |
26 | | array( |
27 | | 'activity' => array( |
28 | | 'embedScriptURL' => includes_url( 'js/wp-embed.min.js' ), |
29 | | ), |
30 | | ) |
31 | | ); |
32 | | } |
33 | | add_filter( 'bp_blocks_editor_settings', 'bp_activity_editor_settings' ); |
-
diff --git src/bp-activity/classes/class-bp-activity-component.php src/bp-activity/classes/class-bp-activity-component.php
index d44879fd3..398550378 100644
|
|
class BP_Activity_Component extends BP_Component { |
497 | 497 | 'wp-block-editor', |
498 | 498 | 'wp-data', |
499 | 499 | 'wp-compose', |
| 500 | 'bp-block-data', |
500 | 501 | ), |
501 | 502 | ), |
502 | 503 | ) |
-
diff --git src/bp-activity/js/blocks/embed-activity.js src/bp-activity/js/blocks/embed-activity.js
index 520118032..5f481a7a1 100644
|
|
var _wp = wp, |
232 | 232 | _wp$blockEditor = _wp.blockEditor, |
233 | 233 | RichText = _wp$blockEditor.RichText, |
234 | 234 | BlockControls = _wp$blockEditor.BlockControls; |
| 235 | /** |
| 236 | * BuddyPress dependencies. |
| 237 | */ |
| 238 | |
| 239 | var _bp = bp, |
| 240 | embedScriptURL = _bp.blockData.embedScriptURL; |
235 | 241 | |
236 | 242 | var EditEmbedActivity = function EditEmbedActivity(_ref) { |
237 | 243 | var attributes = _ref.attributes, |
238 | 244 | setAttributes = _ref.setAttributes, |
239 | 245 | isSelected = _ref.isSelected, |
240 | | bpSettings = _ref.bpSettings, |
241 | 246 | preview = _ref.preview, |
242 | 247 | fetching = _ref.fetching; |
243 | 248 | var url = attributes.url, |
244 | 249 | caption = attributes.caption; |
245 | | var embedScriptURL = bpSettings.embedScriptURL; |
246 | 250 | |
247 | 251 | var label = __('BuddyPress Activity URL', 'buddypress'); |
248 | 252 | |
… |
… |
var EditEmbedActivity = function EditEmbedActivity(_ref) { |
345 | 349 | |
346 | 350 | var editEmbedActivityBlock = compose([withSelect(function (select, ownProps) { |
347 | 351 | var url = ownProps.attributes.url; |
348 | | var editorSettings = select('core/editor').getEditorSettings(); |
349 | 352 | |
350 | 353 | var _select = select('core'), |
351 | 354 | getEmbedPreview = _select.getEmbedPreview, |
… |
… |
var editEmbedActivityBlock = compose([withSelect(function (select, ownProps) { |
354 | 357 | var preview = !!url && getEmbedPreview(url); |
355 | 358 | var fetching = !!url && isRequestingEmbedPreview(url); |
356 | 359 | return { |
357 | | bpSettings: editorSettings.bp.activity || {}, |
358 | 360 | preview: preview, |
359 | 361 | fetching: fetching |
360 | 362 | }; |
… |
… |
var _wp = wp, |
421 | 423 | registerBlockType('bp/embed-activity', { |
422 | 424 | title: __('Embed an activity', 'buddypress'), |
423 | 425 | description: __('Add a block that displays the activity content pulled from this or other community sites.', 'buddypress'), |
424 | | icon: 'buddicons-activity', |
| 426 | icon: { |
| 427 | background: '#fff', |
| 428 | foreground: '#d84800', |
| 429 | src: 'buddicons-activity' |
| 430 | }, |
425 | 431 | category: 'buddypress', |
426 | 432 | attributes: { |
427 | 433 | url: { |
-
diff --git src/bp-groups/bp-groups-blocks.php src/bp-groups/bp-groups-blocks.php
index 063868ee5..c3c08fb39 100644
|
|
if ( ! defined( 'ABSPATH' ) ) { |
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
15 | | /** |
16 | | * Add BP Groups blocks specific settings to the BP Blocks Editor ones. |
17 | | * |
18 | | * @since 6.0.0 |
19 | | * |
20 | | * @param array $bp_editor_settings BP blocks editor settings. |
21 | | * @return array BP Groups blocks editor settings. |
22 | | */ |
23 | | function bp_groups_editor_settings( $bp_editor_settings = array() ) { |
24 | | $bp = buddypress(); |
25 | | |
26 | | return array_merge( |
27 | | $bp_editor_settings, |
28 | | array( |
29 | | 'groups' => array( |
30 | | 'isAvatarEnabled' => $bp->avatar && $bp->avatar->show_avatars && ! bp_disable_group_avatar_uploads(), |
31 | | 'isCoverImageEnabled' => bp_is_active( 'groups', 'cover_image' ), |
32 | | ), |
33 | | ) |
34 | | ); |
35 | | } |
36 | | add_filter( 'bp_blocks_editor_settings', 'bp_groups_editor_settings' ); |
37 | | |
38 | 15 | /** |
39 | 16 | * Callback function to render the BP Group Block. |
40 | 17 | * |
… |
… |
function bp_groups_render_groups_block( $attributes = array() ) { |
264 | 241 | $output .= sprintf( |
265 | 242 | '<div class="item-header-avatar"> |
266 | 243 | <a href="%1$s"> |
267 | | <img class="avatar" alt="%2$s" src="%3$s" /> |
| 244 | <img loading="lazy" src="%2$s" alt="%3$s" class="avatar"> |
268 | 245 | </a> |
269 | 246 | </div>', |
270 | 247 | esc_url( $group_link ), |
271 | 248 | /* Translators: %s is the group's name. */ |
272 | | sprintf( esc_attr__( 'Group Profile photo of %s', 'buddypress' ), $group->display_name ), |
| 249 | sprintf( esc_attr__( 'Group Profile photo of %s', 'buddypress' ), esc_html( $group->name ) ), |
273 | 250 | esc_url( |
274 | 251 | bp_core_fetch_avatar( |
275 | 252 | array( |
-
diff --git src/bp-groups/classes/class-bp-groups-component.php src/bp-groups/classes/class-bp-groups-component.php
index d15a7cb58..d40a5c7b7 100644
|
|
class BP_Groups_Component extends BP_Component { |
978 | 978 | 'wp-element', |
979 | 979 | 'wp-components', |
980 | 980 | 'wp-i18n', |
981 | | 'wp-editor', |
982 | | 'wp-compose', |
983 | | 'wp-data', |
984 | 981 | 'wp-block-editor', |
985 | 982 | 'bp-block-components', |
| 983 | 'bp-block-data', |
986 | 984 | ), |
987 | 985 | 'style' => 'bp-group-block', |
988 | 986 | 'style_url' => plugins_url( 'css/blocks/group.css', dirname( __FILE__ ) ), |
… |
… |
class BP_Groups_Component extends BP_Component { |
1019 | 1017 | 'wp-element', |
1020 | 1018 | 'wp-components', |
1021 | 1019 | 'wp-i18n', |
1022 | | 'wp-compose', |
1023 | | 'wp-data', |
1024 | 1020 | 'wp-api-fetch', |
1025 | 1021 | 'wp-url', |
1026 | 1022 | 'wp-block-editor', |
1027 | 1023 | 'bp-block-components', |
| 1024 | 'bp-block-data', |
1028 | 1025 | 'lodash', |
1029 | 1026 | ), |
1030 | 1027 | 'style' => 'bp-groups-block', |
-
diff --git src/bp-groups/js/blocks/group.js src/bp-groups/js/blocks/group.js
index 2ab5dac6d..0e3c7aafe 100644
|
|
var _wp = wp, |
184 | 184 | ToggleControl = _wp$components.ToggleControl, |
185 | 185 | Toolbar = _wp$components.Toolbar, |
186 | 186 | ToolbarButton = _wp$components.ToolbarButton, |
187 | | compose = _wp.compose.compose, |
188 | | withSelect = _wp.data.withSelect, |
189 | | ServerSideRender = _wp.editor.ServerSideRender, |
190 | 187 | _wp$element = _wp.element, |
191 | 188 | Fragment = _wp$element.Fragment, |
192 | 189 | createElement = _wp$element.createElement, |
… |
… |
var _wp = wp, |
195 | 192 | * BuddyPress dependencies. |
196 | 193 | */ |
197 | 194 | |
198 | | var AutoCompleter = bp.blockComponents.AutoCompleter; |
| 195 | var _bp = bp, |
| 196 | _bp$blockComponents = _bp.blockComponents, |
| 197 | AutoCompleter = _bp$blockComponents.AutoCompleter, |
| 198 | ServerSideRender = _bp$blockComponents.ServerSideRender, |
| 199 | isActive = _bp.blockData.isActive; |
199 | 200 | /** |
200 | 201 | * Internal dependencies. |
201 | 202 | */ |
… |
… |
var getSlugValue = function getSlugValue(item) { |
208 | 209 | return null; |
209 | 210 | }; |
210 | 211 | |
211 | | var editGroup = function editGroup(_ref) { |
| 212 | var editGroupBlock = function editGroupBlock(_ref) { |
212 | 213 | var attributes = _ref.attributes, |
213 | | setAttributes = _ref.setAttributes, |
214 | | bpSettings = _ref.bpSettings; |
215 | | var isAvatarEnabled = bpSettings.isAvatarEnabled, |
216 | | isCoverImageEnabled = bpSettings.isCoverImageEnabled; |
| 214 | setAttributes = _ref.setAttributes; |
| 215 | var isAvatarEnabled = isActive('groups', 'avatar'); |
| 216 | var isCoverImageEnabled = isActive('groups', 'cover'); |
217 | 217 | var avatarSize = attributes.avatarSize, |
218 | 218 | displayDescription = attributes.displayDescription, |
219 | 219 | displayActionButton = attributes.displayActionButton, |
… |
… |
var editGroup = function editGroup(_ref) { |
237 | 237 | })); |
238 | 238 | } |
239 | 239 | |
240 | | return createElement(Fragment, null, createElement(BlockControls, null, createElement(Toolbar, null, createElement(ToolbarButton, { |
| 240 | return createElement(Fragment, null, createElement(BlockControls, null, createElement(Toolbar, { |
| 241 | label: __('Block toolbar', 'buddypress') |
| 242 | }, createElement(ToolbarButton, { |
241 | 243 | icon: "edit", |
242 | 244 | title: __('Select another group', 'buddypress'), |
243 | 245 | onClick: function onClick() { |
… |
… |
var editGroup = function editGroup(_ref) { |
291 | 293 | }))); |
292 | 294 | }; |
293 | 295 | |
294 | | var editGroupBlock = compose([withSelect(function (select) { |
295 | | var editorSettings = select('core/editor').getEditorSettings(); |
296 | | return { |
297 | | bpSettings: editorSettings.bp.groups || {} |
298 | | }; |
299 | | })])(editGroup); |
300 | 296 | var _default = editGroupBlock; |
301 | 297 | exports.default = _default; |
302 | 298 | },{"./constants":"atl5"}],"pvse":[function(require,module,exports) { |
… |
… |
var _wp = wp, |
319 | 315 | registerBlockType('bp/group', { |
320 | 316 | title: __('Group', 'buddypress'), |
321 | 317 | description: __('BuddyPress Group.', 'buddypress'), |
322 | | icon: 'buddicons-groups', |
| 318 | icon: { |
| 319 | background: '#fff', |
| 320 | foreground: '#d84800', |
| 321 | src: 'buddicons-groups' |
| 322 | }, |
323 | 323 | category: 'buddypress', |
324 | 324 | attributes: { |
325 | 325 | itemID: { |
-
diff --git src/bp-groups/js/blocks/groups.js src/bp-groups/js/blocks/groups.js
index 6c119771c..30ac54b00 100644
|
|
var _wp = wp, |
326 | 326 | Tooltip = _wp$components.Tooltip, |
327 | 327 | ToolbarGroup = _wp$components.ToolbarGroup, |
328 | 328 | RangeControl = _wp$components.RangeControl, |
329 | | compose = _wp.compose.compose, |
330 | | withSelect = _wp.data.withSelect, |
331 | 329 | _wp$element = _wp.element, |
332 | 330 | createElement = _wp$element.createElement, |
333 | 331 | Fragment = _wp$element.Fragment, |
… |
… |
var _wp = wp, |
342 | 340 | * BuddyPress dependencies. |
343 | 341 | */ |
344 | 342 | |
345 | | var AutoCompleter = bp.blockComponents.AutoCompleter; |
| 343 | var _bp = bp, |
| 344 | AutoCompleter = _bp.blockComponents.AutoCompleter, |
| 345 | isActive = _bp.blockData.isActive; |
346 | 346 | /** |
347 | 347 | * Internal dependencies. |
348 | 348 | */ |
… |
… |
var getSlugValue = function getSlugValue(item) { |
363 | 363 | return null; |
364 | 364 | }; |
365 | 365 | |
366 | | var editGroups = function editGroups(_ref) { |
| 366 | var editGroupsBlock = function editGroupsBlock(_ref) { |
367 | 367 | var attributes = _ref.attributes, |
368 | 368 | setAttributes = _ref.setAttributes, |
369 | | isSelected = _ref.isSelected, |
370 | | bpSettings = _ref.bpSettings; |
371 | | var isAvatarEnabled = bpSettings.isAvatarEnabled; |
| 369 | isSelected = _ref.isSelected; |
| 370 | var isAvatarEnabled = isActive('groups', 'avatar'); |
372 | 371 | var itemIDs = attributes.itemIDs, |
373 | 372 | avatarSize = attributes.avatarSize, |
374 | 373 | displayGroupName = attributes.displayGroupName, |
… |
… |
var editGroups = function editGroups(_ref) { |
565 | 564 | }))); |
566 | 565 | }; |
567 | 566 | |
568 | | var editGroupsBlock = compose([withSelect(function (select) { |
569 | | var editorSettings = select('core/editor').getEditorSettings(); |
570 | | return { |
571 | | bpSettings: editorSettings.bp.groups || {} |
572 | | }; |
573 | | })])(editGroups); |
574 | 567 | var _default = editGroupsBlock; |
575 | 568 | exports.default = _default; |
576 | 569 | },{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"xkYc","./constants":"jS06"}],"jcTh":[function(require,module,exports) { |
… |
… |
var _wp = wp, |
593 | 586 | registerBlockType('bp/groups', { |
594 | 587 | title: __('Groups', 'buddypress'), |
595 | 588 | description: __('BuddyPress Groups.', 'buddypress'), |
596 | | icon: 'buddicons-groups', |
| 589 | icon: { |
| 590 | background: '#fff', |
| 591 | foreground: '#d84800', |
| 592 | src: 'buddicons-groups' |
| 593 | }, |
597 | 594 | category: 'buddypress', |
598 | 595 | attributes: { |
599 | 596 | itemIDs: { |
-
diff --git src/bp-members/bp-members-blocks.php src/bp-members/bp-members-blocks.php
index 11886548b..50b49bc55 100644
|
|
if ( ! defined( 'ABSPATH' ) ) { |
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
15 | | /** |
16 | | * Add BP Members blocks specific settings to the BP Blocks Editor ones. |
17 | | * |
18 | | * @since 6.0.0 |
19 | | * |
20 | | * @param array $bp_editor_settings BP blocks editor settings. |
21 | | * @return array BP Members blocks editor settings. |
22 | | */ |
23 | | function bp_members_editor_settings( $bp_editor_settings = array() ) { |
24 | | $bp = buddypress(); |
25 | | |
26 | | return array_merge( |
27 | | $bp_editor_settings, |
28 | | array( |
29 | | 'members' => array( |
30 | | 'isMentionEnabled' => bp_is_active( 'activity' ) && bp_activity_do_mentions(), |
31 | | 'isAvatarEnabled' => $bp->avatar && $bp->avatar->show_avatars, |
32 | | 'isCoverImageEnabled' => bp_is_active( 'members', 'cover_image' ), |
33 | | ), |
34 | | ) |
35 | | ); |
36 | | } |
37 | | add_filter( 'bp_blocks_editor_settings', 'bp_members_editor_settings' ); |
38 | | |
39 | 15 | /** |
40 | 16 | * Callback function to render the BP Member Block. |
41 | 17 | * |
… |
… |
function bp_members_render_members_block( $attributes = array() ) { |
260 | 236 | $output .= sprintf( |
261 | 237 | '<div class="item-header-avatar"> |
262 | 238 | <a href="%1$s"> |
263 | | <img class="avatar" alt="%2$s" src="%3$s" /> |
| 239 | <img loading="lazy" class="avatar" alt="%2$s" src="%3$s" /> |
264 | 240 | </a> |
265 | 241 | </div>', |
266 | 242 | esc_url( $member_link ), |
-
diff --git src/bp-members/classes/class-bp-members-component.php src/bp-members/classes/class-bp-members-component.php
index 312a0ceca..280485e33 100644
|
|
class BP_Members_Component extends BP_Component { |
737 | 737 | 'wp-element', |
738 | 738 | 'wp-components', |
739 | 739 | 'wp-i18n', |
740 | | 'wp-editor', |
741 | | 'wp-compose', |
742 | | 'wp-data', |
743 | 740 | 'wp-block-editor', |
744 | 741 | 'bp-block-components', |
| 742 | 'bp-block-data', |
745 | 743 | ), |
746 | 744 | 'style' => 'bp-member-block', |
747 | 745 | 'style_url' => plugins_url( 'css/blocks/member.css', dirname( __FILE__ ) ), |
… |
… |
class BP_Members_Component extends BP_Component { |
778 | 776 | 'wp-element', |
779 | 777 | 'wp-components', |
780 | 778 | 'wp-i18n', |
781 | | 'wp-compose', |
782 | | 'wp-data', |
783 | 779 | 'wp-api-fetch', |
784 | 780 | 'wp-url', |
785 | 781 | 'wp-block-editor', |
786 | 782 | 'bp-block-components', |
| 783 | 'bp-block-data', |
787 | 784 | 'lodash', |
788 | 785 | ), |
789 | 786 | 'style' => 'bp-members-block', |
-
diff --git src/bp-members/js/blocks/member.js src/bp-members/js/blocks/member.js
index fa606072d..2e3648a9e 100644
|
|
var _wp = wp, |
172 | 172 | ToggleControl = _wp$components.ToggleControl, |
173 | 173 | Toolbar = _wp$components.Toolbar, |
174 | 174 | ToolbarButton = _wp$components.ToolbarButton, |
175 | | compose = _wp.compose.compose, |
176 | | withSelect = _wp.data.withSelect, |
177 | | ServerSideRender = _wp.editor.ServerSideRender, |
178 | 175 | _wp$element = _wp.element, |
179 | 176 | Fragment = _wp$element.Fragment, |
180 | 177 | createElement = _wp$element.createElement, |
… |
… |
var _wp = wp, |
183 | 180 | * BuddyPress dependencies. |
184 | 181 | */ |
185 | 182 | |
186 | | var AutoCompleter = bp.blockComponents.AutoCompleter; |
| 183 | var _bp = bp, |
| 184 | _bp$blockComponents = _bp.blockComponents, |
| 185 | AutoCompleter = _bp$blockComponents.AutoCompleter, |
| 186 | ServerSideRender = _bp$blockComponents.ServerSideRender, |
| 187 | isActive = _bp.blockData.isActive; |
187 | 188 | /** |
188 | 189 | * Internal dependencies. |
189 | 190 | */ |
… |
… |
var getSlugValue = function getSlugValue(item) { |
196 | 197 | return null; |
197 | 198 | }; |
198 | 199 | |
199 | | var editMember = function editMember(_ref) { |
| 200 | var editMemberBlock = function editMemberBlock(_ref) { |
200 | 201 | var attributes = _ref.attributes, |
201 | | setAttributes = _ref.setAttributes, |
202 | | bpSettings = _ref.bpSettings; |
203 | | var isAvatarEnabled = bpSettings.isAvatarEnabled, |
204 | | isMentionEnabled = bpSettings.isMentionEnabled, |
205 | | isCoverImageEnabled = bpSettings.isCoverImageEnabled; |
| 202 | setAttributes = _ref.setAttributes; |
| 203 | var isAvatarEnabled = isActive('members', 'avatar'); |
| 204 | var isMentionEnabled = isActive('activity', 'mentions'); |
| 205 | var isCoverImageEnabled = isActive('members', 'cover'); |
206 | 206 | var avatarSize = attributes.avatarSize, |
207 | 207 | displayMentionSlug = attributes.displayMentionSlug, |
208 | 208 | displayActionButton = attributes.displayActionButton, |
… |
… |
var editMember = function editMember(_ref) { |
223 | 223 | })); |
224 | 224 | } |
225 | 225 | |
226 | | return createElement(Fragment, null, createElement(BlockControls, null, createElement(Toolbar, null, createElement(ToolbarButton, { |
| 226 | return createElement(Fragment, null, createElement(BlockControls, null, createElement(Toolbar, { |
| 227 | label: __('Block toolbar', 'buddypress') |
| 228 | }, createElement(ToolbarButton, { |
227 | 229 | icon: "edit", |
228 | 230 | title: __('Select another member', 'buddypress'), |
229 | 231 | onClick: function onClick() { |
… |
… |
var editMember = function editMember(_ref) { |
277 | 279 | }))); |
278 | 280 | }; |
279 | 281 | |
280 | | var editMemberBlock = compose([withSelect(function (select) { |
281 | | var editorSettings = select('core/editor').getEditorSettings(); |
282 | | return { |
283 | | bpSettings: editorSettings.bp.members || {} |
284 | | }; |
285 | | })])(editMember); |
286 | 282 | var _default = editMemberBlock; |
287 | 283 | exports.default = _default; |
288 | 284 | },{"./constants":"AE3e"}],"TmUL":[function(require,module,exports) { |
… |
… |
var _wp = wp, |
305 | 301 | registerBlockType('bp/member', { |
306 | 302 | title: __('Member', 'buddypress'), |
307 | 303 | description: __('BuddyPress Member.', 'buddypress'), |
308 | | icon: 'admin-users', |
| 304 | icon: { |
| 305 | background: '#fff', |
| 306 | foreground: '#d84800', |
| 307 | src: 'admin-users' |
| 308 | }, |
309 | 309 | category: 'buddypress', |
310 | 310 | attributes: { |
311 | 311 | itemID: { |
-
diff --git src/bp-members/js/blocks/members.js src/bp-members/js/blocks/members.js
index 51995673a..61f8c6b9e 100644
|
|
var _wp = wp, |
311 | 311 | Tooltip = _wp$components.Tooltip, |
312 | 312 | ToolbarGroup = _wp$components.ToolbarGroup, |
313 | 313 | RangeControl = _wp$components.RangeControl, |
314 | | compose = _wp.compose.compose, |
315 | | withSelect = _wp.data.withSelect, |
316 | 314 | _wp$element = _wp.element, |
317 | 315 | createElement = _wp$element.createElement, |
318 | 316 | Fragment = _wp$element.Fragment, |
… |
… |
var _wp = wp, |
326 | 324 | * BuddyPress dependencies. |
327 | 325 | */ |
328 | 326 | |
329 | | var AutoCompleter = bp.blockComponents.AutoCompleter; |
| 327 | var _bp = bp, |
| 328 | AutoCompleter = _bp.blockComponents.AutoCompleter, |
| 329 | isActive = _bp.blockData.isActive; |
330 | 330 | /** |
331 | 331 | * Internal dependencies. |
332 | 332 | */ |
… |
… |
var getSlugValue = function getSlugValue(item) { |
347 | 347 | return null; |
348 | 348 | }; |
349 | 349 | |
350 | | var editMembers = function editMembers(_ref) { |
| 350 | var editMembersBlock = function editMembersBlock(_ref) { |
351 | 351 | var attributes = _ref.attributes, |
352 | 352 | setAttributes = _ref.setAttributes, |
353 | | isSelected = _ref.isSelected, |
354 | | bpSettings = _ref.bpSettings; |
355 | | var isAvatarEnabled = bpSettings.isAvatarEnabled, |
356 | | isMentionEnabled = bpSettings.isMentionEnabled; |
| 353 | isSelected = _ref.isSelected; |
| 354 | var isAvatarEnabled = isActive('members', 'avatar'); |
| 355 | var isMentionEnabled = isActive('activity', 'mentions'); |
357 | 356 | var itemIDs = attributes.itemIDs, |
358 | 357 | avatarSize = attributes.avatarSize, |
359 | 358 | displayMentionSlug = attributes.displayMentionSlug, |
… |
… |
var editMembers = function editMembers(_ref) { |
561 | 560 | }))); |
562 | 561 | }; |
563 | 562 | |
564 | | var editMembersBlock = compose([withSelect(function (select) { |
565 | | var editorSettings = select('core/editor').getEditorSettings(); |
566 | | return { |
567 | | bpSettings: editorSettings.bp.members || {} |
568 | | }; |
569 | | })])(editMembers); |
570 | 563 | var _default = editMembersBlock; |
571 | 564 | exports.default = _default; |
572 | 565 | },{"@babel/runtime/helpers/toConsumableArray":"I9dH","@babel/runtime/helpers/slicedToArray":"xkYc","./constants":"gr8I"}],"XEHU":[function(require,module,exports) { |
… |
… |
var _wp = wp, |
589 | 582 | registerBlockType('bp/members', { |
590 | 583 | title: __('Members', 'buddypress'), |
591 | 584 | description: __('BuddyPress Members.', 'buddypress'), |
592 | | icon: 'groups', |
| 585 | icon: { |
| 586 | background: '#fff', |
| 587 | foreground: '#d84800', |
| 588 | src: 'groups' |
| 589 | }, |
593 | 590 | category: 'buddypress', |
594 | 591 | attributes: { |
595 | 592 | itemIDs: { |
-
diff --git src/js/bp-activity/js/blocks/embed-activity.js src/js/bp-activity/js/blocks/embed-activity.js
index 22a57eeaa..c690550e7 100644
|
|
import saveEmbedActivityBlock from './embed-activity/save'; |
19 | 19 | registerBlockType( 'bp/embed-activity', { |
20 | 20 | title: __( 'Embed an activity', 'buddypress' ), |
21 | 21 | description: __( 'Add a block that displays the activity content pulled from this or other community sites.', 'buddypress' ), |
22 | | icon: 'buddicons-activity', |
| 22 | icon: { |
| 23 | background: '#fff', |
| 24 | foreground: '#d84800', |
| 25 | src: 'buddicons-activity', |
| 26 | }, |
23 | 27 | category: 'buddypress', |
24 | 28 | attributes: { |
25 | 29 | url: { |
-
diff --git src/js/bp-activity/js/blocks/embed-activity/edit.js src/js/bp-activity/js/blocks/embed-activity/edit.js
index 50c225b61..125fac0b9 100644
|
|
const { |
32 | 32 | } |
33 | 33 | } = wp; |
34 | 34 | |
| 35 | /** |
| 36 | * BuddyPress dependencies. |
| 37 | */ |
| 38 | const { |
| 39 | blockData: { |
| 40 | embedScriptURL, |
| 41 | } |
| 42 | } = bp; |
| 43 | |
35 | 44 | const EditEmbedActivity = ( { |
36 | 45 | attributes, |
37 | 46 | setAttributes, |
38 | 47 | isSelected, |
39 | | bpSettings, |
40 | 48 | preview, |
41 | 49 | fetching |
42 | 50 | } ) => { |
43 | 51 | const { url, caption } = attributes; |
44 | | const { embedScriptURL } = bpSettings; |
45 | 52 | const label = __( 'BuddyPress Activity URL', 'buddypress' ); |
46 | 53 | const [ value, setURL ] = useState( url ); |
47 | 54 | const [ isEditingURL, setIsEditingURL ] = useState( ! url ); |
… |
… |
const EditEmbedActivity = ( { |
163 | 170 | const editEmbedActivityBlock = compose( [ |
164 | 171 | withSelect( ( select, ownProps ) => { |
165 | 172 | const { url } = ownProps.attributes; |
166 | | const editorSettings = select( 'core/editor' ).getEditorSettings(); |
167 | 173 | const { |
168 | 174 | getEmbedPreview, |
169 | 175 | isRequestingEmbedPreview, |
… |
… |
const editEmbedActivityBlock = compose( [ |
173 | 179 | const fetching = !! url && isRequestingEmbedPreview( url ); |
174 | 180 | |
175 | 181 | return { |
176 | | bpSettings: editorSettings.bp.activity || {}, |
177 | 182 | preview: preview, |
178 | 183 | fetching: fetching, |
179 | 184 | }; |
-
diff --git src/js/bp-activity/js/blocks/embed-activity/save.js src/js/bp-activity/js/blocks/embed-activity/save.js
index 2b4c59e14..cf7ae8317 100644
|
|
const saveEmbedActivityBlock = ( { attributes } ) => { |
18 | 18 | } |
19 | 19 | |
20 | 20 | return ( |
21 | | <figure className="wp-block-embed is-type-bp-activity"> |
22 | | <div className="wp-block-embed__wrapper"> |
23 | | { |
24 | | `\n${ url }\n` /* URL needs to be on its own line. */ |
25 | | } |
26 | | </div> |
27 | | { ! RichText.isEmpty( caption ) && ( |
28 | | <RichText.Content |
29 | | tagName="figcaption" |
30 | | value={ caption } |
31 | | /> |
32 | | ) } |
33 | | </figure> |
| 21 | <figure className="wp-block-embed is-type-bp-activity"> |
| 22 | <div className="wp-block-embed__wrapper"> |
| 23 | { |
| 24 | `\n${ url }\n` /* URL needs to be on its own line. */ |
| 25 | } |
| 26 | </div> |
| 27 | { ! RichText.isEmpty( caption ) && ( |
| 28 | <RichText.Content |
| 29 | tagName="figcaption" |
| 30 | value={ caption } |
| 31 | /> |
| 32 | ) } |
| 33 | </figure> |
34 | 34 | ); |
35 | 35 | }; |
36 | 36 | |
-
diff --git src/js/bp-groups/js/blocks/group.js src/js/bp-groups/js/blocks/group.js
index f8cb17edb..c6e0c1404 100644
|
|
import editGroupBlock from './group/edit'; |
18 | 18 | registerBlockType( 'bp/group', { |
19 | 19 | title: __( 'Group', 'buddypress' ), |
20 | 20 | description: __( 'BuddyPress Group.', 'buddypress' ), |
21 | | icon: 'buddicons-groups', |
| 21 | icon: { |
| 22 | background: '#fff', |
| 23 | foreground: '#d84800', |
| 24 | src: 'buddicons-groups', |
| 25 | }, |
22 | 26 | category: 'buddypress', |
23 | 27 | attributes: { |
24 | 28 | itemID: { |
-
diff --git src/js/bp-groups/js/blocks/group/edit.js src/js/bp-groups/js/blocks/group/edit.js
index 8418fb488..0f44b18b2 100644
|
|
const { |
15 | 15 | Toolbar, |
16 | 16 | ToolbarButton, |
17 | 17 | }, |
18 | | compose: { |
19 | | compose, |
20 | | }, |
21 | | data: { |
22 | | withSelect, |
23 | | }, |
24 | | editor: { |
25 | | ServerSideRender, |
26 | | }, |
27 | 18 | element: { |
28 | 19 | Fragment, |
29 | 20 | createElement, |
… |
… |
const { |
36 | 27 | /** |
37 | 28 | * BuddyPress dependencies. |
38 | 29 | */ |
39 | | const { AutoCompleter } = bp.blockComponents; |
| 30 | const { |
| 31 | blockComponents: { |
| 32 | AutoCompleter, |
| 33 | ServerSideRender, |
| 34 | }, |
| 35 | blockData: { |
| 36 | isActive, |
| 37 | } |
| 38 | } = bp; |
40 | 39 | |
41 | 40 | /** |
42 | 41 | * Internal dependencies. |
… |
… |
const getSlugValue = ( item ) => { |
51 | 50 | return null; |
52 | 51 | } |
53 | 52 | |
54 | | const editGroup = ( { attributes, setAttributes, bpSettings } ) => { |
55 | | const { isAvatarEnabled, isCoverImageEnabled } = bpSettings; |
| 53 | const editGroupBlock = ( { attributes, setAttributes } ) => { |
| 54 | const isAvatarEnabled = isActive( 'groups', 'avatar' ); |
| 55 | const isCoverImageEnabled = isActive( 'groups', 'cover' ); |
56 | 56 | const { avatarSize, displayDescription, displayActionButton, displayCoverImage } = attributes; |
57 | 57 | |
58 | 58 | if ( ! attributes.itemID ) { |
… |
… |
const editGroup = ( { attributes, setAttributes, bpSettings } ) => { |
78 | 78 | return ( |
79 | 79 | <Fragment> |
80 | 80 | <BlockControls> |
81 | | <Toolbar> |
| 81 | <Toolbar label={ __( 'Block toolbar', 'buddypress' ) }> |
82 | 82 | <ToolbarButton |
83 | 83 | icon="edit" |
84 | 84 | title={ __( 'Select another group', 'buddypress' ) } |
… |
… |
const editGroup = ( { attributes, setAttributes, bpSettings } ) => { |
151 | 151 | ); |
152 | 152 | }; |
153 | 153 | |
154 | | const editGroupBlock = compose( [ |
155 | | withSelect( ( select ) => { |
156 | | const editorSettings = select( 'core/editor' ).getEditorSettings(); |
157 | | return { |
158 | | bpSettings: editorSettings.bp.groups || {}, |
159 | | }; |
160 | | } ), |
161 | | ] )( editGroup ); |
162 | | |
163 | 154 | export default editGroupBlock; |
-
diff --git src/js/bp-groups/js/blocks/groups.js src/js/bp-groups/js/blocks/groups.js
index 78008d746..9102e5daa 100644
|
|
import editGroupsBlock from './groups/edit'; |
18 | 18 | registerBlockType( 'bp/groups', { |
19 | 19 | title: __( 'Groups', 'buddypress' ), |
20 | 20 | description: __( 'BuddyPress Groups.', 'buddypress' ), |
21 | | icon: 'buddicons-groups', |
| 21 | icon: { |
| 22 | background: '#fff', |
| 23 | foreground: '#d84800', |
| 24 | src: 'buddicons-groups', |
| 25 | }, |
22 | 26 | category: 'buddypress', |
23 | 27 | attributes: { |
24 | 28 | itemIDs: { |
-
diff --git src/js/bp-groups/js/blocks/groups/edit.js src/js/bp-groups/js/blocks/groups/edit.js
index 3a32fbd48..27abf0351 100644
|
|
const { |
17 | 17 | ToolbarGroup, |
18 | 18 | RangeControl, |
19 | 19 | }, |
20 | | compose: { |
21 | | compose, |
22 | | }, |
23 | | data: { |
24 | | withSelect, |
25 | | }, |
26 | 20 | element: { |
27 | 21 | createElement, |
28 | 22 | Fragment, |
… |
… |
const { |
42 | 36 | /** |
43 | 37 | * BuddyPress dependencies. |
44 | 38 | */ |
45 | | const { AutoCompleter } = bp.blockComponents; |
| 39 | const { |
| 40 | blockComponents: { |
| 41 | AutoCompleter, |
| 42 | }, |
| 43 | blockData: { |
| 44 | isActive, |
| 45 | } |
| 46 | } = bp; |
46 | 47 | |
47 | 48 | /** |
48 | 49 | * Internal dependencies. |
… |
… |
const getSlugValue = ( item ) => { |
66 | 67 | return null; |
67 | 68 | } |
68 | 69 | |
69 | | const editGroups = ( { attributes, setAttributes, isSelected, bpSettings } ) => { |
70 | | const { |
71 | | isAvatarEnabled, |
72 | | } = bpSettings; |
| 70 | const editGroupsBlock = ( { attributes, setAttributes, isSelected } ) => { |
| 71 | const isAvatarEnabled = isActive( 'groups', 'avatar' ); |
73 | 72 | const { |
74 | 73 | itemIDs, |
75 | 74 | avatarSize, |
… |
… |
const editGroups = ( { attributes, setAttributes, isSelected, bpSettings } ) => |
294 | 293 | ); |
295 | 294 | }; |
296 | 295 | |
297 | | const editGroupsBlock = compose( [ |
298 | | withSelect( ( select ) => { |
299 | | const editorSettings = select( 'core/editor' ).getEditorSettings(); |
300 | | |
301 | | return { |
302 | | bpSettings: editorSettings.bp.groups || {}, |
303 | | }; |
304 | | } ), |
305 | | ] )( editGroups ); |
306 | | |
307 | 296 | export default editGroupsBlock; |
-
diff --git src/js/bp-members/js/blocks/member.js src/js/bp-members/js/blocks/member.js
index 744066afe..f762e956e 100644
|
|
import editMemberBlock from './member/edit'; |
18 | 18 | registerBlockType( 'bp/member', { |
19 | 19 | title: __( 'Member', 'buddypress' ), |
20 | 20 | description: __( 'BuddyPress Member.', 'buddypress' ), |
21 | | icon: 'admin-users', |
| 21 | icon: { |
| 22 | background: '#fff', |
| 23 | foreground: '#d84800', |
| 24 | src: 'admin-users', |
| 25 | }, |
22 | 26 | category: 'buddypress', |
23 | 27 | attributes: { |
24 | 28 | itemID: { |
-
diff --git src/js/bp-members/js/blocks/member/edit.js src/js/bp-members/js/blocks/member/edit.js
index fd92ae979..fbafdb359 100644
|
|
const { |
15 | 15 | Toolbar, |
16 | 16 | ToolbarButton, |
17 | 17 | }, |
18 | | compose: { |
19 | | compose, |
20 | | }, |
21 | | data: { |
22 | | withSelect, |
23 | | }, |
24 | | editor: { |
25 | | ServerSideRender, |
26 | | }, |
27 | 18 | element: { |
28 | 19 | Fragment, |
29 | 20 | createElement, |
… |
… |
const { |
36 | 27 | /** |
37 | 28 | * BuddyPress dependencies. |
38 | 29 | */ |
39 | | const { AutoCompleter } = bp.blockComponents; |
| 30 | const { |
| 31 | blockComponents: { |
| 32 | AutoCompleter, |
| 33 | ServerSideRender, |
| 34 | }, |
| 35 | blockData: { |
| 36 | isActive, |
| 37 | } |
| 38 | } = bp; |
40 | 39 | |
41 | 40 | /** |
42 | 41 | * Internal dependencies. |
… |
… |
const getSlugValue = ( item ) => { |
51 | 50 | return null; |
52 | 51 | } |
53 | 52 | |
54 | | const editMember = ( { attributes, setAttributes, bpSettings } ) => { |
55 | | const { isAvatarEnabled, isMentionEnabled, isCoverImageEnabled } = bpSettings; |
| 53 | const editMemberBlock = ( { attributes, setAttributes } ) => { |
| 54 | const isAvatarEnabled = isActive( 'members', 'avatar' ); |
| 55 | const isMentionEnabled = isActive( 'activity', 'mentions' ); |
| 56 | const isCoverImageEnabled = isActive( 'members', 'cover' ); |
56 | 57 | const { avatarSize, displayMentionSlug, displayActionButton, displayCoverImage } = attributes; |
57 | 58 | |
58 | 59 | if ( ! attributes.itemID ) { |
… |
… |
const editMember = ( { attributes, setAttributes, bpSettings } ) => { |
77 | 78 | return ( |
78 | 79 | <Fragment> |
79 | 80 | <BlockControls> |
80 | | <Toolbar> |
| 81 | <Toolbar label={ __( 'Block toolbar', 'buddypress' ) }> |
81 | 82 | <ToolbarButton |
82 | 83 | icon="edit" |
83 | 84 | title={ __( 'Select another member', 'buddypress' ) } |
… |
… |
const editMember = ( { attributes, setAttributes, bpSettings } ) => { |
152 | 153 | ); |
153 | 154 | }; |
154 | 155 | |
155 | | const editMemberBlock = compose( [ |
156 | | withSelect( ( select ) => { |
157 | | const editorSettings = select( 'core/editor' ).getEditorSettings(); |
158 | | return { |
159 | | bpSettings: editorSettings.bp.members || {}, |
160 | | }; |
161 | | } ), |
162 | | ] )( editMember ); |
163 | | |
164 | 156 | export default editMemberBlock; |
-
diff --git src/js/bp-members/js/blocks/members.js src/js/bp-members/js/blocks/members.js
index 09461b043..5c1a21db5 100644
|
|
import editMembersBlock from './members/edit'; |
18 | 18 | registerBlockType( 'bp/members', { |
19 | 19 | title: __( 'Members', 'buddypress' ), |
20 | 20 | description: __( 'BuddyPress Members.', 'buddypress' ), |
21 | | icon: 'groups', |
| 21 | icon: { |
| 22 | background: '#fff', |
| 23 | foreground: '#d84800', |
| 24 | src: 'groups', |
| 25 | }, |
22 | 26 | category: 'buddypress', |
23 | 27 | attributes: { |
24 | 28 | itemIDs: { |
-
diff --git src/js/bp-members/js/blocks/members/edit.js src/js/bp-members/js/blocks/members/edit.js
index ee48cd6d1..329d9f62b 100644
|
|
const { |
17 | 17 | ToolbarGroup, |
18 | 18 | RangeControl, |
19 | 19 | }, |
20 | | compose: { |
21 | | compose, |
22 | | }, |
23 | | data: { |
24 | | withSelect, |
25 | | }, |
26 | 20 | element: { |
27 | 21 | createElement, |
28 | 22 | Fragment, |
… |
… |
const { |
41 | 35 | /** |
42 | 36 | * BuddyPress dependencies. |
43 | 37 | */ |
44 | | const { AutoCompleter } = bp.blockComponents; |
| 38 | const { |
| 39 | blockComponents: { |
| 40 | AutoCompleter, |
| 41 | }, |
| 42 | blockData: { |
| 43 | isActive, |
| 44 | } |
| 45 | } = bp; |
45 | 46 | |
46 | 47 | /** |
47 | 48 | * Internal dependencies. |
… |
… |
const getSlugValue = ( item ) => { |
65 | 66 | return null; |
66 | 67 | } |
67 | 68 | |
68 | | const editMembers = ( { attributes, setAttributes, isSelected, bpSettings } ) => { |
69 | | const { |
70 | | isAvatarEnabled, |
71 | | isMentionEnabled, |
72 | | } = bpSettings; |
| 69 | const editMembersBlock = ( { attributes, setAttributes, isSelected } ) => { |
| 70 | const isAvatarEnabled = isActive( 'members', 'avatar' ); |
| 71 | const isMentionEnabled = isActive( 'activity', 'mentions' ); |
73 | 72 | const { |
74 | 73 | itemIDs, |
75 | 74 | avatarSize, |
… |
… |
const editMembers = ( { attributes, setAttributes, isSelected, bpSettings } ) => |
313 | 312 | ); |
314 | 313 | }; |
315 | 314 | |
316 | | const editMembersBlock = compose( [ |
317 | | withSelect( ( select ) => { |
318 | | const editorSettings = select( 'core/editor' ).getEditorSettings(); |
319 | | |
320 | | return { |
321 | | bpSettings: editorSettings.bp.members || {}, |
322 | | }; |
323 | | } ), |
324 | | ] )( editMembers ); |
325 | | |
326 | 315 | export default editMembersBlock; |