Skip to content

Commit f87b6f6

Browse files
authored
DOC-2578: New back function in ContextFormApi to go back to the previous toolbar. (#3558)
* DOC-2578: New back function in ContextFormApi to go back to the previous toolbar. * Update modules/ROOT/pages/7.6.0-release-notes.adoc
1 parent 9dd1fb6 commit f87b6f6

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,43 @@ For more details on configuring context toolbar groups and labels, see: xref:con
227227
=== New `back` function in `ContextFormApi` to go back to the previous toolbar.
228228
// #TINY-11344
229229

230+
{productname} {release-version} introduces the `+back+` function in the `ContextFormApi`, enabling users to navigate back to the previous toolbar. This enhancement fulfills the need for a back button in context forms, providing a seamless way to return to the previous toolbar configuration when required.
231+
232+
.Example: Using the `back` function in a context form
233+
[source,js]
234+
----
235+
tinymce.init({
236+
selector: "textarea",
237+
setup: (ed) => {
238+
ed.ui.registry.addContextToolbar('toolbar-with-back-example', {
239+
items: 'form-with-back-example undo redo',
240+
position: 'node',
241+
scope: 'node',
242+
predicate: (node) => node.nodeName.toLowerCase() === 'p'
243+
});
244+
ed.ui.registry.addContextForm('form-with-back-example', {
245+
type: 'contextsizeinputform',
246+
launch: {
247+
type: 'contextformtogglebutton',
248+
icon: 'resize',
249+
tooltip: 'ABC'
250+
},
251+
initValue: () => ({ width: '100', height: '200' }),
252+
onInput: (formApi) => console.log(`input.${JSON.stringify(formApi.getValue())}`),
253+
commands: [
254+
{
255+
type: 'contextformbutton',
256+
icon: 'chevron-left',
257+
tooltip: 'Back',
258+
align: 'start',
259+
onAction: (formApi) => formApi.back()
260+
}
261+
]
262+
});
263+
}
264+
});
265+
----
266+
230267
=== New `QuickbarInsertImage` command that is executed by the `quickimage` button.
231268
// #TINY-11399
232269

modules/ROOT/pages/contextform.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ Where the `+toggleButtonApi+` is the same as a regular toolbar toggle button.
105105

106106
=== formApi
107107

108-
Both `+contextformbutton+` and `+contextformtogglebutton+` are passed `+formApi+` in their `+onAction+` callback. The `+formApi+` has two functions:
108+
Both `+contextformbutton+` and `+contextformtogglebutton+` are passed `+formApi+` in their `+onAction+` callback. The `+formApi+` has three functions:
109109

110110
[cols="1,3",options="header"]
111111
|===
112112
|Functions |Description
113113
|`+hide+` |This will hide the form. By default, no button hides the form. It is the responsibility of the developer to hide the form in the `+onAction+` handler of buttons that require that the context form close after the action.
114+
|`+back+` |This will restore the previous toolbar. This is useful when you want to go back to the previous toolbar when you press back in the toolbar.
114115
|`+getValue+` |This will retrieve the value current typed in the input field.
115116
|===
116117

0 commit comments

Comments
 (0)