Skip to content

Commit ffa8cee

Browse files
DOC-3209: editor.getContent() now includes indent and entity_encoding properties to control HTML formatting. (#3837)
* DOC-3209: editor.getContent() now includes indent and entity_encoding properties to control HTML formatting. * Update modules/ROOT/pages/8.1.0-release-notes.adoc * Update modules/ROOT/pages/8.1.0-release-notes.adoc Co-authored-by: Shan <[email protected]> --------- Co-authored-by: Shan <[email protected]>
1 parent f8631e3 commit ffa8cee

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

modules/ROOT/pages/8.1.0-release-notes.adoc

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,46 @@ For information on the **Suggested Edits** plugin, see: xref:suggestededits.adoc
204204

205205
// CCFR here.
206206

207+
=== `editor.getContent()` now includes `indent` and `entity_encoding` properties to control HTML formatting
208+
// #TINY-12786
209+
210+
Previously, when using the {productname} `+getContent+` API, options such as `+indent+` and `+entity_encoding+` could not be overridden during the call. The editor always applied its initial configuration, which limited flexibility when retrieving content. This meant integrators were restricted to the defaults set at initialization, with no way to adjust formatting behavior per call.
211+
212+
In {productname} {release-version}, the `+getContent+` API has been enhanced to support per-call overrides for `+indent+` and `+entity_encoding+`. These options can now be specified directly when invoking `+getContent+`, regardless of the editor’s default configuration. This improvement gives developers greater control over output formatting, allowing tailored content retrieval for different use cases.
213+
214+
.Example: how to use the `+getContent+` API to retrieve content with different formatting options.
215+
[source,js]
216+
----
217+
// Disable indentation
218+
tinymce.get(0).getContent({ indent: false });
219+
220+
// Serialize using named entities
221+
tinymce.get(0).getContent({ indent: false, entity_encoding: 'named' });
222+
223+
// Serialize using numeric entities
224+
tinymce.get(0).getContent({ indent: false, entity_encoding: 'numeric' });
225+
226+
// Serialize core entities as named, others as numeric
227+
tinymce.get(0).getContent({ indent: false, entity_encoding: 'named+numeric' });
228+
229+
// Output raw characters
230+
tinymce.get(0).getContent({ indent: false, entity_encoding: 'raw' });
231+
----
232+
233+
or
234+
235+
.Example of configuring the editor to use named entity encoding and disable indentation.
236+
[source,js]
237+
----
238+
tinymce.init({
239+
selector: "textarea",
240+
entity_encoding: 'named', // or 'numeric' or 'raw'
241+
indent: false, // or true
242+
});
243+
----
244+
245+
For more information on the `+getContent+` API, see `xref:apis/tinymce.editor.adoc#getContent[getContent()]`.
246+
207247
=== Clicking on a non selectable element when the selection is off screen no longer scrolls to the selection
208248
// #TINY-12245
209249

@@ -212,7 +252,6 @@ Previously, and issue was identified where clicking the editor's horizontal scro
212252
{productname} {release-version} addresses this issue. Now, the editor avoids taking focus when users click elements that are not selectable (such as scrollbars), preventing unintended vertical scrolling.
213253

214254

215-
216255
[[additions]]
217256
== Additions
218257

0 commit comments

Comments
 (0)