mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 23:02:31 +03:00
move userSettings to a more appropriate level
This commit is contained in:
parent
f254d7dc58
commit
a6928381c8
@ -1,12 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { create } from '$lib/components/Differ/CodeHighlighter';
|
import { create } from '$lib/components/Differ/CodeHighlighter';
|
||||||
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings';
|
|
||||||
import { SectionType } from '$lib/utils/fileSections';
|
import { SectionType } from '$lib/utils/fileSections';
|
||||||
import { createEventDispatcher, getContext } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import type { Line } from '$lib/utils/fileSections';
|
import type { Line } from '$lib/utils/fileSections';
|
||||||
|
|
||||||
const userSettings = getContext(SETTINGS_CONTEXT) as SettingsStore;
|
|
||||||
|
|
||||||
export let line: Line;
|
export let line: Line;
|
||||||
export let sectionType: SectionType;
|
export let sectionType: SectionType;
|
||||||
export let filePath: string;
|
export let filePath: string;
|
||||||
@ -15,6 +12,7 @@
|
|||||||
export let selected: boolean = true;
|
export let selected: boolean = true;
|
||||||
export let readonly: boolean = false;
|
export let readonly: boolean = false;
|
||||||
export let draggingDisabled: boolean = false;
|
export let draggingDisabled: boolean = false;
|
||||||
|
export let tabSize = 4;
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ selected: boolean }>();
|
const dispatch = createEventDispatcher<{ selected: boolean }>();
|
||||||
|
|
||||||
@ -46,7 +44,7 @@
|
|||||||
<div
|
<div
|
||||||
class="code-line text-sm"
|
class="code-line text-sm"
|
||||||
role="group"
|
role="group"
|
||||||
style="--tab-size: {$userSettings.tabSize}"
|
style="--tab-size: {tabSize}"
|
||||||
on:contextmenu|preventDefault
|
on:contextmenu|preventDefault
|
||||||
>
|
>
|
||||||
<div class="code-line__numbers-line">
|
<div class="code-line__numbers-line">
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
import { draggable } from '$lib/dragging/draggable';
|
import { draggable } from '$lib/dragging/draggable';
|
||||||
import { draggableHunk } from '$lib/dragging/draggables';
|
import { draggableHunk } from '$lib/dragging/draggables';
|
||||||
import { getContextByClass } from '$lib/utils/context';
|
import { getContextByClass } from '$lib/utils/context';
|
||||||
import { onDestroy } from 'svelte';
|
import { getContext, onDestroy } from 'svelte';
|
||||||
|
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings';
|
||||||
import type { HunkSection } from '$lib/utils/fileSections';
|
import type { HunkSection } from '$lib/utils/fileSections';
|
||||||
import type { Ownership } from '$lib/vbranches/ownership';
|
import type { Ownership } from '$lib/vbranches/ownership';
|
||||||
import type { Hunk } from '$lib/vbranches/types';
|
import type { Hunk } from '$lib/vbranches/types';
|
||||||
@ -26,6 +27,7 @@
|
|||||||
export let selectedOwnership: Writable<Ownership> | undefined = undefined;
|
export let selectedOwnership: Writable<Ownership> | undefined = undefined;
|
||||||
export let linesModified: number;
|
export let linesModified: number;
|
||||||
|
|
||||||
|
const userSettings = getContext(SETTINGS_CONTEXT) as SettingsStore;
|
||||||
const project = getContextByClass(Project);
|
const project = getContextByClass(Project);
|
||||||
|
|
||||||
function onHunkSelected(hunk: Hunk, isSelected: boolean) {
|
function onHunkSelected(hunk: Hunk, isSelected: boolean) {
|
||||||
@ -91,6 +93,7 @@
|
|||||||
{minWidth}
|
{minWidth}
|
||||||
{selectable}
|
{selectable}
|
||||||
{draggingDisabled}
|
{draggingDisabled}
|
||||||
|
tabSize={$userSettings.tabSize}
|
||||||
selected={$selectedOwnership?.containsHunk(hunk.filePath, hunk.id)}
|
selected={$selectedOwnership?.containsHunk(hunk.filePath, hunk.id)}
|
||||||
on:selected={(e) => onHunkSelected(hunk, e.detail)}
|
on:selected={(e) => onHunkSelected(hunk, e.detail)}
|
||||||
sectionType={subsection.sectionType}
|
sectionType={subsection.sectionType}
|
||||||
|
Loading…
Reference in New Issue
Block a user