mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 16:02:14 +00:00
fix: make migration view editor read-only so its code can scroll
This commit is contained in:
@@ -95,6 +95,7 @@
|
||||
loadAsync = false,
|
||||
key,
|
||||
disabled = false,
|
||||
readOnly = false,
|
||||
minHeight = 1000,
|
||||
renderLineHighlight = 'none',
|
||||
suggestion
|
||||
@@ -123,6 +124,9 @@
|
||||
initialCursorPos?: IPosition
|
||||
key?: string
|
||||
disabled?: boolean
|
||||
/** Read-only Monaco mode: not editable, but still scrollable/selectable
|
||||
* (unlike `disabled`, which makes the editor non-interactive). */
|
||||
readOnly?: boolean
|
||||
minHeight?: number
|
||||
renderLineHighlight?: 'all' | 'line' | 'gutter' | 'none'
|
||||
suggestion?: string
|
||||
@@ -239,6 +243,9 @@
|
||||
lineNumbers: $relativeLineNumbers ? 'relative' : 'on'
|
||||
})
|
||||
})
|
||||
$effect(() => {
|
||||
editor?.updateOptions({ readOnly })
|
||||
})
|
||||
|
||||
function onVimDisable() {
|
||||
vimDisposable?.dispose()
|
||||
@@ -342,6 +349,7 @@
|
||||
),
|
||||
model,
|
||||
...(yPadding !== undefined ? { padding: { bottom: yPadding, top: yPadding } } : {}),
|
||||
readOnly,
|
||||
renderLineHighlight,
|
||||
lineDecorationsWidth: 0,
|
||||
lineNumbersMinChars: 2,
|
||||
|
||||
@@ -453,11 +453,11 @@
|
||||
<Tab value="down" label="Down" />
|
||||
{#snippet content()}
|
||||
<TabContent value="up" class="h-80">
|
||||
<SimpleEditor class="h-full" lang="sql" code={viewMigration?.code_up ?? ''} disabled />
|
||||
<SimpleEditor class="h-full" lang="sql" code={viewMigration?.code_up ?? ''} readOnly />
|
||||
</TabContent>
|
||||
<TabContent value="down" class="h-80">
|
||||
{#if viewMigration?.code_down}
|
||||
<SimpleEditor class="h-full" lang="sql" code={viewMigration.code_down} disabled />
|
||||
<SimpleEditor class="h-full" lang="sql" code={viewMigration.code_down} readOnly />
|
||||
{:else}
|
||||
<div class="p-6 text-center text-sm text-tertiary">No down migration</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user