mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-12 08:02:44 +00:00
pixel perfect editor placeholder
This commit is contained in:
@@ -1417,12 +1417,7 @@
|
||||
<EditorTheme />
|
||||
{#if !editor}
|
||||
<div class="inset-0 absolute overflow-clip">
|
||||
<FakeMonacoPlaceHolder
|
||||
marginLeft="51px"
|
||||
{code}
|
||||
fontSize={!small ? 14 : 12}
|
||||
className="dark:bg-[#272D38] h-full leading-[20px]"
|
||||
/>
|
||||
<FakeMonacoPlaceHolder {code} />
|
||||
</div>
|
||||
{/if}
|
||||
<div bind:this={divEl} class="{$$props.class} editor {disabled ? 'disabled' : ''}"></div>
|
||||
|
||||
@@ -3,40 +3,65 @@
|
||||
<script lang="ts">
|
||||
type Props = {
|
||||
code?: string
|
||||
fontSize: number
|
||||
marginLeft?: string
|
||||
className?: string
|
||||
}
|
||||
|
||||
let { code, fontSize, marginLeft = '0', className = '' }: Props = $props()
|
||||
let { code }: Props = $props()
|
||||
|
||||
let lines = $derived(code?.split('\n') ?? [])
|
||||
|
||||
let [clientWidth, clientHeight] = $state([0, 0])
|
||||
</script>
|
||||
|
||||
<div
|
||||
class={'relative w-full pr-14 py-0 z-9 mt-[-1px] mb-[1px] dark:bg-[#272D38] overflow-y-clip overflow-x-auto mycontainer ' +
|
||||
className}
|
||||
style="padding-left: {marginLeft};"
|
||||
bind:clientWidth
|
||||
bind:clientHeight
|
||||
class="h-full w-full relative editor dark:bg-[#272D38]"
|
||||
style="--vscode-editorCodeLens-lineHeight: 18px; --vscode-editorCodeLens-fontSize: 12px; --vscode-editorCodeLens-fontFeatureSettings: "liga" off, "calt" off; --code-editorInlayHintsFontFamily: Menlo, Monaco, 'Courier New', monospace;"
|
||||
>
|
||||
<div
|
||||
class="absolute inset-x-0 h-[22px] dark:bg-[#3A4252] mix-blend-lighten"
|
||||
style="margin-left: {marginLeft};"
|
||||
></div>
|
||||
<code
|
||||
class="text-nowrap whitespace-pre overflow-clip text-tertiary/50"
|
||||
style="font-size: {fontSize}px;"
|
||||
class="monaco-editor no-user-select mac standalone showUnused showDeprecated vs-dark"
|
||||
role="code"
|
||||
>
|
||||
{code}
|
||||
{#if code?.endsWith('\n')}
|
||||
|
||||
{/if}
|
||||
</code>
|
||||
<div class="overflow-guard" style="width: {clientWidth}px; height: {clientHeight}px;">
|
||||
<div
|
||||
class="margin"
|
||||
role="presentation"
|
||||
aria-hidden="true"
|
||||
style="position: absolute; transform: translate3d(0px, 0px, 0px); contain: strict; top: 0px; width: {clientWidth}px; height: {clientHeight}px;"
|
||||
>
|
||||
<div
|
||||
class="margin-view-overlays"
|
||||
role="presentation"
|
||||
aria-hidden="true"
|
||||
style="position: absolute; font-family: Menlo, Monaco, "Courier New", monospace; font-weight: normal; font-size: 14px; font-feature-settings: "liga" 0, "calt" 0; font-variation-settings: normal; line-height: 21px; letter-spacing: 0px; width: 51px; height: 4893px;"
|
||||
>
|
||||
{#each lines as _, i}
|
||||
<div style="top:{21 * i}px;height:21px;">
|
||||
<div class="line-numbers" style="left:0px;width:25px;">{i + 1}</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="monaco-scrollable-element editor-scrollable vs-dark mac"
|
||||
style="position: absolute; overflow: hidden; left: 51px; width: {clientWidth}px; height: {clientHeight}px"
|
||||
>
|
||||
<div
|
||||
class="lines-content monaco-editor-background"
|
||||
style="position: absolute; overflow: hidden; width: 1.67772e+07px; height: 1.67772e+07px; transform: translate3d(0px, 0px, 0px); contain: strict; top: 0px; left: 0px;"
|
||||
>
|
||||
<div
|
||||
class="view-lines monaco-mouse-cursor-text text-tertiary/60"
|
||||
style="line-height: 21px; position: absolute; font-family: Menlo, Monaco, "Courier New", monospace; font-weight: normal; font-size: 14px; font-feature-settings: "liga" 0, "calt" 0; font-variation-settings: normal; line-height: 21px; letter-spacing: 0px; width: 1143px; height: 789px;"
|
||||
>
|
||||
{#each lines as line, i}
|
||||
<div style="height: 21px; top: {i * 21}px;" class="text-nowrap whitespace-pre">
|
||||
{line}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.mycontainer::-webkit-scrollbar {
|
||||
/* Try to match monaco's scrollbar */
|
||||
height: 12px;
|
||||
}
|
||||
.mycontainer::-webkit-scrollbar-thumb {
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -494,7 +494,7 @@
|
||||
<!-- {inputCat}
|
||||
{propertyType} -->
|
||||
<div class="relative flex flex-row items-top gap-2 justify-between">
|
||||
<div class="min-w-0 grow leading-[20px]">
|
||||
<div class="min-w-0 grow">
|
||||
{#if isStaticTemplate(inputCat) && propertyType == 'static' && !noDynamicToggle}
|
||||
{#if argName && schema?.properties?.[argName]?.description}
|
||||
<div class="text-xs italic pb-1 text-secondary">
|
||||
|
||||
+2
-2
@@ -71,7 +71,7 @@
|
||||
offset={zIndexes.monacoEditor}
|
||||
>
|
||||
<Splitpanes horizontal class="h-full">
|
||||
<Pane size={50} class="leading-[16px]">
|
||||
<Pane size={50}>
|
||||
<SimpleEditor
|
||||
loadAsync
|
||||
class="h-full w-full"
|
||||
@@ -103,7 +103,7 @@
|
||||
</Splitpanes>
|
||||
</Drawer>
|
||||
{/if}
|
||||
<div class="border relative leading-[16px]">
|
||||
<div class="border relative">
|
||||
{#if !fullscreen}
|
||||
<SimpleEditor
|
||||
loadAsync
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@
|
||||
placeholder="Label"
|
||||
/>
|
||||
{:else}
|
||||
<div class="flex w-full flex-col leading-[16px]">
|
||||
<div class="flex w-full flex-col">
|
||||
<JsonEditor
|
||||
loadAsync
|
||||
small
|
||||
|
||||
Reference in New Issue
Block a user