Skip to content

Commit ec032b4

Browse files
committed
Remove forward referencing for simplicity
1 parent b696f25 commit ec032b4

File tree

9 files changed

+39
-69
lines changed

9 files changed

+39
-69
lines changed

dist/components/form/Form.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ declare const Form: {
1818
({ type, className, ...rest }: import("./components/FormCheck").FormCheckProps): React.JSX.Element;
1919
Feedback: import("react-bootstrap/esm/helpers").BsPrefixRefForwardingComponent<"div", import("react-bootstrap/esm/Feedback").FeedbackProps>;
2020
};
21-
RichText: React.ForwardRefExoticComponent<import("./components/FormRichText").QuillEditorProps & React.RefAttributes<import("quill/core/quill").default>>;
21+
RichText: ({ modules, value, valueChange, ...rest }: import("./components/FormRichText").QuillEditorProps) => React.JSX.Element;
2222
DateTime: {
2323
({ className, ...rest }: import("./components/FormDateTime").FormDateTimeProps): React.JSX.Element;
2424
Feedback: import("react-bootstrap/esm/helpers").BsPrefixRefForwardingComponent<"div", import("react-bootstrap/esm/Feedback").FeedbackProps>;
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React, { CSSProperties } from 'react';
2-
import Quill from 'quill';
32
export interface QuillEditorProps {
43
className?: string;
54
style?: CSSProperties;
65
id?: string;
76
modules?: Record<string, unknown>;
8-
valueChange?(value: string): any;
97
value?: string;
8+
valueChange?(value: string): any;
109
}
11-
declare const _default: React.ForwardRefExoticComponent<QuillEditorProps & React.RefAttributes<Quill>>;
12-
export default _default;
10+
declare const FormRichText: ({ modules, value, valueChange, ...rest }: QuillEditorProps) => React.JSX.Element;
11+
export default FormRichText;
1312
//# sourceMappingURL=FormRichText.d.ts.map

dist/components/form/components/FormRichText.d.ts.map

+1-1
Original file line numberDiff line numberDiff line change

dist/components/form/components/FormRichText.js

+6-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/components/form/components/FormRichText.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.es.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

+5-13
Original file line numberDiff line numberDiff line change
@@ -25531,7 +25531,7 @@ Quill.register({
2553125531
'ui/tooltip': Tooltip
2553225532
}, true);
2553325533

25534-
var FormRichText = function (_a, ref) {
25534+
var FormRichText = function (_a) {
2553525535
var modules = _a.modules, value = _a.value, valueChange = _a.valueChange, rest = __rest(_a, ["modules", "value", "valueChange"]);
2553625536
var editorRef = React.useRef(null);
2553725537
var quillRef = React.useRef(null);
@@ -25551,22 +25551,14 @@ var FormRichText = function (_a, ref) {
2555125551
if (editorRef.current) {
2555225552
var quill = new Quill(editorRef.current, modules);
2555325553
quillRef.current = quill; // Store the Quill instance in a ref
25554-
if (ref) {
25555-
// Assign the Quill instance to the forwarded ref
25556-
if (typeof ref !== 'function') {
25557-
ref.current = quill; // For object refs
25558-
}
25559-
if (value) {
25560-
setValue(quill);
25561-
}
25562-
configureListeners(quill);
25554+
if (value) {
25555+
setValue(quill);
2556325556
}
25557+
configureListeners(quill);
2556425558
}
2556525559
}, []);
25566-
React.useImperativeHandle(ref, function () { return quillRef.current; });
2556725560
return React.createElement("div", { ref: editorRef, style: rest.style, id: rest.id });
2556825561
};
25569-
var FormRichText$1 = React.forwardRef(FormRichText);
2557025562

2557125563
var FormDateTime = function (_a) {
2557225564
var className = _a.className, rest = __rest(_a, ["className"]);
@@ -29211,7 +29203,7 @@ Form$1.Label = FormLabel;
2921129203
Form$1.Control = FormControl;
2921229204
Form$1.Select = FormSelect;
2921329205
Form$1.Check = FormCheck;
29214-
Form$1.RichText = FormRichText$1;
29206+
Form$1.RichText = FormRichText;
2921529207
Form$1.DateTime = FormDateTime;
2921629208
Form$1.Feedback = Feedback$1;
2921729209
Form$1.Text = FormText$1;

dist/index.min.js

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
import React, {
2-
useEffect,
3-
useRef,
4-
useImperativeHandle,
5-
forwardRef,
6-
ForwardedRef,
7-
CSSProperties,
8-
} from 'react';
1+
import React, { useRef, CSSProperties, useEffect } from 'react';
92
import Quill from 'quill';
103

114
export interface QuillEditorProps {
125
className?: string;
136
style?: CSSProperties;
147
id?: string;
158
modules?: Record<string, unknown>;
16-
valueChange?(value: string): any;
179
value?: string;
10+
11+
valueChange?(value: string): any;
1812
}
1913

20-
const FormRichText: React.ForwardRefRenderFunction<Quill, QuillEditorProps> = (
21-
{ modules, value, valueChange, ...rest }: QuillEditorProps,
22-
ref: ForwardedRef<Quill>
23-
) => {
14+
const FormRichText = ({
15+
modules,
16+
value,
17+
valueChange,
18+
...rest
19+
}: QuillEditorProps) => {
2420
const editorRef = useRef<HTMLDivElement | null>(null);
2521
const quillRef = useRef<Quill | null>(null);
2622

@@ -42,23 +38,13 @@ const FormRichText: React.ForwardRefRenderFunction<Quill, QuillEditorProps> = (
4238
const quill = new Quill(editorRef.current, modules);
4339
quillRef.current = quill; // Store the Quill instance in a ref
4440

45-
if (ref) {
46-
// Assign the Quill instance to the forwarded ref
47-
if (typeof ref !== 'function') {
48-
ref.current = quill; // For object refs
49-
}
50-
51-
if (value) {
52-
setValue(quill);
53-
}
54-
configureListeners(quill);
41+
if (value) {
42+
setValue(quill);
5543
}
44+
configureListeners(quill);
5645
}
5746
}, []);
5847

59-
useImperativeHandle(ref, () => quillRef.current as Quill);
60-
6148
return <div ref={editorRef} style={rest.style} id={rest.id} />;
6249
};
63-
64-
export default forwardRef(FormRichText);
50+
export default FormRichText;

0 commit comments

Comments
 (0)