fix: ComponentDispatch and GifPaste plugin (#1843)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
megumin 2023-10-25 13:39:57 +01:00 committed by V
parent 4da79abb21
commit 4beef9f73b
3 changed files with 8 additions and 3 deletions

View file

@ -51,7 +51,10 @@
"eqeqeq": ["error", "always", { "null": "ignore" }], "eqeqeq": ["error", "always", { "null": "ignore" }],
"spaced-comment": ["error", "always", { "markers": ["!"] }], "spaced-comment": ["error", "always", { "markers": ["!"] }],
"yoda": "error", "yoda": "error",
"prefer-destructuring": ["error", { "object": true, "array": false }], "prefer-destructuring": ["error", {
"VariableDeclarator": { "array": false, "object": true },
"AssignmentExpression": { "array": false, "object": false }
}],
"operator-assignment": ["error", "always"], "operator-assignment": ["error", "always"],
"no-useless-computed-key": "error", "no-useless-computed-key": "error",
"no-unneeded-ternary": ["error", { "defaultAssignment": false }], "no-unneeded-ternary": ["error", { "defaultAssignment": false }],

View file

@ -33,7 +33,7 @@ export default definePlugin({
patches: [{ patches: [{
find: ".handleSelectGIF=", find: ".handleSelectGIF=",
replacement: { replacement: {
match: /\.handleSelectGIF=function.+?\{/, match: /\.handleSelectGIF=\i=>\{/,
replace: ".handleSelectGIF=function(gif){return $self.handleSelect(gif);" replace: ".handleSelectGIF=function(gif){return $self.handleSelect(gif);"
} }
}], }],

View file

@ -24,7 +24,9 @@ import { _resolveReady, filters, find, findByCodeLazy, findByPropsLazy, findLazy
import type * as t from "./types/utils"; import type * as t from "./types/utils";
export let FluxDispatcher: t.FluxDispatcher; export let FluxDispatcher: t.FluxDispatcher;
export const ComponentDispatch = findLazy(m => m.emitter?._events?.INSERT_TEXT); export let ComponentDispatch;
waitFor(["ComponentDispatch", "ComponentDispatcher"], m => ComponentDispatch = m.ComponentDispatch);
export const RestAPI: t.RestAPI = findByPropsLazy("getAPIBaseURL", "get"); export const RestAPI: t.RestAPI = findByPropsLazy("getAPIBaseURL", "get");
export const moment: typeof import("moment") = findByPropsLazy("parseTwoDigitYear"); export const moment: typeof import("moment") = findByPropsLazy("parseTwoDigitYear");