@onesy/ui-react 1.0.66 → 1.0.67
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.
@@ -203,7 +203,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
203
203
|
setOptionsMention([...(optionsMention_ || [])]);
|
204
204
|
}, [(0, utils_1.hash)(optionsMention_)]);
|
205
205
|
react_1.default.useEffect(() => {
|
206
|
-
const valuePrevious = (
|
206
|
+
const valuePrevious = (refs.root.current.innerHTML || '').replaceAll(' ', ' ');
|
207
207
|
const valueNew = (0, utils_1.textToInnerHTML)(value_);
|
208
208
|
if (value_ !== undefined && valuePrevious !== valueNew)
|
209
209
|
validate(!value_ ? '' : (0, utils_2.sanitize)(value_));
|
@@ -290,7 +290,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
290
290
|
refs.search.current = getAtSearchData();
|
291
291
|
const onInput = react_1.default.useCallback((event) => {
|
292
292
|
if (refs.root.current) {
|
293
|
-
let valueInput =
|
293
|
+
let valueInput = refs.root.current.innerHTML || '';
|
294
294
|
if (refs.root.current.textContent === '') {
|
295
295
|
valueInput = '';
|
296
296
|
refs.root.current.innerHTML = '';
|
@@ -456,7 +456,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
456
456
|
// Remove the text node
|
457
457
|
textNode.remove();
|
458
458
|
// Invoke onChange method with new value
|
459
|
-
const valueInput = (0, utils_1.innerHTMLToText)(
|
459
|
+
const valueInput = (0, utils_1.innerHTMLToText)(refs.root.current.innerHTML);
|
460
460
|
if ((0, utils_1.is)('function', refs.onChange.current))
|
461
461
|
refs.onChange.current(valueInput, { target: refs.root.current });
|
462
462
|
// Update the caret position to be outside the span mention
|
@@ -34,7 +34,7 @@ import ToggleButtonElement from '../ToggleButton';
|
|
34
34
|
import ClickListenerElement from '../ClickListener';
|
35
35
|
import ToggleButtonsElement from '../ToggleButtons';
|
36
36
|
import MenuElement from '../Menu';
|
37
|
-
import { sanitize, caret, keyboardStyleCommands, staticClassName
|
37
|
+
import { sanitize, caret, keyboardStyleCommands, staticClassName } from '../utils';
|
38
38
|
const useStyle = styleMethod(theme => ({
|
39
39
|
root: {
|
40
40
|
minHeight: '20px',
|
@@ -229,7 +229,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
229
229
|
setOptionsMention([...(optionsMention_ || [])]);
|
230
230
|
}, [hash(optionsMention_)]);
|
231
231
|
React.useEffect(() => {
|
232
|
-
const valuePrevious =
|
232
|
+
const valuePrevious = (refs.root.current.innerHTML || '').replaceAll(' ', ' ');
|
233
233
|
const valueNew = textToInnerHTML(value_);
|
234
234
|
if (value_ !== undefined && valuePrevious !== valueNew) validate(!value_ ? '' : sanitize(value_));
|
235
235
|
}, [value_]);
|
@@ -309,7 +309,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
309
309
|
refs.search.current = getAtSearchData();
|
310
310
|
const onInput = React.useCallback(event => {
|
311
311
|
if (refs.root.current) {
|
312
|
-
let valueInput =
|
312
|
+
let valueInput = refs.root.current.innerHTML || '';
|
313
313
|
if (refs.root.current.textContent === '') {
|
314
314
|
valueInput = '';
|
315
315
|
refs.root.current.innerHTML = '';
|
@@ -474,7 +474,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
474
474
|
textNode.remove();
|
475
475
|
|
476
476
|
// Invoke onChange method with new value
|
477
|
-
const valueInput = innerHTMLToText(
|
477
|
+
const valueInput = innerHTMLToText(refs.root.current.innerHTML);
|
478
478
|
if (is('function', refs.onChange.current)) refs.onChange.current(valueInput, {
|
479
479
|
target: refs.root.current
|
480
480
|
});
|
package/esm/index.js
CHANGED