1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 10:08:52 +08:00

#122 add line wrapping

This commit is contained in:
lana-k
2025-03-26 22:18:55 +01:00
parent 43b6110c28
commit 108ae454c1

View File

@@ -13,6 +13,14 @@
</button> </button>
<button type="button" class="copy" @click="copyToClipboard">Copy</button> <button type="button" class="copy" @click="copyToClipboard">Copy</button>
<button
type="button"
class="line-wrap"
:aria-selected="lineWrapping === true"
@click="lineWrapping = !lineWrapping"
>
Line wrap
</button>
</div> </div>
<div class="value-body"> <div class="value-body">
<codemirror <codemirror
@@ -23,7 +31,11 @@
/> />
<pre <pre
v-if="currentFormat === 'text'" v-if="currentFormat === 'text'"
:class="['text-value', { 'meta-value': isNull || isBlob }]" :class="[
'text-value',
{ 'meta-value': isNull || isBlob },
{ 'line-wrap': lineWrapping }
]"
>{{ cellText }}</pre >{{ cellText }}</pre
> >
<logs <logs
@@ -62,21 +74,25 @@ export default {
{ text: 'JSON', value: 'json' } { text: 'JSON', value: 'json' }
], ],
currentFormat: 'text', currentFormat: 'text',
cmOptions: { lineWrapping: false,
tabSize: 4,
mode: { name: 'javascript', json: true },
theme: 'neo',
lineNumbers: true,
line: true,
foldGutter: true,
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
readOnly: true
},
formattedJson: '', formattedJson: '',
messages: [] messages: []
} }
}, },
computed: { computed: {
cmOptions() {
return {
tabSize: 4,
mode: { name: 'javascript', json: true },
theme: 'neo',
lineNumbers: true,
line: true,
lineWrapping: this.lineWrapping,
foldGutter: true,
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
readOnly: true
}
},
isBlob() { isBlob() {
return this.cellValue && ArrayBuffer.isView(this.cellValue) return this.cellValue && ArrayBuffer.isView(this.cellValue)
}, },
@@ -164,6 +180,11 @@ export default {
color: var(--color-text-light-2); color: var(--color-text-light-2);
} }
.text-value.line-wrap {
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.messages { .messages {
margin: 0 8px; margin: 0 8px;
} }