diff --git a/modules/ROOT/pages/8.7.0-release-notes.adoc b/modules/ROOT/pages/8.7.0-release-notes.adoc index 60a84540ef..e5cd52e8db 100644 --- a/modules/ROOT/pages/8.7.0-release-notes.adoc +++ b/modules/ROOT/pages/8.7.0-release-notes.adoc @@ -39,6 +39,34 @@ The following premium plugin updates were released alongside {productname} {rele // For information on the **** plugin, see: xref:.adoc[]. +=== Export to PDF + +The {productname} {release-version} release includes an accompanying release of the **Export to PDF** premium plugin. + +**Export to PDF** includes the following addition. + +[[exportpdf-getcontent-export-property]] +==== It is now possible to have the kind of `export` in getContent's events and nodeFilter. +// #TINYMCE-14323 + +The **Export to PDF** plugin now calls `tinymce.editor.getContent()` with an `export` property set to `pdf`. {productname} passes this property to the `GetContent` event and to serializer node filters, so an integrator can apply content filtering that targets a PDF export without affecting regular content retrieval. + +For information on filtering content during an export, see: xref:exportpdf.adoc#export-specific-content-filtering[Export-specific content filtering]. For information on the **Export to PDF** plugin, see: xref:exportpdf.adoc[Export to PDF]. + +=== Export to Word + +The {productname} {release-version} release includes an accompanying release of the **Export to Word** premium plugin. + +**Export to Word** includes the following addition. + +[[exportword-getcontent-export-property]] +==== It is now possible to have the kind of `export` in getContent's events and nodeFilter. +// #TINYMCE-14323 + +The **Export to Word** plugin now calls `tinymce.editor.getContent()` with an `export` property set to `word`. {productname} passes this property to the `GetContent` event and to serializer node filters, so an integrator can apply content filtering that targets a Word export without affecting regular content retrieval. + +For information on filtering content during an export, see: xref:exportword.adoc#export-specific-content-filtering[Export-specific content filtering]. For information on the **Export to Word** plugin, see: xref:exportword.adoc[Export to Word]. + [[improvements]] == Improvements diff --git a/modules/ROOT/pages/exportpdf.adoc b/modules/ROOT/pages/exportpdf.adoc index 0455a28ab7..6f2772734f 100644 --- a/modules/ROOT/pages/exportpdf.adoc +++ b/modules/ROOT/pages/exportpdf.adoc @@ -1,6 +1,7 @@ = {pluginname} plugin :plugincode: exportpdf :pluginname: Export to PDF +:export-type: pdf :page-aliases: export.adoc :pluginfilename: export-to-pdf :navtitle: Export to PDF @@ -81,6 +82,8 @@ The `exportpdf_service_url` option automatically appends `/v2/convert/html-pdf` include::partial$misc/pagebreak-export-note.adoc[] +include::partial$misc/export-specific-content-filtering.adoc[] + == Options The following configuration options affect the behavior of the {pluginname} plugin. diff --git a/modules/ROOT/pages/exportword.adoc b/modules/ROOT/pages/exportword.adoc index f4444b888a..bcceb97682 100644 --- a/modules/ROOT/pages/exportword.adoc +++ b/modules/ROOT/pages/exportword.adoc @@ -1,6 +1,7 @@ = {pluginname} plugin :plugincode: exportword :pluginname: Export to Word +:export-type: word :pluginfilename: export-to-word :navtitle: {pluginname} :description: The {pluginname} feature lets you generate a .docx (Microsoft Word document) file directly from the editor. @@ -80,6 +81,8 @@ The `exportword_service_url` option automatically appends `/v2/convert/html-docx include::partial$misc/pagebreak-export-note.adoc[] +include::partial$misc/export-specific-content-filtering.adoc[] + == Options The following configuration options affect the behavior of the {pluginname} plugin. diff --git a/modules/ROOT/partials/misc/export-specific-content-filtering.adoc b/modules/ROOT/partials/misc/export-specific-content-filtering.adoc new file mode 100644 index 0000000000..32ed0acf7c --- /dev/null +++ b/modules/ROOT/partials/misc/export-specific-content-filtering.adoc @@ -0,0 +1,26 @@ +[[export-specific-content-filtering]] +== Export-specific content filtering + +To generate content for export, the {pluginname} plugin calls the `tinymce.editor.getContent()` method with an `export` property set to `{export-type}`. {productname} adds this `export` property to the data for the xref:events.adoc#editor-core-events[`+GetContent+` event] and for serializer node filters. A serializer node filter or a `GetContent` event handler can read the `export` property to filter content during a {pluginname} export only, without changing the result of a standard `tinymce.editor.getContent()` call. + +The following serializer node filter removes `footer` elements during a {pluginname} export: + +[source,js,subs="+attributes"] +---- +editor.serializer.addNodeFilter('footer', (nodes, name, args) => { + if (args.export === '{export-type}') { + nodes.forEach((node) => node.remove()); + } +}); +---- + +A `GetContent` event handler can read the same `export` property: + +[source,js,subs="+attributes"] +---- +editor.on('GetContent', (e) => { + if (e.export === '{export-type}') { + e.content = removeFooterFromHtml(e.content); + } +}); +----