Skip to content

Commit

Permalink
DOC-2578: New onSetup function for context forms.
Browse files Browse the repository at this point in the history
  • Loading branch information
kemister85 committed Dec 9, 2024
1 parent 5a98843 commit 9f2af76
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/ROOT/pages/7.6.0-release-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,24 @@ For more information on the `+disabled+` option, see xref:editor-important-optio

// CCFR here.

=== New `onSetup` function to the context forms.
// #TINY-11494

Issue: There wasn’t a way to have a function to be executed when the context form was opened or closed.

Impact: Development of the uploadcare plugin required us to know when the context form is opened and closed.

Solution: A new `onSetup` API was added to the context forms that gets executed when the form is rendered and it’s return function gets executed when the context form is closed.

Improvements/Benefits: There is a new API that handles the life cycle of context forms.

=== New `onSetup` function for context forms
// #TINY-11494

A new `+onSetup+` API has been introduced for context forms, enabling integrators to execute a function when the form is rendered and handle cleanup when it is closed. This enhancement addresses the previous limitation of not being able to detect or trigger actions during the lifecycle of context forms. The `+onSetup+` API streamlines lifecycle management by supporting initialization at form rendering and providing a return function for cleanup, enhancing integration with plugins and applications.

For more details, refer to xref:contextform.adoc#form[Context Form].


[[changes]]
== Changes
Expand Down
5 changes: 5 additions & 0 deletions modules/ROOT/pages/contextform.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ This relates to the form itself. The form specifications are:
|`+position+` |This controls where the context toolbar will appear with regards to the current cursor.
|`+scope+` |This controls whether the predicate (condition) is a `+node+`-based predicate, or an `+editor+`-based predicate. See context toolbar priority for more details.
|`+commands+` |This is a list of the items to show in the context form. They can be either `+contextformbutton+` or `+contextformtogglebutton+`.
|`+onSetup+`
a|
`+(ContextFormApi) => (ContextFormApi) => void+`

Optional default: `+() => () => {}+` - Function that's executed when the form is rendered. Once rendered It returns a function that is executed when the context form is closed.
|===

include::partial$context/positioning.adoc[leveloffset=+1]
Expand Down

0 comments on commit 9f2af76

Please sign in to comment.