Skip to content

Commit

Permalink
window key updated
Browse files Browse the repository at this point in the history
  • Loading branch information
santushnath committed Jul 4, 2024
1 parent 1c6e831 commit d605c0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/MailUiEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useEditorOptions from "../hooks/useEditorOptions";
import useEditorInitialization from "../hooks/useEditorInitialization";
import useEventHandlers from "../hooks/useEventHandlers";

window.__mailui_newEditorId = window.__mailui_newEditorId || 0;
// window.__mailui_newEditorId = window.__mailui_newEditorId || 0;

const MailUiEditor = React.forwardRef<MailUiEditorRef, MailUiEditorProps>(
(props, ref) => {
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useEditorId.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {MailUiEditorProps} from "../MailUiEditor";
import {useMemo} from "react";

const clientWindow = typeof window === 'undefined' ? { __mailui_newEditorId: 0 } : window
clientWindow.__mailui_newEditorId = clientWindow.__mailui_newEditorId || 0;

const useEditorId = (props: MailUiEditorProps) => {
return useMemo(() => {
return props.editorId || `editor-${++window.__mailui_newEditorId}`
Expand Down

0 comments on commit d605c0f

Please sign in to comment.