mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 18:03:58 +00:00
Merge pull request #941 from dbgate/feature/word-wrap-option
feat: add word wrap option #823
This commit is contained in:
@@ -59,6 +59,7 @@
|
|||||||
on:blur
|
on:blur
|
||||||
bind:this={domEditor}
|
bind:this={domEditor}
|
||||||
options={{
|
options={{
|
||||||
|
...$$props.options,
|
||||||
enableBasicAutocompletion: true,
|
enableBasicAutocompletion: true,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
import SqlEditor from '../query/SqlEditor.svelte';
|
import SqlEditor from '../query/SqlEditor.svelte';
|
||||||
import {
|
import {
|
||||||
currentEditorFontSize,
|
currentEditorFontSize,
|
||||||
|
currentEditorWrapEnabled,
|
||||||
currentEditorTheme,
|
currentEditorTheme,
|
||||||
currentEditorKeybindigMode,
|
currentEditorKeybindigMode,
|
||||||
extensions,
|
extensions,
|
||||||
@@ -162,6 +163,14 @@ ORDER BY
|
|||||||
/>
|
/>
|
||||||
</FormFieldTemplateLarge>
|
</FormFieldTemplateLarge>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<FormFieldTemplateLarge label="Enable word wrap" type="combo">
|
||||||
|
<CheckboxField
|
||||||
|
checked={$currentEditorWrapEnabled}
|
||||||
|
on:change={e => ($currentEditorWrapEnabled = e.target.checked)}
|
||||||
|
/>
|
||||||
|
</FormFieldTemplateLarge>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="2">
|
<svelte:fragment slot="2">
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ export const currentEditorTheme = getElectron()
|
|||||||
export const currentEditorKeybindigMode = getElectron()
|
export const currentEditorKeybindigMode = getElectron()
|
||||||
? writableSettingsValue(null, 'currentEditorKeybindigMode')
|
? writableSettingsValue(null, 'currentEditorKeybindigMode')
|
||||||
: writableWithStorage(null, 'currentEditorKeybindigMode');
|
: writableWithStorage(null, 'currentEditorKeybindigMode');
|
||||||
|
export const currentEditorWrapEnabled = getElectron()
|
||||||
|
? writableSettingsValue(false, 'currentEditorWrapEnabled')
|
||||||
|
: writableWithStorage(false, 'currentEditorWrapEnabled');
|
||||||
export const currentEditorFontSize = getElectron()
|
export const currentEditorFontSize = getElectron()
|
||||||
? writableSettingsValue(null, 'currentEditorFontSize')
|
? writableSettingsValue(null, 'currentEditorFontSize')
|
||||||
: writableWithStorage(null, 'currentEditorFontSize');
|
: writableWithStorage(null, 'currentEditorFontSize');
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
import VerticalSplitter from '../elements/VerticalSplitter.svelte';
|
import VerticalSplitter from '../elements/VerticalSplitter.svelte';
|
||||||
import SqlEditor from '../query/SqlEditor.svelte';
|
import SqlEditor from '../query/SqlEditor.svelte';
|
||||||
import useEditorData from '../query/useEditorData';
|
import useEditorData from '../query/useEditorData';
|
||||||
import { extensions } from '../stores';
|
import { currentEditorWrapEnabled, extensions } from '../stores';
|
||||||
import applyScriptTemplate from '../utility/applyScriptTemplate';
|
import applyScriptTemplate from '../utility/applyScriptTemplate';
|
||||||
import { changeTab, markTabUnsaved } from '../utility/common';
|
import { changeTab, markTabUnsaved } from '../utility/common';
|
||||||
import { getDatabaseInfo, useConnectionInfo } from '../utility/metadataLoaders';
|
import { getDatabaseInfo, useConnectionInfo } from '../utility/metadataLoaders';
|
||||||
@@ -154,6 +154,7 @@
|
|||||||
|
|
||||||
$: connection = useConnectionInfo({ conid });
|
$: connection = useConnectionInfo({ conid });
|
||||||
$: driver = findEngineDriver($connection, $extensions);
|
$: driver = findEngineDriver($connection, $extensions);
|
||||||
|
$: enableWrap = $currentEditorWrapEnabled || false;
|
||||||
|
|
||||||
$: effect = useEffect(() => {
|
$: effect = useEffect(() => {
|
||||||
return onSession(sessionId);
|
return onSession(sessionId);
|
||||||
@@ -427,6 +428,9 @@
|
|||||||
{conid}
|
{conid}
|
||||||
{database}
|
{database}
|
||||||
splitterOptions={driver?.getQuerySplitterOptions('editor')}
|
splitterOptions={driver?.getQuerySplitterOptions('editor')}
|
||||||
|
options={{
|
||||||
|
wrap: enableWrap,
|
||||||
|
}}
|
||||||
value={$editorState.value || ''}
|
value={$editorState.value || ''}
|
||||||
menu={createMenu()}
|
menu={createMenu()}
|
||||||
on:input={e => {
|
on:input={e => {
|
||||||
@@ -453,6 +457,9 @@
|
|||||||
mode={driver?.editorMode || 'text'}
|
mode={driver?.editorMode || 'text'}
|
||||||
value={$editorState.value || ''}
|
value={$editorState.value || ''}
|
||||||
splitterOptions={driver?.getQuerySplitterOptions('editor')}
|
splitterOptions={driver?.getQuerySplitterOptions('editor')}
|
||||||
|
options={{
|
||||||
|
wrap: enableWrap,
|
||||||
|
}}
|
||||||
menu={createMenu()}
|
menu={createMenu()}
|
||||||
on:input={e => setEditorData(e.detail)}
|
on:input={e => setEditorData(e.detail)}
|
||||||
on:focus={() => {
|
on:focus={() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user