learningtribes-studio-frontend 1.4.1 → 1.4.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accessibilityPolicy.min.js +2 -2
- package/dist/assets.min.css +1 -1
- package/dist/assets.min.js +1 -1
- package/dist/assets.min.js.map +1 -1
- package/dist/common.min.css +2 -2
- package/dist/common.min.js +9 -9
- package/dist/common.min.js.map +1 -1
- package/dist/courseHealthCheck.min.js +1 -1
- package/dist/courseOutlineHealthCheck.min.js +1 -1
- package/dist/editImageModal.min.css +1 -1
- package/dist/editImageModal.min.js +1 -1
- package/dist/editImageModal.min.js.map +1 -1
- package/dist/i18n/messages/ar.json +0 -3
- package/dist/i18n/messages/es_419.json +0 -3
- package/dist/i18n/messages/fr.json +0 -3
- package/dist/i18n/messages/zh_CN.json +0 -3
- package/dist/i18nMessages.min.js +1 -1
- package/dist/i18nMessages.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AssetsDropZone/AssetsDropZone.scss +88 -20
- package/src/components/AssetsDropZone/displayMessages.jsx +2 -2
- package/src/components/AssetsDropZone/index.jsx +18 -17
- package/src/components/AssetsList/AssetsList.scss +132 -0
- package/src/components/AssetsList/index.jsx +75 -68
- package/src/components/EditImageModal/EditImageModal.scss +77 -0
- package/src/components/EditImageModal/EditImageModal.test.jsx +9 -160
- package/src/components/EditImageModal/displayMessages.jsx +2 -17
- package/src/components/EditImageModal/index.jsx +37 -81
- package/src/data/i18n/default/transifex_input.json +0 -3
- package/src/data/i18n/locales/ar.json +0 -3
- package/src/data/i18n/locales/es_419.json +0 -3
- package/src/data/i18n/locales/fr.json +0 -3
- package/src/data/i18n/locales/zh_CN.json +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button,
|
|
1
|
+
import { Button, Fieldset, Icon, InputText, Modal, StatusAlert, Variant } from '@edx/paragon';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { connect } from 'react-redux';
|
|
4
4
|
import FontAwesomeStyles from 'font-awesome/css/font-awesome.min.css';
|
|
@@ -16,7 +16,6 @@ import WrappedAssetsDropZone from '../AssetsDropZone/container';
|
|
|
16
16
|
import WrappedAssetsList from '../AssetsList/container';
|
|
17
17
|
import WrappedAssetsSearch from '../AssetsSearch/container';
|
|
18
18
|
import WrappedMessage from '../../utils/i18n/formattedMessageWrapper';
|
|
19
|
-
import WrappedPagination from '../Pagination/container';
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
// Create an AssetsResultsCount that is not aware of the Images filter.
|
|
@@ -51,7 +50,6 @@ const initialEditImageModalState = {
|
|
|
51
50
|
imageDimensions: {},
|
|
52
51
|
imageSource: '',
|
|
53
52
|
imageStyle: '',
|
|
54
|
-
isImageDecorative: false,
|
|
55
53
|
isImageDescriptionValid: true,
|
|
56
54
|
isImageLoaded: false,
|
|
57
55
|
isImageLoading: false,
|
|
@@ -74,7 +72,6 @@ export default class EditImageModal extends React.Component {
|
|
|
74
72
|
this.onImageDescriptionBlur = this.onImageDescriptionBlur.bind(this);
|
|
75
73
|
this.onImageDimensionBlur = this.onImageDimensionBlur.bind(this);
|
|
76
74
|
this.onInsertImageButtonClick = this.onInsertImageButtonClick.bind(this);
|
|
77
|
-
this.onImageIsDecorativeClick = this.onImageIsDecorativeClick.bind(this);
|
|
78
75
|
this.onImageLoad = this.onImageLoad.bind(this);
|
|
79
76
|
this.onNextPageButtonClick = this.onNextPageButtonClick.bind(this);
|
|
80
77
|
this.onPreviousPageButtonClick = this.onPreviousPageButtonClick.bind(this);
|
|
@@ -110,7 +107,8 @@ export default class EditImageModal extends React.Component {
|
|
|
110
107
|
nextProps.clearAssetsStatus();
|
|
111
108
|
newState.currentUploadErrorMessage = null;
|
|
112
109
|
newState.isStatusAlertOpen = false;
|
|
113
|
-
|
|
110
|
+
// Stay on page 1 - the form fields are now shown on the same page
|
|
111
|
+
newState.pageNumber = 1;
|
|
114
112
|
break;
|
|
115
113
|
}
|
|
116
114
|
case assetActions.upload.UPLOAD_EXCEED_MAX_COUNT_ERROR: {
|
|
@@ -166,12 +164,6 @@ export default class EditImageModal extends React.Component {
|
|
|
166
164
|
));
|
|
167
165
|
}
|
|
168
166
|
|
|
169
|
-
onImageIsDecorativeClick = (checked) => {
|
|
170
|
-
this.setState({
|
|
171
|
-
isImageDecorative: checked,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
167
|
onImageLoad = (event) => {
|
|
176
168
|
const img = event.target;
|
|
177
169
|
|
|
@@ -274,14 +266,17 @@ export default class EditImageModal extends React.Component {
|
|
|
274
266
|
});
|
|
275
267
|
|
|
276
268
|
if (isValidFormContent) {
|
|
277
|
-
|
|
269
|
+
// Use the form ref if available, otherwise dispatch from modal wrapper
|
|
270
|
+
const targetElement = this.imageFormRef || this.modalWrapperRef;
|
|
271
|
+
const altText = this.state.imageDescription || '';
|
|
272
|
+
targetElement.dispatchEvent(new CustomEvent('submitForm',
|
|
278
273
|
{
|
|
279
274
|
bubbles: true,
|
|
280
275
|
detail: {
|
|
281
276
|
height: this.getDimensionStateOrNatural('height'),
|
|
282
277
|
width: this.getDimensionStateOrNatural('width'),
|
|
283
278
|
src: this.state.imageSource,
|
|
284
|
-
alt:
|
|
279
|
+
alt: altText,
|
|
285
280
|
style: this.state.imageStyle,
|
|
286
281
|
},
|
|
287
282
|
},
|
|
@@ -293,7 +288,9 @@ export default class EditImageModal extends React.Component {
|
|
|
293
288
|
|
|
294
289
|
this.resetImageSelection();
|
|
295
290
|
} else {
|
|
296
|
-
this.statusAlertRef
|
|
291
|
+
if (this.statusAlertRef) {
|
|
292
|
+
this.statusAlertRef.focus();
|
|
293
|
+
}
|
|
297
294
|
}
|
|
298
295
|
}
|
|
299
296
|
|
|
@@ -384,27 +381,9 @@ export default class EditImageModal extends React.Component {
|
|
|
384
381
|
id={imageDescriptionID}
|
|
385
382
|
type="text"
|
|
386
383
|
value={this.state.imageDescription}
|
|
387
|
-
disabled={this.state.isImageDecorative}
|
|
388
384
|
onBlur={this.onImageDescriptionBlur}
|
|
389
385
|
inputRef={this.setImageDescriptionInputRef}
|
|
390
386
|
/>
|
|
391
|
-
<div className="or-fields">
|
|
392
|
-
<WrappedMessage
|
|
393
|
-
message={messages.editImageModalImageOrFields}
|
|
394
|
-
/>
|
|
395
|
-
</div>
|
|
396
|
-
<CheckBox
|
|
397
|
-
id="isDecorative"
|
|
398
|
-
name="isDecorative"
|
|
399
|
-
label={
|
|
400
|
-
<WrappedMessage
|
|
401
|
-
message={messages.editImageModalImageIsDecorativeCheckboxLabel}
|
|
402
|
-
/>
|
|
403
|
-
}
|
|
404
|
-
description={this.getImageIsDecorativeDescription()}
|
|
405
|
-
checked={this.state.isImageDecorative}
|
|
406
|
-
onChange={this.onImageIsDecorativeClick}
|
|
407
|
-
/>
|
|
408
387
|
</Fieldset>
|
|
409
388
|
);
|
|
410
389
|
|
|
@@ -432,14 +411,6 @@ export default class EditImageModal extends React.Component {
|
|
|
432
411
|
</React.Fragment>
|
|
433
412
|
);
|
|
434
413
|
|
|
435
|
-
getImageIsDecorativeDescription = () => (
|
|
436
|
-
<React.Fragment>
|
|
437
|
-
<WrappedMessage message={messages.editImageModalImageIsDecorativeCheckboxDescription} />
|
|
438
|
-
{' '}
|
|
439
|
-
{this.getLearnMoreLink()}
|
|
440
|
-
</React.Fragment>
|
|
441
|
-
);
|
|
442
|
-
|
|
443
414
|
getImageDimensionsInput = () => (
|
|
444
415
|
<Fieldset
|
|
445
416
|
legend={<WrappedMessage message={messages.editImageModalDimensionsLegend} />}
|
|
@@ -662,7 +633,7 @@ export default class EditImageModal extends React.Component {
|
|
|
662
633
|
{this.getStatusAlert()}
|
|
663
634
|
</div>
|
|
664
635
|
</div>
|
|
665
|
-
<div className="row mb-
|
|
636
|
+
<div className="row mb-3">
|
|
666
637
|
<div className="col">
|
|
667
638
|
<WrappedAssetsDropZone
|
|
668
639
|
maxFileCount={1}
|
|
@@ -673,35 +644,29 @@ export default class EditImageModal extends React.Component {
|
|
|
673
644
|
/>
|
|
674
645
|
</div>
|
|
675
646
|
</div>
|
|
676
|
-
<div className="row no-gutters">
|
|
677
|
-
<div className="col">
|
|
678
|
-
<WrappedMessage message={messages.editImageModalInsertHeader} tagName="h3" />
|
|
679
|
-
</div>
|
|
680
|
-
</div>
|
|
681
|
-
<div className="row">
|
|
682
|
-
<div className="col-6 order-2">
|
|
683
|
-
{(this.state.assetsPageType === pageTypes.NORMAL ||
|
|
684
|
-
this.state.assetsPageType === pageTypes.NO_RESULTS) && (
|
|
685
|
-
<WrappedAssetsSearch />
|
|
686
|
-
)}
|
|
687
|
-
</div>
|
|
688
|
-
<div className="col-6 order-1">
|
|
689
|
-
{this.state.assetsPageType === pageTypes.NORMAL && (
|
|
690
|
-
<div aria-hidden>
|
|
691
|
-
<WrappedAssetsResultsCount />
|
|
692
|
-
</div>
|
|
693
|
-
)}
|
|
694
|
-
</div>
|
|
695
|
-
</div>
|
|
696
647
|
<div className="row">
|
|
697
648
|
<div className="col">
|
|
698
649
|
{this.getImageSelectionModalBodyAssetsList(this.state.assetsPageType)}
|
|
699
650
|
</div>
|
|
700
651
|
</div>
|
|
701
|
-
{this.
|
|
702
|
-
<div className="row mt-3
|
|
652
|
+
{this.isAssetSelected() && (
|
|
653
|
+
<div className="row mt-3">
|
|
703
654
|
<div className="col">
|
|
704
|
-
|
|
655
|
+
{/* Hidden image to load dimensions */}
|
|
656
|
+
{this.state.imageSource && (
|
|
657
|
+
<img
|
|
658
|
+
alt=""
|
|
659
|
+
src={this.getImageAssetSource()}
|
|
660
|
+
onLoad={this.onImageLoad}
|
|
661
|
+
onError={this.onImageError}
|
|
662
|
+
ref={this.setImageRef}
|
|
663
|
+
style={{ display: 'none' }}
|
|
664
|
+
/>
|
|
665
|
+
)}
|
|
666
|
+
<form ref={this.setImageFormRef}>
|
|
667
|
+
{this.getImageDescriptionInput()}
|
|
668
|
+
{this.getImageDimensionsInput()}
|
|
669
|
+
</form>
|
|
705
670
|
</div>
|
|
706
671
|
</div>
|
|
707
672
|
)}
|
|
@@ -731,7 +696,12 @@ export default class EditImageModal extends React.Component {
|
|
|
731
696
|
getModalButtons = () => {
|
|
732
697
|
let buttons;
|
|
733
698
|
if (this.state.pageNumber === 1) {
|
|
734
|
-
|
|
699
|
+
// Show Save button if asset is selected, otherwise show Next button
|
|
700
|
+
if (this.isAssetSelected()) {
|
|
701
|
+
buttons = this.getInsertImageButton();
|
|
702
|
+
} else {
|
|
703
|
+
buttons = this.getNextPageButton();
|
|
704
|
+
}
|
|
735
705
|
} else if (this.state.pageNumber === 2) {
|
|
736
706
|
buttons = this.getInsertImageButton();
|
|
737
707
|
}
|
|
@@ -815,7 +785,6 @@ export default class EditImageModal extends React.Component {
|
|
|
815
785
|
} : {},
|
|
816
786
|
imageSource: eventSource || '',
|
|
817
787
|
imageStyle: event.detail.style || '',
|
|
818
|
-
isImageDecorative: event.detail.alt === '',
|
|
819
788
|
// if existing img had a source, assume it could be loaded and show the image preview
|
|
820
789
|
isImageLoaded: !!eventSource,
|
|
821
790
|
isModalOpen: true,
|
|
@@ -824,25 +793,12 @@ export default class EditImageModal extends React.Component {
|
|
|
824
793
|
}));
|
|
825
794
|
|
|
826
795
|
if (this.props.assetsList.length === 0) {
|
|
827
|
-
this.props.getAssets({ assetTypes: { Images: true }, pageSize:
|
|
796
|
+
this.props.getAssets({ assetTypes: { Images: true }, pageSize: 1000 }, this.props.courseDetails);
|
|
828
797
|
}
|
|
829
798
|
}
|
|
830
799
|
|
|
831
800
|
validateImageDescription = () => {
|
|
832
|
-
|
|
833
|
-
const { imageDescription, isImageDecorative } = this.state;
|
|
834
|
-
|
|
835
|
-
if (!imageDescription && !isImageDecorative) {
|
|
836
|
-
feedback = {
|
|
837
|
-
isValid: false,
|
|
838
|
-
validationMessage:
|
|
839
|
-
(<WrappedMessage
|
|
840
|
-
message={messages.editImageModalFormValidImageDescription}
|
|
841
|
-
/>),
|
|
842
|
-
dangerIconDescription: <WrappedMessage message={messages.editImageModalFormError} />,
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
return feedback;
|
|
801
|
+
return { isValid: true };
|
|
846
802
|
}
|
|
847
803
|
|
|
848
804
|
validateImageDimensions = () => {
|
|
@@ -149,8 +149,6 @@
|
|
|
149
149
|
"editImageModalImageDescriptionLegend": "Image Description",
|
|
150
150
|
"editImageModalDimensionsLegend": "Image Dimensions",
|
|
151
151
|
"editImageModalImageHeight": "Height",
|
|
152
|
-
"editImageModalImageIsDecorativeCheckboxDescription": "This image is a background or other image that does not require alternative text.",
|
|
153
|
-
"editImageModalImageIsDecorativeCheckboxLabel": "This image is decorative only",
|
|
154
152
|
"editImageModalImagePreviewText": "Image Preview",
|
|
155
153
|
"editImageModalInsertImageButton": "Insert Image",
|
|
156
154
|
"editImageModalLearnMore": "Learn more.",
|
|
@@ -159,7 +157,6 @@
|
|
|
159
157
|
"editImageModalInsertTitle": "Add an Image",
|
|
160
158
|
"editImageModalInsertHeader": "Select a previously uploaded image",
|
|
161
159
|
"editImageModalEditTitle": "Edit Image Settings",
|
|
162
|
-
"editImageModalImageOrFields": "or",
|
|
163
160
|
"editImageModalNextPageButton": "Next",
|
|
164
161
|
"editImageModalPreviousPageButton": "Back",
|
|
165
162
|
"editImageModalInvalidFileType": "Files must be images, such as .jpg, .png, and .tiff files. No files were uploaded.",
|
|
@@ -149,8 +149,6 @@
|
|
|
149
149
|
"editImageModalImageDescriptionLegend": "Image Description",
|
|
150
150
|
"editImageModalDimensionsLegend": "Image Dimensions",
|
|
151
151
|
"editImageModalImageHeight": "Height",
|
|
152
|
-
"editImageModalImageIsDecorativeCheckboxDescription": "This image is a background or other image that does not require alternative text.",
|
|
153
|
-
"editImageModalImageIsDecorativeCheckboxLabel": "This image is decorative only",
|
|
154
152
|
"editImageModalImagePreviewText": "Image Preview",
|
|
155
153
|
"editImageModalInsertImageButton": "Insert Image",
|
|
156
154
|
"editImageModalLearnMore": "Learn more.",
|
|
@@ -159,7 +157,6 @@
|
|
|
159
157
|
"editImageModalInsertTitle": "Add an Image",
|
|
160
158
|
"editImageModalInsertHeader": "Select a previously uploaded image",
|
|
161
159
|
"editImageModalEditTitle": "Edit Image Settings",
|
|
162
|
-
"editImageModalImageOrFields": "or",
|
|
163
160
|
"editImageModalNextPageButton": "Next",
|
|
164
161
|
"editImageModalPreviousPageButton": "Back",
|
|
165
162
|
"editImageModalInvalidFileType": "Files must be images, such as .jpg, .png, and .tiff files. No files were uploaded.",
|
|
@@ -149,8 +149,6 @@
|
|
|
149
149
|
"editImageModalImageDescriptionLegend": "Descripción de la imagen",
|
|
150
150
|
"editImageModalDimensionsLegend": "Dimensiones de la imagen",
|
|
151
151
|
"editImageModalImageHeight": "Altura",
|
|
152
|
-
"editImageModalImageIsDecorativeCheckboxDescription": "Esta imagen es un fondo o otra imagen que no necesita un texto alternativo.",
|
|
153
|
-
"editImageModalImageIsDecorativeCheckboxLabel": "Esta es solo una imagen decorativa",
|
|
154
152
|
"editImageModalImagePreviewText": "Previsualización de Imagen",
|
|
155
153
|
"editImageModalInsertImageButton": "Insertar imagen",
|
|
156
154
|
"editImageModalLearnMore": "Saber más.",
|
|
@@ -159,7 +157,6 @@
|
|
|
159
157
|
"editImageModalInsertTitle": "Añadir una imagen",
|
|
160
158
|
"editImageModalInsertHeader": "Seleccionar una imagen subida anteriormente",
|
|
161
159
|
"editImageModalEditTitle": "Editar ajustes de la imagen",
|
|
162
|
-
"editImageModalImageOrFields": "o",
|
|
163
160
|
"editImageModalNextPageButton": "Siguiente",
|
|
164
161
|
"editImageModalPreviousPageButton": "Volver atrás",
|
|
165
162
|
"editImageModalInvalidFileType": "Los archivos deben ser imágenes, formatos como .jpg, .png, y .tiff. Ningún archivo fue subido.",
|
|
@@ -149,8 +149,6 @@
|
|
|
149
149
|
"editImageModalImageDescriptionLegend": "Description de l'Image",
|
|
150
150
|
"editImageModalDimensionsLegend": "Dimensions de l'image",
|
|
151
151
|
"editImageModalImageHeight": "Hauteur",
|
|
152
|
-
"editImageModalImageIsDecorativeCheckboxDescription": "C'est image de fond ou une autre image ne nécessitant pas de texte alternatif.",
|
|
153
|
-
"editImageModalImageIsDecorativeCheckboxLabel": "Cette image est purement décorative",
|
|
154
152
|
"editImageModalImagePreviewText": "Aperçu de l'image",
|
|
155
153
|
"editImageModalInsertImageButton": "Insérer l'image",
|
|
156
154
|
"editImageModalLearnMore": "En savoir plus.",
|
|
@@ -159,7 +157,6 @@
|
|
|
159
157
|
"editImageModalInsertTitle": "Ajouter une image",
|
|
160
158
|
"editImageModalInsertHeader": "Sélectionner une image chargée précédemment",
|
|
161
159
|
"editImageModalEditTitle": "Modifier les paramètres d'images",
|
|
162
|
-
"editImageModalImageOrFields": "ou",
|
|
163
160
|
"editImageModalNextPageButton": "Suivant",
|
|
164
161
|
"editImageModalPreviousPageButton": "Retour",
|
|
165
162
|
"editImageModalInvalidFileType": "Les fichiers doivent être des images, du type .jpg, png, et .tiff. Aucun fichier n'a été chargé.",
|
|
@@ -148,8 +148,6 @@
|
|
|
148
148
|
"editImageModalImageDescriptionLegend": "图片描述",
|
|
149
149
|
"editImageModalDimensionsLegend": "图片长宽比例",
|
|
150
150
|
"editImageModalImageHeight": "高度",
|
|
151
|
-
"editImageModalImageIsDecorativeCheckboxDescription": "此图像是不需要替代文本的背景或其他图像。",
|
|
152
|
-
"editImageModalImageIsDecorativeCheckboxLabel": "此图片仅为装饰",
|
|
153
151
|
"editImageModalImagePreviewText": "图片预览",
|
|
154
152
|
"editImageModalInsertImageButton": "插入图片",
|
|
155
153
|
"editImageModalLearnMore": "了解更多。",
|
|
@@ -158,7 +156,6 @@
|
|
|
158
156
|
"editImageModalInsertTitle": "添加图片",
|
|
159
157
|
"editImageModalInsertHeader": "选择一张之前上传的图片",
|
|
160
158
|
"editImageModalEditTitle": "编辑图片设置",
|
|
161
|
-
"editImageModalImageOrFields": "或者",
|
|
162
159
|
"editImageModalNextPageButton": "下一步",
|
|
163
160
|
"editImageModalPreviousPageButton": "返回",
|
|
164
161
|
"editImageModalInvalidFileType": "文件必须是图片,例如 .jpg,.png 和 .tiff 文件。没有文件被上传。",
|