@startlibs/form 1.0.0-alpha-9z → 1.0.0-alpha-10a

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.
Files changed (2) hide show
  1. package/lib/index.js +27 -12
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -5410,7 +5410,10 @@ var RichText = function RichText(_ref5) {
5410
5410
  helpText = _ref5.helpText,
5411
5411
  linkColor = _ref5.linkColor,
5412
5412
  _ref5$tabIndex = _ref5.tabIndex,
5413
- tabIndex = _ref5$tabIndex === void 0 ? 1 : _ref5$tabIndex;
5413
+ tabIndex = _ref5$tabIndex === void 0 ? 1 : _ref5$tabIndex,
5414
+ value = _ref5.value,
5415
+ setValue = _ref5.setValue,
5416
+ raw = _ref5.raw;
5414
5417
  var linkPopup = core.usePopupToggle();
5415
5418
  var input = core.useEnsureRef(inputRef);
5416
5419
  var activeLinkNode = React.useRef();
@@ -5422,21 +5425,34 @@ var RichText = function RichText(_ref5) {
5422
5425
  var commands = core.useRefState([]);
5423
5426
  var containerFocused = core.useToggle();
5424
5427
  var needsNormalize = core.useRefState();
5425
- var alreadyCancelled = core.useRefState();
5428
+ var alreadyCancelled = core.useRefState(); // const [formValue, setFormValue] = useInput({path})
5426
5429
 
5427
5430
  var _useInput = useInput({
5428
- path: path
5429
- }),
5430
- _useInput2 = _slicedToArray(_useInput, 2),
5431
+ path: path,
5432
+ value: value,
5433
+ setValue: setValue
5434
+ }, raw),
5435
+ _useInput2 = _slicedToArray(_useInput, 3),
5431
5436
  formValue = _useInput2[0],
5432
- setFormValue = _useInput2[1];
5437
+ setFormValue = _useInput2[1],
5438
+ hasErrors = _useInput2[2].hasErrors; // const tempValue = useConstant(formValue)
5433
5439
 
5434
- var tempValue = core.useConstant(formValue);
5435
5440
 
5436
- var _useState = React.useState({}),
5441
+ var _useState = React.useState(formValue),
5437
5442
  _useState2 = _slicedToArray(_useState, 2),
5438
- activatedTools = _useState2[0],
5439
- setActivatedTools = _useState2[1];
5443
+ tempValue = _useState2[0],
5444
+ setTempValue = _useState2[1];
5445
+
5446
+ React.useEffect(function () {
5447
+ if (value === formValue && formValue !== tempValue) {
5448
+ setTempValue(formValue);
5449
+ }
5450
+ }, [path]);
5451
+
5452
+ var _useState3 = React.useState({}),
5453
+ _useState4 = _slicedToArray(_useState3, 2),
5454
+ activatedTools = _useState4[0],
5455
+ setActivatedTools = _useState4[1];
5440
5456
 
5441
5457
  var validElements = core.useLazyConstant(function () {
5442
5458
  return ['br', 'div', 'p', 'span'].concat(_flatten(formatTools.map(function (tool) {
@@ -5472,8 +5488,7 @@ var RichText = function RichText(_ref5) {
5472
5488
  };
5473
5489
 
5474
5490
  var containerBlur = function containerBlur(e) {
5475
- console.log(e.target, e.currentTarget);
5476
-
5491
+ // console.log(e.target,e.currentTarget)
5477
5492
  if (containerFocused.isOpen !== 1) {
5478
5493
  containerFocused.close();
5479
5494
  triggerScrollForPanel(Date.now());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startlibs/form",
3
- "version": "1.0.0-alpha-9z",
3
+ "version": "1.0.0-alpha-10a",
4
4
  "description": "Startlibs Form",
5
5
  "main": "lib/index.js",
6
6
  "sideEffects": false,