diff --git a/modules/ROOT/nav.adoc b/modules/ROOT/nav.adoc index 0f9c7c24ae..e7946da4b6 100644 --- a/modules/ROOT/nav.adoc +++ b/modules/ROOT/nav.adoc @@ -424,20 +424,12 @@ ** xref:release-notes.adoc[Release notes for {productname}] *** {productname} 8.9.0 **** xref:8.9.0-release-notes.adoc#overview[Overview] -**** xref:8.9.0-release-notes.adoc#new-premium-plugin[New Premium Plugin] -**** xref:8.9.0-release-notes.adoc#new-open-source-plugin[New Open Source Plugin] **** xref:8.9.0-release-notes.adoc#accompanying-premium-plugin-changes[Accompanying Premium Plugin changes] -**** xref:8.9.0-release-notes.adoc#accompanying-premium-plugin-end-of-life-announcement[Accompanying Premium Plugin end-of-life announcement] -**** xref:8.9.0-release-notes.adoc#accompanying-open-source-plugin-end-of-life-announcement[Accompanying Open Source Plugin end-of-life announcement] -**** xref:8.9.0-release-notes.adoc#accompanying-enhanced-skins-and-icon-packs-changes[Accompanying Enhanced Skins & Icon Packs changes] **** xref:8.9.0-release-notes.adoc#improvements[Improvements] **** xref:8.9.0-release-notes.adoc#additions[Additions] **** xref:8.9.0-release-notes.adoc#changes[Changes] **** xref:8.9.0-release-notes.adoc#removed[Removed] **** xref:8.9.0-release-notes.adoc#bug-fixes[Bug fixes] -**** xref:8.9.0-release-notes.adoc#security-fixes[Security fixes] -**** xref:8.9.0-release-notes.adoc#deprecated[Deprecated] -**** xref:8.9.0-release-notes.adoc#known-issues[Known issues] *** {productname} 8.8.2 **** xref:8.8.2-release-notes.adoc#overview[Overview] **** xref:8.8.2-release-notes.adoc#bug-fixes[Bug fixes] diff --git a/modules/ROOT/pages/8.9.0-release-notes.adoc b/modules/ROOT/pages/8.9.0-release-notes.adoc index bfefea556f..165ec265ba 100644 --- a/modules/ROOT/pages/8.9.0-release-notes.adoc +++ b/modules/ROOT/pages/8.9.0-release-notes.adoc @@ -11,185 +11,229 @@ include::partial$misc/admon-releasenotes-for-stable.adoc[] [[overview]] == Overview -{productname} {release-version} was released for {enterpriseversion} and {cloudname} on ,
^^, . These release notes provide an overview of the changes for {productname} {release-version}, including: +{productname} {release-version} was released for {enterpriseversion} and {cloudname} on Wednesday, August 27^th^, 2026. These release notes provide an overview of the changes for {productname} {release-version}, including: -// Remove sections and section boilerplates as necessary. -// Pluralise as necessary or remove the placeholder plural marker. -* xref:new-premium-plugin[New Premium plugin] -* xref:new-open-source-plugin[New Open Source plugin] * xref:accompanying-premium-plugin-changes[Accompanying Premium plugin changes] -* xref:accompanying-premium-plugin-end-of-life-announcement[Accompanying Premium plugin end-of-life announcement] -* xref:accompanying-open-source-plugin-end-of-life-announcement[Accompanying open source plugin end-of-life-announcement] -* xref:accompanying-enhanced-skins-and-icon-packs-changes[Accompanying Enhanced Skins & Icon Packs changes] * xref:improvements[Improvements] * xref:additions[Additions] * xref:changes[Changes] * xref:bug-fixes[Bug fixes] -* xref:security-fixes[Security fixes] -* xref:deprecated[Deprecated] -* xref:known-issues[Known issues] -[[new-premium-plugin]] -== New Premium plugin +[[accompanying-premium-plugin-changes]] +== Accompanying Premium plugin changes -The following new Premium plugin was released alongside {productname} {release-version}. +The following premium plugin updates were released alongside {productname} {release-version}. -=== +=== Comments -The new Premium plugin, **** // description here. +The {productname} {release-version} release includes an accompanying release of the **Comments** premium plugin. -For information on the **** plugin, see xref:.adoc[]. +**Comments** includes the following additions and improvement. +==== New option `+tinycomments_always_show_highlights+` to keep comment highlights visible while the sidebar is closed +// #TINYMCE-14726 -[[new-open-source-plugin]] -== New Open Source plugin +Previously, the Comments plugin highlighted commented content only while the Comments sidebar was open. Closing the sidebar removed the highlighting from the editor content, so commented content was easy to overlook and users could overwrite it without warning. -The following new Open Source plugin was released alongside {productname} {release-version}. +In {productname} {release-version}, the Comments plugin offers the xref:comments-embedded-mode.adoc#tinycomments_always_show_highlights[`+tinycomments_always_show_highlights+`] option. When this option is set to `+true+`, commented content remains highlighted whether the Comments sidebar is open or closed. This option defaults to `+false+`, which preserves the existing behavior. -=== +==== Selecting a comment highlight opens the Comments sidebar +// #TINYMCE-14726 -The new open source plugin, **** // description here. +Previously, the Comments plugin removed the highlighting while the Comments sidebar was closed, so users could not reopen a conversation from the editor content. -For information on the **** plugin, see xref:.adoc[]. +In {productname} {release-version}, when the xref:comments-embedded-mode.adoc#tinycomments_always_show_highlights[`+tinycomments_always_show_highlights+`] option is set to `+true+`, selecting highlighted content reopens the closed Comments sidebar. +==== The Comments sidebar can be resized and is wider by default +// #TINYMCE-14683 -[[accompanying-premium-plugin-changes]] -== Accompanying Premium plugin changes +Previously, the content styles of the **Comments** plugin fixed the Comments sidebar at 300 pixels wide, and a user could not change that width. -The following premium plugin updates were released alongside {productname} {release-version}. +In {productname} {release-version}, the Comments sidebar is registered with the xref:customsidebar.adoc#resizable[`+resizable+`] property set to `+true+`, so a user can resize it by dragging its edge. The sidebar opens at the width set by the xref:customsidebar.adoc#sidebar_width[`+sidebar_width+`] option, which defaults to 440 pixels, so the Comments sidebar is wider by default than in earlier versions. Setting `+sidebar_width+` to `+300+` restores the previous width, and applies that width to every resizable sidebar in the editor. -=== +For information on the **Comments** plugin, see: xref:introduction-to-tiny-comments.adoc[Comments]. -The {productname} {release-version} release includes an accompanying release of the **** premium plugin. -**** includes the following . +=== TinyMCE AI -==== +The {productname} {release-version} release includes an accompanying release of the **TinyMCE AI** premium plugin. -// CCFR here. +**TinyMCE AI** includes the following fix, addition and improvements. -For information on the **** plugin, see: xref:.adoc[]. +==== Improved error message shown when the document is too long for a quick action or review +// #TINYMCE-13662 +Previously, when the document content exceeded the context limit of the AI service, a quick action or review failed and reported the general message `+An error occurred while processing the AI response.+` That message did not identify the length of the document as the cause. -[[accompanying-premium-plugin-end-of-life-announcement]] -== Accompanying Premium plugin end-of-life announcement +In {productname} {release-version}, the **TinyMCE AI** plugin shows `+This document is too long for the AI to process at once.+` when a quick action or review fails for this reason. The message states the limit without suggesting a corrective action, because the full document is always sent to the AI service. -The following Premium plugin has been announced as reaching its end-of-life: +==== Improved error message shown when an invalid URL is added as a context source +// #TINYMCE-13715 -=== +Previously, adding a malformed URL as a context source in the Chat sidebar reported `+Provided URL is not valid.+` That message did not indicate what part of the address to correct. -{productname}’s xref:.adoc[] plugin will be deactivated on
, , and is no longer available for purchase. +In {productname} {release-version}, the **TinyMCE AI** plugin shows `+This URL isn't valid. Check the full, correct web address and try again.+` in the same situation. The message applies to the format of the address. A well-formed address that points to a page that cannot be reached is still accepted and sent for processing. +==== Chat welcome actions moved focus into the editor and reset the content scroll position +// #TINYMCE-14749 -[[accompanying-open-source-plugin-end-of-life-announcement]] -== Accompanying open source plugin end-of-life announcement +Previously, selecting a welcome action in the AI Chat sidebar moved focus into the editor before running the action's command. Focusing the editor scrolls the content to the current selection, and when no selection had been made, that position was the start of the content. Users who had scrolled through a document lost that scroll position as soon as a welcome action was selected. -The following open source plugin has been announced as reaching its end-of-life: +In {productname} {release-version}, the **TinyMCE AI** plugin runs welcome action commands without moving focus into the editor. Selecting a welcome action leaves the editor scroll position and focus unchanged. Welcome actions are configured with the xref:tinymceai.adoc#tinymceai_chat_welcome_actions[`+tinymceai_chat_welcome_actions+`] option. -=== +==== Tooltips could not be closed using `+Esc+` +// #TINYMCE-14506 -{productname}’s xref:.adoc[] plugin will be deactivated on
, , and is no longer available for purchase. +Previously, the tooltips shown in the **TinyMCE AI** sidebars did not respond to `+Esc+`. These sidebars use their own tooltips, which were not connected to the editor keyboard shortcut that closes tooltips, so an open tooltip remained on screen until the pointer or focus moved elsewhere. Keyboard users could not dismiss a tooltip that obscured the interface. +In {productname} {release-version}, pressing `+Esc+` closes an open tooltip in the **TinyMCE AI** sidebars. -[[accompanying-enhanced-skins-and-icon-packs-changes]] -== Accompanying Enhanced Skins & Icon Packs changes +==== Changes to text alongside a nested list or table did not render as diffs in Review mode +// #TINYMCE-14519 -The {productname} {release-version} release includes an accompanying release of the **Enhanced Skins & Icon Packs**. +Previously, text that sat directly alongside a nested list or table within the same container was not tracked as a block-level change, so the comparison that produces suggestions skipped it. Review mode showed that text as unchanged even when the review returned suggestions for it. Reviewers could not see or act on those suggestions, and the suggested edits were lost once the review was completed. -=== Enhanced Skins & Icon Packs +In {productname} {release-version}, the **TinyMCE AI** plugin treats text alongside a nested list or table as a block-level change when preparing the document for comparison. Suggestions for that text now appear in the Review sidebar and in the document with the rest of the suggestions, and each one can be accepted or rejected as usual. -The **Enhanced Skins & Icon Packs** release includes the following updates: +==== New commands for running reviews +// #TINYMCE-14747 -The **Enhanced Skins & Icon Packs** were rebuilt to pull in the changes also incorporated into the default {productname} {release-version} skin, Oxide. +In {productname} {release-version}, the **TinyMCE AI** plugin registers an editor command for each built-in review, such as `+TinyMCEAIReviewProofread+` and `+TinyMCEAIReviewToneProfessional+`. The plugin also registers the `+TinyMCEAIReviewCustom+` command, which runs a review from a custom prompt or runs an integrator-defined review by identifier. Each command opens the Review sidebar and runs the review, with the same result as selecting that review in the sidebar. Previously, a review could only be started from the Review sidebar, so integrations could not start one from their own interface. -For information on using Enhanced Skins & Icon Packs, see: xref:enhanced-skins-and-icon-packs.adoc[Enhanced Skins & Icon Packs]. +For the command identifiers and the values accepted by `+TinyMCEAIReviewCustom+`, see xref:editor-command-identifiers.adoc#tinymceai-plugin-commands[TinyMCE AI plugin commands]. +==== Improved error messages shown when adding a file context source fails +// #TINYMCE-13660 -[[improvements]] -== Improvements +Previously, when the AI service rejected a file added as a context source in the Chat sidebar, the sidebar reported the failure using the message returned by the service, such as `+Content too large+`. Those messages described the service response rather than the file, so users could not tell which property of the file caused the failure, or what to try instead. -{productname} {release-version} also includes the following improvement: +In {productname} {release-version}, the **TinyMCE AI** plugin shows a message for each file failure it can identify: -=== -// #TINY-vwxyz1 +* A file that is too large reports `+This file is too large to add. Try a smaller one.+` +* A file with too many pages reports `+This file has too many pages to process. Try one with fewer pages.+` +* A file of an unsupported type reports `+This file type isn't supported. Try a different file.+` -// CCFR here. +When the cause cannot be identified, the plugin shows `+This file can't be added. Try a smaller file, or a different file type.+` +==== Improved error message shown when a chat message exceeds the AI context limit +// #TINYMCE-13661 -[[additions]] -== Additions +Previously, when a chat message combined with the conversation history together exceeded the context limit of the AI service, the Chat sidebar reported the failure with the general message `+An error occurred while processing the AI response.+` That message did not identify the size of the request as the cause, so users could not tell whether to shorten the message, start a new conversation, or try again unchanged. -{productname} {release-version} also includes the following addition: +In {productname} {release-version}, the **TinyMCE AI** plugin shows `+This message is too long for the AI to process. Try a shorter message, or start a new chat.+` when the AI service reports that a chat request exceeds the context limit. The message names the cause and describes the two ways to continue. -=== -// #TINY-vwxyz1 +==== Improved error message shown when the chat prompt exceeds the maximum length +// #TINYMCE-13659 -// CCFR here. +Previously, when the text typed into the Chat sidebar exceeded the maximum length that the AI service accepts for a single message, the request failed and the Chat sidebar reported it with the general message `+An error occurred while processing the AI response.+` That message did not identify the length of the typed text as the cause, so users could not tell that shortening the message would resolve the failure. +In {productname} {release-version}, the **TinyMCE AI** plugin shows `+This prompt is too long. Try a shorter one.+` when the typed text exceeds that limit. This message applies to the typed message on its own, and is distinct from the message shown when a message and the conversation history together exceed the context limit of the AI service. -[[changes]] -== Changes +==== The `tinymceai_chat_fetch_sources` option can now specify default sources for chat conversations. +// #TINYMCE-14777 -{productname} {release-version} also includes the following change: +Previously, the **TinyMCE AI** plugin applied only the current document to the context of a new AI Chat conversation. Users had to manually add every other context source, such as a style guide or reference document, to each new conversation. -=== -// #TINY-vwxyz1 +In {productname} {release-version}, the function supplied to xref:tinymceai.adoc#tinymceai_chat_fetch_sources[`+tinymceai_chat_fetch_sources+`] can resolve to an object with a `+menu+` property, holding the source groups shown in the sources menu, and a `+defaults+` property, holding an array of source identifiers. The plugin adds each source listed in `+defaults+` to the context of every new conversation, and shows it as selected in the sources menu. Users can remove a default source from a conversation and add it again from the sources menu. -// CCFR here. +Identifiers listed in `+defaults+` without a matching source in `+sources+` are not added to the context, and the plugin logs an error in the browser console. +The option continues to accept a function that resolves to an array of source groups, so existing configurations are unaffected. -[[removed]] -== Removed +For details on configuring conversation context, see xref:tinymceai-chat.adoc#context-configuration[Adding custom context sources]. -{productname} {release-version} also includes the following removal: +==== Scroll position is preserved between the editor content and the AI preview +// #TINYMCE-14769 -=== -// #TINY-vwxyz1 +Previously, the scroll position was not carried between the editor content and the AI preview. Opening the preview, running a review, or applying a quick action could move the viewport away from the part of the document being worked on, so users lost their place. -// CCFR here. +In {productname} {release-version}, the **TinyMCE AI** plugin records the content block nearest to the current scroll position and restores the view to that block. The position is preserved when opening the preview, running a review, and applying a quick action, and it is restored to the same block even when the content is a different height in the editor and in the preview. +==== Restored the icon-only buttons in the AI suggestion preview +// #TINYMCE-14814 -[[bug-fixes]] -== Bug fixes +In {productname} xref:8.7.0-release-notes.adoc#replaced-the-icon-only-buttons-in-the-ai-suggestion-preview-with-labeled-apply-and-skip-buttons[8.7.0], the icon-only buttons in the AI suggestion preview were replaced with labeled **Apply** and **Skip** buttons. + +In {productname} {release-version}, the **TinyMCE AI** plugin restores the icon-only buttons used before {productname} 8.7.0. A checkmark button applies the suggestion and a close button skips it, and each button shows a tooltip that names its action, _Apply suggestion_ and _Skip suggestion_. The apply button remains the primary action, and the spacing of the preview toolbar is unchanged from {productname} 8.7.0. + +For information on the **TinyMCE AI** plugin, see: xref:tinymceai.adoc[TinyMCE AI]. + + +[[improvements]] +== Improvements -{productname} {release-version} also includes the following bug fix: +{productname} {release-version} also includes the following improvements: -=== -// #TINY-vwxyz1 +=== Sidebars can now be resized by dragging their edge, and their width can be configured with the new `sidebar_width` option. +// #TINYMCE-14527 +// #TINYMCE-14530 -// CCFR here. +Previously, the styles applied to the content of a sidebar fixed the width of that sidebar. A user working in a wide editor could not give a sidebar more room, and a user working in a narrow editor could not reclaim space for the editable area. +In {productname} {release-version}, {productname} renders a resize handle on sidebars registered with the xref:customsidebar.adoc#resizable[`+resizable+`] property set to `+true+`, and a user can drag that handle to resize the sidebar. The sidebars registered by the xref:introduction-to-tiny-comments.adoc[Comments] and xref:tinymceai.adoc[{productname} AI] plugins are resizable by default. The {productname} AI sidebars are not resizable when xref:tinymceai.adoc#tinymceai_sidebar_type[`+tinymceai_sidebar_type+`] is set to `+'floating'+`. To keep the editable area usable, {productname} does not allow the editable area to shrink below 280 pixels, whatever width a user requests. -[[security-fixes]] -== Security fixes +=== The Help dialog lists plugins with invalid metadata as plain text +// #TINYMCE-14730 -{productname} {release-version} includes : +Previously, the _Plugins_ tab of the xref:help.adoc[Help] dialog used the metadata returned by a plugin without checking that the expected fields were present and of the expected type. A plugin that supplied a name but no URL was still rendered as a link, and selecting that link navigated to `+/undefined+`. -=== -// #TINY-vwxyz1 +In {productname} {release-version}, the Help dialog checks the metadata a plugin supplies before rendering it. A plugin whose metadata is missing or of an unexpected type is listed as plain text rather than as a link, using the plugin name where one is supplied, and the plugin identifier where one is not. -// CCFR here. + +[[additions]] +== Additions + +{productname} {release-version} also includes the following addition: + +=== New options for configuring the width of resizable sidebars +// #TINYMCE-14528 + +Previously, the content styles of a sidebar determined the width of that sidebar, and no editor option set that width. + +In {productname} {release-version}, three new options configure the width of any sidebar registered with the xref:customsidebar.adoc#resizable[`+resizable+`] property set to `+true+`. The xref:customsidebar.adoc#sidebar_width[`+sidebar_width+`] option sets the width the sidebar opens at and defaults to `+440+`. The xref:customsidebar.adoc#sidebar_min_width[`+sidebar_min_width+`] and xref:customsidebar.adoc#sidebar_max_width[`+sidebar_max_width+`] options set the smallest and largest widths a user can drag the sidebar to and default to `+300+` and `+800+`. All three options set widths in pixels. To keep the editable area usable, {productname} does not allow the editable area to shrink below 280 pixels, and this limit takes precedence over all three options. + +=== New `SidebarResizeStart` and `SidebarResized` events for tracking sidebar resizing +// #TINYMCE-14529 + +In {productname} {release-version}, two new events report when a user resizes a sidebar. {productname} fires xref:events.adoc#editor-core-events[`+SidebarResizeStart+`] when a user starts dragging the resize handle, and xref:events.adoc#editor-core-events[`+SidebarResized+`] when a user stops dragging. The `+SidebarResized+` event carries a `+{ width: number }+` payload holding the width of the sidebar, in pixels, after the resize. + +Together with the xref:customsidebar.adoc#sidebar_width[`+sidebar_width+`] option, these events allow an integration to store the width a user chooses and restore it the next time the editor loads. For an example, see: xref:customsidebar.adoc#persisting-the-sidebar-width[Persisting the sidebar width]. -[[deprecated]] -== Deprecated +[[changes]] +== Changes + +{productname} {release-version} also includes the following change: + +=== The new `resizable` property controls whether a custom sidebar can be resized +// #TINYMCE-14678 +// #TINYMCE-14683 + +Previously, the styles applied to the content of a sidebar registered through `+addSidebar+` controlled the width of that sidebar. Resizable sidebars require {productname} to control that width instead, and that change of control would alter how every existing custom sidebar renders. -{productname} {release-version} includes the following deprecation: +In {productname} {release-version}, the `+addSidebar+` specification object accepts a new optional xref:customsidebar.adoc#resizable[`+resizable+`] property that defaults to `+false+`. A custom sidebar registered without the property renders as it did in earlier versions and is not resizable, so existing integrations are unaffected. Setting the property to `+true+` makes the sidebar resizable and requires the content of the sidebar to follow the width of the parent element. For information, see: xref:customsidebar.adoc#styling-a-resizable-sidebar[Styling a resizable sidebar]. + +The sidebars registered by the xref:introduction-to-tiny-comments.adoc[Comments] and xref:tinymceai.adoc[{productname} AI] plugins set `+resizable+` to `+true+` and are resizable by default. + + +[[bug-fixes]] +== Bug fixes -=== The `` configuration property, ``, has been deprecated +{productname} {release-version} also includes the following bug fixes: -// placeholder here. +=== Image with empty alt text would add `+role="presentation"+` instead of adding alt text when updated +// #TINYMCE-13738 +Previously, the xref:image.adoc[Image] plugin treated any image with an empty `+alt+` attribute as decorative. When xref:image.adoc#a11y_advanced_options[`+a11y_advanced_options+`] was disabled, the _Insert/Edit Image_ dialog did not show the *Image is decorative* option, so the dialog offered no way to change that state. Entering alternative text for such an image and saving the dialog applied `+role="presentation"+` and left the `+alt+` attribute empty, discarding the text that had been entered. -[[known-issues]] -== Known issues +In {productname} {release-version}, the Image plugin marks an image as decorative only when the _Insert/Edit Image_ dialog presents the accessibility options. Entering alternative text for an image with an empty `+alt+` attribute now applies that text to the image. -This section describes issues that users of {productname} {release-version} may encounter and possible workarounds for these issues. +=== Opening or closing a sidebar from the toolbar scrolled the editor to the selection +// #TINYMCE-14765 -There known issue in {productname} {release-version}. +Previously, opening or closing a sidebar from a toolbar button scrolled the editor content to the current selection when the editor was not focused. Toggling a sidebar is not a content operation, so the viewport moved away from the part of the document the user was reading. -=== -// #TINY-vwxyz1 +In {productname} {release-version}, toggling a sidebar from the toolbar no longer scrolls the selection into view. This applies to every sidebar registered through `+editor.ui.registry.addSidebar+`. Commands that change content, such as _Bold_, continue to focus the editor and scroll to the selection as before. -// CCFR here. \ No newline at end of file +The xref:apis/tinymce.editor.adoc#focus[`+editor.focus()+`] method also accepts an object argument, so callers can focus the editor without scrolling the selection into view, as in `+editor.focus({ scrollToSelection: false })+`. The `+scrollToSelection+` property defaults to `+true+`, and passing a boolean continues to behave as before. diff --git a/modules/ROOT/pages/changelog.adoc b/modules/ROOT/pages/changelog.adoc index c83dbb5fce..87c302e0eb 100644 --- a/modules/ROOT/pages/changelog.adoc +++ b/modules/ROOT/pages/changelog.adoc @@ -4,7 +4,7 @@ NOTE: This is the {productname} Community version changelog. For information about the latest {cloudname} or {enterpriseversion} Release, see: xref:release-notes.adoc[{productname} Release Notes]. -== xref:8.9.0-release-notes.adoc[8.9.0 - ] +== xref:8.9.0-release-notes.adoc[8.9.0 - 2026-08-26] //TODO diff --git a/modules/ROOT/pages/comments-callback-mode.adoc b/modules/ROOT/pages/comments-callback-mode.adoc index 7f76a26891..9bb1da44bc 100644 --- a/modules/ROOT/pages/comments-callback-mode.adoc +++ b/modules/ROOT/pages/comments-callback-mode.adoc @@ -83,6 +83,8 @@ include::partial$configuration/fetch_users.adoc[leveloffset=+1] include::partial$configuration/tinycomments_fetch_author_info.adoc[leveloffset=+1] +include::partial$configuration/tinycomments_always_show_highlights.adoc[leveloffset=+1] + include::partial$plugins/comments-open-sidebar.adoc[] include::partial$plugins/comments-highlighting-css.adoc[] diff --git a/modules/ROOT/pages/comments-embedded-mode.adoc b/modules/ROOT/pages/comments-embedded-mode.adoc index 280630f5bf..f2845cc30c 100644 --- a/modules/ROOT/pages/comments-embedded-mode.adoc +++ b/modules/ROOT/pages/comments-embedded-mode.adoc @@ -64,6 +64,8 @@ include::partial$configuration/tinycomments_can_delete_comment.adoc[leveloffset= include::partial$configuration/tinycomments_can_edit_comment.adoc[leveloffset=+1] +include::partial$configuration/tinycomments_always_show_highlights.adoc[leveloffset=+1] + include::partial$plugins/comments-open-sidebar.adoc[] include::partial$plugins/comments-highlighting-css.adoc[] \ No newline at end of file diff --git a/modules/ROOT/pages/customsidebar.adoc b/modules/ROOT/pages/customsidebar.adoc index fb59b4c0cc..a555a6ed20 100644 --- a/modules/ROOT/pages/customsidebar.adoc +++ b/modules/ROOT/pages/customsidebar.adoc @@ -32,6 +32,19 @@ The `+icon+` specifies an icon for the sidebar toggle button. The icon should be *Type:* `+String+` +[[resizable]] +==== `+resizable+` + +The `+resizable+` specifies whether a user can resize the sidebar by dragging the edge of the sidebar. The default is `+false+`. + +include::partial$misc/admon-requires-8.9v.adoc[] + +When set to `+true+`, {productname} renders a resize handle and controls the width of the sidebar using the xref:customsidebar.adoc#sidebar_width[`+sidebar_width+`], xref:customsidebar.adoc#sidebar_min_width[`+sidebar_min_width+`], and xref:customsidebar.adoc#sidebar_max_width[`+sidebar_max_width+`] options. The content of a sidebar registered with `+resizable+` set to `+true+` needs to follow the width of the parent element. For information, see: xref:customsidebar.adoc#styling-a-resizable-sidebar[Styling a resizable sidebar]. + +When `+resizable+` is omitted or set to `+false+`, {productname} does not render a resize handle, ignores the three sidebar width options, and renders the sidebar at the width defined by the content styles of that sidebar. + +*Type:* `+Boolean+` + [[onSetup]] ==== `+onSetup+` @@ -62,13 +75,113 @@ The `+onHide+` specifies a function to be called when the panel is hidden. It pa The `+element():HTMLElement+` function returns the root element of the sidebar panel. +[[resizable-sidebars]] +== Resizable sidebars + +include::partial$misc/admon-requires-8.9v.adoc[] + +A user can resize a sidebar by dragging the edge of the sidebar toward or away from the editable area. {productname} renders a resize handle only for sidebars registered with the xref:customsidebar.adoc#resizable[`+resizable+`] property set to `+true+`. + +The sidebars registered by the xref:introduction-to-tiny-comments.adoc[Comments] and xref:tinymceai.adoc[{productname} AI] plugins are resizable by default. The {productname} AI sidebars are not resizable when xref:tinymceai.adoc#tinymceai_sidebar_type[`+tinymceai_sidebar_type+`] is set to `+'floating'+`. Sidebars registered through `+addSidebar+` are not resizable by default, so a custom sidebar created before {productname} 8.9 renders as it did previously. + +The xref:customsidebar.adoc#sidebar_width[`+sidebar_width+`], xref:customsidebar.adoc#sidebar_min_width[`+sidebar_min_width+`], and xref:customsidebar.adoc#sidebar_max_width[`+sidebar_max_width+`] options apply to every resizable sidebar in an editor. {productname} cannot set a separate width for an individual sidebar. + +[[styling-a-resizable-sidebar]] +=== Styling a resizable sidebar + +The content styles of a sidebar that is not resizable determine how wide the sidebar renders. + +[source,js] +---- +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + sidebar_show: 'mysidebar', + setup: (editor) => { + editor.ui.registry.addSidebar('mysidebar', { + tooltip: 'My sidebar', + icon: 'comment', + onShow: (api) => { + const container = document.createElement('div'); + container.style.width = '600px'; + api.element().appendChild(container); + }, + }); + } +}); +---- + +{productname} sets the width of a resizable sidebar, so the content styles need to follow the width of the parent element rather than set a width. Set the width of the content to `+100%+` so that the content inherits the width from xref:customsidebar.adoc#element[`+api.element()+`]. + +[source,js] +---- +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + sidebar_show: 'mysidebar', + sidebar_width: 500, + setup: (editor) => { + editor.ui.registry.addSidebar('mysidebar', { + tooltip: 'My sidebar', + icon: 'comment', + resizable: true, + onShow: (api) => { + const container = document.createElement('div'); + container.style.width = '100%'; + api.element().appendChild(container); + }, + }); + } +}); +---- + +IMPORTANT: A sidebar whose content styles set a fixed width does not render correctly when `+resizable+` is set to `+true+`. Update the content styles to `+100%+` before enabling the property. + +[[persisting-the-sidebar-width]] +=== Persisting the sidebar width + +{productname} does not store the width a user drags a sidebar to. To keep a width between editor loads, store the width reported by the xref:events.adoc#editor-core-events[`+SidebarResized+`] event and pass the stored value to xref:customsidebar.adoc#sidebar_width[`+sidebar_width+`] when the editor is next created. + +[source,js] +---- +const storedWidth = window.localStorage.getItem('sidebar-width'); + +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + sidebar_show: 'mysidebar', + sidebar_width: storedWidth ? parseInt(storedWidth, 10) : 440, + setup: (editor) => { + editor.ui.registry.addSidebar('mysidebar', { + tooltip: 'My sidebar', + icon: 'comment', + resizable: true, + onShow: (api) => { + const container = document.createElement('div'); + container.style.width = '100%'; + api.element().appendChild(container); + }, + }); + + editor.on('SidebarResized', (e) => { + window.localStorage.setItem('sidebar-width', e.width); + }); + } +}); +---- + == Options +include::partial$configuration/sidebar_max_width.adoc[leveloffset=+1] + +include::partial$configuration/sidebar_min_width.adoc[leveloffset=+1] + include::partial$configuration/sidebar_show.adoc[leveloffset=+1] +include::partial$configuration/sidebar_width.adoc[leveloffset=+1] + [[example-inside-the-tinymceinit]] == Example inside the tinymce.init +For information on creating a sidebar that a user can resize, see: xref:customsidebar.adoc#resizable-sidebars[Resizable sidebars]. + [source,js] ---- tinymce.init({ @@ -78,6 +191,7 @@ tinymce.init({ editor.ui.registry.addSidebar('mysidebar', { tooltip: 'My sidebar', icon: 'comment', + resizable: true, onSetup: (api) => { console.log('Render panel', api.element()); return () => { @@ -98,12 +212,15 @@ tinymce.init({ == Example inside a TinyMCE plugin +For information on creating a sidebar that a user can resize, see: xref:customsidebar.adoc#resizable-sidebars[Resizable sidebars]. + [source,js] ---- tinymce.PluginManager.add('myplugin', (editor) => { editor.ui.registry.addSidebar('mysidebar', { tooltip: 'My sidebar', icon: 'comment', + resizable: true, onSetup: (api) => { console.log('Render panel', api.element()); return () => { diff --git a/modules/ROOT/pages/events.adoc b/modules/ROOT/pages/events.adoc index 43b16a3500..17d7ea945b 100644 --- a/modules/ROOT/pages/events.adoc +++ b/modules/ROOT/pages/events.adoc @@ -229,6 +229,8 @@ The following events are provided by the {productname} editor. |LanguageLoadError |`+{ message: string }+` |Fired when the editor language pack fails to load. |BeforeRenderUI |N/A |Fired before the theme UI is rendered. |ToggleSidebar |N/A |Fired when a sidebar is toggled opened/closed. +|SidebarResizeStart |N/A |Fired when a user starts dragging the resize handle of a sidebar. This event requires the sidebar to be registered with the xref:customsidebar.adoc#resizable[`+resizable+`] property set to `+true+`. +|SidebarResized |`+{ width: number }+` |Fired when a user stops dragging the resize handle of a sidebar. The `+width+` is the width of the sidebar, in pixels, after the resize. This event requires the sidebar to be registered with the xref:customsidebar.adoc#resizable[`+resizable+`] property set to `+true+`. |longpress |(Same data as the native https://developer.mozilla.org/en-US/docs/Web/API/Element/touchstart_event[touchstart event]) |Fired when a long press occurs on a touch device inside the editor. |tap |(Same data as the native https://developer.mozilla.org/en-US/docs/Web/API/Document/touchend_event[touchend event]) |Fired when a tap occurs on a touch device inside the editor (simulated event similar to click). |ScrollContent |(Same data as the native https://developer.mozilla.org/en-US/docs/Web/API/Element/scroll_event[scroll event]) |(iframe mode only) Fired when the content inside an iframe window has been scrolled. diff --git a/modules/ROOT/pages/tinymceai-chat.adoc b/modules/ROOT/pages/tinymceai-chat.adoc index efdf9b5e29..e110299faa 100644 --- a/modules/ROOT/pages/tinymceai-chat.adoc +++ b/modules/ROOT/pages/tinymceai-chat.adoc @@ -160,6 +160,8 @@ To add custom external sources for users to select from, configure: Full schemas, return types, and examples are documented under xref:tinymceai.adoc#tinymceai_chat_fetch_sources[Chat configuration options]. +To apply a custom source to every new conversation without requiring users to select it, return an object from xref:tinymceai.adoc#tinymceai_chat_fetch_sources[`+tinymceai_chat_fetch_sources+`] and list the source ID in its `+defaults+` property. + [source,js] ---- tinymce.init({ @@ -176,9 +178,9 @@ tinymce.init({ } ], tinymceai_chat_fetch_source: async (id) => { - const res = await fetch(`/api/documents/\$\{id\}`); + const res = await fetch(`/api/documents/${id}`); const blob = await res.blob(); - const filename = `\$\{id\}.pdf`; + const filename = `${id}.pdf`; return { type: 'file', file: new File([blob], filename, { type: blob.type }) }; }, // Required for authentication diff --git a/modules/ROOT/pages/tinymceai.adoc b/modules/ROOT/pages/tinymceai.adoc index b32c601b9b..8aca2f5dd8 100644 --- a/modules/ROOT/pages/tinymceai.adoc +++ b/modules/ROOT/pages/tinymceai.adoc @@ -93,9 +93,9 @@ tinymce.init({ } ], tinymceai_chat_fetch_source: async (id) => { - const res = await fetch(`/api/documents/\$\{id\}`); + const res = await fetch(`/api/documents/${id}`); const blob = await res.blob(); - const filename = `\$\{id\}.pdf`; + const filename = `${id}.pdf`; return { type: 'file', file: new File([blob], filename, { type: blob.type }) }; }, tinymceai_quickactions_custom: [ diff --git a/modules/ROOT/partials/commands/tinymceai-cmds.adoc b/modules/ROOT/partials/commands/tinymceai-cmds.adoc index fe4779afcd..333d7401e2 100644 --- a/modules/ROOT/partials/commands/tinymceai-cmds.adoc +++ b/modules/ROOT/partials/commands/tinymceai-cmds.adoc @@ -24,7 +24,7 @@ NOTE: These commands work regardless of xref:tinymceai.adoc#tinymceai_sidebar_ty [[tinymceai-plugin-commands]] == TinyMCE AI plugin commands -The xref:tinymceai.adoc[`tinymceai`] plugin registers the following editor commands. They mirror the Quick Actions and related UI: each invocation returns immediately while the plugin performs any network and UI work asynchronously. +The xref:tinymceai.adoc[`tinymceai`] plugin registers the following editor commands. They mirror the Quick Actions, Chat, and Review user interface: each invocation returns immediately while the plugin performs any network and UI work asynchronously. [cols="2,2,3",options="header"] |=== @@ -46,8 +46,21 @@ The xref:tinymceai.adoc[`tinymceai`] plugin registers the following editor comma |`+TinyMCEAIQuickActionsSummarize+` | |Opens Chat with the built-in **Summarize** prompt. |`+TinyMCEAIQuickActionsHighlightKeyPoints+` | |Opens Chat with the built-in **Highlight key points** prompt. |`+TinyMCEAIChatPrompt+` |`+{ prompt, displayedPrompt? }+` |Opens the Chat sidebar if needed, then sends `+prompt+` to the back end. Optional `+displayedPrompt+` controls the label shown in the chat UI when it differs from the text sent to the model. +|`+TinyMCEAIReviewProofread+` | |Runs the **Proofread** review. +|`+TinyMCEAIReviewClarity+` | |Runs the **Improve clarity** review. +|`+TinyMCEAIReviewReadability+` | |Runs the **Improve readability** review. +|`+TinyMCEAIReviewMakeLonger+` | |Runs the **Change length** review with the **Longer** option. +|`+TinyMCEAIReviewMakeShorter+` | |Runs the **Change length** review with the **Shorter** option. +|`+TinyMCEAIReviewToneCasual+` | |Runs the **Adjust tone and style** review with the **Casual** tone. +|`+TinyMCEAIReviewToneDirect+` | |Runs the **Adjust tone and style** review with the **Direct** tone. +|`+TinyMCEAIReviewToneFriendly+` | |Runs the **Adjust tone and style** review with the **Friendly** tone. +|`+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 <>. |=== +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. + [NOTE] ==== Command names use the `+TinyMCEAIQuickActions…+` prefix (with an `+s+`) for **Explain**, **Summarize**, and **Highlight key points** — these map to the xref:tinymceai.adoc#tinymceai_quickactions_chat_prompts[chat prompts] submenu, not to standalone `+TinyMCEAIQuickAction…+` spellings. @@ -72,3 +85,53 @@ tinymce.activeEditor.execCommand('TinyMCEAIChatPrompt', false, { displayedPrompt: 'Explain' }); ---- + +.Example: running built-in reviews +[source,js] +---- +tinymce.activeEditor.execCommand('TinyMCEAIReviewProofread'); + +tinymce.activeEditor.execCommand('TinyMCEAIReviewToneProfessional'); +---- + +[[tinymceai-review-custom-values]] +=== Values for `+TinyMCEAIReviewCustom+` + +The `+TinyMCEAIReviewCustom+` command accepts three forms of third argument. + +A `+String+` runs a review from that prompt on the default model, titled **Custom review**: + +[source,js] +---- +tinymce.activeEditor.execCommand('TinyMCEAIReviewCustom', false, 'Check for passive voice'); +---- + +An object with a `+prompt+` property runs a review from a custom prompt: + +* `+prompt+` (`+String+`): The prompt sent to the model. This property is required. +* `+model+` (optional `+String+`): The model that runs the review. When omitted, the review runs on the model set by xref:tinymceai.adoc#tinymceai_default_model[`+tinymceai_default_model+`]. For the available model identifiers, see xref:tinymceai-models.adoc[AI Models]. +* `+name+` (optional `+String+`): The title shown above the review. When omitted, the title is **Custom review**. + +[source,js] +---- +tinymce.activeEditor.execCommand('TinyMCEAIReviewCustom', false, { + prompt: 'Check the document for passive voice', + model: 'agent-1', + name: 'Passive voice' +}); +---- + +An object with an `+id+` property runs an xref:tinymceai.adoc#integrator-defined-reviews[integrator-defined review] configured in xref:tinymceai.adoc#tinymceai_reviews[`+tinymceai_reviews+`]: + +* `+id+` (`+String+`): The `+id+` of the integrator-defined review. This property is required. +* `+value+` (optional `+String+`): The value passed to the review. A `+simple+` review takes no value. For a `+list+` review, the value must match one of the review's `+options+` values; when omitted, the first option is used. For an `+input+` review, the value is the text substituted into the prompt, and it is required. + +[source,js] +---- +tinymce.activeEditor.execCommand('TinyMCEAIReviewCustom', false, { + id: 'integrator-list-review', + value: 'swedish' +}); +---- + +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. diff --git a/modules/ROOT/partials/configuration/sidebar_max_width.adoc b/modules/ROOT/partials/configuration/sidebar_max_width.adoc new file mode 100644 index 0000000000..ba1d5c5224 --- /dev/null +++ b/modules/ROOT/partials/configuration/sidebar_max_width.adoc @@ -0,0 +1,41 @@ +[[sidebar_max_width]] +== `+sidebar_max_width+` + +This option sets the largest width, in pixels, that a user can drag the sidebar to. + +The option applies only to sidebars registered with the `+resizable+` property set to `+true+`. A user cannot resize a sidebar registered without that property, and {productname} ignores this option. + +This option restricts dragging only. This option does not restrict the width set by xref:customsidebar.adoc#sidebar_width[`+sidebar_width+`], so a sidebar can open wider than the value set here. + +include::partial$misc/admon-iframe-only.adoc[] + +*Type:* `+Number+` + +*Default value:* `+800+` + +=== Example: using `+sidebar_max_width+` + +[source,js] +---- +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + sidebar_show: 'mysidebar', + sidebar_max_width: 600, + setup: (editor) => { + editor.ui.registry.addSidebar('mysidebar', { + tooltip: 'My sidebar', + icon: 'comment', + resizable: true, + onShow: (api) => { + api.element().innerHTML = 'Hello world!'; + }, + }); + } +}); +---- + +=== Limitations of the `+sidebar_max_width+` option + +The editable area cannot shrink below 280 pixels, and this limit takes precedence over `+sidebar_max_width+`. For information on this restriction, see: xref:customsidebar.adoc#limitations-of-the-sidebar-width-option[Limitations of the `+sidebar_width+` option]. + +In a narrow editor, the width that remains beside a 280-pixel editable area can be smaller than the value set by `+sidebar_max_width+`. In that case, the remaining width becomes the effective maximum, and a user cannot drag the sidebar beyond that width. diff --git a/modules/ROOT/partials/configuration/sidebar_min_width.adoc b/modules/ROOT/partials/configuration/sidebar_min_width.adoc new file mode 100644 index 0000000000..ac615dc9a0 --- /dev/null +++ b/modules/ROOT/partials/configuration/sidebar_min_width.adoc @@ -0,0 +1,41 @@ +[[sidebar_min_width]] +== `+sidebar_min_width+` + +This option sets the smallest width, in pixels, that a user can drag the sidebar to. + +The option applies only to sidebars registered with the `+resizable+` property set to `+true+`. A user cannot resize a sidebar registered without that property, and {productname} ignores this option. + +This option restricts dragging only. This option does not restrict the width set by xref:customsidebar.adoc#sidebar_width[`+sidebar_width+`], so a sidebar can open narrower than the value set here. + +include::partial$misc/admon-iframe-only.adoc[] + +*Type:* `+Number+` + +*Default value:* `+300+` + +=== Example: using `+sidebar_min_width+` + +[source,js] +---- +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + sidebar_show: 'mysidebar', + sidebar_min_width: 400, + setup: (editor) => { + editor.ui.registry.addSidebar('mysidebar', { + tooltip: 'My sidebar', + icon: 'comment', + resizable: true, + onShow: (api) => { + api.element().innerHTML = 'Hello world!'; + }, + }); + } +}); +---- + +=== Limitations of the `+sidebar_min_width+` option + +The editable area cannot shrink below 280 pixels, and this limit takes precedence over `+sidebar_min_width+`. For information on this restriction, see: xref:customsidebar.adoc#limitations-of-the-sidebar-width-option[Limitations of the `+sidebar_width+` option]. + +When the editor is too narrow to provide the width set by `+sidebar_min_width+` alongside a 280-pixel editable area, {productname} does not resize the sidebar on drag, and the sidebar keeps the current width. diff --git a/modules/ROOT/partials/configuration/sidebar_width.adoc b/modules/ROOT/partials/configuration/sidebar_width.adoc new file mode 100644 index 0000000000..6264cf1620 --- /dev/null +++ b/modules/ROOT/partials/configuration/sidebar_width.adoc @@ -0,0 +1,42 @@ +[[sidebar_width]] +== `+sidebar_width+` + +This option sets the width, in pixels, that the sidebar opens at on editor initialization. + +The option applies only to sidebars registered with the `+resizable+` property set to `+true+`. A sidebar registered without that property keeps the width defined by the content styles of that sidebar, and {productname} ignores this option. + +The xref:customsidebar.adoc#sidebar_min_width[`+sidebar_min_width+`] and xref:customsidebar.adoc#sidebar_max_width[`+sidebar_max_width+`] options do not restrict the width set by this option. Those options restrict only the widths a user can drag the sidebar to. The minimum width of the editable area does restrict this width. For information on this restriction, see: xref:customsidebar.adoc#limitations-of-the-sidebar-width-option[Limitations of the `+sidebar_width+` option]. + +include::partial$misc/admon-iframe-only.adoc[] + +*Type:* `+Number+` + +*Default value:* `+440+` + +=== Example: using `+sidebar_width+` + +[source,js] +---- +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + sidebar_show: 'mysidebar', + sidebar_width: 500, + setup: (editor) => { + editor.ui.registry.addSidebar('mysidebar', { + tooltip: 'My sidebar', + icon: 'comment', + resizable: true, + onShow: (api) => { + api.element().innerHTML = 'Hello world!'; + }, + }); + } +}); +---- + +[[limitations-of-the-sidebar-width-option]] +=== Limitations of the `+sidebar_width+` option + +The editable area and the sidebar share the same container. To keep the editable area usable, {productname} does not allow the editable area to shrink below 280 pixels. This limit is fixed and takes precedence over `+sidebar_width+`, xref:customsidebar.adoc#sidebar_min_width[`+sidebar_min_width+`], and xref:customsidebar.adoc#sidebar_max_width[`+sidebar_max_width+`]. + +When the editor is too narrow to provide the requested width alongside a 280-pixel editable area, {productname} reduces the sidebar to the width that remains. For example, in an editor 1000 pixels wide, a `+sidebar_width+` of 2000 results in a sidebar approximately 716 pixels wide, because the editable area reserves 280 pixels and the editor border occupies the remaining pixels. diff --git a/modules/ROOT/partials/configuration/tinycomments_always_show_highlights.adoc b/modules/ROOT/partials/configuration/tinycomments_always_show_highlights.adoc new file mode 100644 index 0000000000..7d3372409d --- /dev/null +++ b/modules/ROOT/partials/configuration/tinycomments_always_show_highlights.adoc @@ -0,0 +1,28 @@ +[[tinycomments_always_show_highlights]] +== `+tinycomments_always_show_highlights+` + +_Optional_: The {pluginname} plugin offers the `+tinycomments_always_show_highlights+` option to keep the highlighting on commented content visible while the {pluginname} sidebar is closed. By default, {productname} highlights commented content only while the sidebar is open, and removes the highlighting from the editor content once the sidebar is closed. + +When this option is set to `+true+`, {productname} highlights commented content whether the sidebar is open or closed, and selecting highlighted content reopens the closed {pluginname} sidebar. + +*Type:* `+Boolean+` + +*Default value:* `+false+` + +*Possible values:* `+true+`, `+false+` + +=== Example: using `+tinycomments_always_show_highlights+` + +[source,js] +---- +const currentAuthor = 'embedded_journalist'; + +tinymce.init({ + selector: 'textarea', // change this value according to your html + plugins: 'tinycomments', + toolbar: 'addcomment showcomments', + tinycomments_mode: 'embedded', + user_id: currentAuthor, + tinycomments_always_show_highlights: true +}); +---- diff --git a/modules/ROOT/partials/configuration/tinymceai_options.adoc b/modules/ROOT/partials/configuration/tinymceai_options.adoc index 49d736a774..73902da544 100644 --- a/modules/ROOT/partials/configuration/tinymceai_options.adoc +++ b/modules/ROOT/partials/configuration/tinymceai_options.adoc @@ -178,17 +178,28 @@ These options configure the AI Chat sidebar, where users have interactive conver [[tinymceai_chat_fetch_sources]] === `+tinymceai_chat_fetch_sources+` -Populates the sources menu with submenus of files and web resources. Users can select these sources as additional context for chat conversations. +Populates the sources menu with submenus of files and web resources. Users can select these sources as additional context for chat conversations. The option can also nominate default sources, which the {pluginname} plugin adds to the context of every new conversation. -Takes a function that returns a Promise resolving to an array of additional context source groups. Each group has `+label+`, optional `+icon+`, and `+sources+` array. Each source has `+id+`, `+label+`, and `+type+` (`+'web-resource'+` or `+'file'+`). A source's `+id+` is used to fetch its content through xref:tinymceai.adoc#tinymceai_chat_fetch_source[`tinymceai_chat_fetch_source`]. +Takes a function that returns a Promise resolving to either of the following: -*Type:* `+Function+` (`+() => Promise+`) +* An array of source groups. +* An object with a `+menu+` property, holding the array of source groups, and a `+defaults+` property, holding an array of source identifiers. + +Each source group has `+label+`, optional `+icon+`, and `+sources+` array. Each source has `+id+`, `+label+`, and `+type+` (`+'web-resource'+` or `+'file'+`). A source's `+id+` is used to fetch its content through xref:tinymceai.adoc#tinymceai_chat_fetch_source[`tinymceai_chat_fetch_source`]. + +Both shapes are supported. Returning an array populates the sources menu without nominating any default sources. + +Each identifier listed in `+defaults+` must match the `+id+` of a source listed in `+sources+`. The plugin adds each matching source to the context of every new conversation, and shows it as selected in the sources menu. Identifiers without a matching source are not added to the context, and the plugin logs an error in the browser console. Users can remove a default source from a conversation and add it again from the sources menu. + +If `+menu+` is missing or empty, the plugin logs an error in the browser console and populates no sources. + +*Type:* `+Function+` (`+() => Promise+`) *Possible Values:* For source `+type+` property: `+'web-resource'+`, `+'file'+` *Default value:* `+() => Promise.resolve([])+` -.Example +.Example: populating the sources menu [source,js] ---- tinymce.init({ @@ -206,9 +217,42 @@ tinymce.init({ } ], tinymceai_chat_fetch_source: async (id) => { - const res = await fetch(`/api/documents/\$\{id\}`); + const res = await fetch(`/api/documents/${id}`); + const blob = await res.blob(); + const filename = `${id}.pdf`; + return { type: 'file', file: new File([blob], filename, { type: blob.type }) }; + }, + // Required for authentication + tinymceai_token_provider: () => { + return fetch('/api/token').then(r => r.json()); + } +}); +---- + +.Example: nominating default sources +[source,js] +---- +tinymce.init({ + selector: 'textarea', + plugins: 'tinymceai', + toolbar: 'tinymceai-chat tinymceai-quickactions tinymceai-review', + tinymceai_chat_fetch_sources: async () => ({ + defaults: [ 'doc-1' ], + menu: [ + { + label: 'My Documents', + icon: 'folder', + sources: [ + { id: 'doc-1', label: 'Style guide', type: 'file' }, + { id: 'url-1', label: 'Web Page', type: 'web-resource' } + ] + } + ] + }), + tinymceai_chat_fetch_source: async (id) => { + const res = await fetch(`/api/documents/${id}`); const blob = await res.blob(); - const filename = `\$\{id\}.pdf`; + const filename = `${id}.pdf`; return { type: 'file', file: new File([blob], filename, { type: blob.type }) }; }, // Required for authentication @@ -227,7 +271,7 @@ A function that fetches the content for an additional source by ID. Receives the *Possible Values:* For return object `+type+` property: `+'file'+`, `+'web-resource'+` -*Default value:* `+(id) => Promise.resolve(\`Should fetch additional source with given \$\{id\}\`)+` +*Default value:* `+++(id) => Promise.resolve(`Should fetch additional source with given ${id}`)+++` .Example [source,js] @@ -240,9 +284,9 @@ tinymce.init({ { label: 'Docs', sources: [{ id: 'doc-1', label: 'Document 1', type: 'file' }] } ], tinymceai_chat_fetch_source: async (id) => { - const res = await fetch(`/api/documents/\$\{id\}`); + const res = await fetch(`/api/documents/${id}`); const blob = await res.blob(); - const filename = `\$\{id\}.pdf`; + const filename = `${id}.pdf`; return { type: 'file', file: new File([blob], filename, { type: blob.type }) }; }, // Required for authentication @@ -290,7 +334,7 @@ Each item in the array is one of the following: * A `+String+`, or an object with a `+text+` property (`+{ text: 'string' }+`), shown as descriptive text. * An action object, shown as a clickable button, with the following properties: ** `+title+` (`+String+`): The label shown on the button. -** `+command+` (`+String+`): The editor command run when the button is selected, using `+editor.execCommand(command, false, value)+`. This can be a Quick Action or Chat command, the core `+ToggleSidebar+` command, or any other registered editor command, such as `+Bold+`. For the AI command names, see xref:editor-command-identifiers.adoc#tinymceai[TinyMCE AI]. +** `+command+` (`+String+`): The editor command run when the button is selected. The command runs without moving focus into the editor, so the editor scroll position is preserved. This can be a Quick Action or Chat command, the core `+ToggleSidebar+` command, or any other registered editor command, such as `+Bold+`. For the AI command names, see xref:editor-command-identifiers.adoc#tinymceai[TinyMCE AI]. ** `+value+` (optional): The argument passed to the command. The accepted value matches the command, for example a language label for `+TinyMCEAIQuickActionTranslate+`, a `+{ prompt, displayedPrompt }+` object for `+TinyMCEAIChatPrompt+`, or a sidebar name such as `+'tinymceai-review'+` for `+ToggleSidebar+`. ** `+icon+` (optional `+String+`): The name of the icon shown on the button, using any editor icon identifier. When omitted, an icon is selected automatically based on the command. diff --git a/modules/ROOT/partials/misc/admon-requires-8.9v.adoc b/modules/ROOT/partials/misc/admon-requires-8.9v.adoc new file mode 100644 index 0000000000..68e484a2d4 --- /dev/null +++ b/modules/ROOT/partials/misc/admon-requires-8.9v.adoc @@ -0,0 +1 @@ +NOTE: This feature is only available for {productname} 8.9 and later. diff --git a/modules/ROOT/partials/misc/supported-versions.adoc b/modules/ROOT/partials/misc/supported-versions.adoc index 31f91c7250..c9d9ef6d69 100644 --- a/modules/ROOT/partials/misc/supported-versions.adoc +++ b/modules/ROOT/partials/misc/supported-versions.adoc @@ -6,7 +6,7 @@ Supported versions of {productname}: [cols="^,^,^",options="header"] |=== |Version |Release Date |End of Premium Support -|8.9 | | +|8.9 |2026-08-26 |2028-02-26 |8.8 |2026-07-15 |2028-01-15 |8.7 |2026-06-30 |2027-12-30 |8.6 |2026-06-03 |2027-12-03