Version Description
Download this release
Release Info
Developer | ebuccelli |
Plugin | Full Site Editing |
Version | 3.29629 |
Comparing to | |
See all releases |
Code changes from version 3.29613 to 3.29629
- build_meta.txt +3 -3
- full-site-editing-plugin.php +10 -2
- readme.txt +1 -1
- wpcom-block-description-links/README.md +20 -0
- wpcom-block-description-links/class-wpcom-block-description-links.php +70 -0
- wpcom-block-description-links/dist/wpcom-block-description-links.asset.php +1 -0
- wpcom-block-description-links/dist/wpcom-block-description-links.js +1 -0
- wpcom-block-description-links/index.ts +1 -0
- wpcom-block-description-links/src/index.ts +156 -0
- wpcom-block-description-links/src/inline-block-link.tsx +36 -0
- wpcom-documentation-links/dist/wpcom-documentation-links.asset.php +1 -1
- wpcom-documentation-links/dist/wpcom-documentation-links.js +1 -1
- wpcom-documentation-links/src/index.tsx +2 -0
build_meta.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
commit_hash=
|
2 |
-
commit_url=https://github.com/Automattic/wp-calypso/commit/
|
3 |
-
build_number=3.
|
1 |
+
commit_hash=84117c45a23da3115a9dcf6f3e58e6fbea5775d0
|
2 |
+
commit_url=https://github.com/Automattic/wp-calypso/commit/84117c45a23da3115a9dcf6f3e58e6fbea5775d0
|
3 |
+
build_number=3.29629
|
full-site-editing-plugin.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: WordPress.com Editing Toolkit
|
4 |
* Description: Enhances your page creation workflow within the Block Editor.
|
5 |
-
* Version: 3.
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com/wordpress-plugins/
|
8 |
* License: GPLv2 or later
|
@@ -42,7 +42,7 @@ namespace A8C\FSE;
|
|
42 |
*
|
43 |
* @var string
|
44 |
*/
|
45 |
-
define( 'A8C_ETK_PLUGIN_VERSION', '3.
|
46 |
|
47 |
// Always include these helper files for dotcom FSE.
|
48 |
require_once __DIR__ . '/dotcom-fse/helpers.php';
|
@@ -348,3 +348,11 @@ function load_wpcom_documentation_links() {
|
|
348 |
require_once __DIR__ . '/wpcom-documentation-links/class-wpcom-documentation-links.php';
|
349 |
}
|
350 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_wpcom_documentation_links' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
* Plugin Name: WordPress.com Editing Toolkit
|
4 |
* Description: Enhances your page creation workflow within the Block Editor.
|
5 |
+
* Version: 3.29629
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com/wordpress-plugins/
|
8 |
* License: GPLv2 or later
|
42 |
*
|
43 |
* @var string
|
44 |
*/
|
45 |
+
define( 'A8C_ETK_PLUGIN_VERSION', '3.29629' );
|
46 |
|
47 |
// Always include these helper files for dotcom FSE.
|
48 |
require_once __DIR__ . '/dotcom-fse/helpers.php';
|
348 |
require_once __DIR__ . '/wpcom-documentation-links/class-wpcom-documentation-links.php';
|
349 |
}
|
350 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_wpcom_documentation_links' );
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Add support links to block description
|
354 |
+
*/
|
355 |
+
function load_block_description_links() {
|
356 |
+
require_once __DIR__ . '/wpcom-block-description-links/class-wpcom-block-description-links.php';
|
357 |
+
}
|
358 |
+
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_block_description_links' );
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic
|
|
3 |
Tags: block, blocks, editor, gutenberg, page
|
4 |
Requires at least: 5.5
|
5 |
Tested up to: 5.6
|
6 |
-
Stable tag: 3.
|
7 |
Requires PHP: 5.6.20
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
3 |
Tags: block, blocks, editor, gutenberg, page
|
4 |
Requires at least: 5.5
|
5 |
Tested up to: 5.6
|
6 |
+
Stable tag: 3.29629
|
7 |
Requires PHP: 5.6.20
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
wpcom-block-description-links/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Block Description Links
|
2 |
+
|
3 |
+
## Summary
|
4 |
+
|
5 |
+
This adds a "Learn more" link inline with the Block Description.
|
6 |
+
|
7 |
+
## Adding more
|
8 |
+
|
9 |
+
To extend this to more blocks you must add the block name to the switch case found in `./src/index.ts`. The case should set the `settings.description` using the `inlineBlockDescriptionLink` and break, it should not be returned. Please notice they are segregated as Core, Jetpack, and A8C.
|
10 |
+
|
11 |
+
## Example
|
12 |
+
|
13 |
+
```javasctipt
|
14 |
+
case 'core/social-links':
|
15 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
16 |
+
settings[ 'description' ],
|
17 |
+
'https://wordpress.com/support/wordpress-editor/blocks/social-links-block/'
|
18 |
+
);
|
19 |
+
break;
|
20 |
+
```
|
wpcom-block-description-links/class-wpcom-block-description-links.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WPCOM add support link to block descriptions.
|
4 |
+
*
|
5 |
+
* @package A8C\FSE
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace A8C\FSE;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class WPCOM_Block_Description_Links
|
12 |
+
*/
|
13 |
+
class WPCOM_Block_Description_Links {
|
14 |
+
/**
|
15 |
+
* Class instance.
|
16 |
+
*
|
17 |
+
* @var WPCOM_Block_Description_Links
|
18 |
+
*/
|
19 |
+
private static $instance = null;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* WPCOM_Block_Description_Links constructor.
|
23 |
+
*/
|
24 |
+
public function __construct() {
|
25 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_script' ), 100 );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Creates instance.
|
30 |
+
*
|
31 |
+
* @return \A8C\FSE\WPCOM_Block_Description_Links
|
32 |
+
*/
|
33 |
+
public static function init() {
|
34 |
+
if ( is_null( self::$instance ) ) {
|
35 |
+
self::$instance = new self();
|
36 |
+
}
|
37 |
+
return self::$instance;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Enqueue block editor assets.
|
42 |
+
*/
|
43 |
+
public function enqueue_script() {
|
44 |
+
$asset_file = include plugin_dir_path( __FILE__ ) . 'dist/wpcom-block-description-links.asset.php';
|
45 |
+
$script_dependencies = $asset_file['dependencies'];
|
46 |
+
$version = $asset_file['version'];
|
47 |
+
|
48 |
+
wp_enqueue_script(
|
49 |
+
'wpcom-block-description-links-script',
|
50 |
+
plugins_url( 'dist/wpcom-block-description-links.js', __FILE__ ),
|
51 |
+
is_array( $script_dependencies ) ? $script_dependencies : array(),
|
52 |
+
$version,
|
53 |
+
true
|
54 |
+
);
|
55 |
+
|
56 |
+
wp_localize_script(
|
57 |
+
'wpcom-block-description-links-script',
|
58 |
+
'wpcomBlockDescriptionLinksAssetsUrl',
|
59 |
+
plugins_url( 'dist/', __FILE__ )
|
60 |
+
);
|
61 |
+
|
62 |
+
wp_localize_script(
|
63 |
+
'wpcom-block-description-links-script',
|
64 |
+
'wpcomBlockDescriptionLinksLocale',
|
65 |
+
\A8C\FSE\Common\get_iso_639_locale( determine_locale() )
|
66 |
+
);
|
67 |
+
}
|
68 |
+
|
69 |
+
}
|
70 |
+
add_action( 'init', array( __NAMESPACE__ . '\WPCOM_Block_Description_Links', 'init' ) );
|
wpcom-block-description-links/dist/wpcom-block-description-links.asset.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php return array('dependencies' => array('react', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => 'becce98fb96faf488b7584ff9e07a7ef');
|
wpcom-block-description-links/dist/wpcom-block-description-links.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(){"use strict";var o={978:function(o,e,r){var t=r(694),s=r(79);(0,t.addFilter)("blocks.registerBlockType","full-site-editing/add-block-support-link",((o,e)=>{var r;const t=["core/columns","core/social-links","core/buttons","jetpack/contact-form"].includes(null===(r=o.parent)||void 0===r?void 0:r.toString());var c;t&&(e=null===(c=o.parent)||void 0===c?void 0:c.toString());switch(e){case"core/table":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/table-block/");break;case"core/social-links":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/social-links-block/");break;case"core/columns":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/columns-block/");break;case"core/image":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/image-block/");break;case"core/cover":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/cover-block/");break;case"core/buttons":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/buttons-block/");break;case"core/gallery":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/gallery-block/");break;case"premium-content/container":case"premium-content/subscriber-view":case"premium-content/logged-out-view":case"premium-content/buttons":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/premium-content-block/");break;case"a8c/blog-posts":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/blog-posts-block/");break;case"jetpack/tiled-gallery":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/tiled-gallery-block/");break;case"jetpack/slideshow":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/slideshow-block/");break;case"jetpack/subscriptions":o.description=(0,s.a)("Allow readers to receive a newsletter with future posts in their inbox. Subscribers can get notifications through email or the Reader app.","https://wordpress.com/support/wordpress-editor/blocks/subscription-form-block/");break;case"jetpack/contact-form":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/form-block/");break;case"jetpack/layout-grid":case"jetpack/layout-grid-column":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/layout-grid-block/");break;case"jetpack/mailchimp":o.description=(0,s.a)(o.description,"https://wordpress.com/support/wordpress-editor/blocks/mailchimp-block/")}return t&&(e=o.name),o}))},79:function(o,e,r){r.d(e,{a:function(){return a}});var t=r(307),s=r(609),c=r(736),i=r(196),n=r.n(i);const __=c.__,p=o=>{let{url:e}=o;const[r,c]=n().useState();return!r||null!=r&&r.closest(".block-editor-block-inspector")?(0,t.createElement)(s.ExternalLink,{ref:o=>r!==o&&c(o),style:{paddingLeft:5},className:"fse-inline-support-link",href:e},__("Learn more","full-site-editing")," "):null},a=(o,e)=>(0,t.createInterpolateElement)(o+"<BlockDescriptionLink/>",{span:(0,t.createElement)("span",null),BlockDescriptionLink:(0,t.createElement)(p,{url:e})})},196:function(o){o.exports=window.React},609:function(o){o.exports=window.wp.components},307:function(o){o.exports=window.wp.element},694:function(o){o.exports=window.wp.hooks},736:function(o){o.exports=window.wp.i18n}},e={};function r(t){var s=e[t];if(void 0!==s)return s.exports;var c=e[t]={exports:{}};return o[t](c,c.exports,r),c.exports}r.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return r.d(e,{a:e}),e},r.d=function(o,e){for(var t in e)r.o(e,t)&&!r.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:e[t]})},r.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},r.r=function(o){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})};var t={};!function(){r.r(t);r(978)}(),window.EditingToolkit=t}();
|
wpcom-block-description-links/index.ts
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
import './src';
|
wpcom-block-description-links/src/index.ts
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { addFilter } from '@wordpress/hooks';
|
2 |
+
import { ReactElement } from 'react';
|
3 |
+
import { inlineBlockDescriptionLink } from './inline-block-link';
|
4 |
+
|
5 |
+
const addBlockSupportLinks = (
|
6 |
+
settings: {
|
7 |
+
[ key: string ]: string | ReactElement;
|
8 |
+
},
|
9 |
+
name: string
|
10 |
+
) => {
|
11 |
+
/**
|
12 |
+
* Adjust the block name to apply link to InnerBlocks. This gets reset at the end
|
13 |
+
*/
|
14 |
+
const applyToChildren = [
|
15 |
+
'core/columns',
|
16 |
+
'core/social-links',
|
17 |
+
'core/buttons',
|
18 |
+
'jetpack/contact-form',
|
19 |
+
].includes( settings[ 'parent' ]?.toString() );
|
20 |
+
|
21 |
+
if ( applyToChildren ) {
|
22 |
+
name = settings[ 'parent' ]?.toString();
|
23 |
+
}
|
24 |
+
|
25 |
+
switch ( name ) {
|
26 |
+
/**
|
27 |
+
* Core Blocks
|
28 |
+
*/
|
29 |
+
case 'core/table':
|
30 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
31 |
+
settings[ 'description' ],
|
32 |
+
'https://wordpress.com/support/wordpress-editor/blocks/table-block/'
|
33 |
+
);
|
34 |
+
break;
|
35 |
+
|
36 |
+
case 'core/social-links':
|
37 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
38 |
+
settings[ 'description' ],
|
39 |
+
'https://wordpress.com/support/wordpress-editor/blocks/social-links-block/'
|
40 |
+
);
|
41 |
+
break;
|
42 |
+
|
43 |
+
case 'core/columns':
|
44 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
45 |
+
settings[ 'description' ],
|
46 |
+
'https://wordpress.com/support/wordpress-editor/blocks/columns-block/'
|
47 |
+
);
|
48 |
+
break;
|
49 |
+
|
50 |
+
case 'core/image':
|
51 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
52 |
+
settings[ 'description' ],
|
53 |
+
'https://wordpress.com/support/wordpress-editor/blocks/image-block/'
|
54 |
+
);
|
55 |
+
break;
|
56 |
+
|
57 |
+
case 'core/cover':
|
58 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
59 |
+
settings[ 'description' ],
|
60 |
+
'https://wordpress.com/support/wordpress-editor/blocks/cover-block/'
|
61 |
+
);
|
62 |
+
break;
|
63 |
+
|
64 |
+
case 'core/buttons':
|
65 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
66 |
+
settings[ 'description' ],
|
67 |
+
'https://wordpress.com/support/wordpress-editor/blocks/buttons-block/'
|
68 |
+
);
|
69 |
+
break;
|
70 |
+
|
71 |
+
case 'core/gallery':
|
72 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
73 |
+
settings[ 'description' ],
|
74 |
+
'https://wordpress.com/support/wordpress-editor/blocks/gallery-block/'
|
75 |
+
);
|
76 |
+
break;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* A8C Blocks
|
80 |
+
*/
|
81 |
+
case 'premium-content/container':
|
82 |
+
case 'premium-content/subscriber-view':
|
83 |
+
case 'premium-content/logged-out-view':
|
84 |
+
case 'premium-content/buttons':
|
85 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
86 |
+
settings[ 'description' ],
|
87 |
+
'https://wordpress.com/support/wordpress-editor/blocks/premium-content-block/'
|
88 |
+
);
|
89 |
+
break;
|
90 |
+
|
91 |
+
case 'a8c/blog-posts':
|
92 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
93 |
+
settings[ 'description' ],
|
94 |
+
'https://wordpress.com/support/wordpress-editor/blocks/blog-posts-block/'
|
95 |
+
);
|
96 |
+
break;
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Jetpack Blocks
|
100 |
+
*/
|
101 |
+
case 'jetpack/tiled-gallery':
|
102 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
103 |
+
settings[ 'description' ],
|
104 |
+
'https://wordpress.com/support/wordpress-editor/blocks/tiled-gallery-block/'
|
105 |
+
);
|
106 |
+
break;
|
107 |
+
|
108 |
+
case 'jetpack/slideshow':
|
109 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
110 |
+
settings[ 'description' ],
|
111 |
+
'https://wordpress.com/support/wordpress-editor/blocks/slideshow-block/'
|
112 |
+
);
|
113 |
+
break;
|
114 |
+
|
115 |
+
case 'jetpack/subscriptions':
|
116 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
117 |
+
'Allow readers to receive a newsletter with future posts in their inbox. Subscribers can get notifications through email or the Reader app.',
|
118 |
+
'https://wordpress.com/support/wordpress-editor/blocks/subscription-form-block/'
|
119 |
+
);
|
120 |
+
break;
|
121 |
+
|
122 |
+
case 'jetpack/contact-form':
|
123 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
124 |
+
settings[ 'description' ],
|
125 |
+
'https://wordpress.com/support/wordpress-editor/blocks/form-block/'
|
126 |
+
);
|
127 |
+
break;
|
128 |
+
|
129 |
+
case 'jetpack/layout-grid':
|
130 |
+
case 'jetpack/layout-grid-column':
|
131 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
132 |
+
settings[ 'description' ],
|
133 |
+
'https://wordpress.com/support/wordpress-editor/blocks/layout-grid-block/'
|
134 |
+
);
|
135 |
+
break;
|
136 |
+
|
137 |
+
case 'jetpack/mailchimp':
|
138 |
+
settings[ 'description' ] = inlineBlockDescriptionLink(
|
139 |
+
settings[ 'description' ],
|
140 |
+
'https://wordpress.com/support/wordpress-editor/blocks/mailchimp-block/'
|
141 |
+
);
|
142 |
+
break;
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( applyToChildren ) {
|
146 |
+
name = settings[ 'name' ] as string;
|
147 |
+
}
|
148 |
+
|
149 |
+
return settings;
|
150 |
+
};
|
151 |
+
|
152 |
+
addFilter(
|
153 |
+
'blocks.registerBlockType',
|
154 |
+
'full-site-editing/add-block-support-link',
|
155 |
+
addBlockSupportLinks
|
156 |
+
);
|
wpcom-block-description-links/src/inline-block-link.tsx
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { ExternalLink } from '@wordpress/components';
|
2 |
+
import { createInterpolateElement } from '@wordpress/element';
|
3 |
+
import { __ } from '@wordpress/i18n';
|
4 |
+
import React, { ReactElement } from 'react';
|
5 |
+
|
6 |
+
type Props = {
|
7 |
+
url: string;
|
8 |
+
};
|
9 |
+
|
10 |
+
const BlockDescriptionLink = ( { url }: Props ) => {
|
11 |
+
// This was cooked up to only apply the link in the BlockEditor sidebar.
|
12 |
+
// Since there was no identifier in the environment to differentiate.
|
13 |
+
const [ ref, setRef ] = React.useState< any >();
|
14 |
+
|
15 |
+
if ( ref && ! ref?.closest( '.block-editor-block-inspector' ) ) {
|
16 |
+
return null;
|
17 |
+
}
|
18 |
+
|
19 |
+
return (
|
20 |
+
<ExternalLink
|
21 |
+
ref={ ( reference ) => ref !== reference && setRef( reference ) }
|
22 |
+
style={ { paddingLeft: 5 } }
|
23 |
+
className="fse-inline-support-link"
|
24 |
+
href={ url }
|
25 |
+
>
|
26 |
+
{ __( 'Learn more', 'full-site-editing' ) }{ ' ' }
|
27 |
+
</ExternalLink>
|
28 |
+
);
|
29 |
+
};
|
30 |
+
|
31 |
+
export const inlineBlockDescriptionLink = ( description: string | ReactElement, url: string ) => {
|
32 |
+
return createInterpolateElement( description + '<BlockDescriptionLink/>', {
|
33 |
+
span: <span />,
|
34 |
+
BlockDescriptionLink: <BlockDescriptionLink url={ url } />,
|
35 |
+
} );
|
36 |
+
};
|
wpcom-documentation-links/dist/wpcom-documentation-links.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-hooks', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-hooks', 'wp-polyfill'), 'version' => 'e9805d5051d9bfcafe982b411c8dc84f');
|
wpcom-documentation-links/dist/wpcom-documentation-links.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){"use strict";var
|
1 |
+
!function(){"use strict";var r={6:function(r,t,e){var o=e(694);(0,o.addFilter)("i18n.gettext_default","full-site-editing/override-core-docs-to-wpcom",(function(r,t){switch(t){case"https://wordpress.org/support/article/excerpt/":return"https://wordpress.com/support/excerpts/";case"https://wordpress.org/support/article/writing-posts/#post-field-descriptions":return"https://wordpress.com/support/permalinks-and-slugs/";case"https://wordpress.org/support/article/wordpress-editor/":return"https://wordpress.com/support/wordpress-editor/"}return r}))},694:function(r){r.exports=window.wp.hooks}},t={};function e(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return r[o](s,s.exports,e),s.exports}e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,{a:t}),t},e.d=function(r,t){for(var o in t)e.o(t,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:t[o]})},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var o={};!function(){e.r(o);e(6)}(),window.EditingToolkit=o}();
|
wpcom-documentation-links/src/index.tsx
CHANGED
@@ -6,6 +6,8 @@ function overrideCoreDocumentationLinksToWpcom( translation: string, text: strin
|
|
6 |
return 'https://wordpress.com/support/excerpts/';
|
7 |
case 'https://wordpress.org/support/article/writing-posts/#post-field-descriptions':
|
8 |
return 'https://wordpress.com/support/permalinks-and-slugs/';
|
|
|
|
|
9 |
}
|
10 |
|
11 |
return translation;
|
6 |
return 'https://wordpress.com/support/excerpts/';
|
7 |
case 'https://wordpress.org/support/article/writing-posts/#post-field-descriptions':
|
8 |
return 'https://wordpress.com/support/permalinks-and-slugs/';
|
9 |
+
case 'https://wordpress.org/support/article/wordpress-editor/':
|
10 |
+
return 'https://wordpress.com/support/wordpress-editor/';
|
11 |
}
|
12 |
|
13 |
return translation;
|