From 79eef5bb919249777e0eaf43daff1bbdabcd0fe5 Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Mon, 8 Jul 2024 19:27:02 +0530 Subject: [PATCH] fix: clickhouse editor cursor sync issue (#5435) --- .../container/ListOfDashboard/ImportJSON/index.tsx | 10 +++++----- frontend/src/container/LogDetailedView/Overview.tsx | 12 +++++------- .../QuerySection/QueryBuilder/clickHouse/query.tsx | 8 +++++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx b/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx index 849305c7c2..5b95eb4a9a 100644 --- a/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx +++ b/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx @@ -141,11 +141,6 @@ function ImportJSON({ colors: { 'editor.background': Color.BG_INK_300, }, - fontFamily: 'Space Mono', - fontSize: 20, - fontWeight: 'normal', - lineHeight: 18, - letterSpacing: -0.06, }); } @@ -233,6 +228,11 @@ function ImportJSON({ fontFamily: 'Space Mono', }} theme={isDarkMode ? 'my-theme' : 'light'} + onMount={(_, monaco): void => { + document.fonts.ready.then(() => { + monaco.editor.remeasureFonts(); + }); + }} // eslint-disable-next-line react/jsx-no-bind beforeMount={setEditorTheme} /> diff --git a/frontend/src/container/LogDetailedView/Overview.tsx b/frontend/src/container/LogDetailedView/Overview.tsx index 957aac5bf7..bd54524931 100644 --- a/frontend/src/container/LogDetailedView/Overview.tsx +++ b/frontend/src/container/LogDetailedView/Overview.tsx @@ -53,7 +53,6 @@ function Overview({ enabled: false, }, fontWeight: 400, - // fontFamily: 'SF Mono', fontFamily: 'Space Mono', fontSize: 13, lineHeight: '18px', @@ -80,12 +79,6 @@ function Overview({ colors: { 'editor.background': Color.BG_INK_400, }, - // fontFamily: 'SF Mono', - fontFamily: 'Space Mono', - fontSize: 12, - fontWeight: 'normal', - lineHeight: 18, - letterSpacing: -0.06, }); } @@ -124,6 +117,11 @@ function Overview({ onChange={(): void => {}} height="20vh" theme={isDarkMode ? 'my-theme' : 'light'} + onMount={(_, monaco): void => { + document.fonts.ready.then(() => { + monaco.editor.remeasureFonts(); + }); + }} // eslint-disable-next-line react/jsx-no-bind beforeMount={setEditorTheme} /> diff --git a/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/clickHouse/query.tsx b/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/clickHouse/query.tsx index 7dd61595d6..bf6925fea5 100644 --- a/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/clickHouse/query.tsx +++ b/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/clickHouse/query.tsx @@ -87,9 +87,6 @@ function ClickHouseQueryBuilder({ 'editor.background': Color.BG_INK_300, }, }); - document.fonts.ready.then(() => { - monaco.editor.remeasureFonts(); - }); } return ( @@ -105,6 +102,11 @@ function ClickHouseQueryBuilder({ height="200px" onChange={handleUpdateEditor} value={queryData.query} + onMount={(_, monaco): void => { + document.fonts.ready.then(() => { + monaco.editor.remeasureFonts(); + }); + }} options={{ scrollbar: { alwaysConsumeMouseWheel: false,