diff --git a/client/src/features/editor/utils/domSyncUtils.ts b/client/src/features/editor/utils/domSyncUtils.ts index 524f928..e31bbdf 100644 --- a/client/src/features/editor/utils/domSyncUtils.ts +++ b/client/src/features/editor/utils/domSyncUtils.ts @@ -139,14 +139,13 @@ const setsEqual = (a: Set, b: Set): boolean => { }; const sanitizeText = (text: string): string => { - return text.replace(/
/g, "\u00A0").replace(/[<>&"'\s]/g, (match) => { + return text.replace(/
/g, "\u00A0").replace(/[<>&"']/g, (match) => { const escapeMap: Record = { "<": "<", ">": ">", "&": "&", '"': """, "'": "'", - " ": " ", }; return escapeMap[match] || match; }); diff --git a/client/src/stores/useSocketStore.ts b/client/src/stores/useSocketStore.ts index 41ce659..e48e227 100644 --- a/client/src/stores/useSocketStore.ts +++ b/client/src/stores/useSocketStore.ts @@ -242,45 +242,45 @@ export const useSocketStore = create((set, get) => ({ }, sendBlockInsertOperation: (operation: RemoteBlockInsertOperation) => { - const { socket } = get(); - socket?.emit("insert/block", operation); - // const { sendOperation } = get(); - // sendOperation(operation); + // const { socket } = get(); + // socket?.emit("insert/block", operation); + const { sendOperation } = get(); + sendOperation(operation); }, sendCharInsertOperation: (operation: RemoteCharInsertOperation) => { - const { socket } = get(); - socket?.emit("insert/char", operation); - // const { sendOperation } = get(); - // sendOperation(operation); + // const { socket } = get(); + // socket?.emit("insert/char", operation); + const { sendOperation } = get(); + sendOperation(operation); }, sendBlockUpdateOperation: (operation: RemoteBlockUpdateOperation) => { - const { socket } = get(); - socket?.emit("update/block", operation); - // const { sendOperation } = get(); - // sendOperation(operation); + // const { socket } = get(); + // socket?.emit("update/block", operation); + const { sendOperation } = get(); + sendOperation(operation); }, sendBlockDeleteOperation: (operation: RemoteBlockDeleteOperation) => { - const { socket } = get(); - socket?.emit("delete/block", operation); - // const { sendOperation } = get(); - // sendOperation(operation); + // const { socket } = get(); + // socket?.emit("delete/block", operation); + const { sendOperation } = get(); + sendOperation(operation); }, sendCharDeleteOperation: (operation: RemoteCharDeleteOperation) => { - const { socket } = get(); - socket?.emit("delete/char", operation); - // const { sendOperation } = get(); - // sendOperation(operation); + // const { socket } = get(); + // socket?.emit("delete/char", operation); + const { sendOperation } = get(); + sendOperation(operation); }, sendCharUpdateOperation: (operation: RemoteCharUpdateOperation) => { - const { socket } = get(); - socket?.emit("update/char", operation); - // const { sendOperation } = get(); - // sendOperation(operation); + // const { socket } = get(); + // socket?.emit("update/char", operation); + const { sendOperation } = get(); + sendOperation(operation); }, sendCursorPosition: (position: CursorPosition) => { @@ -289,10 +289,10 @@ export const useSocketStore = create((set, get) => ({ }, sendBlockReorderOperation: (operation: RemoteBlockReorderOperation) => { - const { socket } = get(); - socket?.emit("reorder/block", operation); - // const { sendOperation } = get(); - // sendOperation(operation); + // const { socket } = get(); + // socket?.emit("reorder/block", operation); + const { sendOperation } = get(); + sendOperation(operation); }, sendBlockCheckboxOperation: (operation: RemoteBlockCheckboxOperation) => {