@pdg/react-form 1.0.68 → 1.0.69

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/dist/index.esm.js CHANGED
@@ -7509,7 +7509,7 @@ styleInject(css_248z$c);var FormTextEditor = React__default.forwardRef(function
7509
7509
  // State - FormState -----------------------------------------------------------------------------------------------
7510
7510
  var _c = useAutoUpdateState$1(initFocused == null ? formFocused : initFocused), focused = _c[0], setFocused = _c[1];
7511
7511
  // Ref -------------------------------------------------------------------------------------------------------------
7512
- var editorRef = useRef(null);
7512
+ var editorRef = useRef();
7513
7513
  var keyDownTime = useRef(0);
7514
7514
  // State - value ---------------------------------------------------------------------------------------------------
7515
7515
  var _d = useAutoUpdateState$1(initValue || ''), value = _d[0], setValue = _d[1];
@@ -7528,13 +7528,8 @@ styleInject(css_248z$c);var FormTextEditor = React__default.forwardRef(function
7528
7528
  var _j = useAutoUpdateState$1(initData), data = _j[0], setData = _j[1];
7529
7529
  // Function - focus ------------------------------------------------------------------------------------------------
7530
7530
  var focus = useCallback(function () {
7531
- var _a, _b;
7532
- var textarea = (_b = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.elementRef) === null || _b === void 0 ? void 0 : _b.current;
7533
- if (textarea) {
7534
- textarea.style.display = 'block';
7535
- textarea.focus();
7536
- textarea.style.display = 'none';
7537
- }
7531
+ var _a;
7532
+ (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
7538
7533
  }, [editorRef]);
7539
7534
  // Function - setErrorErrorHelperText -----------------------------------------------------------------------------------
7540
7535
  var setErrorErrorHelperText = useCallback(function (error, errorHelperText) {
@@ -7543,14 +7538,8 @@ styleInject(css_248z$c);var FormTextEditor = React__default.forwardRef(function
7543
7538
  }, [setError]);
7544
7539
  // Function - validate ---------------------------------------------------------------------------------------------
7545
7540
  var validate = useCallback(function (value) {
7546
- var isEmptyValue = false;
7547
- if (value) {
7548
- var d = document.createElement('div');
7549
- d.innerHTML = value;
7550
- var text = d.textContent || d.innerText;
7551
- isEmptyValue = empty(text.trim());
7552
- }
7553
- if (required && (isEmptyValue || empty(value))) {
7541
+ var _a;
7542
+ if (required && empty((_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.getContent())) {
7554
7543
  setErrorErrorHelperText(true, '필수 입력 항목입니다.');
7555
7544
  return false;
7556
7545
  }
@@ -7666,7 +7655,7 @@ styleInject(css_248z$c);var FormTextEditor = React__default.forwardRef(function
7666
7655
  // Render ----------------------------------------------------------------------------------------------------------
7667
7656
  return (React__default.createElement(FormItemBase, { variant: variant, size: size, color: color, focused: focused, className: classNames$1(className, 'FormValueItem', 'FormTextEditor', !initialized && 'initializing'), labelIcon: labelIcon, label: label, error: error, required: required, fullWidth: true, helperText: error ? errorHelperText : helperText, helperTextProps: { style: { marginLeft: 5 } }, style: { width: '100%' }, hidden: hidden, controlHeight: height, control: React__default.createElement(React__default.Fragment, null,
7668
7657
  !initialized ? React__default.createElement(Skeleton, { variant: 'rectangular', width: '100%', height: height }) : null,
7669
- React__default.createElement(Editor, { ref: editorRef, apiKey: apiKey, value: value, disabled: readOnly || disabled, init: {
7658
+ React__default.createElement(Editor, { apiKey: apiKey, value: value, disabled: readOnly || disabled, init: {
7670
7659
  height: height,
7671
7660
  menubar: menubar,
7672
7661
  readonly: true,
@@ -7696,7 +7685,8 @@ styleInject(css_248z$c);var FormTextEditor = React__default.forwardRef(function
7696
7685
  bold italic | align | forecolor backcolor | \
7697
7686
  link image media | advtable | code',
7698
7687
  images_upload_handler: handleImageUpload,
7699
- }, onInit: function () {
7688
+ }, onInit: function (evt, editor) {
7689
+ editorRef.current = editor;
7700
7690
  setTimeout(function () { return setInitialized(true); }, 10);
7701
7691
  }, onEditorChange: handleEditorChange, onKeyDown: handleKeyDown, onFocus: function () { return setFocused(initFocused || true); }, onBlur: function () { return setFocused(initFocused || false); } })) }));
7702
7692
  });