@antscorp/antsomi-ui 1.3.5-beta.902 → 1.3.5-beta.903
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/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +0 -1
- package/es/components/molecules/TagifyInput/TagifyInput.js +8 -3
- package/es/components/molecules/TagifyInput/constants.js +1 -0
- package/es/components/molecules/TagifyInput/types.d.ts +7 -0
- package/es/components/template/TemplateListing/Loadable.d.ts +0 -1
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ import { acceptablePatternChecking, detectURLRegex, getCachedRegex, getPersonali
|
|
|
22
22
|
import { DETECT_LINK, EMOJI, FORCE_SHOW_TOOLTIP, INVALID_TAG, MESSAGE_TAG, NO_VIEW_TAG, PERSONALIZE_PTN, PROMOTION_CODE, READONLY_TAG, REMOVED_TAG, SHORT_LINK, SHORT_LINK_PTN, defaultCssVariables, tagifyDefaultProps, } from './constants';
|
|
23
23
|
const TagifyInput = forwardRef((props, ref) => {
|
|
24
24
|
// Props
|
|
25
|
-
const { initialValue, escapeHTML, status, readonly, readonlyTag, disabled, maxLength, maxHeight, minWidth, placeholder, isSingleLineText, acceptableTagPattern, mapAttributes, mapErrorAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
|
|
25
|
+
const { initialValue, escapeHTML, status, readonly, readonlyTag, realtime, disabled, maxLength, maxHeight, minWidth, placeholder, isSingleLineText, acceptableTagPattern, mapAttributes, mapErrorAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
|
|
26
26
|
// States
|
|
27
27
|
const [isLineBreak, setIsLineBreak] = useState(hasLineBreak(initialValue));
|
|
28
28
|
const [tooltipRefresher, setTooltipRefresher] = useState(1);
|
|
@@ -406,15 +406,20 @@ const TagifyInput = forwardRef((props, ref) => {
|
|
|
406
406
|
// Used to trigger replace URL detection and line break
|
|
407
407
|
const onTagifyTyping = useCallback((event) => {
|
|
408
408
|
if (event.detail) {
|
|
409
|
-
const { textContent } = event.detail;
|
|
409
|
+
const { textContent, tagify } = event.detail;
|
|
410
410
|
// Tracking if the tagify input is line break
|
|
411
411
|
setIsLineBreak(hasLineBreak(textContent));
|
|
412
412
|
// Update URL to tag to show hint in the tooltip with tag
|
|
413
413
|
if (textContent) {
|
|
414
414
|
detectReplaceURLToTag();
|
|
415
415
|
}
|
|
416
|
+
if (realtime) {
|
|
417
|
+
const inputValue = tagify.getInputValue();
|
|
418
|
+
const convertedValue = convertInputStringToOriginal(inputValue);
|
|
419
|
+
onOutputData(convertedValue);
|
|
420
|
+
}
|
|
416
421
|
}
|
|
417
|
-
}, [detectReplaceURLToTag]);
|
|
422
|
+
}, [realtime, detectReplaceURLToTag, onOutputData]);
|
|
418
423
|
/**
|
|
419
424
|
* Capture to trigger when tagify changed
|
|
420
425
|
*/
|
|
@@ -20,6 +20,13 @@ export interface TagifyInputProps {
|
|
|
20
20
|
* Defines whether the input should escape HTML characters.
|
|
21
21
|
*/
|
|
22
22
|
escapeHTML?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Defines whether the input should be in *realtime* mode.
|
|
25
|
+
* In *realtime* mode, the input is updated as the user stops typing, otherwise only on blur types.
|
|
26
|
+
*
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
realtime?: boolean;
|
|
23
30
|
/**
|
|
24
31
|
* Optional mapping configuration for custom attributes associated with tags.
|
|
25
32
|
* Defines how tag attributes are mapped and processed internally.
|