mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 17:53:59 +00:00
use resize observer
This commit is contained in:
@@ -255,7 +255,7 @@ export function registerFileCommands({
|
|||||||
name: 'Kill',
|
name: 'Kill',
|
||||||
icon: 'icon close',
|
icon: 'icon close',
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
testEnabled: () => getCurrentEditor() != null && getCurrentEditor()?.canKill(),
|
testEnabled: () => getCurrentEditor()?.canKill && getCurrentEditor().canKill(),
|
||||||
onClick: () => getCurrentEditor().kill(),
|
onClick: () => getCurrentEditor().kill(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1069,7 +1069,9 @@
|
|||||||
data-col="header"
|
data-col="header"
|
||||||
bind:clientHeight={rowHeight}
|
bind:clientHeight={rowHeight}
|
||||||
style={`width:${headerColWidth}px; min-width:${headerColWidth}px; max-width:${headerColWidth}px`}
|
style={`width:${headerColWidth}px; min-width:${headerColWidth}px; max-width:${headerColWidth}px`}
|
||||||
/>
|
>
|
||||||
|
|
||||||
|
</td>
|
||||||
{#each visibleRealColumns as col (col.uniqueName)}
|
{#each visibleRealColumns as col (col.uniqueName)}
|
||||||
<td
|
<td
|
||||||
class="header-cell"
|
class="header-cell"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
import { currentDropDownMenu, currentThemeDefinition } from '../stores';
|
import { currentDropDownMenu, currentThemeDefinition } from '../stores';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { handleCommandKeyDown } from '../commands/CommandListener.svelte';
|
import { handleCommandKeyDown } from '../commands/CommandListener.svelte';
|
||||||
|
import resizeObserver from '../utility/resizeObserver';
|
||||||
|
|
||||||
const EDITOR_ID = `svelte-ace-editor-div:${Math.floor(Math.random() * 10000000000)}`;
|
const EDITOR_ID = `svelte-ace-editor-div:${Math.floor(Math.random() * 10000000000)}`;
|
||||||
const dispatch = createEventDispatcher<{
|
const dispatch = createEventDispatcher<{
|
||||||
@@ -177,7 +178,16 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div bind:clientWidth bind:clientHeight class="ace-container">
|
<div
|
||||||
|
use:resizeObserver={true}
|
||||||
|
on:resize={e => {
|
||||||
|
// @ts-ignore
|
||||||
|
clientWidth = e.detail.width;
|
||||||
|
// @ts-ignore
|
||||||
|
clientHeight = e.detail.height;
|
||||||
|
}}
|
||||||
|
class="ace-container"
|
||||||
|
>
|
||||||
<div id={EDITOR_ID} style="width:{clientWidth}px;height:{clientHeight}px" />
|
<div id={EDITOR_ID} style="width:{clientWidth}px;height:{clientHeight}px" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user