MessageLinkEmbeds: SearchResultClasses is lazy loaded so fix

This commit is contained in:
thororen1234 2026-06-09 21:47:30 -04:00
parent 7b8d25dca1
commit 18fd4fb4ef
No known key found for this signature in database
2 changed files with 19 additions and 2 deletions

View file

@ -16,12 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import "./styles.css";
import { addMessageAccessory, removeMessageAccessory } from "@api/MessageAccessories";
import { updateMessage } from "@api/MessageUpdater";
import { definePluginSettings } from "@api/Settings";
import { getUserSettingLazy } from "@api/UserSettings";
import { BaseText } from "@components/BaseText";
import { Devs } from "@utils/constants.js";
import { classNameFactory } from "@utils/css";
import { classes } from "@utils/misc";
import { Queue } from "@utils/Queue";
import definePlugin, { OptionType } from "@utils/types";
@ -42,6 +45,7 @@ import {
} from "@webpack/common";
import { ComponentType, JSX } from "react";
const cl = classNameFactory("vc-message-link-embeds-");
const messageCache = new Map<string, {
message?: Message;
fetched: boolean;
@ -51,7 +55,6 @@ const Embed = findComponentLazy(m => m.prototype?.renderSuppressButton);
const ChannelMessage = findComponentByCodeLazy("childrenExecutedCommand:", ".hideAccessories");
let AutoModEmbed: ComponentType<any> = () => null;
const SearchResultClasses = findCssClassesLazy("message", "searchResult");
const EmbedClasses = findCssClassesLazy("embedAuthorIcon", "embedAuthor", "embedAuthor", "embedMargin");
const MessageDisplayCompact = getUserSettingLazy("textAndImages", "messageDisplayCompact")!;
@ -302,7 +305,7 @@ function ChannelMessageEmbedAccessory({ message, channel }: MessageEmbedProps):
}
}}
renderDescription={() => (
<div key={message.id} className={classes(SearchResultClasses.message, settings.store.messageBackgroundColor && SearchResultClasses.searchResult)}>
<div key={message.id} className={classes(cl("message"), settings.store.messageBackgroundColor && cl("search-result"))}>
<ChannelMessage
id={`message-link-embeds-${message.id}`}
message={message}

View file

@ -0,0 +1,14 @@
/* from findCssClasses("message", "searchResult") which is lazy loaded */
.vc-message-link-embeds-search-result {
background-color: var(--background-base-lower);
border: 1px solid var(--border-subtle);
border-radius: 8px;
box-sizing: border-box;
cursor: pointer;
margin-bottom: 8px;
overflow: hidden;
}
.vc-message-link-embeds-message {
padding: 6px 0;
}