From dc8336bd6e301079c7e310d9580bc87593d19dd1 Mon Sep 17 00:00:00 2001 From: r-a-y Date: Mon, 13 Apr 2020 23:43:42 -0700 Subject: [PATCH] Gutenberg: Download option should not show up for forms. See #13. --- block.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/block.js b/block.js index 43dce90..623e160 100644 --- a/block.js +++ b/block.js @@ -325,6 +325,7 @@ sidebarControls, blockControls, extraField = '', + downloadField = '', id, type; // Link added. @@ -381,6 +382,19 @@ } + if ( 'form' !== type ) { + downloadField = el( wp.components.CheckboxControl, { + label: i18n.__( 'Add Download Link?' ), + className: 'components-panel__body is-opened gdrive-sidebar-item', + checked: isTrue( attr.downloadlink ) ? true : false, + onChange: function( newVal ) { + props.setAttributes({ + downloadlink: true === newVal ? 1 : 0 + }); + }, + } ); + } + // Sidebar controls. sidebarControls = el( wp.blockEditor.InspectorControls, { key: 'gdrive-controls-' + id }, // Dimensions. @@ -416,16 +430,7 @@ ) ), extraField, - el( wp.components.CheckboxControl, { - label: i18n.__( 'Add Download Link?' ), - className: 'components-panel__body is-opened gdrive-sidebar-item', - checked: isTrue( attr.downloadlink ) ? true : false, - onChange: function( newVal ) { - props.setAttributes({ - downloadlink: true === newVal ? 1 : 0 - }); - }, - } ) + downloadField ); // Block controls.