Fix lazy portal
This commit is contained in:
@@ -661,13 +661,15 @@
|
||||
|
||||
{#each blocks as block, i}
|
||||
<div
|
||||
class="w-full max-w-full" id={'x-chat-' + (blocks.length - i - 1)}
|
||||
class="w-full max-w-full lazy-portal" id={'x-lazy-portal-' + (blocks.length - i - 1)}
|
||||
bind:this={blockEle[blocks.length - i - 1]}
|
||||
>
|
||||
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
|
||||
|
||||
{#if DBState.db.characters[$selectedCharID].chats[DBState.db.characters[$selectedCharID].chatPage].message?.[0]?.data?.startsWith(coldStorageHeader) }
|
||||
{#await preLoadChat($selectedCharID, DBState.db.characters[$selectedCharID].chatPage)}
|
||||
<div class="w-full flex justify-center text-textcolor2 italic mb-12">
|
||||
@@ -728,6 +730,15 @@
|
||||
<LazyPortal root={root} target={blockEle[0]}>
|
||||
|
||||
{#if DBState.db.characters[$selectedCharID].type !== 'group' }
|
||||
{#if !DBState.db.characters[$selectedCharID].removedQuotes && DBState.db.characters[$selectedCharID].creatorNotes.length >= 2}
|
||||
<CreatorQuote quote={DBState.db.characters[$selectedCharID].creatorNotes} onRemove={() => {
|
||||
const cha = DBState.db.characters[$selectedCharID]
|
||||
if(cha.type !== 'group'){
|
||||
cha.removedQuotes = true
|
||||
}
|
||||
DBState.db.characters[$selectedCharID] = cha
|
||||
}} />
|
||||
{/if}
|
||||
<Chat
|
||||
character={createSimpleCharacter(DBState.db.characters[$selectedCharID])}
|
||||
name={DBState.db.characters[$selectedCharID].name}
|
||||
@@ -767,15 +778,6 @@
|
||||
isLastMemory={false}
|
||||
|
||||
/>
|
||||
{#if !DBState.db.characters[$selectedCharID].removedQuotes && DBState.db.characters[$selectedCharID].creatorNotes.length >= 2}
|
||||
<CreatorQuote quote={DBState.db.characters[$selectedCharID].creatorNotes} onRemove={() => {
|
||||
const cha = DBState.db.characters[$selectedCharID]
|
||||
if(cha.type !== 'group'){
|
||||
cha.removedQuotes = true
|
||||
}
|
||||
DBState.db.characters[$selectedCharID] = cha
|
||||
}} />
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
</LazyPortal>
|
||||
@@ -948,4 +950,5 @@
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -3,7 +3,6 @@
|
||||
import { language } from "src/lang";
|
||||
import Help from "src/lib/Others/Help.svelte";
|
||||
import { selectSingleFile } from "src/ts/util";
|
||||
import { alertError } from "src/ts/alert";
|
||||
import { DBState, selectedCharID } from 'src/ts/stores.svelte';
|
||||
import { isTauri, saveAsset, downloadFile } from "src/ts/globalApi.svelte";
|
||||
import NumberInput from "src/lib/UI/GUI/NumberInput.svelte";
|
||||
@@ -42,7 +41,6 @@
|
||||
autoSmea:false,
|
||||
legacy_uc:false,
|
||||
use_coords:false,
|
||||
cfg_rescale:0,
|
||||
v4_prompt:{
|
||||
caption:{
|
||||
base_caption:'',
|
||||
@@ -62,7 +60,6 @@
|
||||
reference_strength_multiple: [0.7],
|
||||
vibe_data: undefined,
|
||||
vibe_model_selection: undefined,
|
||||
noise_schedule: 'karras'
|
||||
}
|
||||
if (DBState.db.NAIImgConfig.sampler === 'ddim_v3'){
|
||||
DBState.db.NAIImgConfig.sm = false
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
|
||||
const { target: target = document.body, children, root, idx }:Props = $props();
|
||||
const paddingEle = document.createElement('div')
|
||||
let paddingEle = null
|
||||
const context = getAllContexts();
|
||||
|
||||
let instance;
|
||||
@@ -20,21 +20,16 @@
|
||||
|
||||
onMount(() => {
|
||||
|
||||
paddingEle.style.height = '48px';
|
||||
paddingEle.style.width = '100%'
|
||||
paddingEle.style.backgroundColor = '#ffffff'
|
||||
paddingEle.style.color = 'black'
|
||||
target.appendChild(paddingEle)
|
||||
|
||||
|
||||
const observer = new IntersectionObserver((v) => {
|
||||
if(v[0].intersectionRatio > 0.5){
|
||||
seen = true
|
||||
target.removeChild(paddingEle)
|
||||
observer.disconnect()
|
||||
}
|
||||
|
||||
}, {
|
||||
threshold: 0.5,
|
||||
root: root,
|
||||
})
|
||||
|
||||
observer.observe(target)
|
||||
@@ -48,15 +43,14 @@
|
||||
|
||||
$effect(() => {
|
||||
if(seen){
|
||||
try {
|
||||
instance = mount(PortalConsumer, { target, props: { children }, context })
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
return () => {
|
||||
if(instance){
|
||||
unmount(instance);
|
||||
try {
|
||||
target.removeChild(paddingEle)
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,4 +4,6 @@
|
||||
|
||||
{#if children}
|
||||
{@render children()}
|
||||
{:else}
|
||||
<div class="empty-portal"></div>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user