Version Description
Download this release
Release Info
Developer | automattic |
Plugin | Full Site Editing |
Version | 3.14685 |
Comparing to | |
See all releases |
Code changes from version 3.14565 to 3.14685
- common/disable-heic-images.js +31 -0
- common/dist/disable-heic-images.asset.php +1 -0
- common/dist/disable-heic-images.js +1 -0
- common/index.php +19 -0
- full-site-editing-plugin.php +2 -2
- readme.txt +1 -1
common/disable-heic-images.js
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
2 |
+
import { createElement } from '@wordpress/element';
|
3 |
+
import { addFilter } from '@wordpress/hooks';
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
|
6 |
+
const DisableHEICImages = createHigherOrderComponent( ( MediaPlaceholder ) => {
|
7 |
+
return ( props ) => {
|
8 |
+
props.onFilesPreUpload = ( files ) => {
|
9 |
+
if ( files ) {
|
10 |
+
Object.values( files ).forEach( ( file ) => {
|
11 |
+
const filename = file.name;
|
12 |
+
const extension = filename.split( '.' ).pop()?.toLowerCase();
|
13 |
+
|
14 |
+
if ( 'heic' === extension || 'heif' === extension ) {
|
15 |
+
const error = __(
|
16 |
+
'HEIC images are not viewable in the editor. Please convert to a JPG, PNG, or GIF and try again.',
|
17 |
+
'full-site-editing'
|
18 |
+
);
|
19 |
+
props.onError( error );
|
20 |
+
throw Error( error );
|
21 |
+
}
|
22 |
+
} );
|
23 |
+
return files;
|
24 |
+
}
|
25 |
+
};
|
26 |
+
|
27 |
+
return createElement( MediaPlaceholder, props );
|
28 |
+
};
|
29 |
+
}, 'DisableHEICImages' );
|
30 |
+
|
31 |
+
addFilter( 'editor.MediaPlaceholder', 'wpcom/DisableHEICImages', DisableHEICImages );
|
common/dist/disable-heic-images.asset.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php return array('dependencies' => array('wp-compose', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => 'f10173c9fe6e70088f4b7d31f46494c8');
|
common/dist/disable-heic-images.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(){"use strict";var e={1417:function(e){e.exports=window.wp.compose},3027:function(e){e.exports=window.wp.element},5799:function(e){e.exports=window.wp.hooks},3163:function(e){e.exports=window.wp.i18n}},o={};function n(r){var t=o[r];if(void 0!==t)return t.exports;var i=o[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(o,{a:o}),o},n.d=function(e,o){for(var r in o)n.o(o,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},n.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},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);var e=n(1417),o=n(3027),t=n(5799),i=n(3163),__=i.__,a=(0,e.createHigherOrderComponent)((function(e){return function(n){return n.onFilesPreUpload=function(e){if(e)return Object.values(e).forEach((function(e){var o,r=null===(o=e.name.split(".").pop())||void 0===o?void 0:o.toLowerCase();if("heic"===r||"heif"===r){var t=__("HEIC images are not viewable in the editor. Please convert to a JPG, PNG, or GIF and try again.","full-site-editing");throw n.onError(t),Error(t)}})),e},(0,o.createElement)(e,n)}}),"DisableHEICImages");(0,t.addFilter)("editor.MediaPlaceholder","wpcom/DisableHEICImages",a)}(),window.EditingToolkit=r}();
|
common/index.php
CHANGED
@@ -223,3 +223,22 @@ function enqueue_hide_plugin_buttons_mobile_style() {
|
|
223 |
}
|
224 |
}
|
225 |
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_hide_plugin_buttons_mobile_style' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
}
|
224 |
}
|
225 |
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_hide_plugin_buttons_mobile_style' );
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Prevent HEIC images from being uploaded by drag and drop
|
229 |
+
* See: https://github.com/Automattic/wp-calypso/issues/55102
|
230 |
+
*
|
231 |
+
* Can be disabled with the `a8c_disable_heic_images` filter.
|
232 |
+
*/
|
233 |
+
function enqueue_disable_heic_images_script() {
|
234 |
+
if ( apply_filters( 'a8c_disable_heic_images', true ) ) {
|
235 |
+
wp_enqueue_script(
|
236 |
+
'a8c-disable-heic-images',
|
237 |
+
plugins_url( 'dist/disable-heic-images.js', __FILE__ ),
|
238 |
+
array(),
|
239 |
+
filemtime( plugin_dir_path( __FILE__ ) . 'dist/disable-heic-images.js' ),
|
240 |
+
true
|
241 |
+
);
|
242 |
+
}
|
243 |
+
}
|
244 |
+
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_disable_heic_images_script' );
|
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';
|
2 |
/**
|
3 |
* Plugin Name: WordPress.com Editing Toolkit
|
4 |
* Description: Enhances your page creation workflow within the Block Editor.
|
5 |
+
* Version: 3.14685
|
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.14685' );
|
46 |
|
47 |
// Always include these helper files for dotcom FSE.
|
48 |
require_once __DIR__ . '/dotcom-fse/helpers.php';
|
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.14685
|
7 |
Requires PHP: 5.6.20
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|