🐛 fix: CivitAI Helper and PromptEditor

CivitAI Helper buttons (#520)
PromptEditor: revert to 8409d3c as #198 reappeared on 2a651f6
PromptEditor: add svg icons for buttons
pull/522/head
kaalibro 2024-01-17 00:38:06 +06:00
parent d15623d5a9
commit c545f094b9
No known key found for this signature in database
4 changed files with 52 additions and 50 deletions

File diff suppressed because one or more lines are too long

View File

@ -79,11 +79,10 @@ const TagList = memo<TagListProps>(({ tags, setTags, type, setValue }) => {
);
useEffect(() => {
if (!addAutocompleteToArea || bind) return;
let retryTimes = 0;
let bindInterval: any;
try {
bindInterval = setInterval(() => {
if (!addAutocompleteToArea || bind) return;
let retryTimes = 0;
const bindInterval = setInterval(() => {
if (bind || retryTimes > 10) {
const inputDom = document.querySelector(`#${id}`) as HTMLInputElement;
if (inputDom) {
@ -98,9 +97,6 @@ const TagList = memo<TagListProps>(({ tags, setTags, type, setValue }) => {
} catch (error) {
consola.error('🤯 [promptTagEditor]', error);
}
return () => {
if (bindInterval) clearInterval(bindInterval);
};
}, [bind]);
return (

View File

@ -1,9 +1,10 @@
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { memo, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';
import PromptPicker from '@/components/PromptEditor/PromptPicker';
import replaceIcon from '@/scripts/replaceIcon';
import { selectors, useAppStore } from '@/store';
import Prompt from './Prompt';
@ -11,6 +12,11 @@ import Prompt from './Prompt';
const PromptEditor = memo(() => {
const setting = useAppStore(selectors.currentSetting, isEqual);
const { t } = useTranslation();
useEffect(() => {
if (setting.svgIcon) replaceIcon();
}, []);
return (
<Flexbox gap={16}>
{setting.promptEditor && (

View File

@ -279,5 +279,5 @@ export default () => {
}, 500);
};
return helperFix;
return helperFix();
};