Decor: Fix not displaying in multiple places (#3773)
This commit is contained in:
parent
ef0d85a367
commit
0718b56f59
5 changed files with 20 additions and 7 deletions
|
|
@ -91,11 +91,24 @@ export default definePlugin({
|
|||
replacement: [
|
||||
// Use Decor avatar decoration hook
|
||||
{
|
||||
match: /(?<=\i\)\({avatarDecoration:)(\i)(?=,)(?<=currentUser:(\i).+?)/,
|
||||
match: /(?<=\i\)\({avatarDecoration:)\i(?=,)(?<=currentUser:(\i).+?)/,
|
||||
replace: "$self.useUserDecorAvatarDecoration($1)??$&"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
...[
|
||||
'"Message Username"', // Messages
|
||||
".nameplatePreview,{", // Nameplate preview
|
||||
"#{intl::ayozFl::raw}", // Avatar preview
|
||||
].map(find => ({
|
||||
find,
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=userValue.{0,25}void 0:)((\i)\.avatarDecoration)/,
|
||||
replace: "$self.useUserDecorAvatarDecoration($2)??$1"
|
||||
}
|
||||
]
|
||||
})),
|
||||
],
|
||||
settings,
|
||||
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ import { extractAndLoadChunksLazy, findByPropsLazy } from "@webpack";
|
|||
export const cl = classNameFactory("vc-decor-");
|
||||
export const DecorationModalStyles = findByPropsLazy("modalPreview", "modalCloseButton", "spinner", "modal");
|
||||
|
||||
export const requireAvatarDecorationModal = extractAndLoadChunksLazy(["initialSelectedDecoration:", /initialSelectedDecoration:\i,.{0,300}Promise\.all/]);
|
||||
export const requireAvatarDecorationModal = extractAndLoadChunksLazy(["initialSelectedDecoration:", /initialSelectedDecoration:\i,.{0,300}\i\.e\(/]);
|
||||
export const requireCreateStickerModal = extractAndLoadChunksLazy(["stickerInspected]:"]);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ function ChangeDecorationModal(props: ModalProps) {
|
|||
const [tryingDecoration, setTryingDecoration] = useState<Decoration | null | undefined>(undefined);
|
||||
const isTryingDecoration = typeof tryingDecoration !== "undefined";
|
||||
|
||||
const avatarDecorationOverride = tryingDecoration != null ? decorationToAvatarDecoration(tryingDecoration) : tryingDecoration;
|
||||
const avatarDecoration = tryingDecoration != null ? decorationToAvatarDecoration(tryingDecoration) : tryingDecoration;
|
||||
|
||||
const {
|
||||
decorations,
|
||||
|
|
@ -197,7 +197,7 @@ function ChangeDecorationModal(props: ModalProps) {
|
|||
/>
|
||||
<div className={cl("change-decoration-modal-preview")}>
|
||||
<AvatarDecorationModalPreview
|
||||
avatarDecorationOverride={avatarDecorationOverride}
|
||||
avatarDecoration={avatarDecoration}
|
||||
user={UserStore.getCurrentUser()}
|
||||
/>
|
||||
{isActiveDecorationPreset && <Forms.FormTitle className="">Part of the {activeDecorationPreset.name} Preset</Forms.FormTitle>}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ function CreateDecorationModal(props: ModalProps) {
|
|||
</div>
|
||||
<div>
|
||||
<AvatarDecorationModalPreview
|
||||
avatarDecorationOverride={decoration}
|
||||
avatarDecoration={decoration}
|
||||
user={UserStore.getCurrentUser()}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ function canonicalizeMatchCompatString(str: string) {
|
|||
const re = /#{intl::([\w$+/]*)(?:::(\w+))?}/g;
|
||||
for (const match of str.matchAll(re)) {
|
||||
result += escapeRegex(str.slice(lastIndex, match.index));
|
||||
result += getCompatReplacement(match[1]);
|
||||
result += match[2] === "raw" ? getReplacement(false, match[1]) : getCompatReplacement(match[1]);
|
||||
lastIndex = (match.index ?? 0) + match[0].length;
|
||||
}
|
||||
result += escapeRegex(str.slice(lastIndex));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue