@arquimedes.co/eureka-forms 0.2.17-test → 0.2.18-test
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.
|
@@ -20,10 +20,9 @@ import { convertFromRaw, EditorState } from 'draft-js';
|
|
|
20
20
|
import { useState } from 'react';
|
|
21
21
|
import { ClickAwayListener } from '@material-ui/core';
|
|
22
22
|
function TextAreaStep(_a) {
|
|
23
|
-
var _b;
|
|
24
23
|
var step = _a.step, errors = _a.errors, control = _a.control, postview = _a.postview, formStyle = _a.formStyle, originalValues = _a.originalValues;
|
|
25
|
-
var
|
|
26
|
-
var
|
|
24
|
+
var _b = useState(false), hovering = _b[0], setHovering = _b[1];
|
|
25
|
+
var _c = useState(false), focus = _c[0], setFocus = _c[1];
|
|
27
26
|
var calcStyle = function () {
|
|
28
27
|
if (focus) {
|
|
29
28
|
return {
|
|
@@ -40,6 +39,20 @@ function TextAreaStep(_a) {
|
|
|
40
39
|
return { border: '1px solid ' + formStyle.outlineColor };
|
|
41
40
|
}
|
|
42
41
|
};
|
|
42
|
+
var calcDefaultValue = function () {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if ((_a = originalValues[step.id]) === null || _a === void 0 ? void 0 : _a.draft) {
|
|
45
|
+
(_b = originalValues[step.id]) === null || _b === void 0 ? void 0 : _b.draft;
|
|
46
|
+
var converted = convertFromRaw(originalValues[step.id].draft);
|
|
47
|
+
console.log(converted);
|
|
48
|
+
var test_1 = EditorState.createWithContent(converted);
|
|
49
|
+
console.log(test_1);
|
|
50
|
+
return test_1;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return EditorState.createEmpty();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
43
56
|
if (step.hasTextEditor) {
|
|
44
57
|
return (_jsxs("div", __assign({ className: styles.textEditorContainer, style: {
|
|
45
58
|
'--eureka-outline': formStyle.outlineColor,
|
|
@@ -64,9 +77,7 @@ function TextAreaStep(_a) {
|
|
|
64
77
|
if (!postview) {
|
|
65
78
|
setFocus(true);
|
|
66
79
|
}
|
|
67
|
-
} }, { children: [postview && (_jsx("div", { className: styles.disabledCurtain }, void 0)), _jsx(Controller, { name: step.id, control: control, defaultValue: (
|
|
68
|
-
? EditorState.createWithContent(convertFromRaw(originalValues[step.id].draft))
|
|
69
|
-
: EditorState.createEmpty(), rules: step.required
|
|
80
|
+
} }, { children: [postview && (_jsx("div", { className: styles.disabledCurtain }, void 0)), _jsx(Controller, { name: step.id, control: control, defaultValue: calcDefaultValue(), rules: step.required
|
|
70
81
|
? {
|
|
71
82
|
validate: function (editorState) {
|
|
72
83
|
return editorState
|
package/package.json
CHANGED