Skip to content

Commit b8294db

Browse files
authored
chore: Improve the style of DiffEditor (#69)
1 parent 09d11c1 commit b8294db

3 files changed

Lines changed: 47 additions & 7 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<script setup lang="ts">
2+
import type CodeMirror from 'codemirror'
3+
import { onMounted, toRefs, useTemplateRef, watchEffect } from 'vue'
4+
import { useCodeMirror } from '~/composables/codemirror'
5+
import { settings } from '~/state/settings'
6+
7+
const props = defineProps<{
8+
code: string
9+
}
10+
>()
11+
12+
const { code } = toRefs(props)
13+
14+
let cm: CodeMirror.Editor
15+
16+
const codeEl = useTemplateRef('codeEl')
17+
18+
onMounted(() => {
19+
cm = useCodeMirror(
20+
codeEl,
21+
code,
22+
{
23+
mode: 'javascript',
24+
readOnly: true,
25+
lineNumbers: true,
26+
},
27+
)
28+
watchEffect(() => {
29+
cm.setOption('lineWrapping', settings.value.codeviewerLineWrap)
30+
})
31+
})
32+
</script>
33+
34+
<template>
35+
<div ref="codeEl" />
36+
</template>

packages/devtools-vite/src/app/components/data/AssetDetails.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,8 @@ function openInEditor() {
9999
<DisplayCloseButton @click="showSource = false" />
100100
</div>
101101
<div class="w-full of-auto px2 py1" border="~ base rounded-lg">
102-
<CodeDiffEditor
103-
:from="asset.content!"
104-
:to="asset.content!"
105-
:diff="false"
106-
:one-column="true"
102+
<CodeViewer
103+
:code="asset.content!"
107104
/>
108105
</div>
109106
</template>

packages/devtools-vite/src/app/styles/splitpanes.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,27 @@
2727

2828
.splitpanes--vertical>.splitpanes__splitter {
2929
width: 0 !important;
30+
min-width: 0 !important;
3031
}
3132

3233
.splitpanes--horizontal>.splitpanes__splitter {
3334
height: 0 !important;
35+
min-height: 0 !important;
3436
}
3537

3638
.splitpanes--vertical>.splitpanes__splitter:before {
3739
left: -5px;
38-
right: -4px;
40+
right: -5px;
3941
height: 100%;
4042
}
4143

4244
.splitpanes--horizontal>.splitpanes__splitter:before {
4345
top: -5px;
44-
bottom: -4px;
46+
bottom: -5px;
4547
width: 100%;
4648
}
49+
50+
.splitpanes__pane[style*="display: none"]+.splitpanes__splitter,
51+
.splitpanes__pane[hidden]+.splitpanes__splitter {
52+
display: none;
53+
}

0 commit comments

Comments
 (0)