@antscorp/antsomi-ui 1.3.7-beta.13 → 1.3.7-beta.15

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.
@@ -17,7 +17,7 @@ import '@yaireo/tagify/dist/tagify.css';
17
17
  // Styled
18
18
  import { TagTextArea, TagifyWrapper, WrapperPlaceHolder } from './styled';
19
19
  // Utils
20
- import { parseTagStringToTagify, convertInputStringToOriginal, emojiManufacturer, getEmojiTag, isPersonalizeTagType, generateTagContent, unescapeString, hasLineBreak, selectRange, isTagClickable, findURLInTextNodes, getAttributesString, isAnchorNodeChildOfElement, isShortLinkTagType, isCustomTagType, sanitizeTagAttributes, getTagAttributes, applyTagAttributes, getTagContentAttributes, isCaretAtEndOfTextNodeWithNextTag, getCurrentSelectionAndCloneRange, handleEnterWithNextTag, handleTextNodeBackspace, extractTagValues, removeInvisibleChars, } from './utils';
20
+ import { parseTagStringToTagify, convertInputStringToOriginal, emojiManufacturer, getEmojiTag, isPersonalizeTagType, generateTagContent, unescapeString, hasLineBreak, selectRange, isTagClickable, findURLInTextNodes, getAttributesString, isAnchorNodeChildOfElement, isShortLinkTagType, isCustomTagType, sanitizeTagAttributes, getTagAttributes, applyTagAttributes, getTagContentAttributes, isCaretAtEndOfTextNodeWithNextTag, getCurrentSelectionAndCloneRange, handleEnterWithNextTag, handleTextNodeBackspace, extractTagValues, } from './utils';
21
21
  import { acceptablePatternChecking, detectURLRegex, getCachedRegex, getCustomTagId, getPersonalizeTagInfo, getShortLinkTagInfo, patternHandlers, } from './patternHandlers';
22
22
  // Constants
23
23
  import { DETECT_LINK, EMOJI, PERSONALIZE_PTN, SHORT_LINK, SHORT_LINK_PTN, SHORT_LINK_V2, TAG_TYPE, UNSUBSCRIBE_WHATSAPP, defaultCssVariables, tagifyDefaultProps, TAG_CUSTOM_ATTRIBUTES, } from './constants';
@@ -778,14 +778,16 @@ const TagifyInput = forwardRef((props, ref) => {
778
778
  return;
779
779
  const { classList } = DOM?.scope;
780
780
  const { classNames } = settings;
781
+ // Set the input to editable if the input value is empty and readonlyWhenNotEmpty is enabled
782
+ if (readonlyWhenNotEmpty) {
783
+ const isInputEmpty = classList.contains(classNames.empty);
784
+ DOM.input.setAttribute('contenteditable', isInputEmpty ? 'true' : 'false');
785
+ // Not focus the input if the input value is not empty and readonlyWhenNotEmpty is enabled
786
+ if (!isInputEmpty)
787
+ return;
788
+ }
781
789
  if (!classList.contains(classNames.focus) && DOM?.input) {
782
790
  try {
783
- if (readonlyWhenNotEmpty) {
784
- const cleanValue = removeInvisibleChars(tagifyRef.current.getInputValue().trim());
785
- // Set the input to editable if the input value is empty
786
- DOM.input.setAttribute('contenteditable', !cleanValue.length ? 'true' : 'false');
787
- return;
788
- }
789
791
  const { lastChild } = DOM?.input;
790
792
  const isValidLastBRTag = lastChild && lastChild.nodeName === 'BR';
791
793
  const hasEmptyCls = classList.contains(classNames.empty);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.7-beta.13",
3
+ "version": "1.3.7-beta.15",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",