@commercetools-uikit/rich-text-input 19.6.0 → 19.8.0
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.
|
@@ -103,10 +103,10 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
103
103
|
const resetValue = react.useCallback(newValue => {
|
|
104
104
|
richTextUtils.resetEditor(editor, newValue);
|
|
105
105
|
}, [editor]);
|
|
106
|
-
/*
|
|
106
|
+
/*
|
|
107
107
|
Resetting the editor requires access to `editor` object returned from `useSlate` hook.
|
|
108
108
|
Therefore, `reset` function is attached to the passed `ref` object via `useImperativeHandle` hook
|
|
109
|
-
to be called from the parent component.
|
|
109
|
+
to be called from the parent component.
|
|
110
110
|
e.g. <button onMouseDown={() => ref.current?.resetValue("<p><strong>Value after reset</strong></p>")}>Reset</button>
|
|
111
111
|
*/
|
|
112
112
|
react.useImperativeHandle(forwardedRef, () => {
|
|
@@ -176,6 +176,10 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
176
176
|
break;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
+
if (event.shiftKey && event.key === 'Enter') {
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
editor.insertText(richTextUtils.Softbreaker.placeholderCharacter);
|
|
182
|
+
}
|
|
179
183
|
}
|
|
180
184
|
})), props.children, jsxRuntime.jsx(richTextUtils.HiddenInput, {
|
|
181
185
|
isFocused: slateReact.ReactEditor.isFocused(editor),
|
|
@@ -333,7 +337,7 @@ RichTextInputWithRef.isTouched = isTouched;
|
|
|
333
337
|
var RichTextInputWithRef$1 = RichTextInputWithRef;
|
|
334
338
|
|
|
335
339
|
// NOTE: This string will be replaced on build time with the package version.
|
|
336
|
-
var version = "19.
|
|
340
|
+
var version = "19.8.0";
|
|
337
341
|
|
|
338
342
|
exports["default"] = RichTextInputWithRef$1;
|
|
339
343
|
exports.version = version;
|
|
@@ -99,10 +99,10 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
99
99
|
const resetValue = react.useCallback(newValue => {
|
|
100
100
|
richTextUtils.resetEditor(editor, newValue);
|
|
101
101
|
}, [editor]);
|
|
102
|
-
/*
|
|
102
|
+
/*
|
|
103
103
|
Resetting the editor requires access to `editor` object returned from `useSlate` hook.
|
|
104
104
|
Therefore, `reset` function is attached to the passed `ref` object via `useImperativeHandle` hook
|
|
105
|
-
to be called from the parent component.
|
|
105
|
+
to be called from the parent component.
|
|
106
106
|
e.g. <button onMouseDown={() => ref.current?.resetValue("<p><strong>Value after reset</strong></p>")}>Reset</button>
|
|
107
107
|
*/
|
|
108
108
|
react.useImperativeHandle(forwardedRef, () => {
|
|
@@ -172,6 +172,10 @@ const Editor = /*#__PURE__*/react.forwardRef((props, forwardedRef) => {
|
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
+
if (event.shiftKey && event.key === 'Enter') {
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
editor.insertText(richTextUtils.Softbreaker.placeholderCharacter);
|
|
178
|
+
}
|
|
175
179
|
}
|
|
176
180
|
})), props.children, jsxRuntime.jsx(richTextUtils.HiddenInput, {
|
|
177
181
|
isFocused: slateReact.ReactEditor.isFocused(editor),
|
|
@@ -308,7 +312,7 @@ RichTextInputWithRef.isTouched = isTouched;
|
|
|
308
312
|
var RichTextInputWithRef$1 = RichTextInputWithRef;
|
|
309
313
|
|
|
310
314
|
// NOTE: This string will be replaced on build time with the package version.
|
|
311
|
-
var version = "19.
|
|
315
|
+
var version = "19.8.0";
|
|
312
316
|
|
|
313
317
|
exports["default"] = RichTextInputWithRef$1;
|
|
314
318
|
exports.version = version;
|
|
@@ -16,7 +16,7 @@ import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
|
16
16
|
import _pt from 'prop-types';
|
|
17
17
|
import { forwardRef, useRef, useMemo, useState, useCallback, useEffect, useImperativeHandle, PureComponent } from 'react';
|
|
18
18
|
import { filterDataAttributes, warning } from '@commercetools-uikit/utils';
|
|
19
|
-
import { resetEditor, RichTextBody, focusEditor, toggleMark, HiddenInput, Element, Leaf, isEmpty, validSlateStateAdapter, html } from '@commercetools-uikit/rich-text-utils';
|
|
19
|
+
import { resetEditor, RichTextBody, focusEditor, toggleMark, Softbreaker, HiddenInput, Element, Leaf, isEmpty, validSlateStateAdapter, html } from '@commercetools-uikit/rich-text-utils';
|
|
20
20
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
21
21
|
import { useIntl } from 'react-intl';
|
|
22
22
|
import CollapsibleMotion from '@commercetools-uikit/collapsible-motion';
|
|
@@ -79,10 +79,10 @@ const Editor = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
79
79
|
const resetValue = useCallback(newValue => {
|
|
80
80
|
resetEditor(editor, newValue);
|
|
81
81
|
}, [editor]);
|
|
82
|
-
/*
|
|
82
|
+
/*
|
|
83
83
|
Resetting the editor requires access to `editor` object returned from `useSlate` hook.
|
|
84
84
|
Therefore, `reset` function is attached to the passed `ref` object via `useImperativeHandle` hook
|
|
85
|
-
to be called from the parent component.
|
|
85
|
+
to be called from the parent component.
|
|
86
86
|
e.g. <button onMouseDown={() => ref.current?.resetValue("<p><strong>Value after reset</strong></p>")}>Reset</button>
|
|
87
87
|
*/
|
|
88
88
|
useImperativeHandle(forwardedRef, () => {
|
|
@@ -152,6 +152,10 @@ const Editor = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
if (event.shiftKey && event.key === 'Enter') {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
editor.insertText(Softbreaker.placeholderCharacter);
|
|
158
|
+
}
|
|
155
159
|
}
|
|
156
160
|
})), props.children, jsx(HiddenInput, {
|
|
157
161
|
isFocused: ReactEditor.isFocused(editor),
|
|
@@ -309,6 +313,6 @@ RichTextInputWithRef.isTouched = isTouched;
|
|
|
309
313
|
var RichTextInputWithRef$1 = RichTextInputWithRef;
|
|
310
314
|
|
|
311
315
|
// NOTE: This string will be replaced on build time with the package version.
|
|
312
|
-
var version = "19.
|
|
316
|
+
var version = "19.8.0";
|
|
313
317
|
|
|
314
318
|
export { RichTextInputWithRef$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/rich-text-input",
|
|
3
3
|
"description": "A controlled rich text input component for rich text with validation states.",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.8.0",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/collapsible-motion": "19.
|
|
25
|
-
"@commercetools-uikit/constraints": "19.
|
|
26
|
-
"@commercetools-uikit/design-system": "19.
|
|
27
|
-
"@commercetools-uikit/flat-button": "19.
|
|
28
|
-
"@commercetools-uikit/hooks": "19.
|
|
29
|
-
"@commercetools-uikit/icons": "19.
|
|
30
|
-
"@commercetools-uikit/input-utils": "19.
|
|
31
|
-
"@commercetools-uikit/rich-text-utils": "19.
|
|
32
|
-
"@commercetools-uikit/spacings-inline": "19.
|
|
33
|
-
"@commercetools-uikit/spacings-stack": "19.
|
|
34
|
-
"@commercetools-uikit/tooltip": "19.
|
|
35
|
-
"@commercetools-uikit/utils": "19.
|
|
24
|
+
"@commercetools-uikit/collapsible-motion": "19.8.0",
|
|
25
|
+
"@commercetools-uikit/constraints": "19.8.0",
|
|
26
|
+
"@commercetools-uikit/design-system": "19.8.0",
|
|
27
|
+
"@commercetools-uikit/flat-button": "19.8.0",
|
|
28
|
+
"@commercetools-uikit/hooks": "19.8.0",
|
|
29
|
+
"@commercetools-uikit/icons": "19.8.0",
|
|
30
|
+
"@commercetools-uikit/input-utils": "19.8.0",
|
|
31
|
+
"@commercetools-uikit/rich-text-utils": "19.8.0",
|
|
32
|
+
"@commercetools-uikit/spacings-inline": "19.8.0",
|
|
33
|
+
"@commercetools-uikit/spacings-stack": "19.8.0",
|
|
34
|
+
"@commercetools-uikit/tooltip": "19.8.0",
|
|
35
|
+
"@commercetools-uikit/utils": "19.8.0",
|
|
36
36
|
"@emotion/react": "^11.10.5",
|
|
37
37
|
"@emotion/styled": "^11.10.5",
|
|
38
38
|
"downshift": "6.1.12",
|