Skip to content

Commit

Permalink
include optional debug prop to silence module import notifications in…
Browse files Browse the repository at this point in the history
… the console
  • Loading branch information
Jamie-n committed Jun 19, 2024
1 parent af8aee7 commit 15efd71
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion dist/components/form/Form.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare const Form: {
({ type, className, ...rest }: import("./components/FormCheck").FormCheckProps): React.JSX.Element;
Feedback: import("react-bootstrap/esm/helpers").BsPrefixRefForwardingComponent<"div", import("react-bootstrap/esm/Feedback").FeedbackProps>;
};
RichText: ({ modules, value, onChange, theme, importCallback, ...rest }: import("./components/FormRichText").QuillEditorProps) => React.JSX.Element;
RichText: ({ modules, value, onChange, theme, importCallback, debug, ...rest }: import("./components/FormRichText").QuillEditorProps) => React.JSX.Element;
DateTime: {
({ className, ...rest }: import("./components/FormDateTime").FormDateTimeProps): React.JSX.Element;
Feedback: import("react-bootstrap/esm/helpers").BsPrefixRefForwardingComponent<"div", import("react-bootstrap/esm/Feedback").FeedbackProps>;
Expand Down
3 changes: 2 additions & 1 deletion dist/components/form/components/FormRichText.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ export interface QuillEditorProps {
modules?: Record<string, unknown>;
value?: string;
theme?: string;
debug?: boolean;
onChange?(value: string): any;
importCallback?(): any;
}
declare const FormRichText: ({ modules, value, onChange, theme, importCallback, ...rest }: QuillEditorProps) => React.JSX.Element;
declare const FormRichText: ({ modules, value, onChange, theme, importCallback, debug, ...rest }: QuillEditorProps) => React.JSX.Element;
export default FormRichText;
//# sourceMappingURL=FormRichText.d.ts.map
2 changes: 1 addition & 1 deletion dist/components/form/components/FormRichText.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions dist/components/form/components/FormRichText.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/components/form/components/FormRichText.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.es.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25532,9 +25532,11 @@ Quill.register({
}, true);

var FormRichText = function (_a) {
var modules = _a.modules, value = _a.value, onChange = _a.onChange, theme = _a.theme, importCallback = _a.importCallback, rest = __rest(_a, ["modules", "value", "onChange", "theme", "importCallback"]);
var modules = _a.modules, value = _a.value, onChange = _a.onChange, theme = _a.theme, importCallback = _a.importCallback, debug = _a.debug, rest = __rest(_a, ["modules", "value", "onChange", "theme", "importCallback", "debug"]);
var quillRef = React.useRef(null);
var containerRef = React.useRef(null);
//Set debug mode, false results in no output.
Quill.debug(debug || false);
var quillOptions = __assign(__assign({}, modules), { theme: theme || 'snow' });
var setValue = function (quillRef) {
var delta = quillRef.clipboard.convert({ html: value });
Expand All @@ -25550,10 +25552,8 @@ var FormRichText = function (_a) {
};
React.useEffect(function () {
if (containerRef.current) {
console.log(importCallback);
if (importCallback) {
console.log("import callback called");
// Callback to import new modules into quill, needs to be done within the same instance as the quill object.
//Callback to import new modules into quill, needs to be done within the same instance as the quill object.
importCallback();
}
var container_1 = containerRef.current;
Expand All @@ -25572,7 +25572,7 @@ var FormRichText = function (_a) {
// NOTE: Run effect once on component mount, please recheck dependencies if effect is updated.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (React.createElement("div", { ref: containerRef, style: rest.style, id: rest.id, className: rest.className }));
return React.createElement("div", { ref: containerRef, style: rest.style, id: rest.id, className: rest.className });
};

var FormDateTime = function (_a) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.min.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions src/components/form/components/FormRichText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface QuillEditorProps {
modules?: Record<string, unknown>;
value?: string;
theme?: string;
debug?: boolean;

onChange?(value: string): any;
importCallback?(): any;
Expand All @@ -20,11 +21,15 @@ const FormRichText = ({
onChange,
theme,
importCallback,
debug,
...rest
}: QuillEditorProps) => {
const quillRef = useRef<Quill | null>(null);
const containerRef = useRef<HTMLDivElement>(null);

// Set debug mode, false results in no output.
Quill.debug(debug || false);

const quillOptions = {
...modules,
theme: theme || 'snow',
Expand All @@ -45,9 +50,7 @@ const FormRichText = ({

useEffect(() => {
if (containerRef.current) {
console.log(importCallback);
if (importCallback) {
console.log('import callback called');
// Callback to import new modules into quill, needs to be done within the same instance as the quill object.
importCallback();
}
Expand Down

0 comments on commit 15efd71

Please sign in to comment.