Skip to content

Commit c545f09

Browse files
committed
🐛 fix: CivitAI Helper and PromptEditor
CivitAI Helper buttons (#520) PromptEditor: revert to 8409d3c as #198 reappeared on 2a651f6 PromptEditor: add svg icons for buttons
1 parent d15623d commit c545f09

File tree

4 files changed

+52
-50
lines changed

4 files changed

+52
-50
lines changed

javascript/main.js

+41-41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/PromptEditor/TagList/index.tsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ const TagList = memo<TagListProps>(({ tags, setTags, type, setValue }) => {
7979
);
8080

8181
useEffect(() => {
82-
if (!addAutocompleteToArea || bind) return;
83-
let retryTimes = 0;
84-
let bindInterval: any;
8582
try {
86-
bindInterval = setInterval(() => {
83+
if (!addAutocompleteToArea || bind) return;
84+
let retryTimes = 0;
85+
const bindInterval = setInterval(() => {
8786
if (bind || retryTimes > 10) {
8887
const inputDom = document.querySelector(`#${id}`) as HTMLInputElement;
8988
if (inputDom) {
@@ -98,9 +97,6 @@ const TagList = memo<TagListProps>(({ tags, setTags, type, setValue }) => {
9897
} catch (error) {
9998
consola.error('🤯 [promptTagEditor]', error);
10099
}
101-
return () => {
102-
if (bindInterval) clearInterval(bindInterval);
103-
};
104100
}, [bind]);
105101

106102
return (

src/components/PromptEditor/index.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
import isEqual from 'fast-deep-equal';
2-
import { memo } from 'react';
2+
import { memo, useEffect } from 'react';
33
import { useTranslation } from 'react-i18next';
44
import { Flexbox } from 'react-layout-kit';
55

66
import PromptPicker from '@/components/PromptEditor/PromptPicker';
7+
import replaceIcon from '@/scripts/replaceIcon';
78
import { selectors, useAppStore } from '@/store';
89

910
import Prompt from './Prompt';
1011

1112
const PromptEditor = memo(() => {
1213
const setting = useAppStore(selectors.currentSetting, isEqual);
1314
const { t } = useTranslation();
15+
16+
useEffect(() => {
17+
if (setting.svgIcon) replaceIcon();
18+
}, []);
19+
1420
return (
1521
<Flexbox gap={16}>
1622
{setting.promptEditor && (

src/scripts/civitaiHelperFix.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,5 +279,5 @@ export default () => {
279279
}, 500);
280280
};
281281

282-
return helperFix;
282+
return helperFix();
283283
};

0 commit comments

Comments
 (0)