Skip to content

Conversation

@Myestery
Copy link
Contributor

@Myestery Myestery commented Oct 27, 2025

This pull request introduces a comprehensive migration guide for context menu extensions in ComfyUI and updates related documentation and examples to reflect the new recommended APIs. The most important changes are the addition of a step-by-step migration guide, updates to example code to use the new extension hooks, and improvements to documentation clarity and maintainability.

Documentation: Context Menu Migration

  • Added custom-nodes/js/context-menu-migration.mdx, a detailed migration guide explaining how to move from deprecated monkey-patching of context menus to the new extension hooks (getCanvasMenuItems and getNodeMenuItems). The guide includes before/after code samples, troubleshooting tips, and best practices for submenus and state access.
  • Registered the new migration guide in the documentation navigation by adding it to docs.json.

Example Code Updates

  • Updated custom-nodes/js/javascript_examples.mdx to replace deprecated monkey-patching patterns with the new extension hooks for both canvas and node menus. Examples now use getCanvasMenuItems and getNodeMenuItems methods, demonstrating cleaner and more maintainable code.
  • Revised submenu creation examples to use the declarative submenu property with an options array, aligning with the recommended API for better maintainability.

Clarity and Best Practices

  • Added comparison tables and highlighted key differences between old and new approaches, making it easier for developers to understand the migration process and benefits.
  • Included troubleshooting steps and migration verification checklist to help developers ensure a smooth transition and avoid deprecation warnings.

- Complete migration guide from deprecated monkey-patching to new API
- Side-by-side comparisons of old vs new approaches
- Canvas menu and node menu migration examples
- Troubleshooting section with deprecation warnings
- Recommends declarative submenu pattern
- Replace deprecated prototype monkey-patching with getCanvasMenuItems/getNodeMenuItems hooks
- Update background menu examples to use modern extension API
- Update node menu examples with proper type filtering
- Switch to declarative submenu pattern using submenu.options
- Keep original example simplicity and patterns
@Myestery Myestery merged commit 7445bc5 into main Oct 28, 2025
8 of 9 checks passed
@github-actions github-actions bot deleted the contextmenu-migration branch October 28, 2025 00:45
comfyui-wiki added a commit that referenced this pull request Oct 28, 2025
This PR synchronizes the Chinese documentation with the changes made in PR #508 (Contextmenu migration). The updates replace deprecated monkey-patching patterns with the new recommended extension hooks for context menus.

Changes:
- Updated background menu section to use `getCanvasMenuItems` method instead of monkey-patching `LGraphCanvas.prototype.getCanvasMenuOptions`
- Updated node menu section to use `getNodeMenuItems` method instead of monkey-patching in `beforeRegisterNodeDef()`
- Updated submenu section to use declarative `submenu` property with `options` array instead of `LiteGraph.ContextMenu`

These changes align with the best practices introduced in the context menu migration guide and ensure Chinese documentation stays in sync with English documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
comfyui-wiki added a commit that referenced this pull request Oct 29, 2025
* Update tutorials/api-nodes/pricing.mdx

* Update zh-CN/tutorials/api-nodes/pricing.mdx

* Update pricing

* Update pricing

* Update Chinese version of javascript_examples.mdx to match PR #508

This PR synchronizes the Chinese documentation with the changes made in PR #508 (Contextmenu migration). The updates replace deprecated monkey-patching patterns with the new recommended extension hooks for context menus.

Changes:
- Updated background menu section to use `getCanvasMenuItems` method instead of monkey-patching `LGraphCanvas.prototype.getCanvasMenuOptions`
- Updated node menu section to use `getNodeMenuItems` method instead of monkey-patching in `beforeRegisterNodeDef()`
- Updated submenu section to use declarative `submenu` property with `options` array instead of `LiteGraph.ContextMenu`

These changes align with the best practices introduced in the context menu migration guide and ensure Chinese documentation stays in sync with English documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix typos

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants