Skip to content

Conversation

rijil-tr
Copy link

@rijil-tr rijil-tr commented Jun 5, 2025

Introduces a new PluginBuilder class and a streamlined registration mechanism to simplify the development and integration of RTE plugins. This change significantly improves the developer experience by providing a declarative API and centralizing SDK context management.

Key Changes:

  • PluginBuilder Class: Provides a fluent API for defining RTE plugins (e.g., .title(...).icon(...).on(...).build()), separating plugin definition from runtime materialization.
  • Unified Plugin Registration (ContentstackAppSDK.registerRTEPlugins):
    • Exposes a new static method ContentstackAppSDK.registerRTEPlugins as the primary entry point for plugin registration.
    • This method returns an asynchronous function that the Contentstack platform loader will call, providing the necessary context and rte instances.
  • Automatic SDK Context Provisioning (rte.sdk injection):
    • The SDK instance (UiLocation) is now automatically injected into the rte: IRteParam object, making rte.sdk available within all plugin callbacks (on handlers) and render components. This eliminates the need for developers to call ContentstackAppSDK.init() repeatedly within their plugin logic.
  • Enhanced Developer Experience:
    • Reduced boilerplate in plugin definition.
    • Clearer API for SDK interaction within plugins.
    • Comprehensive JSDoc documentation and examples for registerRTEPlugins.

Migration Notes for Plugin Developers:

  • New plugins should use PluginBuilder and export default ContentstackAppSDK.registerRTEPlugins(...).
  • Access the SDK instance via rte.sdk within your plugin callbacks and components.
  • Existing plugins will continue to work. Consider migrating them to the new builder pattern for a cleaner definition.

@rijil-tr rijil-tr requested a review from a team as a code owner June 5, 2025 13:28
@rijil-tr rijil-tr changed the base branch from develop to main June 9, 2025 07:19
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