Skip to content

Commit ba9149a

Browse files
committed
WIP
1 parent e9799b9 commit ba9149a

38 files changed

+3879
-728
lines changed

components/RichTextEditor.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type RichTextEditorContainerProps = {
2828
withStickyToolbar?: boolean;
2929
/** Version of the editor */
3030
version: 'default' | 'simplified';
31+
/** If true, the image upload button will be displayed - even in simplified mode */
32+
imageUploadEnabled?: boolean;
3133
/** If position is sticky, this prop defines the `top` property. Support responsive arrays */
3234
toolbarTop?: number | string | number[] | string[];
3335
/** Useful to compensate the height of the toolbar when editing inline */
@@ -75,6 +77,7 @@ type RichTextEditorProps = RichTextEditorContainerProps & {
7577
disabled?: boolean;
7678

7779
videoEmbedEnabled?: boolean;
80+
imageUploadEnabled?: boolean;
7881
'data-cy': string;
7982
/** Called when an image is being uploaded to set a boolean */
8083
setUploading?: (uploading: boolean) => void;
@@ -179,9 +182,11 @@ const TrixEditorContainer = styled.div<RichTextEditorContainerProps>`
179182
${props =>
180183
props.version === 'simplified' &&
181184
css({
182-
'.trix-button-group--file-tools': {
183-
display: 'none',
184-
},
185+
...(!props.imageUploadEnabled && {
186+
'.trix-button-group--file-tools': {
187+
display: 'none',
188+
},
189+
}),
185190
'.trix-button-group--block-tools .trix-button:not(.trix-button--icon-number-list):not(.trix-button--icon-bullet-list)':
186191
{
187192
display: 'none',
@@ -548,7 +553,7 @@ export default class RichTextEditor extends React.Component<RichTextEditorProps,
548553
}
549554

550555
return;
551-
} else if (this.props.version === 'simplified') {
556+
} else if (this.props.version === 'simplified' && !this.props.imageUploadEnabled) {
552557
// Don't upload files in simplified mode
553558
attachment.remove();
554559
return;
@@ -698,6 +703,7 @@ export default class RichTextEditor extends React.Component<RichTextEditorProps,
698703
showCount,
699704
maxLength,
700705
editorMaxHeight,
706+
imageUploadEnabled,
701707
} = this.props;
702708

703709
return !this.state.id ? (
@@ -715,6 +721,7 @@ export default class RichTextEditor extends React.Component<RichTextEditorProps,
715721
editorMaxHeight={editorMaxHeight}
716722
withBorders={withBorders}
717723
version={version}
724+
imageUploadEnabled={imageUploadEnabled}
718725
isDisabled={disabled}
719726
error={error}
720727
data-cy={this.props['data-cy']}

components/contribution-flow/ContributionFlowPublicMessage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useMutation } from '@apollo/client';
33
import { themeGet } from '@styled-system/theme-get';
44
import { Field, Form, Formik } from 'formik';
55
import { truncate } from 'lodash';
6-
import { defineMessages, FormattedMessage, injectIntl, useIntl } from 'react-intl';
6+
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
77
import { styled } from 'styled-components';
88

99
import { confettiFireworks } from '../../lib/confettis';
@@ -147,4 +147,4 @@ const ContributionFlowPublicMessage = ({ order, publicMessage }) => {
147147
);
148148
};
149149

150-
export default injectIntl(ContributionFlowPublicMessage);
150+
export default ContributionFlowPublicMessage;

0 commit comments

Comments
 (0)