Skip to content

Commit 31e3558

Browse files
committed
fix: welcome screen z-index, crosscheck env's, fixing text display bug in dark mode while typing
1 parent 3571cc1 commit 31e3558

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed

apps/collabydraw/app/globals.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ button {
736736
z-index: 2;
737737
}
738738

739+
.dark .collabydraw-textEditorContainer textarea{
740+
filter: var(--theme-filter);
741+
}
742+
739743
.canvas-bg-color-item {
740744
filter: var(--theme-filter);
741745
}

apps/collabydraw/canvas-engine/CanvasEngine.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ export class CanvasEngine {
10301030
let span: HTMLSpanElement | null = null;
10311031

10321032
const resizeTextarea = () => {
1033-
if (span) {
1033+
if (span && document.body.contains(span)) {
10341034
document.body.removeChild(span);
10351035
}
10361036

@@ -1070,16 +1070,20 @@ export class CanvasEngine {
10701070
const text = textarea.value.trim();
10711071
if (!text) {
10721072
textarea.remove();
1073-
document.body.removeChild(span!);
1073+
if (span && document.body.contains(span)) {
1074+
document.body.removeChild(span);
1075+
}
10741076
return;
10751077
}
1076-
1078+
if (!span) {
1079+
throw new Error("Span is null");
1080+
}
10771081
const newShape: Shape = {
10781082
id: uuidv4(),
10791083
type: "text",
10801084
x: x,
10811085
y: y,
1082-
width: span!.offsetWidth,
1086+
width: span.offsetWidth,
10831087
text,
10841088
fontSize: this.fontSize,
10851089
fontFamily: this.fontFamily,
@@ -1109,7 +1113,9 @@ export class CanvasEngine {
11091113

11101114
if (collabydrawContainer?.contains(textarea)) {
11111115
collabydrawContainer.removeChild(textarea);
1112-
document.body.removeChild(span!);
1116+
if (span && document.body.contains(span)) {
1117+
document.body.removeChild(span);
1118+
}
11131119
}
11141120

11151121
this.clearCanvas();

apps/collabydraw/components/CollaborationToolbar.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ export default function CollaborationToolbar({ participants, hash }: { participa
3131
}, [hash]);
3232

3333
const getSharingUrl = () => {
34-
return getRoomSharingUrl(BASE_URL, decodedPathname, hash ?? '');
34+
if (!BASE_URL) {
35+
throw new Error("BASE_URL not found")
36+
} else {
37+
return getRoomSharingUrl(BASE_URL, decodedPathname, hash ?? '');
38+
}
3539
};
3640

3741
return (

apps/collabydraw/components/canvas/CanvasBoard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { StyleConfigurator } from "../StyleConfigurator";
1818
import ToolSelector from "../ToolSelector";
1919
import CollaborationToolbar from "../CollaborationToolbar";
2020
import ZoomControl from "../ZoomControl";
21-
import CollabydrawTextEditorContainer from "../Collabydraw-TextEditorContainer";
2221
import { HomeWelcome, MainMenuWelcome, ToolMenuWelcome } from "../welcome-screen";
2322
import EncryptedWidget from "../EncryptedWidget";
2423

@@ -381,7 +380,7 @@ export default function CanvasBoard() {
381380
<EncryptedWidget />
382381
)}
383382

384-
<CollabydrawTextEditorContainer />
383+
<div className="collabydraw-textEditorContainer"></div>
385384

386385
{!matches && (
387386
<MobileCommandBar

apps/collabydraw/components/welcome-screen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function ToolMenuWelcome() {
3030
export function HomeWelcome() {
3131
return (
3232
<>
33-
<div className="welcome-screen-center z-[4]">
33+
<div className="welcome-screen-center z-[3]">
3434
<div className="welcome-screen-center__logo excalifont welcome-screen-decor">
3535
<div className="ExcalidrawLogo is-small">
3636
<svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" className="ExcalidrawLogo-icon">

apps/collabydraw/config/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ export const getDashArrayDotted = (strokeWidth: number) => [
1616
];
1717

1818
export const BASE_URL =
19-
process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000";
20-
export const WS_URL = process.env.NEXT_PUBLIC_WS_URL || "ws://localhost:8080";
19+
process.env.NEXT_PUBLIC_BASE_URL;
20+
export const WS_URL = process.env.NEXT_PUBLIC_WS_URL;

0 commit comments

Comments
 (0)