extension: Give precedence to toggles over default options (fixes #5825)
Also fixes #5696
This commit is contained in:
parent
9530da22e2
commit
b7c20a6c60
|
@ -12,7 +12,10 @@ declare global {
|
|||
* [[PublicAPI]] instance itself.
|
||||
*/
|
||||
RufflePlayer?:
|
||||
| { config?: DataLoadOptions | URLLoadOptions | object }
|
||||
| {
|
||||
config?: DataLoadOptions | URLLoadOptions | object;
|
||||
conflict?: Record<string, unknown> | null;
|
||||
}
|
||||
| PublicAPI;
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +36,11 @@ export class PublicAPI {
|
|||
* The configuration object used when Ruffle is instantiated.
|
||||
*/
|
||||
config: DataLoadOptions | URLLoadOptions | object;
|
||||
conflict: Record<string, unknown> | null;
|
||||
|
||||
private sources: Record<string, typeof SourceAPI>;
|
||||
private invoked: boolean;
|
||||
private newestName: string | null;
|
||||
private conflict: Record<string, unknown> | null;
|
||||
|
||||
/**
|
||||
* Construct the Ruffle public API.
|
||||
|
|
|
@ -666,6 +666,13 @@ export class RufflePlayer extends HTMLElement {
|
|||
try {
|
||||
this.loadedConfig = {
|
||||
...DEFAULT_CONFIG,
|
||||
...(window.RufflePlayer?.conflict &&
|
||||
window.RufflePlayer?.conflict["newestName"] === "extension"
|
||||
? (window.RufflePlayer?.conflict["config"] as Record<
|
||||
string,
|
||||
unknown
|
||||
>)
|
||||
: {}),
|
||||
...(window.RufflePlayer?.config ?? {}),
|
||||
...this.config,
|
||||
...options,
|
||||
|
|
|
@ -16,8 +16,8 @@ function handleMessage(message: Message) {
|
|||
case "load": {
|
||||
const api = window.RufflePlayer ?? {};
|
||||
api.config = {
|
||||
...api.config,
|
||||
...message.config,
|
||||
...api.config,
|
||||
};
|
||||
window.RufflePlayer = PublicAPI.negotiate(api, "extension");
|
||||
return {};
|
||||
|
|
Loading…
Reference in New Issue