Using PluginBase.util.enterContext to enter a context does not show the commands in the help menu.
For example this plugin has one command which is non-normal and only active in context “somecontext”. It the beginning, context is switched to ["somecontext"] without Normal context. This renders the command not showing in the command list in the help
PluginBase.util.enterContext(["somecontext"]);
export default <IPluginBase & IPlugin>{
...PluginBase,
...{
niceName: "SomePlugin",
description: 'A "SomePlugin" plugin that works on the example.com domain.',
match: /.*\.example.com/,
version: "1.0.0",
commands: [
{
name: "Some::Non-normal",
match: "hello example",
context: "somecontext",
normal: false,
pageFn: () => {
console.log("hello example");
}
}
]
}
};
enterContext actually enters only the context given. So you would need to include “normal” in the params if you use that and still want the Normal context. I will rename it to replaceContext to be more clear. If you just want to add a context, you should use addContext.
PluginBase.util.enterContext(["somecontext"]);
This doesn’t really make sense in the global scope. It should be in init. With those changes, when you go to example.com, it should work
What I wanted is to have only [“somecontext”], not [“Normal”, “somecontext”].
Since the command “Some::Normal” has normal: false and context: "somecontext", I expected that the command will show on the help menu. Was that the wrong assumption regarding how context work?
OK, then your use of enterContext is fine. The problem with using it in global scope remains. Try putting it in init. And also, what URL are you opening the help on?
I used this one on netflix, of course with /.*\.netflix.com/ as the match field value.
I’ll try putting it on init. But in my implementation, it would be calling PluginBase.util.enterContext on certain events like window.addEventListener("popstate", () => { PluginBase.util.enterContext([...]) })