From e96eb4f55d90a7841de6334f680212e47f7f7f63 Mon Sep 17 00:00:00 2001 From: Karl Kemister-Sheppard Date: Tue, 10 Dec 2024 20:41:17 +1000 Subject: [PATCH] DOC-2578: New `onSetup` function for context forms. (#3550) * DOC-2578: New onSetup function for context forms. * Update modules/ROOT/pages/7.6.0-release-notes.adoc --- modules/ROOT/pages/7.6.0-release-notes.adoc | 7 +++++++ modules/ROOT/pages/contextform.adoc | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/modules/ROOT/pages/7.6.0-release-notes.adoc b/modules/ROOT/pages/7.6.0-release-notes.adoc index 9fef5d5179..b49ad83af2 100644 --- a/modules/ROOT/pages/7.6.0-release-notes.adoc +++ b/modules/ROOT/pages/7.6.0-release-notes.adoc @@ -297,6 +297,13 @@ For more information on the `+disabled+` option, see xref:editor-important-optio // CCFR here. +=== 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]. + === Added placeholder support for context form input fields // #TINY-11459 diff --git a/modules/ROOT/pages/contextform.adoc b/modules/ROOT/pages/contextform.adoc index e3ec4fb325..e803760b6f 100644 --- a/modules/ROOT/pages/contextform.adoc +++ b/modules/ROOT/pages/contextform.adoc @@ -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]