Skip to content

Commit 4232295

Browse files
committed
DOC-2578: New back function in ContextFormApi to go back to the previous toolbar.
1 parent 9dd1fb6 commit 4232295

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,44 @@ 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+
245+
ed.ui.registry.addContextForm('form-with-back-example', {
246+
type: 'contextsizeinputform',
247+
launch: {
248+
type: 'contextformtogglebutton',
249+
icon: 'resize',
250+
tooltip: 'ABC'
251+
},
252+
initValue: () => ({ width: '100', height: '200' }),
253+
onInput: (formApi) => console.log(`input.${JSON.stringify(formApi.getValue())}`),
254+
commands: [
255+
{
256+
type: 'contextformbutton',
257+
icon: 'chevron-left',
258+
tooltip: 'Back',
259+
align: 'start',
260+
onAction: (formApi) => formApi.back()
261+
}
262+
]
263+
});
264+
}
265+
});
266+
----
267+
230268
=== New `QuickbarInsertImage` command that is executed by the `quickimage` button.
231269
// #TINY-11399
232270

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)