Merge branch 'dev' into feat/api/SettingsLists

This commit is contained in:
Elvyra 2025-02-05 01:03:37 +01:00 committed by GitHub
commit f590766fd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 9 deletions

View file

@ -33,11 +33,11 @@ function getEmojiMarkdown(target: Target, copyUnicode: boolean): string {
: `:${emojiName}:`; : `:${emojiName}:`;
} }
const extension = target?.firstChild.src.match( const url = new URL(target.firstChild.src);
/https:\/\/cdn\.discordapp\.com\/emojis\/\d+\.(\w+)/ const hasParam = url.searchParams.get("animated") === "true";
)?.[1]; const isGif = url.pathname.endsWith(".gif");
return `<${extension === "gif" ? "a" : ""}:${emojiName.replace(/~\d+$/, "")}:${emojiId}>`; return `<${(hasParam || isGif) ? "a" : ""}:${emojiName.replace(/~\d+$/, "")}:${emojiId}>`;
} }
const settings = definePluginSettings({ const settings = definePluginSettings({
@ -55,7 +55,7 @@ export default definePlugin({
settings, settings,
contextMenus: { contextMenus: {
"expression-picker"(children, { target }: { target: Target }) { "expression-picker"(children, { target }: { target: Target; }) {
if (target.dataset.type !== "emoji") return; if (target.dataset.type !== "emoji") return;
children.push( children.push(

View file

@ -57,7 +57,7 @@ export const Heading = waitForComponent<t.Heading>("Heading", filters.componentB
export const Select = waitForComponent<t.Select>("Select", filters.componentByCode('.selectPositionTop]:"top"===', '"Escape"===')); export const Select = waitForComponent<t.Select>("Select", filters.componentByCode('.selectPositionTop]:"top"===', '"Escape"==='));
export const SearchableSelect = waitForComponent<t.SearchableSelect>("SearchableSelect", filters.componentByCode('.selectPositionTop]:"top"===', ".multi]:")); export const SearchableSelect = waitForComponent<t.SearchableSelect>("SearchableSelect", filters.componentByCode('.selectPositionTop]:"top"===', ".multi]:"));
export const Slider = waitForComponent<t.Slider>("Slider", filters.componentByCode('"markDash".concat(')); export const Slider = waitForComponent<t.Slider>("Slider", filters.componentByCode('"markDash".concat('));
export const Popout = waitForComponent<t.Popout>("Popout", filters.componentByCode("ref:this.ref,preload:")); export const Popout = waitForComponent<t.Popout>("Popout", filters.componentByCode("ref:this.ref,", "renderPopout:this.renderPopout,"));
export const Dialog = waitForComponent<t.Dialog>("Dialog", filters.componentByCode('role:"dialog",tabIndex:-1')); export const Dialog = waitForComponent<t.Dialog>("Dialog", filters.componentByCode('role:"dialog",tabIndex:-1'));
export const TabBar = waitForComponent("TabBar", filters.componentByCode("ref:this.tabBarRef,className:")); export const TabBar = waitForComponent("TabBar", filters.componentByCode("ref:this.tabBarRef,className:"));
export const Paginator = waitForComponent<t.Paginator>("Paginator", filters.componentByCode('rel:"prev",children:')); export const Paginator = waitForComponent<t.Paginator>("Paginator", filters.componentByCode('rel:"prev",children:'));

View file

@ -69,12 +69,12 @@ export const filters = {
m.constructor?.displayName === name, m.constructor?.displayName === name,
componentByCode: (...code: CodeFilter): FilterFn => { componentByCode: (...code: CodeFilter): FilterFn => {
const filter = filters.byCode(...code); const byCodeFilter = filters.byCode(...code);
return m => { const filter = m => {
let inner = m; let inner = m;
while (inner != null) { while (inner != null) {
if (filter(inner)) return true; if (byCodeFilter(inner)) return true;
else if (!inner.$$typeof) return false; else if (!inner.$$typeof) return false;
else if (inner.type) inner = inner.type; // memos else if (inner.type) inner = inner.type; // memos
else if (inner.render) inner = inner.render; // forwardRefs else if (inner.render) inner = inner.render; // forwardRefs
@ -83,6 +83,9 @@ export const filters = {
return false; return false;
}; };
filter.$$vencordProps = [...code];
return filter;
} }
}; };