oolib 2.188.0 → 2.188.2
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/components/ImageInput/comps/ImageEditor/index.d.ts +2 -1
- package/dist/components/ImageInput/comps/ImageEditor/index.js +33 -12
- package/dist/components/ImageInput/comps/SingleImageInput/index.js +2 -2
- package/dist/components/ImageInput/index.d.ts +2 -1
- package/dist/components/ImageInput/index.js +2 -2
- package/dist/v2/components/TextInputs/derivedComps/URLInput.d.ts +2 -1
- package/dist/v2/components/TextInputs/derivedComps/URLInput.js +15 -10
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* fiddle for dealing with rotation: https://jsfiddle.net/wunderbart/w1hw5kv1/
|
|
3
3
|
*/
|
|
4
|
-
export function ImageEditor({ id, readOnly, value: imageData, defaultImageSpread, handleSingleImageDataChange, handleDeleteSingleImage, handleReplaceSingleImage, aspectRatio, invert, handleUpload, setImageUnderEdit, disableImageBorder, stretchToFullHeight, containerShape, omitEditorTools, enableCaptions, underEditImageData: _underEditImageData, setUnderEditImageData: _setUnderEditImageData, isInPopUp, isInRTE, handleDragStart }: {
|
|
4
|
+
export function ImageEditor({ id, readOnly, value: imageData, defaultImageSpread, handleSingleImageDataChange, handleDeleteSingleImage, handleReplaceSingleImage, aspectRatio, invert, handleUpload, setImageUnderEdit, disableImageBorder, stretchToFullHeight, containerShape, omitEditorTools, enableCaptions, imageTags, underEditImageData: _underEditImageData, setUnderEditImageData: _setUnderEditImageData, isInPopUp, isInRTE, handleDragStart }: {
|
|
5
5
|
id: any;
|
|
6
6
|
readOnly: any;
|
|
7
7
|
value: any;
|
|
@@ -18,6 +18,7 @@ export function ImageEditor({ id, readOnly, value: imageData, defaultImageSpread
|
|
|
18
18
|
containerShape: any;
|
|
19
19
|
omitEditorTools: any;
|
|
20
20
|
enableCaptions: any;
|
|
21
|
+
imageTags: any;
|
|
21
22
|
underEditImageData: any;
|
|
22
23
|
setUnderEditImageData: any;
|
|
23
24
|
isInPopUp: any;
|
|
@@ -71,18 +71,20 @@ var TextInputs_1 = require("../../../../v2/components/TextInputs");
|
|
|
71
71
|
* fiddle for dealing with rotation: https://jsfiddle.net/wunderbart/w1hw5kv1/
|
|
72
72
|
*/
|
|
73
73
|
function ImageEditor(_a) {
|
|
74
|
+
var _b;
|
|
74
75
|
var id = _a.id, readOnly = _a.readOnly, imageData = _a.value, defaultImageSpread = _a.defaultImageSpread, handleSingleImageDataChange = _a.handleSingleImageDataChange, handleDeleteSingleImage = _a.handleDeleteSingleImage, handleReplaceSingleImage = _a.handleReplaceSingleImage, aspectRatio = _a.aspectRatio, invert = _a.invert, handleUpload = _a.handleUpload, setImageUnderEdit = _a.setImageUnderEdit, //comes from ImageInput context if used inside it
|
|
75
|
-
disableImageBorder = _a.disableImageBorder, stretchToFullHeight = _a.stretchToFullHeight, containerShape = _a.containerShape, omitEditorTools = _a.omitEditorTools, enableCaptions = _a.enableCaptions,
|
|
76
|
+
disableImageBorder = _a.disableImageBorder, stretchToFullHeight = _a.stretchToFullHeight, containerShape = _a.containerShape, omitEditorTools = _a.omitEditorTools, enableCaptions = _a.enableCaptions, imageTags = _a.imageTags,
|
|
76
77
|
//sent by parent ImageEditor to child (modal) ImageEditor
|
|
77
78
|
_underEditImageData = _a.underEditImageData, //ImageEditor passes this to its recursive self when opening in popup
|
|
78
79
|
_setUnderEditImageData = _a.setUnderEditImageData, isInPopUp = _a.isInPopUp, isInRTE = _a.isInRTE, handleDragStart = _a.handleDragStart;
|
|
79
80
|
var theme = (0, styled_components_1.useTheme)();
|
|
80
|
-
var
|
|
81
|
+
var _c = theme || {}, LexicalTextEditor = _c.LexicalTextEditor, _d = _c.lexicalTextEditorHasValue, lexicalTextEditorHasValue = _d === void 0 ? function () { return false; } : _d, //we are just defaulting to false for oolib preview. Meaning, when previewing in oolib, since this function doesnt exist (as it has to be provided by okf-fe), we will always return false from it.
|
|
82
|
+
TagsInputSingle = _c.TagsInputSingle, TagsInputMulti = _c.TagsInputMulti,
|
|
81
83
|
//backwards compat
|
|
82
|
-
|
|
84
|
+
_e = _c.richTextHasValue,
|
|
83
85
|
//backwards compat
|
|
84
|
-
richTextHasValue =
|
|
85
|
-
var
|
|
86
|
+
richTextHasValue = _e === void 0 ? function () { return false; } : _e; //temporarily passed thru from okf
|
|
87
|
+
var _f = (0, react_1.useState)(_underEditImageData || undefined), underEditImageData = _f[0], setUnderEditImageData = _f[1];
|
|
86
88
|
var screenWidth = (0, _EXPORTS_1.useScreenWidth)();
|
|
87
89
|
//set state in parent imageeditor
|
|
88
90
|
(0, react_1.useEffect)(function () {
|
|
@@ -97,15 +99,15 @@ function ImageEditor(_a) {
|
|
|
97
99
|
* underEditImageData is merged into imageData, only if the 'formattings'
|
|
98
100
|
* are 'saved'
|
|
99
101
|
*/
|
|
100
|
-
var
|
|
102
|
+
var _g = underEditImageData || imageData, publicUrl = _g.publicUrl, _h = _g.imageSpread, imageSpread = _h === void 0 ? defaultImageSpread : _h, _j = _g.imageRotate, imageRotate = _j === void 0 ? 0 : _j, _k = _g.cropX, cropX = _k === void 0 ? 0 : _k, _l = _g.cropY, cropY = _l === void 0 ? 0 : _l;
|
|
101
103
|
/**
|
|
102
104
|
* repos management
|
|
103
105
|
*/
|
|
104
106
|
var wrapperRef = (0, react_1.useRef)(null);
|
|
105
107
|
var renderedImageRef = (0, react_1.useRef)(null);
|
|
106
108
|
var isFirstMount = (0, react_1.useRef)(true);
|
|
107
|
-
var
|
|
108
|
-
var
|
|
109
|
+
var _m = (0, react_1.useState)(undefined), fullWidthOrFullHeightImg = _m[0], setFullWidthOrFullHeightImg = _m[1];
|
|
110
|
+
var _o = (0, useReorientImage_1.useReorientImage)({
|
|
109
111
|
imageRotate: imageRotate,
|
|
110
112
|
setFullWidthOrFullHeightImg: setFullWidthOrFullHeightImg,
|
|
111
113
|
setUnderEditImageData: setUnderEditImageData,
|
|
@@ -115,10 +117,10 @@ function ImageEditor(_a) {
|
|
|
115
117
|
isFirstMount: isFirstMount,
|
|
116
118
|
handleDeleteSingleImage: handleDeleteSingleImage,
|
|
117
119
|
readOnly: readOnly
|
|
118
|
-
}), reorientedImageTempUrl =
|
|
119
|
-
var
|
|
120
|
+
}), reorientedImageTempUrl = _o.reorientedImageTempUrl, imageLazyLoading = _o.imageLazyLoading;
|
|
121
|
+
var _p = (0, react_1.useState)(undefined), showDeleteImageModal = _p[0], setShowDeleteImageModal = _p[1];
|
|
120
122
|
var inputRef = (0, react_1.useRef)(null);
|
|
121
|
-
var
|
|
123
|
+
var _q = (0, react_1.useState)(undefined), editorStyle = _q[0], setEditorStyle = _q[1]; //alt: modal
|
|
122
124
|
(0, react_1.useEffect)(function () { isFirstMount.current = false; }, []);
|
|
123
125
|
var decideEditorStyle = function () {
|
|
124
126
|
var _a = wrapperRef.current.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
@@ -177,5 +179,24 @@ function ImageEditor(_a) {
|
|
|
177
179
|
imageData: __assign(__assign({}, imageData), { caption: val }),
|
|
178
180
|
});
|
|
179
181
|
} })),
|
|
180
|
-
readOnly && react_1.default.createElement(Divider_1.Divider, { invert: invert })))
|
|
182
|
+
readOnly && react_1.default.createElement(Divider_1.Divider, { invert: invert }))),
|
|
183
|
+
(imageTags === null || imageTags === void 0 ? void 0 : imageTags.enable) &&
|
|
184
|
+
((_b = imageTags === null || imageTags === void 0 ? void 0 : imageTags.config) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
185
|
+
var _b;
|
|
186
|
+
var comp = _a.comp, tagCategory = _a.tagCategory;
|
|
187
|
+
var compsLookup = {
|
|
188
|
+
TagsInputMulti: TagsInputMulti,
|
|
189
|
+
TagsInputSingle: TagsInputSingle
|
|
190
|
+
};
|
|
191
|
+
var Comp = compsLookup[comp];
|
|
192
|
+
if (!Comp)
|
|
193
|
+
return react_1.default.createElement("div", null, "placeholder for tag input");
|
|
194
|
+
return (react_1.default.createElement(Comp, { tagType: tagCategory, value: (_b = imageData.tags) === null || _b === void 0 ? void 0 : _b[tagCategory], onChange: function (id, val) {
|
|
195
|
+
var _a;
|
|
196
|
+
handleSingleImageDataChange({
|
|
197
|
+
publicUrl: publicUrl,
|
|
198
|
+
imageData: __assign(__assign({}, imageData), { tags: __assign(__assign({}, (imageData.tags || {})), (_a = {}, _a[tagCategory] = val, _a)) }),
|
|
199
|
+
});
|
|
200
|
+
} }));
|
|
201
|
+
}))))));
|
|
181
202
|
}
|
|
@@ -20,9 +20,9 @@ var Placeholder_1 = __importDefault(require("../Placeholder"));
|
|
|
20
20
|
var SingleImageInput = function (_a) {
|
|
21
21
|
var value = _a.value, // this is a subset of ImageInput's value prop
|
|
22
22
|
handleDragStart = _a.handleDragStart;
|
|
23
|
-
var _b = (0, ImageInputContext_1.useImageInputContext)(), id = _b.id, aspectRatio = _b.aspectRatio, onChange = _b.onChange, handleUpload = _b.handleUpload, publicUrlBeingReplaced = _b.publicUrlBeingReplaced, readOnly = _b.readOnly, enableCaptions = _b.enableCaptions, invert = _b.invert, containerShape = _b.containerShape, defaultImageSpread = _b.defaultImageSpread, handleSingleImageDataChange = _b.handleSingleImageDataChange, handleDeleteSingleImage = _b.handleDeleteSingleImage, handleReplaceSingleImage = _b.handleReplaceSingleImage, setImageUnderEdit = _b.setImageUnderEdit, stretchToFullHeight = _b.stretchToFullHeight, disableImageBorder = _b.disableImageBorder, omitEditorTools = _b.omitEditorTools, isInRTE = _b.isInRTE;
|
|
23
|
+
var _b = (0, ImageInputContext_1.useImageInputContext)(), id = _b.id, aspectRatio = _b.aspectRatio, onChange = _b.onChange, handleUpload = _b.handleUpload, publicUrlBeingReplaced = _b.publicUrlBeingReplaced, readOnly = _b.readOnly, enableCaptions = _b.enableCaptions, imageTags = _b.imageTags, invert = _b.invert, containerShape = _b.containerShape, defaultImageSpread = _b.defaultImageSpread, handleSingleImageDataChange = _b.handleSingleImageDataChange, handleDeleteSingleImage = _b.handleDeleteSingleImage, handleReplaceSingleImage = _b.handleReplaceSingleImage, setImageUnderEdit = _b.setImageUnderEdit, stretchToFullHeight = _b.stretchToFullHeight, disableImageBorder = _b.disableImageBorder, omitEditorTools = _b.omitEditorTools, isInRTE = _b.isInRTE;
|
|
24
24
|
//this helps for the ImageSlider, since ImageSlider uses SingleImageInput as child
|
|
25
25
|
var isBeingReplaced = publicUrlBeingReplaced && publicUrlBeingReplaced === (value === null || value === void 0 ? void 0 : value.publicUrl);
|
|
26
|
-
return !value || !value.publicUrl || isBeingReplaced ? (react_1.default.createElement(Placeholder_1.default, null)) : (react_1.default.createElement(ImageEditor_1.ImageEditor, { id: id, value: value, aspectRatio: aspectRatio, invert: invert, containerShape: containerShape, readOnly: readOnly, onChange: onChange, enableCaptions: enableCaptions, defaultImageSpread: defaultImageSpread, handleSingleImageDataChange: handleSingleImageDataChange, handleDeleteSingleImage: handleDeleteSingleImage, handleReplaceSingleImage: handleReplaceSingleImage, handleUpload: handleUpload, setImageUnderEdit: setImageUnderEdit, stretchToFullHeight: stretchToFullHeight, disableImageBorder: disableImageBorder, omitEditorTools: omitEditorTools, isInRTE: isInRTE, handleDragStart: handleDragStart }));
|
|
26
|
+
return !value || !value.publicUrl || isBeingReplaced ? (react_1.default.createElement(Placeholder_1.default, null)) : (react_1.default.createElement(ImageEditor_1.ImageEditor, { id: id, value: value, aspectRatio: aspectRatio, invert: invert, containerShape: containerShape, readOnly: readOnly, onChange: onChange, enableCaptions: enableCaptions, imageTags: imageTags, defaultImageSpread: defaultImageSpread, handleSingleImageDataChange: handleSingleImageDataChange, handleDeleteSingleImage: handleDeleteSingleImage, handleReplaceSingleImage: handleReplaceSingleImage, handleUpload: handleUpload, setImageUnderEdit: setImageUnderEdit, stretchToFullHeight: stretchToFullHeight, disableImageBorder: disableImageBorder, omitEditorTools: omitEditorTools, isInRTE: isInRTE, handleDragStart: handleDragStart }));
|
|
27
27
|
};
|
|
28
28
|
exports.SingleImageInput = SingleImageInput;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - richInputHasValue (util)
|
|
7
7
|
* - RichTextEditor
|
|
8
8
|
*/
|
|
9
|
-
export function ImageInput({ id, value, onChange, readOnly, multiple, stretchToFullHeight, aspectRatio, containerShape, invert, enableCaptions, defaultImageSpread, allowedFormats, folderName, bucketEnv, formatConvertConfig, dropzoneLabel, dropzoneSublabel, disableImageBorder, omitEditorTools, isRequired, showImageUploadCaution, files, isInRTE }: {
|
|
9
|
+
export function ImageInput({ id, value, onChange, readOnly, multiple, stretchToFullHeight, aspectRatio, containerShape, invert, enableCaptions, imageTags, defaultImageSpread, allowedFormats, folderName, bucketEnv, formatConvertConfig, dropzoneLabel, dropzoneSublabel, disableImageBorder, omitEditorTools, isRequired, showImageUploadCaution, files, isInRTE }: {
|
|
10
10
|
id: any;
|
|
11
11
|
value: any;
|
|
12
12
|
onChange: any;
|
|
@@ -17,6 +17,7 @@ export function ImageInput({ id, value, onChange, readOnly, multiple, stretchToF
|
|
|
17
17
|
containerShape?: string;
|
|
18
18
|
invert: any;
|
|
19
19
|
enableCaptions?: boolean;
|
|
20
|
+
imageTags: any;
|
|
20
21
|
defaultImageSpread?: string;
|
|
21
22
|
allowedFormats?: string[];
|
|
22
23
|
folderName?: string;
|
|
@@ -33,13 +33,13 @@ var utilsOolib_1 = require("../../utilsOolib");
|
|
|
33
33
|
*/
|
|
34
34
|
function ImageInput(_a) {
|
|
35
35
|
var id = _a.id, value = _a.value, onChange = _a.onChange, readOnly = _a.readOnly, multiple = _a.multiple, _b = _a.stretchToFullHeight, stretchToFullHeight = _b === void 0 ? false : _b, _c = _a.aspectRatio, aspectRatio = _c === void 0 ? '5/3' : _c, _d = _a.containerShape, containerShape = _d === void 0 ? 'rectangle' : _d, //alt = circle
|
|
36
|
-
invert = _a.invert, _e = _a.enableCaptions, enableCaptions = _e === void 0 ? true : _e, _f = _a.defaultImageSpread, defaultImageSpread = _f === void 0 ? 'contain' : _f, _g = _a.allowedFormats, allowedFormats = _g === void 0 ? ["jpg", "jpeg", "png"] : _g, _h = _a.folderName, folderName = _h === void 0 ? 'images' : _h, bucketEnv = _a.bucketEnv, formatConvertConfig = _a.formatConvertConfig, dropzoneLabel = _a.dropzoneLabel, dropzoneSublabel = _a.dropzoneSublabel, _j = _a.disableImageBorder, disableImageBorder = _j === void 0 ? false : _j, _k = _a.omitEditorTools, omitEditorTools = _k === void 0 ? [] : _k, //can include : 'cover_contain' | 'rotate' | 'reposition'
|
|
36
|
+
invert = _a.invert, _e = _a.enableCaptions, enableCaptions = _e === void 0 ? true : _e, imageTags = _a.imageTags, _f = _a.defaultImageSpread, defaultImageSpread = _f === void 0 ? 'contain' : _f, _g = _a.allowedFormats, allowedFormats = _g === void 0 ? ["jpg", "jpeg", "png"] : _g, _h = _a.folderName, folderName = _h === void 0 ? 'images' : _h, bucketEnv = _a.bucketEnv, formatConvertConfig = _a.formatConvertConfig, dropzoneLabel = _a.dropzoneLabel, dropzoneSublabel = _a.dropzoneSublabel, _j = _a.disableImageBorder, disableImageBorder = _j === void 0 ? false : _j, _k = _a.omitEditorTools, omitEditorTools = _k === void 0 ? [] : _k, //can include : 'cover_contain' | 'rotate' | 'reposition'
|
|
37
37
|
isRequired = _a.isRequired, _l = _a.showImageUploadCaution, showImageUploadCaution = _l === void 0 ? {} : _l, files = _a.files, //used by RTEImageInput
|
|
38
38
|
isInRTE = _a.isInRTE;
|
|
39
39
|
var props = arguments[0];
|
|
40
40
|
var showOptionalLabelInDropzone = !props.label && !props.sublabel;
|
|
41
41
|
var localize = (0, utilsOolib_1.useLocale)();
|
|
42
|
-
return (react_1.default.createElement(ImageInputContext_1.ImageInputContextProvider, { value: value, onChange: onChange, id: id, allowedFormats: allowedFormats, formatConvertConfig: formatConvertConfig, folderName: folderName, bucketEnv: bucketEnv, multiple: multiple, aspectRatio: aspectRatio, readOnly: readOnly, enableCaptions: enableCaptions, defaultImageSpread: defaultImageSpread, invert: invert, containerShape: containerShape, stretchToFullHeight: stretchToFullHeight, disableImageBorder: disableImageBorder, omitEditorTools: omitEditorTools, dropzoneLabel: dropzoneLabel || (multiple ? "".concat(localize('Add Images'), " ( max 10 )") : "Add Image"),
|
|
42
|
+
return (react_1.default.createElement(ImageInputContext_1.ImageInputContextProvider, { value: value, onChange: onChange, id: id, allowedFormats: allowedFormats, formatConvertConfig: formatConvertConfig, folderName: folderName, bucketEnv: bucketEnv, multiple: multiple, aspectRatio: aspectRatio, readOnly: readOnly, enableCaptions: enableCaptions, imageTags: imageTags, defaultImageSpread: defaultImageSpread, invert: invert, containerShape: containerShape, stretchToFullHeight: stretchToFullHeight, disableImageBorder: disableImageBorder, omitEditorTools: omitEditorTools, dropzoneLabel: dropzoneLabel || (multiple ? "".concat(localize('Add Images'), " ( max 10 )") : "Add Image"),
|
|
43
43
|
dropzoneSublabel: dropzoneSublabel ||
|
|
44
44
|
"Supports: ".concat(allowedFormats.map(function (f) { return f.toUpperCase(); }).join(", ")), showOptionalLabelInDropzone: showOptionalLabelInDropzone, // in cases like cover image scenario, we wanna show the 'optional' label in the dropzone area, rather than label area
|
|
45
45
|
isRequired: isRequired, files: files, isInRTE: isInRTE, showImageUploadCaution: showImageUploadCaution },
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export function URLInput({ routesAreValidInputs, validationPlugin, passValidationErrorToFormValidation, content, ...props }: {
|
|
1
|
+
export function URLInput({ routesAreValidInputs, validationPlugin: _validationPlugin, passValidationErrorToFormValidation, content, plugin, ...props }: {
|
|
2
2
|
[x: string]: any;
|
|
3
3
|
routesAreValidInputs?: boolean;
|
|
4
4
|
validationPlugin: any;
|
|
5
5
|
passValidationErrorToFormValidation: any;
|
|
6
6
|
content: any;
|
|
7
|
+
plugin: any;
|
|
7
8
|
}): React.JSX.Element;
|
|
8
9
|
import React from "react";
|
|
@@ -63,15 +63,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
63
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
64
|
exports.URLInput = void 0;
|
|
65
65
|
var react_1 = __importDefault(require("react"));
|
|
66
|
+
var styled_components_1 = require("styled-components");
|
|
66
67
|
var __1 = require("..");
|
|
67
68
|
var URLInput = function (_a) {
|
|
68
69
|
var _b = _a.routesAreValidInputs, routesAreValidInputs = _b === void 0 ? false : _b, //if we want react route declarations to be considered as 'valid' then set this to true
|
|
69
|
-
|
|
70
|
+
_validationPlugin = _a.validationPlugin, passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, content = _a.content, plugin = _a.plugin, props = __rest(_a, ["routesAreValidInputs", "validationPlugin", "passValidationErrorToFormValidation", "content", "plugin"]);
|
|
71
|
+
var theme = (0, styled_components_1.useTheme)();
|
|
70
72
|
var handleValidation = function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
-
var pluginResponse, successObj, response, successObj, err_1, successObj, errorObj;
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
var validationPlugin, pluginResponse, successObj, response, successObj, err_1, successObj, errorObj;
|
|
74
|
+
var _a;
|
|
75
|
+
return __generator(this, function (_b) {
|
|
76
|
+
switch (_b.label) {
|
|
74
77
|
case 0:
|
|
78
|
+
validationPlugin = (_validationPlugin ||
|
|
79
|
+
((plugin === null || plugin === void 0 ? void 0 : plugin.validation) && ((_a = theme.pluginConfigs) === null || _a === void 0 ? void 0 : _a.tplBlockPlugins[plugin.validation])));
|
|
75
80
|
if (!validationPlugin) return [3 /*break*/, 2];
|
|
76
81
|
return [4 /*yield*/, validationPlugin({
|
|
77
82
|
value: value,
|
|
@@ -79,10 +84,10 @@ var URLInput = function (_a) {
|
|
|
79
84
|
passValidationErrorToFormValidation: passValidationErrorToFormValidation,
|
|
80
85
|
})];
|
|
81
86
|
case 1:
|
|
82
|
-
pluginResponse =
|
|
87
|
+
pluginResponse = _b.sent();
|
|
83
88
|
if (pluginResponse)
|
|
84
89
|
return [2 /*return*/, pluginResponse];
|
|
85
|
-
|
|
90
|
+
_b.label = 2;
|
|
86
91
|
case 2:
|
|
87
92
|
//else
|
|
88
93
|
//if routesAreValidInputs, then first validate for a route
|
|
@@ -96,12 +101,12 @@ var URLInput = function (_a) {
|
|
|
96
101
|
if (!/^https?:\/\//i.test(value)) {
|
|
97
102
|
value = "https://" + value;
|
|
98
103
|
}
|
|
99
|
-
|
|
104
|
+
_b.label = 3;
|
|
100
105
|
case 3:
|
|
101
|
-
|
|
106
|
+
_b.trys.push([3, 5, , 6]);
|
|
102
107
|
return [4 /*yield*/, fetch(value)];
|
|
103
108
|
case 4:
|
|
104
|
-
response =
|
|
109
|
+
response = _b.sent();
|
|
105
110
|
if (response.status !== 200)
|
|
106
111
|
throw new Error("");
|
|
107
112
|
successObj = { type: "success", msg: "valid url" };
|
|
@@ -109,7 +114,7 @@ var URLInput = function (_a) {
|
|
|
109
114
|
passValidationErrorToFormValidation(successObj.type);
|
|
110
115
|
return [2 /*return*/, successObj];
|
|
111
116
|
case 5:
|
|
112
|
-
err_1 =
|
|
117
|
+
err_1 = _b.sent();
|
|
113
118
|
if (/[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(value)) {
|
|
114
119
|
successObj = { type: "success", msg: "valid url" };
|
|
115
120
|
if (passValidationErrorToFormValidation)
|