fix: large content scroll bug in codemirror editor (#4138)

This commit is contained in:
Nivedin
2024-06-21 23:27:22 +05:30
committed by GitHub
parent 292d752f32
commit 257974325e
3 changed files with 8 additions and 4 deletions

View File

@@ -119,10 +119,11 @@
/> />
</div> </div>
</div> </div>
<div class="h-full"> <div class="h-full relative overflow-auto">
<div <div
ref="jsonResponse" ref="jsonResponse"
:class="toggleFilter ? 'responseToggleOn' : 'responseToggleOff'" :class="toggleFilter ? 'responseToggleOn' : 'responseToggleOff'"
class="absolute inset-0 h-full"
></div> ></div>
</div> </div>
<div <div

View File

@@ -35,8 +35,8 @@
/> />
</div> </div>
</div> </div>
<div class="h-full"> <div class="h-full relative overflow-auto">
<div ref="rawResponse" class="flex flex-1 flex-col"></div> <div ref="rawResponse" class="absolute inset-0"></div>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -330,7 +330,10 @@ export function useCodemirror(
), ),
EditorView.domEventHandlers({ EditorView.domEventHandlers({
scroll(event) { scroll(event, view) {
// HACK: This is a workaround to fix the issue in CodeMirror where the content doesn't load when the editor is not in view.
view.requestMeasure()
if (event.target && options.contextMenuEnabled) { if (event.target && options.contextMenuEnabled) {
// Debounce to make the performance better // Debounce to make the performance better
debouncedTextSelection(30)() debouncedTextSelection(30)()