mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 14:46:01 +00:00
activator used whereever possible
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
<script lang="ts" context="module">
|
||||
let lastFocusedEditor = null;
|
||||
const getCurrentEditor = () =>
|
||||
lastFocusedEditor?.getTabId && lastFocusedEditor?.getTabId() == getActiveTabId() ? lastFocusedEditor : null;
|
||||
const getCurrentEditor = () => getActiveComponent('ChartTab');
|
||||
|
||||
registerFileCommands({
|
||||
idPrefix: 'chart',
|
||||
@@ -17,8 +15,6 @@
|
||||
|
||||
<script lang="ts">
|
||||
import _ from 'lodash';
|
||||
import { getContext } from 'svelte';
|
||||
import { get_current_component } from 'svelte/internal';
|
||||
import { derived } from 'svelte/store';
|
||||
import ChartEditor from '../charts/ChartEditor.svelte';
|
||||
import invalidateCommands from '../commands/invalidateCommands';
|
||||
@@ -29,15 +25,14 @@
|
||||
import LoadingInfo from '../elements/LoadingInfo.svelte';
|
||||
|
||||
import useEditorData from '../query/useEditorData';
|
||||
import { getActiveTabId } from '../stores';
|
||||
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||
import createUndoReducer from '../utility/createUndoReducer';
|
||||
|
||||
export let tabid;
|
||||
export let conid;
|
||||
export let database;
|
||||
|
||||
const instance = get_current_component();
|
||||
const tabVisible: any = getContext('tabVisible');
|
||||
export const activator = createActivator('ChartTab', true);
|
||||
|
||||
export function getData() {
|
||||
return $editorState.value || '';
|
||||
@@ -58,8 +53,6 @@
|
||||
|
||||
$: setEditorData($modelState.value);
|
||||
|
||||
$: if ($tabVisible) lastFocusedEditor = instance;
|
||||
|
||||
$: {
|
||||
$modelState;
|
||||
invalidateCommands();
|
||||
@@ -97,10 +90,6 @@
|
||||
dispatchModel({ type: 'redo' });
|
||||
}
|
||||
|
||||
export function getTabId() {
|
||||
return tabid;
|
||||
}
|
||||
|
||||
function createMenu() {
|
||||
return [
|
||||
{ command: 'chart.save' },
|
||||
|
||||
Reference in New Issue
Block a user