Skip to content

Commit

Permalink
fix: use target id to get the div
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-work committed Aug 13, 2024
1 parent bfa12a1 commit a983d3a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/shared/Buttons/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ button:disabled {
border: 1px solid #eee;
}

.button-text:active {
.button-text:active:not(:disabled) {
background-color: #eee;
color: #0d0d0d !important;
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class GooeyEmbedFactory {
}
const innerDiv = document.createElement("div");
innerDiv.style.display = "contents";
innerDiv.className = "inner-div";
if(targetElem.children.length > 0) targetElem.removeChild(targetElem.children[0]);
targetElem.appendChild(innerDiv);
const root = renderCopilotChatWidget(innerDiv, config);
Expand Down
5 changes: 3 additions & 2 deletions src/widgets/copilot/components/widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ type CopilotWidgetType = {
};

const CopilotWidget: FC<CopilotWidgetType> = ({ isInline }) => {
const { isExpanded }: SystemContextType = useSystemContext();
const { isExpanded, config }: SystemContextType = useSystemContext();
const { flushData, cancelApiCall }: any = useMessagesContext();
const handleEditClick = () => {
cancelApiCall();
flushData();
const shadowRoot = document.getElementById(isInline ? "inline" : "popup")?.getElementsByClassName("inner-div")[0]?.shadowRoot;
const shadowRoot = document.querySelector((config?.target || "") as string)
?.firstElementChild?.shadowRoot;
const ele = shadowRoot?.getElementById(CHAT_INPUT_ID);
ele?.focus();
};
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function CopilotChatWidget({ config }: { config?: any }) {
}

export function renderCopilotChatWidget(elem: Element, config?: any) {
const shadow = elem.attachShadow({ mode: "open", delegatesFocus: true});
const shadow = elem.attachShadow({ mode: "open", delegatesFocus: true });
const root = ReactDOM.createRoot(shadow);
root.render(
<React.StrictMode>
Expand Down

0 comments on commit a983d3a

Please sign in to comment.