From 4df4b646c1c0ae5667409401dd2f980f64037ee2 Mon Sep 17 00:00:00 2001 From: Karl Kemister-Sheppard Date: Tue, 17 Nov 2026 10:47:11 +1000 Subject: [PATCH] TINYDOC-3583: New TinyMCEAIDiscardSuggestions command to discard the AI suggestions previewed in an editor. --- modules/ROOT/pages/8.11.0-release-notes.adoc | 15 +++++++++++++ .../partials/commands/tinymceai-cmds.adoc | 22 +++++++++++++++++++ .../partials/misc/admon-requires-8.11v.adoc | 1 + 3 files changed, 38 insertions(+) create mode 100644 modules/ROOT/partials/misc/admon-requires-8.11v.adoc diff --git a/modules/ROOT/pages/8.11.0-release-notes.adoc b/modules/ROOT/pages/8.11.0-release-notes.adoc index 68c3245e33..93c474fd34 100644 --- a/modules/ROOT/pages/8.11.0-release-notes.adoc +++ b/modules/ROOT/pages/8.11.0-release-notes.adoc @@ -71,6 +71,21 @@ The {productname} {release-version} release includes an accompanying release of For information on the **** plugin, see: xref:.adoc[]. +=== TinyMCE AI + +The {productname} {release-version} release includes an accompanying release of the **TinyMCE AI** premium plugin. + +**TinyMCE AI** includes the following addition. + +==== New `+TinyMCEAIDiscardSuggestions+` command to discard the AI suggestions previewed in an editor +// #TINYMCE-15157 + +Previously, integrations had no public way to discard the AI suggestions previewed in an editor. In decoupled mode, the **TinyMCE AI** plugin does not show its own confirmation dialog before the AI view closes, so an integration that detected pending suggestions could not complete its own prompt to discard them. + +In {productname} {release-version}, the new `+TinyMCEAIDiscardSuggestions+` command discards the AI suggestions previewed in the editor it runs on, without applying any of them. The editor keeps the content it had before the preview, and returns to the editor mode it had before the preview. In a xref:tinymceai-multi-editor.adoc[multi-editor group], the command affects only the editor it runs on, so an integration runs the command on each editor in the group to discard every suggestion. For details, see xref:tinymceai.adoc#tinymceai-discard-suggestions[Discarding previewed suggestions]. + +For information on the **TinyMCE AI** plugin, see: xref:tinymceai.adoc[TinyMCE AI]. + [[accompanying-premium-plugin-end-of-life-announcement]] == Accompanying Premium plugin end-of-life announcement diff --git a/modules/ROOT/partials/commands/tinymceai-cmds.adoc b/modules/ROOT/partials/commands/tinymceai-cmds.adoc index fb7d0e08c4..eb52df3e80 100644 --- a/modules/ROOT/partials/commands/tinymceai-cmds.adoc +++ b/modules/ROOT/partials/commands/tinymceai-cmds.adoc @@ -57,6 +57,7 @@ The xref:tinymceai.adoc[`tinymceai`] plugin registers the following editor comma |`+TinyMCEAIReviewToneConfident+` | |Runs the **Adjust tone and style** review with the **Confident** tone. |`+TinyMCEAIReviewToneProfessional+` | |Runs the **Adjust tone and style** review with the **Professional** tone. |`+TinyMCEAIReviewCustom+` |`+String+`, `+{ prompt, model, name }+`, or `+{ id, value }+` |Runs a review from a custom prompt, or runs an xref:tinymceai.adoc#integrator-defined-reviews[integrator-defined review] by identifier. See <>. +|`+TinyMCEAIDiscardSuggestions+` | |Discards the AI suggestions previewed in the editor without applying them. See <>. |=== Each `+TinyMCEAIReview…+` command opens the Review sidebar and runs the review, with the same result as selecting that review in the sidebar. Running a review command while another review is in progress stops the earlier review and starts the requested one. @@ -135,3 +136,24 @@ tinymce.activeEditor.execCommand('TinyMCEAIReviewCustom', false, { ---- When the value does not match any of these forms, {productname} logs an error to the browser console and runs no review. This also applies when the prompt or identifier is blank, when no integrator-defined review matches the identifier, when a `+list+` review value is not one of its options, and when an `+input+` review is run without a value. + +[[tinymceai-discard-suggestions]] +=== Discarding previewed suggestions + +include::partial$misc/admon-requires-8.11v.adoc[] + +The `+TinyMCEAIDiscardSuggestions+` command discards the AI suggestions previewed in the editor, such as changes proposed in Chat or Review, without applying any of them. The editor keeps the content it had before the preview. If the editor mode changed while the preview was open, the command restores the mode the editor had before the preview. The command takes no third argument. + +In a xref:tinymceai-multi-editor.adoc[multi-editor group], the command discards only the suggestions of the editor it runs on. The previews in the other editors of the group stay open, and the Review sidebar keeps the suggestions from those previews. To discard the suggestions of the whole group, run the command on each editor in the group. + +.Example: discarding the suggestions previewed in every editor of a group +[source,js] +---- +tinymce.get() + .filter((editor) => editor.options.get('tinymceai_group') === 'my-group') + .forEach((editor) => { + if (editor.queryCommandState('TinyMCEAIPreview')) { + editor.execCommand('TinyMCEAIDiscardSuggestions'); + } + }); +---- diff --git a/modules/ROOT/partials/misc/admon-requires-8.11v.adoc b/modules/ROOT/partials/misc/admon-requires-8.11v.adoc new file mode 100644 index 0000000000..82c489b10e --- /dev/null +++ b/modules/ROOT/partials/misc/admon-requires-8.11v.adoc @@ -0,0 +1 @@ +NOTE: This feature is only available for {productname} 8.11 and later.