From 24c2e98fb28033f0a1c7766a81326b22c283c88d Mon Sep 17 00:00:00 2001 From: Karl Kemister-Sheppard Date: Mon, 28 Jul 2025 11:35:18 +1000 Subject: [PATCH] DOC-3229: Add missing `iframe_attrs` option. (#3804) * DOC-3229: Add missing iframe_attrs option. * Update modules/ROOT/partials/configuration/iframe_attrs.adoc Co-authored-by: tiny-ben-tran * Update modules/ROOT/partials/configuration/iframe_attrs.adoc Co-authored-by: tiny-ben-tran * Update modules/ROOT/partials/configuration/iframe_attrs.adoc * Update modules/ROOT/partials/configuration/iframe_attrs.adoc --------- Co-authored-by: tiny-ben-tran --- .../ROOT/pages/editor-important-options.adoc | 9 ++-- .../partials/configuration/iframe_attrs.adoc | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 modules/ROOT/partials/configuration/iframe_attrs.adoc diff --git a/modules/ROOT/pages/editor-important-options.adoc b/modules/ROOT/pages/editor-important-options.adoc index 4bb655ea99..22e4a93a39 100644 --- a/modules/ROOT/pages/editor-important-options.adoc +++ b/modules/ROOT/pages/editor-important-options.adoc @@ -13,6 +13,10 @@ include::partial$configuration/target.adoc[leveloffset=+1] include::partial$configuration/placeholder.adoc[leveloffset=+1] +== Configuring the editor iframe + +include::partial$configuration/iframe_attrs.adoc[leveloffset=+1] + == Focusing on the editor include::partial$configuration/taborder.adoc[leveloffset=+1] @@ -52,8 +56,3 @@ include::partial$configuration/content_security_policy.adoc[leveloffset=+1] include::partial$configuration/referrer_policy.adoc[leveloffset=+1] include::partial$configuration/suffix.adoc[leveloffset=+1] - -//// -Not documented, but probably belongs in a new section here somewhere. -include::partial$configuration/iframe_attrs.adoc[] -//// diff --git a/modules/ROOT/partials/configuration/iframe_attrs.adoc b/modules/ROOT/partials/configuration/iframe_attrs.adoc new file mode 100644 index 0000000000..8bf842a83d --- /dev/null +++ b/modules/ROOT/partials/configuration/iframe_attrs.adoc @@ -0,0 +1,41 @@ +[[iframe_attrs]] +== `+iframe_attrs+` + +This option allows adding custom attributes to the editor's content iframe element when running in classic mode. The attributes are applied during the iframe creation. + +NOTE: This option only affects the main editor content iframe, not other iframes such as preview frames, dialog iframes, or iframe elements created within the editor content. + + +*Type:* `+Object+` + +.Example: using `+iframe_attrs+` for accessibility +[source,js] +---- +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + iframe_attrs: { + 'aria-required': 'true', + 'aria-describedby': 'editor-description' + } +}); +---- + +.Example: using `+iframe_attrs+` for custom styling +[source,js] +---- +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + iframe_attrs: { + 'style': 'background-color:rgb(64, 167, 99); border: 2px solid #ddd;', + 'class': 'custom-editor-frame' + } +}); +---- + +.Example: verifying `+iframe_attrs+` configuration +[source,js] +---- +// After the editor is initialized, you can verify the configuration: +console.log(tinymce.activeEditor.options.get('iframe_attrs')); +// Output: {style: 'background-color:rgb(64, 167, 99); border: 2px solid #ddd;', class: 'custom-editor-frame'} +----