Fix the original missing menu options

This commit is contained in:
johnqiao 2023-11-24 19:06:40 -07:00
parent 355991ecc9
commit e32072ab34

View File

@ -766,10 +766,19 @@ app.registerExtension({
},
_addExtraNodeContextMenu(node, app) {
const origGetExtraMenuOptions = node.prototype.getExtraMenuOptions;
node.prototype.getExtraMenuOptions = function (_, options) {
origGetExtraMenuOptions?.apply?.(this, arguments);
if (isOutputNode(node)) {
const { potential_outputs } = getPotentialOutputsAndOutputNodes([this]);
const hasOutput = potential_outputs.length > 0;
// Check if the previous menu option is `null`. If it's not,
// then we need to add a `null` as a separator.
if (options[options.length - 1] !== null) {
options.push(null);
}
options.push({
content: "🏞️ Share Output",
disabled: !hasOutput,