Skip to content

Commit 04cd312

Browse files
committed
Merge branch 'release/1.1.1'
2 parents d0dc1e4 + 839506a commit 04cd312

File tree

9 files changed

+512
-189
lines changed

9 files changed

+512
-189
lines changed

β€Žclient/src/features/ai/AIModal.style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const loadingOverlay = css({
4848
display: "flex",
4949
zIndex: 10,
5050
position: "absolute",
51-
top: 0,
51+
top: "50%",
5252
left: 0,
5353
right: 0,
5454
bottom: 0,

β€Žclient/src/features/ai/AIModal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ export const AIModal = ({ onCloseButton }: { onCloseButton: () => void }) => {
4949
className={style.inputBox}
5050
disabled={isLoading}
5151
/>
52-
{isLoading && (
52+
</div>
53+
<div className={style.iconBox} onClick={!isLoading ? handleSubmit : undefined}>
54+
{isLoading ? (
5355
<div className={style.loadingOverlay}>
5456
<LoadingSpinner size={50} />
5557
</div>
58+
) : (
59+
<FaLocationArrow />
5660
)}
5761
</div>
58-
<div className={style.iconBox} onClick={!isLoading ? handleSubmit : undefined}>
59-
{isLoading && <div className={style.loadingOverlay}></div>}
60-
<FaLocationArrow />
61-
</div>
6262
</div>
6363
</div>
6464
</motion.div>

β€Žclient/src/features/editor/components/block/Block.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export const Block: React.FC<BlockProps> = memo(
288288
if (blockRef.current) {
289289
setInnerHTML({ element: blockRef.current, block });
290290
}
291-
}, [getTextAndStylesHash(block)]);
291+
}, [virtualIndex, getTextAndStylesHash(block)]);
292292

293293
// useEffect(() => {
294294
// console.log(block.crdt);

β€Žclient/src/features/editor/utils/domSyncUtils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ const getClassNames = (state: TextStyleState): string => {
6060
};
6161
export const setInnerHTML = ({ element, block }: SetInnerHTMLProps): void => {
6262
const chars = block.crdt.LinkedList.spread();
63+
64+
let caretNode: Node | undefined;
65+
6366
const selection = window.getSelection();
64-
const range = selection?.getRangeAt(0);
65-
let caretNode = range?.startContainer;
67+
if (selection && selection.rangeCount > 0) {
68+
const range = selection.getRangeAt(0);
69+
caretNode = range.startContainer;
70+
}
6671

6772
if (chars.length === 0) {
6873
while (element.firstChild) {

β€Žclient/src/features/workSpace/components/OnboardingOverlay.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { motion } from "framer-motion";
2-
import { useState, useEffect } from "react";
2+
import { useState, useEffect, useRef } from "react";
33
import CloseIcon from "@assets/icons/close.svg?react";
44
import {
55
overlayContainer,
@@ -28,7 +28,7 @@ interface OnboardingOverlayProps {
2828
export const OnboardingOverlay = ({ isShow }: OnboardingOverlayProps) => {
2929
const [isVisible, setIsVisible] = useState(false);
3030
const [currentStep, setCurrentStep] = useState(0);
31-
31+
const overlayRef = useRef<HTMLDivElement>(null);
3232
const steps: Step[] = [
3333
{
3434
target: '[data-onboarding="menu-button"]',
@@ -69,7 +69,6 @@ export const OnboardingOverlay = ({ isShow }: OnboardingOverlayProps) => {
6969
];
7070
useEffect(() => {
7171
const hasCompletedOnboarding = sessionStorage.getItem("hasCompletedOnboarding");
72-
7372
if (isShow && hasCompletedOnboarding === null) {
7473
// μš”μ†Œλ“€μ΄ λ Œλ”λ§λ  μ‹œκ°„μ„ μ£ΌκΈ° μœ„ν•΄ μ•½κ°„μ˜ λ”œλ ˆμ΄ μΆ”κ°€
7574
const timer = setTimeout(() => {
@@ -80,6 +79,16 @@ export const OnboardingOverlay = ({ isShow }: OnboardingOverlayProps) => {
8079
}
8180
}, [isShow]);
8281

82+
useEffect(() => {
83+
if (isVisible) {
84+
const focusTimer = setTimeout(() => {
85+
overlayRef.current?.focus();
86+
}, 50);
87+
88+
return () => clearTimeout(focusTimer);
89+
}
90+
}, [isVisible]);
91+
8392
const handleClose = () => {
8493
if (currentStep < steps.length - 1) {
8594
setCurrentStep((prev) => prev + 1);
@@ -88,6 +97,11 @@ export const OnboardingOverlay = ({ isShow }: OnboardingOverlayProps) => {
8897
sessionStorage.setItem("hasCompletedOnboarding", "true");
8998
}
9099
};
100+
const handleEnter = (e: React.KeyboardEvent<HTMLDivElement>) => {
101+
if (e.key === "Enter") {
102+
handleClose();
103+
}
104+
};
91105
const handlePrevious = () => {
92106
if (currentStep > 0) {
93107
setCurrentStep((prev) => prev - 1);
@@ -145,10 +159,13 @@ export const OnboardingOverlay = ({ isShow }: OnboardingOverlayProps) => {
145159

146160
return (
147161
<motion.div
162+
ref={overlayRef}
163+
tabIndex={0}
148164
initial={{ opacity: 0 }}
149165
animate={{ opacity: 1 }}
150166
exit={{ opacity: 0 }}
151167
className={overlayContainer}
168+
onKeyDown={(e) => handleEnter(e)}
152169
>
153170
{targetPosition && (
154171
<motion.div

β€Žclient/src/features/workSpace/hooks/usePagesManage.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export const usePagesManage = (workspace: WorkSpace | null, clientId: number | n
5353
clientId: operation.clientId,
5454
});
5555
addPage(newPage);
56+
if (operation.clientId === clientId) {
57+
setPageDataReady(newPage.id, true);
58+
}
5659
},
5760
onRemotePageDelete: (operation) => {
5861
addToast(`${operation.clientId}번 μœ μ €κ°€ νŽ˜μ΄μ§€(${operation.pageTitle})λ₯Ό μ‚­μ œν•˜μ˜€μŠ΅λ‹ˆλ‹€.`);

β€Žserver/src/ai/ai.controller.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,7 @@ export class AiController {
4949
@Body() body: { clientId: number; workspaceId: string; message: string },
5050
@Response({ passthrough: true }) res: ExpressResponse,
5151
): Promise<void> {
52-
const message = await this.aiService.requestAI(body.message);
53-
const operations = await this.aiService.generateDocumentToCRDT(
54-
body.workspaceId,
55-
body.clientId,
56-
message,
57-
);
58-
this.aiService.emitOperations(body.workspaceId, operations);
52+
await this.aiService.requestAI(body.message, body.workspaceId, body.clientId);
5953
res.status(200).send();
6054
}
6155
}

0 commit comments

Comments
Β (0)