Skip to content

Commit

Permalink
Gutenberg: Download option should not show up for forms.
Browse files Browse the repository at this point in the history
See #13.
  • Loading branch information
r-a-y committed Apr 14, 2020
1 parent 771124b commit dc8336b
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions block.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
sidebarControls,
blockControls,
extraField = '',
downloadField = '',
id, type;

// Link added.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit dc8336b

Please sign in to comment.