@festo-ui/react 8.2.0-dev.624 → 8.2.0-dev.627
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/lib/forms/text-editor/TextEditor.d.ts +0 -1
- package/lib/forms/text-editor/TextEditor.js +8 -3
- package/lib/forms/text-input/TextInput.d.ts +1 -0
- package/lib/forms/text-input/TextInput.js +5 -2
- package/node/lib/forms/text-editor/TextEditor.js +8 -3
- package/node/lib/forms/text-input/TextInput.js +5 -2
- package/package.json +1 -1
|
@@ -75,8 +75,7 @@ function TextEditor(_ref) {
|
|
|
75
75
|
if (editorRef.current && Quill && editor === null) {
|
|
76
76
|
const newEditor = new Quill(editorRef.current, {
|
|
77
77
|
modules: {
|
|
78
|
-
toolbar: `#editor-toolbar-${CSS.escape(id ?? "")}
|
|
79
|
-
...config.modules
|
|
78
|
+
toolbar: `#editor-toolbar-${CSS.escape(id ?? "")}`
|
|
80
79
|
},
|
|
81
80
|
theme: "snow"
|
|
82
81
|
});
|
|
@@ -96,7 +95,7 @@ function TextEditor(_ref) {
|
|
|
96
95
|
}
|
|
97
96
|
};
|
|
98
97
|
initializeQuill();
|
|
99
|
-
}, [editor, disabled, readOnly, id, setEditorContents, defaultValue
|
|
98
|
+
}, [editor, disabled, readOnly, id, setEditorContents, defaultValue]);
|
|
100
99
|
useEffect(() => {
|
|
101
100
|
if (editor) {
|
|
102
101
|
editor.on("text-change", () => {
|
|
@@ -104,6 +103,12 @@ function TextEditor(_ref) {
|
|
|
104
103
|
if (html === "<p><br></p>" || html === "<div><br></div>" || html === undefined) {
|
|
105
104
|
html = null;
|
|
106
105
|
}
|
|
106
|
+
if (html !== null) {
|
|
107
|
+
// Repairs relative links in an HTML string by prepending "https://".
|
|
108
|
+
// It ignores links that are already absolute (http, https) as well as mailto: and tel: links.
|
|
109
|
+
const relativeLinkRegex = /href="(?!https?:\/\/|mailto:|tel:)([^"]+)"/g;
|
|
110
|
+
html = html.replace(relativeLinkRegex, 'href="https://$1"');
|
|
111
|
+
}
|
|
107
112
|
if (onChange) {
|
|
108
113
|
onChange(html);
|
|
109
114
|
}
|
|
@@ -16,6 +16,7 @@ interface TextInputProps {
|
|
|
16
16
|
hint?: string;
|
|
17
17
|
error?: string;
|
|
18
18
|
labelClassName?: string;
|
|
19
|
+
icon?: React.ReactNode;
|
|
19
20
|
}
|
|
20
21
|
declare const TextInput: (props: TextInputProps & React.HTMLProps<HTMLInputElement> & React.RefAttributes<HTMLLabelElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
21
22
|
export default TextInput;
|
|
@@ -20,6 +20,7 @@ const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
20
20
|
hint,
|
|
21
21
|
label,
|
|
22
22
|
labelClassName,
|
|
23
|
+
icon,
|
|
23
24
|
id: idProps,
|
|
24
25
|
...props
|
|
25
26
|
} = _ref;
|
|
@@ -30,7 +31,9 @@ const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
30
31
|
}, [value]);
|
|
31
32
|
const supported = ["text", "number", "password", "datetime-local"];
|
|
32
33
|
const innerType = type && supported.indexOf(type) !== -1 ? type : "text";
|
|
33
|
-
const labelClasses = classNames("fwe-input-text",
|
|
34
|
+
const labelClasses = classNames("fwe-input-text", {
|
|
35
|
+
"fwe-input-text-icon": icon
|
|
36
|
+
}, labelClassName);
|
|
34
37
|
const hintClasses = classNames("fwe-input-text-info");
|
|
35
38
|
function handleChange(e) {
|
|
36
39
|
setInnerValue(e.target.value);
|
|
@@ -59,7 +62,7 @@ const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
59
62
|
value: innerValue,
|
|
60
63
|
id: id,
|
|
61
64
|
...props
|
|
62
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
65
|
+
}), icon, /*#__PURE__*/_jsx("span", {
|
|
63
66
|
className: "fwe-input-text-label",
|
|
64
67
|
children: label
|
|
65
68
|
}), hint && /*#__PURE__*/_jsx("span", {
|
|
@@ -84,8 +84,7 @@ function TextEditor(_ref) {
|
|
|
84
84
|
if (editorRef.current && Quill && editor === null) {
|
|
85
85
|
const newEditor = new Quill(editorRef.current, {
|
|
86
86
|
modules: {
|
|
87
|
-
toolbar: `#editor-toolbar-${CSS.escape(id ?? "")}
|
|
88
|
-
...config.modules
|
|
87
|
+
toolbar: `#editor-toolbar-${CSS.escape(id ?? "")}`
|
|
89
88
|
},
|
|
90
89
|
theme: "snow"
|
|
91
90
|
});
|
|
@@ -105,7 +104,7 @@ function TextEditor(_ref) {
|
|
|
105
104
|
}
|
|
106
105
|
};
|
|
107
106
|
initializeQuill();
|
|
108
|
-
}, [editor, disabled, readOnly, id, setEditorContents, defaultValue
|
|
107
|
+
}, [editor, disabled, readOnly, id, setEditorContents, defaultValue]);
|
|
109
108
|
(0, _react.useEffect)(() => {
|
|
110
109
|
if (editor) {
|
|
111
110
|
editor.on("text-change", () => {
|
|
@@ -113,6 +112,12 @@ function TextEditor(_ref) {
|
|
|
113
112
|
if (html === "<p><br></p>" || html === "<div><br></div>" || html === undefined) {
|
|
114
113
|
html = null;
|
|
115
114
|
}
|
|
115
|
+
if (html !== null) {
|
|
116
|
+
// Repairs relative links in an HTML string by prepending "https://".
|
|
117
|
+
// It ignores links that are already absolute (http, https) as well as mailto: and tel: links.
|
|
118
|
+
const relativeLinkRegex = /href="(?!https?:\/\/|mailto:|tel:)([^"]+)"/g;
|
|
119
|
+
html = html.replace(relativeLinkRegex, 'href="https://$1"');
|
|
120
|
+
}
|
|
116
121
|
if (onChange) {
|
|
117
122
|
onChange(html);
|
|
118
123
|
}
|
|
@@ -29,6 +29,7 @@ const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
29
29
|
hint,
|
|
30
30
|
label,
|
|
31
31
|
labelClassName,
|
|
32
|
+
icon,
|
|
32
33
|
id: idProps,
|
|
33
34
|
...props
|
|
34
35
|
} = _ref;
|
|
@@ -39,7 +40,9 @@ const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
39
40
|
}, [value]);
|
|
40
41
|
const supported = ["text", "number", "password", "datetime-local"];
|
|
41
42
|
const innerType = type && supported.indexOf(type) !== -1 ? type : "text";
|
|
42
|
-
const labelClasses = (0, _classnames.default)("fwe-input-text",
|
|
43
|
+
const labelClasses = (0, _classnames.default)("fwe-input-text", {
|
|
44
|
+
"fwe-input-text-icon": icon
|
|
45
|
+
}, labelClassName);
|
|
43
46
|
const hintClasses = (0, _classnames.default)("fwe-input-text-info");
|
|
44
47
|
function handleChange(e) {
|
|
45
48
|
setInnerValue(e.target.value);
|
|
@@ -68,7 +71,7 @@ const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
68
71
|
value: innerValue,
|
|
69
72
|
id: id,
|
|
70
73
|
...props
|
|
71
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
74
|
+
}), icon, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
72
75
|
className: "fwe-input-text-label",
|
|
73
76
|
children: label
|
|
74
77
|
}), hint && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
package/package.json
CHANGED