I have a plug-in that logs a message. The command shows up in the plug-ins menu but when I click on it on Windows 10, nothing happens and nothing is logged to the developer console. Please advise:
async function insertImage(selection) {
// Go to Plugins > Development > Developer Console to see this log output
console.log("Inserting image");
}
module.exports = {
commands: {
insertImage: insertImage
}
};
Could you please also share the contents of your manifest.json file? The JS looks ggod, so maybe something there could be at fault… Thank you very much in advance
The problem is that your commandId in the manifest.json begins with a capital letter InsertImage, while your exported function doesn’t (insertImage) – if you fix that, everything should be working as expected
Hope this helps.
Edit: By the way, your code gets a lot more readable here in the forums if you wrap it in three backticks (`) at the beginning and the end (markdown syntax)
Ok. The problem is that your code looks good so far (I don’t see anything that’s wrong).
I can understand that. However, the code (with the typo being fixed) seems fine (and should work as expected). Therefore, I fear that at this point, we won’t be able to help you much further (since based on the info provided, the code should work just fine). There are a few things that might be able to shed a light here, but other than that, that’s basically it…
Does the console show any errors (and if so: what) when reloading the plugins with Ctrl+Shift+R (on Windows) or Cmd+Shift+R (on macOS)
What parts are different between the code you’ve shared here and your own parts (I’m not asking what your code does, but simply which parts are “changed”)
Could you please try to replicate the issue with the code you’ve provided here (without the typo, of course)? Does this code, by itself, work for you?
Something else is going wrong - I’ve cloned the sample git repro, added the quick-start sample to the develop folder, reloaded plugins, and selected “Create Rectangle” and nothing happens, nothing shows up it the Developer Console. I can help debug this with you if necessary.
Michael Scherotter (mischero@microsoft.com)