From 85a2c2d925478d9de32b1ea7465a541d65ebab0b Mon Sep 17 00:00:00 2001 From: "CODE:AG" <57781325+abhinavgandham@users.noreply.github.com> Date: Wed, 19 Feb 2025 09:08:22 +1000 Subject: [PATCH] =?UTF-8?q?DOC-3132:=20Added=20=20`link=5Fattributes=5Fpos?= =?UTF-8?q?tprocess`=20option=20that=20allows=20overriding=20attributes=20?= =?UTF-8?q?of=20a=20link=20t=E2=80=A6=20(#3624)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * DOC-3132: Added option that allows overriding attributes of a link that would be inserted through the link dialog. * Update modules/ROOT/pages/7.7.0-release-notes.adoc Co-authored-by: Sorita Heng <69398037+soritaheng@users.noreply.github.com> * Update modules/ROOT/pages/7.7.0-release-notes.adoc Co-authored-by: Karl Kemister-Sheppard * Update modules/ROOT/partials/configuration/link_attributes_postprocess.adoc Co-authored-by: Karl Kemister-Sheppard * Update modules/ROOT/pages/7.7.0-release-notes.adoc Co-authored-by: Karl Kemister-Sheppard --------- Co-authored-by: Sorita Heng <69398037+soritaheng@users.noreply.github.com> Co-authored-by: Karl Kemister-Sheppard --- modules/ROOT/pages/7.7.0-release-notes.adoc | 7 +++-- modules/ROOT/pages/link.adoc | 2 ++ .../link_attributes_postprocess.adoc | 26 +++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 modules/ROOT/partials/configuration/link_attributes_postprocess.adoc diff --git a/modules/ROOT/pages/7.7.0-release-notes.adoc b/modules/ROOT/pages/7.7.0-release-notes.adoc index 41624e1205..67dba91212 100644 --- a/modules/ROOT/pages/7.7.0-release-notes.adoc +++ b/modules/ROOT/pages/7.7.0-release-notes.adoc @@ -168,11 +168,10 @@ For information on the **Image Optimizer** plugin, see: xref:uploadcare.adoc[Ima {productname} {release-version} also includes the following improvement: -=== -// #TINY-vwxyz1 - -// CCFR here. +=== Added `link_attributes_postprocess` option that allows overriding attributes of a link inserted through the link dialog. +// #TINY-11707 +Previously in the xref:link.adoc[Link] plugin, there was no ability to override attributes of a link. With the release of {productname} {release-version}, a new option xref:link.adoc#link_attributes_postprocess[link_attributes_postprocess] has been added that allows this functionality. [[additions]] == Additions diff --git a/modules/ROOT/pages/link.adoc b/modules/ROOT/pages/link.adoc index 24137ba934..22a08f1458 100644 --- a/modules/ROOT/pages/link.adoc +++ b/modules/ROOT/pages/link.adoc @@ -46,6 +46,8 @@ include::partial$configuration/link_rel_list.adoc[leveloffset=+1] include::partial$configuration/link_target_list.adoc[leveloffset=+1] +include::partial$configuration/link_attributes_postprocess.adoc[leveloffset=+1] + include::partial$misc/plugin-toolbar-button-id-boilerplate.adoc[] include::partial$misc/plugin-menu-item-id-boilerplate.adoc[] diff --git a/modules/ROOT/partials/configuration/link_attributes_postprocess.adoc b/modules/ROOT/partials/configuration/link_attributes_postprocess.adoc new file mode 100644 index 0000000000..1ae88d09c7 --- /dev/null +++ b/modules/ROOT/partials/configuration/link_attributes_postprocess.adoc @@ -0,0 +1,26 @@ +[[link_attributes_postprocess]] +== `+link_attributes_postprocess+` + +This option allows overriding attributes of an inserted link. + +*Type:* `+Function+` + +*Default value:* `+undefined+` + +=== Example: using `+link_attributes_postprocess+` + +[source,js] +---- +tinymce.init({ + selector: 'textarea', // change this value according to your HTML + plugins: 'link', + toolbar: 'link', + link_attributes_postprocess: (attrs) => { + console.log(attrs); + if (attrs.rel) { + attrs.rel += 'noreferrer'; + } + } +}); + +----