@commercetools-uikit/localized-rich-text-input 20.2.3 → 20.3.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.
|
@@ -13,6 +13,7 @@ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWit
|
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
14
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
15
15
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
16
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
16
17
|
var _Map = require('@babel/runtime-corejs3/core-js-stable/map');
|
|
17
18
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
18
19
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
@@ -56,6 +57,7 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
56
57
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
57
58
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
58
59
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
60
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
59
61
|
var _Map__default = /*#__PURE__*/_interopDefault(_Map);
|
|
60
62
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
61
63
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
@@ -70,7 +72,7 @@ var isHotkey__default = /*#__PURE__*/_interopDefault(isHotkey);
|
|
|
70
72
|
var pipe__default = /*#__PURE__*/_interopDefault(pipe);
|
|
71
73
|
|
|
72
74
|
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
73
|
-
const getEditorLanguageLabelBorderColor = props =>
|
|
75
|
+
const getEditorLanguageLabelBorderColor = props => "1px solid ".concat(props.isReadOnly ? designSystem.designTokens.borderColorForInputWhenReadonly : designSystem.designTokens.borderColorForInputWhenDisabled);
|
|
74
76
|
const getBackgroundColor = props => {
|
|
75
77
|
if (props.isDisabled) {
|
|
76
78
|
return designSystem.designTokens.backgroundColorForInputWhenDisabled;
|
|
@@ -183,7 +185,8 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
183
185
|
toggleLanguage(props.language);
|
|
184
186
|
}, [toggleLanguage, props.language]);
|
|
185
187
|
const updateRenderToggleButton = react.useCallback(() => {
|
|
186
|
-
|
|
188
|
+
var _ref$current;
|
|
189
|
+
const doesExceedCollapsedHeightLimit = Number((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientHeight) > COLLAPSED_HEIGHT;
|
|
187
190
|
if (doesExceedCollapsedHeightLimit && !renderToggleButton) {
|
|
188
191
|
setRenderToggleButton(true);
|
|
189
192
|
}
|
|
@@ -197,7 +200,8 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
197
200
|
|
|
198
201
|
// resetting
|
|
199
202
|
const resetValue = react.useCallback(newValue => {
|
|
200
|
-
|
|
203
|
+
var _newValue$props$langu;
|
|
204
|
+
const newStringValue = typeof newValue === 'string' ? newValue : (_newValue$props$langu = newValue === null || newValue === void 0 ? void 0 : newValue[props.language]) !== null && _newValue$props$langu !== void 0 ? _newValue$props$langu : '';
|
|
201
205
|
richTextUtils.resetEditor(editor, newStringValue);
|
|
202
206
|
}, [editor, props.language]);
|
|
203
207
|
/*
|
|
@@ -275,7 +279,8 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
275
279
|
autoFocus: props.isAutofocused,
|
|
276
280
|
onBlur: props.onBlur,
|
|
277
281
|
onFocus: event => {
|
|
278
|
-
|
|
282
|
+
var _props$onFocus;
|
|
283
|
+
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 || _props$onFocus.call(props, event);
|
|
279
284
|
// opens the input if it regains focus and it's closed
|
|
280
285
|
if (!isOpen) {
|
|
281
286
|
toggle();
|
|
@@ -383,7 +388,8 @@ let RichTextInput = /*#__PURE__*/function (_PureComponent) {
|
|
|
383
388
|
// the consumer only cares about the serializedValue, so it doesn't make sense to call
|
|
384
389
|
// onChange unless this value changes.
|
|
385
390
|
if (hasSerializedValueChanged) {
|
|
386
|
-
_this
|
|
391
|
+
var _this$props$onChange, _this$props;
|
|
392
|
+
(_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 || _this$props$onChange.call(_this$props, richTextUtils.html.serialize(state));
|
|
387
393
|
}
|
|
388
394
|
if (hasInternalSlateValueChanged && !hasSerializedValueChanged) {
|
|
389
395
|
// this way we force update if cursor or selection changes
|
|
@@ -459,7 +465,7 @@ var RequiredValueErrorMessage$1 = RequiredValueErrorMessage;
|
|
|
459
465
|
|
|
460
466
|
const _excluded = ["horizontalConstraint", "showExpandIcon"];
|
|
461
467
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
462
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
468
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
463
469
|
const expandedTranslationsReducer = (state, action) => {
|
|
464
470
|
switch (action.type) {
|
|
465
471
|
case 'toggle':
|
|
@@ -522,10 +528,11 @@ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
522
528
|
});
|
|
523
529
|
}, [expandedTranslationsDispatch]);
|
|
524
530
|
const createChangeHandler = react.useCallback(language => state => {
|
|
525
|
-
|
|
531
|
+
var _props$onChange, _context3, _context4;
|
|
532
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, {
|
|
526
533
|
target: {
|
|
527
|
-
id: props
|
|
528
|
-
name: props
|
|
534
|
+
id: props !== null && props !== void 0 && props.id ? _concatInstanceProperty__default["default"](_context3 = "".concat(props.id, ".")).call(_context3, language) : '',
|
|
535
|
+
name: props !== null && props !== void 0 && props.name ? _concatInstanceProperty__default["default"](_context4 = "".concat(props.name, ".")).call(_context4, language) : '',
|
|
529
536
|
language,
|
|
530
537
|
value: state
|
|
531
538
|
}
|
|
@@ -545,9 +552,9 @@ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
545
552
|
}
|
|
546
553
|
const langRefs = react.useRef(new _Map__default["default"]());
|
|
547
554
|
const resetValue = react.useCallback(newValue => {
|
|
548
|
-
var
|
|
549
|
-
_forEachInstanceProperty__default["default"](
|
|
550
|
-
langRef
|
|
555
|
+
var _context5;
|
|
556
|
+
_forEachInstanceProperty__default["default"](_context5 = langRefs.current).call(_context5, langRef => {
|
|
557
|
+
langRef === null || langRef === void 0 || langRef.resetValue(newValue);
|
|
551
558
|
});
|
|
552
559
|
}, []);
|
|
553
560
|
react.useImperativeHandle(ref, () => {
|
|
@@ -614,7 +621,7 @@ LocalizedRichTextInput.isTouched = localizedUtils.isTouched;
|
|
|
614
621
|
var LocalizedRichTextInput$1 = LocalizedRichTextInput;
|
|
615
622
|
|
|
616
623
|
// NOTE: This string will be replaced on build time with the package version.
|
|
617
|
-
var version = "20.
|
|
624
|
+
var version = "20.3.1";
|
|
618
625
|
|
|
619
626
|
exports["default"] = LocalizedRichTextInput$1;
|
|
620
627
|
exports.version = version;
|
|
@@ -13,6 +13,7 @@ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWit
|
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
14
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
15
15
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
16
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
16
17
|
var _Map = require('@babel/runtime-corejs3/core-js-stable/map');
|
|
17
18
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
18
19
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
@@ -56,6 +57,7 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
56
57
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
57
58
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
58
59
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
60
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
59
61
|
var _Map__default = /*#__PURE__*/_interopDefault(_Map);
|
|
60
62
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
61
63
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
@@ -69,7 +71,7 @@ var FlatButton__default = /*#__PURE__*/_interopDefault(FlatButton);
|
|
|
69
71
|
var isHotkey__default = /*#__PURE__*/_interopDefault(isHotkey);
|
|
70
72
|
var pipe__default = /*#__PURE__*/_interopDefault(pipe);
|
|
71
73
|
|
|
72
|
-
const getEditorLanguageLabelBorderColor = props =>
|
|
74
|
+
const getEditorLanguageLabelBorderColor = props => "1px solid ".concat(props.isReadOnly ? designSystem.designTokens.borderColorForInputWhenReadonly : designSystem.designTokens.borderColorForInputWhenDisabled);
|
|
73
75
|
const getBackgroundColor = props => {
|
|
74
76
|
if (props.isDisabled) {
|
|
75
77
|
return designSystem.designTokens.backgroundColorForInputWhenDisabled;
|
|
@@ -141,7 +143,8 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
141
143
|
toggleLanguage(props.language);
|
|
142
144
|
}, [toggleLanguage, props.language]);
|
|
143
145
|
const updateRenderToggleButton = react.useCallback(() => {
|
|
144
|
-
|
|
146
|
+
var _ref$current;
|
|
147
|
+
const doesExceedCollapsedHeightLimit = Number((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientHeight) > COLLAPSED_HEIGHT;
|
|
145
148
|
if (doesExceedCollapsedHeightLimit && !renderToggleButton) {
|
|
146
149
|
setRenderToggleButton(true);
|
|
147
150
|
}
|
|
@@ -155,7 +158,8 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
155
158
|
|
|
156
159
|
// resetting
|
|
157
160
|
const resetValue = react.useCallback(newValue => {
|
|
158
|
-
|
|
161
|
+
var _newValue$props$langu;
|
|
162
|
+
const newStringValue = typeof newValue === 'string' ? newValue : (_newValue$props$langu = newValue === null || newValue === void 0 ? void 0 : newValue[props.language]) !== null && _newValue$props$langu !== void 0 ? _newValue$props$langu : '';
|
|
159
163
|
richTextUtils.resetEditor(editor, newStringValue);
|
|
160
164
|
}, [editor, props.language]);
|
|
161
165
|
/*
|
|
@@ -233,7 +237,8 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
233
237
|
autoFocus: props.isAutofocused,
|
|
234
238
|
onBlur: props.onBlur,
|
|
235
239
|
onFocus: event => {
|
|
236
|
-
|
|
240
|
+
var _props$onFocus;
|
|
241
|
+
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 || _props$onFocus.call(props, event);
|
|
237
242
|
// opens the input if it regains focus and it's closed
|
|
238
243
|
if (!isOpen) {
|
|
239
244
|
toggle();
|
|
@@ -341,7 +346,8 @@ let RichTextInput = /*#__PURE__*/function (_PureComponent) {
|
|
|
341
346
|
// the consumer only cares about the serializedValue, so it doesn't make sense to call
|
|
342
347
|
// onChange unless this value changes.
|
|
343
348
|
if (hasSerializedValueChanged) {
|
|
344
|
-
_this
|
|
349
|
+
var _this$props$onChange, _this$props;
|
|
350
|
+
(_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 || _this$props$onChange.call(_this$props, richTextUtils.html.serialize(state));
|
|
345
351
|
}
|
|
346
352
|
if (hasInternalSlateValueChanged && !hasSerializedValueChanged) {
|
|
347
353
|
// this way we force update if cursor or selection changes
|
|
@@ -413,7 +419,7 @@ var RequiredValueErrorMessage$1 = RequiredValueErrorMessage;
|
|
|
413
419
|
|
|
414
420
|
const _excluded = ["horizontalConstraint", "showExpandIcon"];
|
|
415
421
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
416
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
422
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
417
423
|
const expandedTranslationsReducer = (state, action) => {
|
|
418
424
|
switch (action.type) {
|
|
419
425
|
case 'toggle':
|
|
@@ -469,10 +475,11 @@ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
469
475
|
});
|
|
470
476
|
}, [expandedTranslationsDispatch]);
|
|
471
477
|
const createChangeHandler = react.useCallback(language => state => {
|
|
472
|
-
|
|
478
|
+
var _props$onChange, _context3, _context4;
|
|
479
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, {
|
|
473
480
|
target: {
|
|
474
|
-
id: props
|
|
475
|
-
name: props
|
|
481
|
+
id: props !== null && props !== void 0 && props.id ? _concatInstanceProperty__default["default"](_context3 = "".concat(props.id, ".")).call(_context3, language) : '',
|
|
482
|
+
name: props !== null && props !== void 0 && props.name ? _concatInstanceProperty__default["default"](_context4 = "".concat(props.name, ".")).call(_context4, language) : '',
|
|
476
483
|
language,
|
|
477
484
|
value: state
|
|
478
485
|
}
|
|
@@ -492,9 +499,9 @@ const LocalizedRichTextInput = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
492
499
|
}
|
|
493
500
|
const langRefs = react.useRef(new _Map__default["default"]());
|
|
494
501
|
const resetValue = react.useCallback(newValue => {
|
|
495
|
-
var
|
|
496
|
-
_forEachInstanceProperty__default["default"](
|
|
497
|
-
langRef
|
|
502
|
+
var _context5;
|
|
503
|
+
_forEachInstanceProperty__default["default"](_context5 = langRefs.current).call(_context5, langRef => {
|
|
504
|
+
langRef === null || langRef === void 0 || langRef.resetValue(newValue);
|
|
498
505
|
});
|
|
499
506
|
}, []);
|
|
500
507
|
react.useImperativeHandle(ref, () => {
|
|
@@ -561,7 +568,7 @@ LocalizedRichTextInput.isTouched = localizedUtils.isTouched;
|
|
|
561
568
|
var LocalizedRichTextInput$1 = LocalizedRichTextInput;
|
|
562
569
|
|
|
563
570
|
// NOTE: This string will be replaced on build time with the package version.
|
|
564
|
-
var version = "20.
|
|
571
|
+
var version = "20.3.1";
|
|
565
572
|
|
|
566
573
|
exports["default"] = LocalizedRichTextInput$1;
|
|
567
574
|
exports.version = version;
|
|
@@ -9,6 +9,7 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectW
|
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
10
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
11
11
|
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
12
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
12
13
|
import _Map from '@babel/runtime-corejs3/core-js-stable/map';
|
|
13
14
|
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
14
15
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
@@ -43,7 +44,7 @@ import pipe from 'lodash/fp/pipe';
|
|
|
43
44
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
44
45
|
|
|
45
46
|
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
46
|
-
const getEditorLanguageLabelBorderColor = props =>
|
|
47
|
+
const getEditorLanguageLabelBorderColor = props => "1px solid ".concat(props.isReadOnly ? designTokens.borderColorForInputWhenReadonly : designTokens.borderColorForInputWhenDisabled);
|
|
47
48
|
const getBackgroundColor = props => {
|
|
48
49
|
if (props.isDisabled) {
|
|
49
50
|
return designTokens.backgroundColorForInputWhenDisabled;
|
|
@@ -156,7 +157,8 @@ const Editor = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
156
157
|
toggleLanguage(props.language);
|
|
157
158
|
}, [toggleLanguage, props.language]);
|
|
158
159
|
const updateRenderToggleButton = useCallback(() => {
|
|
159
|
-
|
|
160
|
+
var _ref$current;
|
|
161
|
+
const doesExceedCollapsedHeightLimit = Number((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientHeight) > COLLAPSED_HEIGHT;
|
|
160
162
|
if (doesExceedCollapsedHeightLimit && !renderToggleButton) {
|
|
161
163
|
setRenderToggleButton(true);
|
|
162
164
|
}
|
|
@@ -170,7 +172,8 @@ const Editor = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
170
172
|
|
|
171
173
|
// resetting
|
|
172
174
|
const resetValue = useCallback(newValue => {
|
|
173
|
-
|
|
175
|
+
var _newValue$props$langu;
|
|
176
|
+
const newStringValue = typeof newValue === 'string' ? newValue : (_newValue$props$langu = newValue === null || newValue === void 0 ? void 0 : newValue[props.language]) !== null && _newValue$props$langu !== void 0 ? _newValue$props$langu : '';
|
|
174
177
|
resetEditor(editor, newStringValue);
|
|
175
178
|
}, [editor, props.language]);
|
|
176
179
|
/*
|
|
@@ -248,7 +251,8 @@ const Editor = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
248
251
|
autoFocus: props.isAutofocused,
|
|
249
252
|
onBlur: props.onBlur,
|
|
250
253
|
onFocus: event => {
|
|
251
|
-
|
|
254
|
+
var _props$onFocus;
|
|
255
|
+
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 || _props$onFocus.call(props, event);
|
|
252
256
|
// opens the input if it regains focus and it's closed
|
|
253
257
|
if (!isOpen) {
|
|
254
258
|
toggle();
|
|
@@ -356,7 +360,8 @@ let RichTextInput = /*#__PURE__*/function (_PureComponent) {
|
|
|
356
360
|
// the consumer only cares about the serializedValue, so it doesn't make sense to call
|
|
357
361
|
// onChange unless this value changes.
|
|
358
362
|
if (hasSerializedValueChanged) {
|
|
359
|
-
_this
|
|
363
|
+
var _this$props$onChange, _this$props;
|
|
364
|
+
(_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 || _this$props$onChange.call(_this$props, html.serialize(state));
|
|
360
365
|
}
|
|
361
366
|
if (hasInternalSlateValueChanged && !hasSerializedValueChanged) {
|
|
362
367
|
// this way we force update if cursor or selection changes
|
|
@@ -432,7 +437,7 @@ var RequiredValueErrorMessage$1 = RequiredValueErrorMessage;
|
|
|
432
437
|
|
|
433
438
|
const _excluded = ["horizontalConstraint", "showExpandIcon"];
|
|
434
439
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
435
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
440
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(t), !0)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
436
441
|
const expandedTranslationsReducer = (state, action) => {
|
|
437
442
|
switch (action.type) {
|
|
438
443
|
case 'toggle':
|
|
@@ -495,10 +500,11 @@ const LocalizedRichTextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
495
500
|
});
|
|
496
501
|
}, [expandedTranslationsDispatch]);
|
|
497
502
|
const createChangeHandler = useCallback(language => state => {
|
|
498
|
-
|
|
503
|
+
var _props$onChange, _context3, _context4;
|
|
504
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, {
|
|
499
505
|
target: {
|
|
500
|
-
id: props
|
|
501
|
-
name: props
|
|
506
|
+
id: props !== null && props !== void 0 && props.id ? _concatInstanceProperty(_context3 = "".concat(props.id, ".")).call(_context3, language) : '',
|
|
507
|
+
name: props !== null && props !== void 0 && props.name ? _concatInstanceProperty(_context4 = "".concat(props.name, ".")).call(_context4, language) : '',
|
|
502
508
|
language,
|
|
503
509
|
value: state
|
|
504
510
|
}
|
|
@@ -518,9 +524,9 @@ const LocalizedRichTextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
518
524
|
}
|
|
519
525
|
const langRefs = useRef(new _Map());
|
|
520
526
|
const resetValue = useCallback(newValue => {
|
|
521
|
-
var
|
|
522
|
-
_forEachInstanceProperty(
|
|
523
|
-
langRef
|
|
527
|
+
var _context5;
|
|
528
|
+
_forEachInstanceProperty(_context5 = langRefs.current).call(_context5, langRef => {
|
|
529
|
+
langRef === null || langRef === void 0 || langRef.resetValue(newValue);
|
|
524
530
|
});
|
|
525
531
|
}, []);
|
|
526
532
|
useImperativeHandle(ref, () => {
|
|
@@ -587,6 +593,6 @@ LocalizedRichTextInput.isTouched = isTouched;
|
|
|
587
593
|
var LocalizedRichTextInput$1 = LocalizedRichTextInput;
|
|
588
594
|
|
|
589
595
|
// NOTE: This string will be replaced on build time with the package version.
|
|
590
|
-
var version = "20.
|
|
596
|
+
var version = "20.3.1";
|
|
591
597
|
|
|
592
598
|
export { LocalizedRichTextInput$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/localized-rich-text-input",
|
|
3
3
|
"description": "A controlled text input component for localized rich text input with validation states.",
|
|
4
|
-
"version": "20.
|
|
4
|
+
"version": "20.3.1",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,35 +21,35 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/collapsible-motion": "20.
|
|
25
|
-
"@commercetools-uikit/constraints": "20.
|
|
26
|
-
"@commercetools-uikit/design-system": "20.
|
|
27
|
-
"@commercetools-uikit/flat-button": "20.
|
|
28
|
-
"@commercetools-uikit/hooks": "20.
|
|
29
|
-
"@commercetools-uikit/icons": "20.
|
|
30
|
-
"@commercetools-uikit/input-utils": "20.
|
|
31
|
-
"@commercetools-uikit/localized-utils": "20.
|
|
32
|
-
"@commercetools-uikit/messages": "20.
|
|
33
|
-
"@commercetools-uikit/rich-text-utils": "20.
|
|
34
|
-
"@commercetools-uikit/spacings-inline": "20.
|
|
35
|
-
"@commercetools-uikit/spacings-stack": "20.
|
|
36
|
-
"@commercetools-uikit/text": "20.
|
|
37
|
-
"@commercetools-uikit/tooltip": "20.
|
|
38
|
-
"@commercetools-uikit/utils": "20.
|
|
24
|
+
"@commercetools-uikit/collapsible-motion": "20.3.1",
|
|
25
|
+
"@commercetools-uikit/constraints": "20.3.1",
|
|
26
|
+
"@commercetools-uikit/design-system": "20.3.1",
|
|
27
|
+
"@commercetools-uikit/flat-button": "20.3.1",
|
|
28
|
+
"@commercetools-uikit/hooks": "20.3.1",
|
|
29
|
+
"@commercetools-uikit/icons": "20.3.1",
|
|
30
|
+
"@commercetools-uikit/input-utils": "20.3.1",
|
|
31
|
+
"@commercetools-uikit/localized-utils": "20.3.1",
|
|
32
|
+
"@commercetools-uikit/messages": "20.3.1",
|
|
33
|
+
"@commercetools-uikit/rich-text-utils": "20.3.1",
|
|
34
|
+
"@commercetools-uikit/spacings-inline": "20.3.1",
|
|
35
|
+
"@commercetools-uikit/spacings-stack": "20.3.1",
|
|
36
|
+
"@commercetools-uikit/text": "20.3.1",
|
|
37
|
+
"@commercetools-uikit/tooltip": "20.3.1",
|
|
38
|
+
"@commercetools-uikit/utils": "20.3.1",
|
|
39
39
|
"@emotion/react": "^11.10.5",
|
|
40
40
|
"@emotion/styled": "^11.10.5",
|
|
41
41
|
"downshift": "9.0.10",
|
|
42
42
|
"immutable": "4.3.7",
|
|
43
43
|
"is-hotkey": "0.2.0",
|
|
44
|
-
"lodash": "4.17.
|
|
44
|
+
"lodash": "4.17.23",
|
|
45
45
|
"react-textarea-autosize": "8.4.0",
|
|
46
46
|
"slate": "0.75.0",
|
|
47
47
|
"slate-history": "0.113.1",
|
|
48
48
|
"slate-react": "0.75.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"react": "19.
|
|
52
|
-
"react-dom": "19.
|
|
51
|
+
"react": "19.2.0",
|
|
52
|
+
"react-dom": "19.2.0",
|
|
53
53
|
"react-intl": "^7.1.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|