@hw-component/form 1.10.30 → 1.10.31
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/RichEditor/hooks.js
CHANGED
|
@@ -56,10 +56,6 @@ var useVC = function useVC(_ref3) {
|
|
|
56
56
|
var richValue = valueType === "html" ? BraftEditor.createEditorState(value) : value;
|
|
57
57
|
var change = function change(editorState) {
|
|
58
58
|
var changeVal = valueType === "html" ? editorState.toHTML() : editorState;
|
|
59
|
-
var isEmpty = !!richValue ? richValue.isEmpty() : true;
|
|
60
|
-
if (isEmpty && editorState.isEmpty()) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
59
|
onChange === null || onChange === void 0 || onChange(changeVal);
|
|
64
60
|
};
|
|
65
61
|
return {
|
|
@@ -76,10 +72,9 @@ var useUploadFn = function useUploadFn(_ref4) {
|
|
|
76
72
|
while (1) switch (_context.prev = _context.next) {
|
|
77
73
|
case 0:
|
|
78
74
|
file = params.file, id = params.id;
|
|
79
|
-
|
|
80
|
-
_context.next = 4;
|
|
75
|
+
_context.next = 3;
|
|
81
76
|
return fileRequest === null || fileRequest === void 0 ? void 0 : fileRequest(file, params);
|
|
82
|
-
case
|
|
77
|
+
case 3:
|
|
83
78
|
_yield$fileRequest = _context.sent;
|
|
84
79
|
url = _yield$fileRequest.url;
|
|
85
80
|
params.success({
|
|
@@ -94,7 +89,7 @@ var useUploadFn = function useUploadFn(_ref4) {
|
|
|
94
89
|
poster: url
|
|
95
90
|
}
|
|
96
91
|
});
|
|
97
|
-
case
|
|
92
|
+
case 6:
|
|
98
93
|
case "end":
|
|
99
94
|
return _context.stop();
|
|
100
95
|
}
|
package/lib/RichEditor/hooks.js
CHANGED
|
@@ -57,10 +57,6 @@ var useVC = function useVC(_ref3) {
|
|
|
57
57
|
var richValue = valueType === "html" ? BraftEditor.createEditorState(value) : value;
|
|
58
58
|
var change = function change(editorState) {
|
|
59
59
|
var changeVal = valueType === "html" ? editorState.toHTML() : editorState;
|
|
60
|
-
var isEmpty = !!richValue ? richValue.isEmpty() : true;
|
|
61
|
-
if (isEmpty && editorState.isEmpty()) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
60
|
onChange === null || onChange === void 0 || onChange(changeVal);
|
|
65
61
|
};
|
|
66
62
|
return {
|
|
@@ -77,10 +73,9 @@ var useUploadFn = function useUploadFn(_ref4) {
|
|
|
77
73
|
while (1) switch (_context.prev = _context.next) {
|
|
78
74
|
case 0:
|
|
79
75
|
file = params.file, id = params.id;
|
|
80
|
-
|
|
81
|
-
_context.next = 4;
|
|
76
|
+
_context.next = 3;
|
|
82
77
|
return fileRequest === null || fileRequest === void 0 ? void 0 : fileRequest(file, params);
|
|
83
|
-
case
|
|
78
|
+
case 3:
|
|
84
79
|
_yield$fileRequest = _context.sent;
|
|
85
80
|
url = _yield$fileRequest.url;
|
|
86
81
|
params.success({
|
|
@@ -95,7 +90,7 @@ var useUploadFn = function useUploadFn(_ref4) {
|
|
|
95
90
|
poster: url
|
|
96
91
|
}
|
|
97
92
|
});
|
|
98
|
-
case
|
|
93
|
+
case 6:
|
|
99
94
|
case "end":
|
|
100
95
|
return _context.stop();
|
|
101
96
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { useFormConfigContext } from "../Form/Context/FormConfigProvider";
|
|
|
2
2
|
import { baseConfig } from "../config";
|
|
3
3
|
import type { IHRichEditorProps } from "src/components/RichEditor/modal";
|
|
4
4
|
import { useClassName } from "../hooks";
|
|
5
|
-
import {
|
|
5
|
+
import { useState } from "react";
|
|
6
6
|
import type { EditorState } from "braft-editor";
|
|
7
7
|
import BraftEditor from "braft-editor";
|
|
8
8
|
|
|
@@ -46,15 +46,9 @@ export const useFocusClassname = ({
|
|
|
46
46
|
|
|
47
47
|
export const useVC = ({ value, onChange, valueType }: IHRichEditorProps) => {
|
|
48
48
|
const richValue: EditorState | undefined =
|
|
49
|
-
valueType === "html"
|
|
50
|
-
? BraftEditor.createEditorState(value)
|
|
51
|
-
: (value as EditorState);
|
|
49
|
+
valueType === "html" ? BraftEditor.createEditorState(value) : (value as EditorState);
|
|
52
50
|
const change = (editorState) => {
|
|
53
51
|
const changeVal = valueType === "html" ? editorState.toHTML() : editorState;
|
|
54
|
-
const isEmpty = !!richValue ? richValue.isEmpty() : true;
|
|
55
|
-
if (isEmpty && editorState.isEmpty()) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
52
|
onChange?.(changeVal);
|
|
59
53
|
};
|
|
60
54
|
return {
|
|
@@ -66,7 +60,6 @@ export const useVC = ({ value, onChange, valueType }: IHRichEditorProps) => {
|
|
|
66
60
|
export const useUploadFn = ({ fileRequest }: IHRichEditorProps) => {
|
|
67
61
|
return async (params) => {
|
|
68
62
|
const { file, id } = params;
|
|
69
|
-
console.log(params,"pppppp")
|
|
70
63
|
const { url } = await fileRequest?.(file, params);
|
|
71
64
|
params.success({
|
|
72
65
|
url,
|
|
@@ -49,7 +49,7 @@ const Index: React.ForwardRefRenderFunction<any, IHRichEditorProps> = (
|
|
|
49
49
|
inputValue: (item, initValue) => {
|
|
50
50
|
const { name = "" } = item;
|
|
51
51
|
const keyName = name as string;
|
|
52
|
-
|
|
52
|
+
const itemVal = initValue[keyName];
|
|
53
53
|
const initVal =
|
|
54
54
|
typeof itemVal === "string"
|
|
55
55
|
? BraftEditor.createEditorState(itemVal)
|