From a968bc75295a358921635a63ecf8260ea63bca8c Mon Sep 17 00:00:00 2001 From: devleejb Date: Thu, 25 Jan 2024 15:02:47 +0900 Subject: [PATCH 1/2] Fix doc synchronization when grab multi cursor --- frontend/src/utils/yorkie/yorkieSync.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/yorkie/yorkieSync.ts b/frontend/src/utils/yorkie/yorkieSync.ts index 4e0641ea..97e010eb 100644 --- a/frontend/src/utils/yorkie/yorkieSync.ts +++ b/frontend/src/utils/yorkie/yorkieSync.ts @@ -83,13 +83,15 @@ class YorkieSyncPluginValue implements cmView.PluginValue { return; } + let adj = 0; this._doc.update((root, presence) => { update.changes.iterChanges((fromA, toA, _fromB, _toB, insert) => { if (!root.content) { root.content = new yorkie.Text(); } const insertText = insert.sliceString(0, insert.length, "\n"); - const updatedIndexRange = root.content.edit(fromA, toA, insertText); + const updatedIndexRange = root.content.edit(fromA + adj, toA + adj, insertText); + adj += insertText.length - (toA - fromA); if (updatedIndexRange) { presence.set({ selection: root.content.indexRangeToPosRange(updatedIndexRange), From 2c489730e5b9d321403ba5e0895b0eb2c6d0ed2e Mon Sep 17 00:00:00 2001 From: devleejb Date: Thu, 25 Jan 2024 15:05:13 +0900 Subject: [PATCH 2/2] Update env for docker-compose --- backend/docker/docker-compose-full.yml | 3 +++ backend/docker/docker-compose.yml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/backend/docker/docker-compose-full.yml b/backend/docker/docker-compose-full.yml index be326f1b..033257ec 100644 --- a/backend/docker/docker-compose-full.yml +++ b/backend/docker/docker-compose-full.yml @@ -12,6 +12,9 @@ services: GITHUB_CALLBACK_URL: "/auth/login/github" JWT_AUTH_SECRET: "JWT_AUTH_SECRET" FRONTEND_BASE_URL: "FRONTEND_BASE_URL" + YORKIE_API_ADDR: "YORKIE_API_ADDR" + YORKIE_PROJECT_NAME: "YORKIE_PROJECT_NAME" + YORKIE_PROJECT_SECRET_KEY: "YORKIE_PROJECT_SECRET_KEY" ports: - "3000:3000" depends_on: diff --git a/backend/docker/docker-compose.yml b/backend/docker/docker-compose.yml index 1c3c853b..43f7d86c 100644 --- a/backend/docker/docker-compose.yml +++ b/backend/docker/docker-compose.yml @@ -5,12 +5,16 @@ services: build: context: ../ environment: + # Environment variables need to be passed to the container DATABASE_URL: "DATABASE_URL" GITHUB_CLIENT_ID: "GITHUB_CLIENT_ID" GITHUB_CLIENT_SECRET: "GITHUB_CLIENT_SECRET" GITHUB_CALLBACK_URL: "/auth/login/github" JWT_AUTH_SECRET: "JWT_AUTH_SECRET" FRONTEND_BASE_URL: "FRONTEND_BASE_URL" + YORKIE_API_ADDR: "YORKIE_API_ADDR" + YORKIE_PROJECT_NAME: "YORKIE_PROJECT_NAME" + YORKIE_PROJECT_SECRET_KEY: "YORKIE_PROJECT_SECRET_KEY" ports: - "3000:3000" restart: unless-stopped