mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 13:55:19 +00:00
Revert "feat: Dynamically load CodeEditor.svelte to improve first-screen loading speed (-1MB)"
This commit is contained in:
parent
2904a78222
commit
6614c73b6c
3 changed files with 42 additions and 45 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
|
import CodeEditor from '$lib/components/common/CodeEditor.svelte';
|
||||||
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||||
import Badge from '$lib/components/common/Badge.svelte';
|
import Badge from '$lib/components/common/Badge.svelte';
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
|
|
@ -366,22 +367,20 @@ class Pipe:
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-2 flex-1 overflow-auto h-0 rounded-lg">
|
<div class="mb-2 flex-1 overflow-auto h-0 rounded-lg">
|
||||||
{#await import('$lib/components/common/CodeEditor.svelte') then { default: CodeEditor }}
|
<CodeEditor
|
||||||
<CodeEditor
|
bind:this={codeEditor}
|
||||||
bind:this={codeEditor}
|
value={content}
|
||||||
value={content}
|
lang="python"
|
||||||
lang="python"
|
{boilerplate}
|
||||||
{boilerplate}
|
onChange={(e) => {
|
||||||
onChange={(e) => {
|
_content = e;
|
||||||
_content = e;
|
}}
|
||||||
}}
|
onSave={async () => {
|
||||||
onSave={async () => {
|
if (formElement) {
|
||||||
if (formElement) {
|
formElement.requestSubmit();
|
||||||
formElement.requestSubmit();
|
}
|
||||||
}
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
{/await}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pb-3 flex justify-between">
|
<div class="pb-3 flex justify-between">
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
import 'highlight.js/styles/github-dark.min.css';
|
import 'highlight.js/styles/github-dark.min.css';
|
||||||
|
|
||||||
import PyodideWorker from '$lib/workers/pyodide.worker?worker';
|
import PyodideWorker from '$lib/workers/pyodide.worker?worker';
|
||||||
|
import CodeEditor from '$lib/components/common/CodeEditor.svelte';
|
||||||
import SvgPanZoom from '$lib/components/common/SVGPanZoom.svelte';
|
import SvgPanZoom from '$lib/components/common/SVGPanZoom.svelte';
|
||||||
import { config } from '$lib/stores';
|
import { config } from '$lib/stores';
|
||||||
import { executeCode } from '$lib/apis/utils';
|
import { executeCode } from '$lib/apis/utils';
|
||||||
|
|
@ -480,19 +481,17 @@
|
||||||
|
|
||||||
{#if !collapsed}
|
{#if !collapsed}
|
||||||
{#if edit}
|
{#if edit}
|
||||||
{#await import('$lib/components/common/CodeEditor.svelte') then { default: CodeEditor }}
|
<CodeEditor
|
||||||
<CodeEditor
|
value={code}
|
||||||
value={code}
|
{id}
|
||||||
{id}
|
{lang}
|
||||||
{lang}
|
onSave={() => {
|
||||||
onSave={() => {
|
saveCode();
|
||||||
saveCode();
|
}}
|
||||||
}}
|
onChange={(value) => {
|
||||||
onChange={(value) => {
|
_code = value;
|
||||||
_code = value;
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
{/await}
|
|
||||||
{:else}
|
{:else}
|
||||||
<pre
|
<pre
|
||||||
class=" hljs p-4 px-5 overflow-x-auto"
|
class=" hljs p-4 px-5 overflow-x-auto"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
|
import CodeEditor from '$lib/components/common/CodeEditor.svelte';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||||
import Badge from '$lib/components/common/Badge.svelte';
|
import Badge from '$lib/components/common/Badge.svelte';
|
||||||
|
|
@ -285,22 +286,20 @@ class Tools:
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-2 flex-1 overflow-auto h-0 rounded-lg">
|
<div class="mb-2 flex-1 overflow-auto h-0 rounded-lg">
|
||||||
{#await import('$lib/components/common/CodeEditor.svelte') then { default: CodeEditor }}
|
<CodeEditor
|
||||||
<CodeEditor
|
bind:this={codeEditor}
|
||||||
bind:this={codeEditor}
|
value={content}
|
||||||
value={content}
|
lang="python"
|
||||||
lang="python"
|
{boilerplate}
|
||||||
{boilerplate}
|
onChange={(e) => {
|
||||||
onChange={(e) => {
|
_content = e;
|
||||||
_content = e;
|
}}
|
||||||
}}
|
onSave={async () => {
|
||||||
onSave={async () => {
|
if (formElement) {
|
||||||
if (formElement) {
|
formElement.requestSubmit();
|
||||||
formElement.requestSubmit();
|
}
|
||||||
}
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
{/await}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pb-3 flex justify-between">
|
<div class="pb-3 flex justify-between">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue