mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 17:06:01 +00:00
html cell view
This commit is contained in:
13
packages/web/src/celldata/HtmlCellView.svelte
Normal file
13
packages/web/src/celldata/HtmlCellView.svelte
Normal file
@@ -0,0 +1,13 @@
|
||||
<script lang="ts">
|
||||
import _ from 'lodash';
|
||||
|
||||
export let selection;
|
||||
</script>
|
||||
|
||||
{@html selection
|
||||
.map(cell => {
|
||||
const { value } = cell;
|
||||
if (_.isPlainObject(value) || _.isArray(value)) return JSON.stringify(value, undefined, 2);
|
||||
return cell.value;
|
||||
})
|
||||
.join('\n')}
|
||||
@@ -30,6 +30,12 @@
|
||||
component: PictureCellView,
|
||||
single: true,
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
title: 'HTML',
|
||||
component: HtmlCellView,
|
||||
single: false,
|
||||
},
|
||||
];
|
||||
|
||||
function autodetect(selection) {
|
||||
@@ -53,8 +59,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import _ from 'lodash';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import HtmlCellView from '../celldata/HtmlCellView.svelte';
|
||||
import JsonCellView from '../celldata/JsonCellView.svelte';
|
||||
import JsonRowView from '../celldata/JsonRowView.svelte';
|
||||
import PictureCellView from '../celldata/PictureCellView.svelte';
|
||||
|
||||
Reference in New Issue
Block a user