Full Site Editing - Version 3.10808

Version Description

Download this release

Release Info

Developer andrewserong
Plugin Icon wp plugin Full Site Editing
Version 3.10808
Comparing to
See all releases

Code changes from version 3.10777 to 3.10808

block-patterns/class-block-patterns-modifications.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
- /**
3
- * WPCOM block patterns modifications.
4
- *
5
- * Enqueues JS modifications to how block patterns behave within the editor.
6
- *
7
- * @package A8C\FSE
8
- */
9
-
10
- namespace A8C\FSE;
11
-
12
- /**
13
- * Class Block_Patterns_Modifications
14
- */
15
- class Block_Patterns_Modifications {
16
- /**
17
- * Class instance.
18
- *
19
- * @var Block_Patterns_Modifications
20
- */
21
- private static $instance = null;
22
-
23
- /**
24
- * Block_Patterns_Modifications constructor.
25
- */
26
- public function __construct() {
27
- add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_script_and_style' ), 100 );
28
- }
29
-
30
- /**
31
- * Creates instance.
32
- *
33
- * @return \A8C\FSE\Block_Patterns_Modifications
34
- */
35
- public static function init() {
36
- if ( is_null( self::$instance ) ) {
37
- self::$instance = new self();
38
- }
39
- return self::$instance;
40
- }
41
-
42
- /**
43
- * Enqueue block editor assets.
44
- */
45
- public function enqueue_script_and_style() {
46
- $asset_file = include plugin_dir_path( __FILE__ ) . 'dist/block-patterns.asset.php';
47
- $script_dependencies = $asset_file['dependencies'];
48
- $version = $asset_file['version'];
49
-
50
- wp_enqueue_script(
51
- 'wpcom-block-patterns-modifications',
52
- plugins_url( 'dist/block-patterns.js', __FILE__ ),
53
- is_array( $script_dependencies ) ? $script_dependencies : array(),
54
- $version,
55
- true
56
- );
57
-
58
- wp_set_script_translations( 'wpcom-block-patterns-modifications', 'full-site-editing' );
59
-
60
- $style_path = 'dist/block-patterns' . ( is_rtl() ? '.rtl' : '' ) . '.css';
61
- wp_enqueue_style(
62
- 'wpcom-block-patterns-modifications',
63
- plugins_url( $style_path, __FILE__ ),
64
- array(),
65
- filemtime( plugin_dir_path( __FILE__ ) . $style_path )
66
- );
67
- }
68
- }
69
- add_action( 'init', array( __NAMESPACE__ . '\Block_Patterns_Modifications', 'init' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
block-patterns/dist/block-patterns.asset.php DELETED
@@ -1 +0,0 @@
1
- <?php return array('dependencies' => array('react', 'wp-data', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-polyfill'), 'version' => '3e5f6c0909258e8291b1b6c7055e3f4e');
 
block-patterns/dist/block-patterns.css DELETED
@@ -1 +0,0 @@
1
- .pattern-title-container{position:absolute;left:0;top:0;width:100%;height:100%}.premium-pattern-title:after{content:"";background:var(--color-accent);height:6px;width:6px;border-radius:50%;display:inline-block;position:relative;vertical-align:text-top}
 
block-patterns/dist/block-patterns.js DELETED
@@ -1 +0,0 @@
1
- !function(){"use strict";var e={119:function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,{Z:function(){return r}})},394:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(119);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},901:function(){},192:function(e,t,n){var r,o,i=n(394),c=n(27),u=(n(804),n(707)),l=n(163),a=n(200),__=(n(901),l.__),f=function(e){var t=e.title;return(0,c.createElement)("div",null,(0,c.createElement)("div",{className:"pattern-title-container"}),(0,c.createElement)("span",{className:"premium-pattern-title"}," ",t," "))},p=function(){var e=(0,u.useSelect)((function(e){return e("core/block-editor").getSettings()})).__experimentalBlockPatterns,t=(0,u.useDispatch)("core/block-editor").updateSettings;if(e){var n=!1,r=[];e.forEach((function(e){var t=(0,i.Z)({},e);if(t.isPremium&&"string"==typeof t.title){var o=t.title,u=(0,c.createElement)(f,{title:o});Object.isExtensible(u)&&(t.title=u,t.title.toString=function(){return(0,l.sprintf)(__("%s (Premium)","full-site-editing"),o)},n=!0)}r.push(t)})),n&&t({__experimentalBlockPatterns:r})}return null};r="a8c-wpcom-premium-block-patterns",o={render:function(){return(0,c.createElement)(p,null)}},(0,a.registerPlugin)(r,o)},804:function(e){e.exports=window.React},707:function(e){e.exports=window.wp.data},27:function(e){e.exports=window.wp.element},163:function(e){e.exports=window.wp.i18n},200:function(e){e.exports=window.wp.plugins}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};!function(){n.r(r);n(192)}(),window.EditingToolkit=r}();
 
block-patterns/dist/block-patterns.rtl.css DELETED
@@ -1 +0,0 @@
1
- .pattern-title-container{position:absolute;right:0;top:0;width:100%;height:100%}.premium-pattern-title:after{content:"";background:var(--color-accent);height:6px;width:6px;border-radius:50%;display:inline-block;position:relative;vertical-align:text-top}
 
block-patterns/src/premium-block-patterns.tsx DELETED
@@ -1,104 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React, { ReactNode } from 'react';
5
- import { useDispatch, useSelect } from '@wordpress/data';
6
- import { __, sprintf } from '@wordpress/i18n';
7
- import { registerPlugin as originalRegisterPlugin, PluginSettings } from '@wordpress/plugins';
8
- import type { EditorSettings } from '@wordpress/block-editor';
9
-
10
- /**
11
- * Internal dependencies
12
- */
13
- import './style.scss';
14
-
15
- interface PatternTitleProps {
16
- title: string;
17
- description?: string;
18
- }
19
-
20
- interface ExperimentalEditorSettings extends EditorSettings {
21
- __experimentalBlockPatterns: ExperimentalBlockPattern[];
22
- }
23
-
24
- interface ExperimentalBlockPattern {
25
- categories: string[];
26
- content: string;
27
- description: string;
28
- isPremium: boolean;
29
- name: string;
30
- title: ReactNode;
31
- viewportWidth: number;
32
- }
33
-
34
- export const PatternTitleContainer: React.FunctionComponent< PatternTitleProps > = ( {
35
- title,
36
- } ) => {
37
- return (
38
- <div>
39
- <div className="pattern-title-container"></div>
40
- <span className="premium-pattern-title"> { title } </span>
41
- </div>
42
- );
43
- };
44
-
45
- export const PremiumBlockPatterns: React.FunctionComponent = () => {
46
- const { __experimentalBlockPatterns } = useSelect( ( select ) =>
47
- select( 'core/block-editor' ).getSettings()
48
- ) as ExperimentalEditorSettings;
49
- const {
50
- updateSettings,
51
- }: { updateSettings: ( settings: Partial< ExperimentalEditorSettings > ) => void } = useDispatch(
52
- 'core/block-editor'
53
- );
54
-
55
- if ( __experimentalBlockPatterns ) {
56
- let shouldUpdateBlockPatterns = false;
57
- const updatedPatterns: ExperimentalBlockPattern[] = [];
58
-
59
- __experimentalBlockPatterns.forEach( ( originalPattern: ExperimentalBlockPattern ) => {
60
- const pattern = { ...originalPattern };
61
-
62
- if ( pattern.isPremium && typeof pattern.title === 'string' ) {
63
- const originalTitle = pattern.title;
64
-
65
- const titleOverride = <PatternTitleContainer title={ originalTitle } />;
66
-
67
- // When React is running in development mode, ReactElement calls Object.freeze() on the element.
68
- // To prevent the editor from throwing a fatal, we should only attempt to run the override
69
- // when the React element is extensible so we can use the custom toString method. This means that
70
- // in React development mode (define SCRIPT_DEBUG as true in PHP) this feature is switched off.
71
- // See: https://github.com/facebook/react/blob/702fad4b1b48ac8f626ed3f35e8f86f5ea728084/packages/react/src/jsx/ReactJSXElement.js#L194
72
- if ( Object.isExtensible( titleOverride ) ) {
73
- pattern.title = titleOverride;
74
- pattern.title.toString = () =>
75
- sprintf(
76
- // translators: %s is the title of a block pattern e.g. "Two columns (Premium)". "Premium" is synonymous with "paid"
77
- __( '%s (Premium)', 'full-site-editing' ),
78
- originalTitle
79
- );
80
- shouldUpdateBlockPatterns = true;
81
- }
82
- }
83
- updatedPatterns.push( pattern );
84
- } );
85
-
86
- if ( shouldUpdateBlockPatterns ) {
87
- updateSettings( {
88
- __experimentalBlockPatterns: updatedPatterns,
89
- } );
90
- }
91
- }
92
-
93
- return null;
94
- };
95
-
96
- const registerPlugin = ( name: string, settings: Omit< PluginSettings, 'icon' > ) =>
97
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
- originalRegisterPlugin( name, settings as any );
99
-
100
- registerPlugin( 'a8c-wpcom-premium-block-patterns', {
101
- render: () => {
102
- return <PremiumBlockPatterns />;
103
- },
104
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
block-patterns/src/style.scss DELETED
@@ -1,19 +0,0 @@
1
- .pattern-title-container {
2
- position: absolute;
3
- left: 0;
4
- top: 0;
5
- width: 100%;
6
- height: 100%;
7
- }
8
-
9
- // The pink dot
10
- .premium-pattern-title::after {
11
- content: '';
12
- background: var( --color-accent );
13
- height: 6px;
14
- width: 6px;
15
- border-radius: 50%;
16
- display: inline-block;
17
- position: relative;
18
- vertical-align: text-top;
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.10777
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.10777' );
46
 
47
  // Always include these helper files for dotcom FSE.
48
  require_once __DIR__ . '/dotcom-fse/helpers.php';
@@ -268,23 +268,6 @@ function load_block_patterns_from_api( $current_screen ) {
268
  }
269
  add_action( 'current_screen', __NAMESPACE__ . '\load_block_patterns_from_api' );
270
 
271
- /**
272
- * Load WPCOM Block Patterns Modifications.
273
- *
274
- * This is responsible for modifying how block patterns behave in the editor,
275
- * including adding support for premium block patterns. The patterns themselves
276
- * are loaded via load_block_patterns_from_api.
277
- */
278
- function load_wpcom_block_patterns_modifications() {
279
- // Disable the premium patterns feature temporarily due to performance issues (#50069).
280
- // phpcs:disable
281
- // if ( apply_filters( 'a8c_enable_block_patterns_modifications', false ) ) {
282
- // require_once __DIR__ . '/block-patterns/class-block-patterns-modifications.php';
283
- // }
284
- // phpcs:enable
285
- }
286
- add_action( 'plugins_loaded', __NAMESPACE__ . '\load_wpcom_block_patterns_modifications' );
287
-
288
  /**
289
  * Load Block Inserter Modifications module.
290
  */
2
  /**
3
  * Plugin Name: WordPress.com Editing Toolkit
4
  * Description: Enhances your page creation workflow within the Block Editor.
5
+ * Version: 3.10808
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.10808' );
46
 
47
  // Always include these helper files for dotcom FSE.
48
  require_once __DIR__ . '/dotcom-fse/helpers.php';
268
  }
269
  add_action( 'current_screen', __NAMESPACE__ . '\load_block_patterns_from_api' );
270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  /**
272
  * Load Block Inserter Modifications module.
273
  */
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.10777
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.10808
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html