oolib 2.82.0 → 2.82.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.
|
@@ -66,10 +66,12 @@ function ImageEditor(_a) {
|
|
|
66
66
|
_underEditImageData = _a.underEditImageData, //ImageEditor passes this to its recursive self when opening in popup
|
|
67
67
|
_setUnderEditImageData = _a.setUnderEditImageData, isInPopUp = _a.isInPopUp, isInRTE = _a.isInRTE;
|
|
68
68
|
var theme = (0, styled_components_1.useTheme)();
|
|
69
|
-
var _b = theme || {},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
var _b = theme || {}, LexicalTextEditor = _b.LexicalTextEditor, _c = _b.lexicalTextEditorHasValue, lexicalTextEditorHasValue = _c === void 0 ? function () { return false; } : _c, //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.
|
|
70
|
+
//backwards compat
|
|
71
|
+
_d = _b.richTextHasValue, //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.
|
|
72
|
+
//backwards compat
|
|
73
|
+
richTextHasValue = _d === void 0 ? function () { return false; } : _d; //temporarily passed thru from okf
|
|
74
|
+
var _e = (0, react_1.useState)(_underEditImageData || undefined), underEditImageData = _e[0], setUnderEditImageData = _e[1];
|
|
73
75
|
//set state in parent imageeditor
|
|
74
76
|
(0, react_1.useEffect)(function () {
|
|
75
77
|
_setUnderEditImageData && _setUnderEditImageData(underEditImageData);
|
|
@@ -83,15 +85,15 @@ function ImageEditor(_a) {
|
|
|
83
85
|
* underEditImageData is merged into imageData, only if the 'formattings'
|
|
84
86
|
* are 'saved'
|
|
85
87
|
*/
|
|
86
|
-
var
|
|
88
|
+
var _f = underEditImageData || imageData, publicUrl = _f.publicUrl, _g = _f.imageSpread, imageSpread = _g === void 0 ? defaultImageSpread : _g, _h = _f.imageRotate, imageRotate = _h === void 0 ? 0 : _h, _j = _f.cropX, cropX = _j === void 0 ? 0 : _j, _k = _f.cropY, cropY = _k === void 0 ? 0 : _k;
|
|
87
89
|
/**
|
|
88
90
|
* repos management
|
|
89
91
|
*/
|
|
90
92
|
var wrapperRef = (0, react_1.useRef)(null);
|
|
91
93
|
var renderedImageRef = (0, react_1.useRef)(null);
|
|
92
94
|
var isFirstMount = (0, react_1.useRef)(true);
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
+
var _l = (0, react_1.useState)(undefined), fullWidthOrFullHeightImg = _l[0], setFullWidthOrFullHeightImg = _l[1];
|
|
96
|
+
var _m = (0, useReorientImage_1.useReorientImage)({
|
|
95
97
|
imageRotate: imageRotate,
|
|
96
98
|
setFullWidthOrFullHeightImg: setFullWidthOrFullHeightImg,
|
|
97
99
|
setUnderEditImageData: setUnderEditImageData,
|
|
@@ -101,10 +103,10 @@ function ImageEditor(_a) {
|
|
|
101
103
|
isFirstMount: isFirstMount,
|
|
102
104
|
handleDeleteSingleImage: handleDeleteSingleImage,
|
|
103
105
|
readOnly: readOnly
|
|
104
|
-
}), reorientedImageTempUrl =
|
|
105
|
-
var
|
|
106
|
+
}), reorientedImageTempUrl = _m.reorientedImageTempUrl, imageLazyLoading = _m.imageLazyLoading;
|
|
107
|
+
var _o = (0, react_1.useState)(undefined), showDeleteImageModal = _o[0], setShowDeleteImageModal = _o[1];
|
|
106
108
|
var inputRef = (0, react_1.useRef)(null);
|
|
107
|
-
var
|
|
109
|
+
var _p = (0, react_1.useState)(undefined), editorStyle = _p[0], setEditorStyle = _p[1]; //alt: modal
|
|
108
110
|
(0, react_1.useEffect)(function () { isFirstMount.current = false; }, []);
|
|
109
111
|
var decideEditorStyle = function () {
|
|
110
112
|
var _a = wrapperRef.current.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
@@ -196,7 +198,9 @@ function ImageEditor(_a) {
|
|
|
196
198
|
handleUpload: handleUpload,
|
|
197
199
|
isInRTE: isInRTE
|
|
198
200
|
}))) : editorStyle === "toolbar" ? (genToolbarStyledEditor()) : (editorStyle === "modal" && genModalStyleEditor()))),
|
|
199
|
-
enableCaptions && (readOnly &&
|
|
201
|
+
enableCaptions && (readOnly &&
|
|
202
|
+
!lexicalTextEditorHasValue(imageData.caption) &&
|
|
203
|
+
!richTextHasValue(imageData.caption) //backwards compat cuz its possible caption data might be in draftjs shape
|
|
200
204
|
? null
|
|
201
205
|
: react_1.default.createElement(react_1.Fragment, null,
|
|
202
206
|
react_1.default.createElement(Divider_1.Divider, { invert: invert }),
|
|
@@ -204,12 +208,12 @@ function ImageEditor(_a) {
|
|
|
204
208
|
borderRadius: "0.2rem",
|
|
205
209
|
padding: readOnly ? "1rem" : "2rem",
|
|
206
210
|
backgroundColor: readOnly ? "initial" : invert ? themes_1.colors.greyColor90 : themes_1.colors.greyColor5,
|
|
207
|
-
} }, !
|
|
211
|
+
} }, !LexicalTextEditor
|
|
208
212
|
? (0, renderRTEPlaceholderForOolibPreview_1.renderRTEPlaceholderForOolibPreview)({
|
|
209
213
|
width: '100%',
|
|
210
214
|
height: '30px'
|
|
211
215
|
})
|
|
212
|
-
: react_1.default.createElement(
|
|
216
|
+
: react_1.default.createElement(LexicalTextEditor, { variant: 'simple', disableNewline: true, invert: invert, placeholder: "type caption for image (optional)", readOnly: readOnly, charLimit: 100, typo: "SANS_3", placeholderColor: invert ? themes_1.colors.greyColor70 : themes_1.colors.greyColor40, value: imageData.caption, onChange: function (id, val) {
|
|
213
217
|
handleSingleImageDataChange({
|
|
214
218
|
publicUrl: publicUrl,
|
|
215
219
|
imageData: __assign(__assign({}, imageData), { caption: val }),
|
|
@@ -39,7 +39,7 @@ var LoaderOverlay = function (_a) {
|
|
|
39
39
|
opacity: 0.8,
|
|
40
40
|
top: 0,
|
|
41
41
|
left: 0,
|
|
42
|
-
zIndex:
|
|
42
|
+
zIndex: 1000000,
|
|
43
43
|
} },
|
|
44
44
|
react_1.default.createElement(LoaderCircle_1.LoaderCircle, { text: loaderText || "Generating Template...", isBlock: true, invert: true }))));
|
|
45
45
|
};
|
|
@@ -44,7 +44,7 @@ var genColor = function (_a) {
|
|
|
44
44
|
};
|
|
45
45
|
exports.genColor = genColor;
|
|
46
46
|
//separated out this way so we can use it in LexicalTextEditor's StyledEditorWrapperLex
|
|
47
|
-
exports.styledOKELinkCSS = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\ncursor: ", ";\n display: inline-flex;\n gap: 0.7rem;\n align-items: center;\n max-width:
|
|
47
|
+
exports.styledOKELinkCSS = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\ncursor: ", ";\n display: inline-flex;\n gap: 0.7rem;\n align-items: center;\n max-width: 100%;\n text-decoration: none;\n position: relative;\n color: ", ";\n\n &::after{\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n width: ", ";\n height: ", ";\n pointer-events: ", ";\n ", ";\n background-color: ", ";\n }\n\n &:hover{\n color: ", ";\n &::after{ width: ", "; }\n }\n"], ["\ncursor: ", ";\n display: inline-flex;\n gap: 0.7rem;\n align-items: center;\n max-width: 100%;\n text-decoration: none;\n position: relative;\n color: ", ";\n\n &::after{\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n width: ", ";\n height: ", ";\n pointer-events: ", ";\n ", ";\n background-color: ", ";\n }\n\n &:hover{\n color: ", ";\n &::after{ width: ", "; }\n }\n"])), function (_a) {
|
|
48
48
|
var disabled = _a.disabled;
|
|
49
49
|
return !disabled ? 'pointer' : 'not-allowed';
|
|
50
50
|
}, exports.genColor, function (_a) {
|
|
@@ -61,5 +61,5 @@ exports.styledOKELinkCSS = (0, styled_components_1.css)(templateObject_1 || (tem
|
|
|
61
61
|
return invertUnderline ? '100%' : 0;
|
|
62
62
|
});
|
|
63
63
|
exports.StyledLink = styled_components_1.default.a(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), exports.styledOKELinkCSS);
|
|
64
|
-
exports.StyledLinkText = styled_components_1.default.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n
|
|
64
|
+
exports.StyledLinkText = styled_components_1.default.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n max-width: 100%;\n ", ";\n"], ["\n max-width: 100%;\n ", ";\n"])), mixins_1.ellipsis);
|
|
65
65
|
var templateObject_1, templateObject_2, templateObject_3;
|