Skip to content

Commit

Permalink
Merge pull request #522 from kaalibro/dev
Browse files Browse the repository at this point in the history
🐛 fix: CivitAI Helper and PromptEditor

CivitAI Helper buttons (#520)
PromptEditor: revert to 8409d3c as #198 reappeared on 2a651f6
PromptEditor: add svg icons for buttons
  • Loading branch information
kaalibro authored Jan 16, 2024
2 parents d15623d + c545f09 commit 06ae6ca
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 50 deletions.
82 changes: 41 additions & 41 deletions javascript/main.js

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions src/components/PromptEditor/TagList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 (
Expand Down
8 changes: 7 additions & 1 deletion src/components/PromptEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
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';

const PromptEditor = memo(() => {
const setting = useAppStore(selectors.currentSetting, isEqual);
const { t } = useTranslation();

useEffect(() => {
if (setting.svgIcon) replaceIcon();
}, []);

return (
<Flexbox gap={16}>
{setting.promptEditor && (
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/civitaiHelperFix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,5 @@ export default () => {
}, 500);
};

return helperFix;
return helperFix();
};

0 comments on commit 06ae6ca

Please sign in to comment.