Skip to content

Commit 9f2af76

Browse files
committed
DOC-2578: New onSetup function for context forms.
1 parent 5a98843 commit 9f2af76

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

modules/ROOT/pages/7.6.0-release-notes.adoc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,24 @@ For more information on the `+disabled+` option, see xref:editor-important-optio
238238

239239
// CCFR here.
240240

241+
=== New `onSetup` function to the context forms.
242+
// #TINY-11494
243+
244+
Issue: There wasn’t a way to have a function to be executed when the context form was opened or closed.
245+
246+
Impact: Development of the uploadcare plugin required us to know when the context form is opened and closed.
247+
248+
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.
249+
250+
Improvements/Benefits: There is a new API that handles the life cycle of context forms.
251+
252+
=== New `onSetup` function for context forms
253+
// #TINY-11494
254+
255+
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.
256+
257+
For more details, refer to xref:contextform.adoc#form[Context Form].
258+
241259

242260
[[changes]]
243261
== Changes

modules/ROOT/pages/contextform.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ This relates to the form itself. The form specifications are:
4646
|`+position+` |This controls where the context toolbar will appear with regards to the current cursor.
4747
|`+scope+` |This controls whether the predicate (condition) is a `+node+`-based predicate, or an `+editor+`-based predicate. See context toolbar priority for more details.
4848
|`+commands+` |This is a list of the items to show in the context form. They can be either `+contextformbutton+` or `+contextformtogglebutton+`.
49+
|`+onSetup+`
50+
a|
51+
`+(ContextFormApi) => (ContextFormApi) => void+`
52+
53+
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.
4954
|===
5055

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

0 commit comments

Comments
 (0)