Skip to content

Commit

Permalink
[Bug fix] : FIlePicker - if Parse content is disabled, the "File type…
Browse files Browse the repository at this point in the history
…" dropdown should be hidden (ToolJet#3622)

* Fixed :When parse content is disabled, the file type dropdown options are not hidden

* Fixed : Even if the Parse content toggled is disabled the file gets parsed.

* updated with the suggested changes

* Fixed : If paseContent configured programatically, it will throw error

* made the requested changes
  • Loading branch information
manishkushare authored Aug 24, 2022
1 parent 9022ef9 commit e82f7fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions frontend/src/Editor/Components/FilePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ export const FilePicker = ({
const fileType = component.definition.properties.fileType?.value ?? 'image/*';
const maxSize = component.definition.properties.maxSize?.value ?? 1048576;
const minSize = component.definition.properties.minSize?.value ?? 0;
const parseContent = component.definition.properties.parseContent?.value ?? false;
const parseContent = resolveWidgetFieldValue(
component.definition.properties.parseContent?.value ?? false,
currentState
);
const fileTypeFromExtension = component.definition.properties.parseFileType?.value ?? 'auto-detect';

const parsedEnableDropzone =
typeof enableDropzone !== 'boolean' ? resolveWidgetFieldValue(enableDropzone, currentState) : true;
const parsedEnablePicker =
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/Editor/Inspector/Components/FilePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Accordion from '@/_ui/Accordion';
import { renderElement } from '../Utils';
import { baseComponentProperties } from './DefaultComponent';
import { resolveReferences } from '@/_helpers/utils';

export const FilePicker = ({ componentMeta, darkMode, ...restProps }) => {
const {
Expand All @@ -19,7 +20,10 @@ export const FilePicker = ({ componentMeta, darkMode, ...restProps }) => {
return renderElement(component, componentMeta, paramUpdated, dataQueries, param, paramType, currentState);
};
const conditionalAccordionItems = (component) => {
const parseContent = component.component.definition.properties.parseContent?.value ?? false;
const parseContent = resolveReferences(
component.component.definition.properties.parseContent?.value ?? false,
currentState
);
const accordionItems = [];
const options = ['parseContent'];

Expand Down

0 comments on commit e82f7fa

Please sign in to comment.