mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 06:22:28 +03:00
Lock hunks when viewing remote files
- readonly prop for hunks to disable cursor and dragging - removes a console.log - undo a previous change related to AnyFile - fix gap between text selection blocks line numbers
This commit is contained in:
parent
90e7b0f192
commit
e5fe606ab0
@ -12,18 +12,18 @@
|
||||
export let showCheckboxes = false;
|
||||
export let selectedFiles: Writable<AnyFile[]>;
|
||||
export let allowMultiple = false;
|
||||
|
||||
$: console.log(selectedFiles);
|
||||
export let readonly = false;
|
||||
</script>
|
||||
|
||||
{#each sortLikeFileTree(files) as file (file.id)}
|
||||
<FileListItem
|
||||
{file}
|
||||
{isUnapplied}
|
||||
{readonly}
|
||||
{branchId}
|
||||
{isUnapplied}
|
||||
{selectedFiles}
|
||||
{selectedOwnership}
|
||||
showCheckbox={showCheckboxes}
|
||||
{selectedFiles}
|
||||
on:click={(e) => {
|
||||
const isAlreadySelected = $selectedFiles.includes(file);
|
||||
if (isAlreadySelected && e.shiftKey) {
|
||||
|
@ -78,6 +78,7 @@
|
||||
{branchController}
|
||||
{selectedOwnership}
|
||||
{isUnapplied}
|
||||
readonly={selected instanceof RemoteFile}
|
||||
selectable={$commitBoxOpen && !isUnapplied}
|
||||
on:close={() => {
|
||||
const selectedId = selected?.id;
|
||||
|
@ -113,6 +113,7 @@
|
||||
{selectedOwnership}
|
||||
{selectedFiles}
|
||||
{isUnapplied}
|
||||
readonly={true}
|
||||
/>
|
||||
{:else}
|
||||
<FileTree
|
||||
@ -174,6 +175,7 @@
|
||||
<div class="commit-modal__code-container custom-scrollbar">
|
||||
<div class="commit-modal__code-wrapper">
|
||||
<FileDiff
|
||||
readonly={true}
|
||||
filePath={remoteFile.path}
|
||||
isBinary={remoteFile.binary}
|
||||
isLarge={false}
|
||||
|
@ -23,6 +23,7 @@
|
||||
export let branchController: BranchController;
|
||||
export let isUnapplied: boolean;
|
||||
export let selectable = false;
|
||||
export let readonly = false;
|
||||
export let selectedOwnership: Writable<Ownership>;
|
||||
|
||||
let rsViewport: HTMLElement;
|
||||
@ -74,6 +75,7 @@
|
||||
filePath={file.path}
|
||||
isLarge={file.large}
|
||||
isBinary={file.binary}
|
||||
{readonly}
|
||||
{sections}
|
||||
{projectPath}
|
||||
{isFileLocked}
|
||||
|
@ -18,6 +18,7 @@
|
||||
export let selectable = false;
|
||||
export let selectedOwnership: Writable<Ownership> | undefined = undefined;
|
||||
export let isFileLocked = false;
|
||||
export let readonly: boolean = false;
|
||||
|
||||
function getGutterMinWidth(max: number) {
|
||||
if (max >= 10000) return 2.5;
|
||||
@ -61,6 +62,7 @@
|
||||
{branchController}
|
||||
{isFileLocked}
|
||||
{minWidth}
|
||||
{readonly}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
@ -15,6 +15,7 @@
|
||||
export let showCheckbox: boolean = false;
|
||||
export let selectedOwnership: Writable<Ownership>;
|
||||
export let selectedFiles: Writable<AnyFile[]>;
|
||||
export let readonly = false;
|
||||
|
||||
let checked = false;
|
||||
let indeterminate = false;
|
||||
@ -40,7 +41,7 @@
|
||||
}}
|
||||
use:draggable={{
|
||||
...draggableFile(branchId, file, selectedFiles),
|
||||
disabled: isUnapplied,
|
||||
disabled: readonly || isUnapplied,
|
||||
selector: '.selected-draggable'
|
||||
}}
|
||||
role="button"
|
||||
|
@ -10,6 +10,7 @@
|
||||
export let minWidth = 1.75;
|
||||
export let selectable: boolean = false;
|
||||
export let selected: boolean = true;
|
||||
export let readonly: boolean = false;
|
||||
|
||||
const dispatch = createEventDispatcher<{ selected: boolean }>();
|
||||
|
||||
@ -59,6 +60,7 @@
|
||||
</div>
|
||||
<div
|
||||
class="line"
|
||||
class:readonly
|
||||
class:diff-line-deletion={sectionType === SectionType.RemovedLines}
|
||||
class:diff-line-addition={sectionType === SectionType.AddedLines}
|
||||
>
|
||||
@ -80,8 +82,9 @@
|
||||
|
||||
.line {
|
||||
flex-grow: 1;
|
||||
cursor: grab;
|
||||
padding-left: var(--space-4);
|
||||
&:not(.readonly) {
|
||||
cursor: grab;
|
||||
}
|
||||
}
|
||||
|
||||
.code-line__numbers-line {
|
||||
@ -93,5 +96,6 @@
|
||||
.selectable-wrapper {
|
||||
cursor: text;
|
||||
display: inline-block;
|
||||
text-indent: var(--space-4);
|
||||
}
|
||||
</style>
|
||||
|
@ -19,6 +19,7 @@
|
||||
export let selectable = false;
|
||||
export let isUnapplied: boolean;
|
||||
export let isFileLocked: boolean;
|
||||
export let readonly: boolean = false;
|
||||
|
||||
export let branchController: BranchController;
|
||||
export let selectedOwnership: Writable<Ownership> | undefined = undefined;
|
||||
@ -54,10 +55,11 @@
|
||||
role="cell"
|
||||
use:draggable={{
|
||||
...draggableHunk(branchId, section.hunk),
|
||||
disabled: isUnapplied || section.hunk.locked || !branchId
|
||||
disabled: readonly || isUnapplied || section.hunk.locked || !branchId
|
||||
}}
|
||||
on:contextmenu|preventDefault
|
||||
class="hunk"
|
||||
class:readonly
|
||||
class:opacity-60={section.hunk.locked && !isFileLocked}
|
||||
>
|
||||
<div class="hunk__bg-stretch">
|
||||
@ -67,6 +69,7 @@
|
||||
<HunkLine
|
||||
{line}
|
||||
{filePath}
|
||||
{readonly}
|
||||
{minWidth}
|
||||
{selectable}
|
||||
selected={$selectedOwnership?.containsHunk(hunk.filePath, hunk.id)}
|
||||
@ -89,7 +92,6 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-x: auto;
|
||||
cursor: grab;
|
||||
|
||||
background: var(--clr-theme-container-light);
|
||||
border-radius: var(--radius-s);
|
||||
|
Loading…
Reference in New Issue
Block a user