Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC-2578: New back function in ContextFormApi to go back to the previous toolbar. #3558

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions modules/ROOT/pages/7.6.0-release-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,43 @@ For more details on configuring context toolbar groups and labels, see: xref:con
=== New `back` function in `ContextFormApi` to go back to the previous toolbar.
// #TINY-11344

{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.

.Example: Using the `back` function in a context form
[source,js]
----
tinymce.init({
selector: "textarea",
setup: (ed) => {
ed.ui.registry.addContextToolbar('toolbar-with-back-example', {
items: 'form-with-back-example undo redo',
position: 'node',
scope: 'node',
predicate: (node) => node.nodeName.toLowerCase() === 'p'
});
ed.ui.registry.addContextForm('form-with-back-example', {
type: 'contextsizeinputform',
launch: {
type: 'contextformtogglebutton',
icon: 'resize',
tooltip: 'ABC'
},
initValue: () => ({ width: '100', height: '200' }),
onInput: (formApi) => console.log(`input.${JSON.stringify(formApi.getValue())}`),
commands: [
{
type: 'contextformbutton',
icon: 'chevron-left',
tooltip: 'Back',
align: 'start',
onAction: (formApi) => formApi.back()
}
]
});
}
});
----

=== New `QuickbarInsertImage` command that is executed by the `quickimage` button.
// #TINY-11399

Expand Down
3 changes: 2 additions & 1 deletion modules/ROOT/pages/contextform.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ Where the `+toggleButtonApi+` is the same as a regular toolbar toggle button.

=== formApi

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

[cols="1,3",options="header"]
|===
|Functions |Description
|`+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.
|`+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.
|`+getValue+` |This will retrieve the value current typed in the input field.
|===

Expand Down
Loading