Skip to content

Commit 8bae5c1

Browse files
committed
DOC-3209: editor.getContent() now includes indent and entity_encoding properties to control HTML formatting.
1 parent 942ba64 commit 8bae5c1

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,47 @@ The following premium plugin updates were released alongside {productname} {rele
6565

6666
// CCFR here.
6767

68+
=== `editor.getContent()` now includes `indent` and `entity_encoding` properties to control HTML formatting
69+
// #TINY-12786
70+
71+
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.
72+
73+
In {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.
74+
75+
.Example: how to use the `+getContent+` API to retrieve content with different formatting options.
76+
[source,js]
77+
----
78+
// Disable indentation
79+
tinymce.get(0).getContent({ indent: false });
80+
81+
// Serialize using named entities
82+
tinymce.get(0).getContent({ indent: false, entity_encoding: 'named' });
83+
84+
// Serialize using numeric entities
85+
tinymce.get(0).getContent({ indent: false, entity_encoding: 'numeric' });
86+
87+
// Serialize core entities as named, others as numeric
88+
tinymce.get(0).getContent({ indent: false, entity_encoding: 'named+numeric' });
89+
90+
// Output raw characters
91+
tinymce.get(0).getContent({ indent: false, entity_encoding: 'raw' });
92+
----
93+
94+
or
95+
96+
.Example of configuring the editor to use named entities and disable indentation.
97+
[source,js]
98+
----
99+
tinymce.init({
100+
selector: "textarea",
101+
entity_encoding: 'named', // or 'numeric' or 'raw'
102+
indent: false, // or true
103+
});
104+
----
105+
106+
For more information on the `+getContent+` API, see `xref:apis/tinymce.editor.adoc#getContent[getContent()]`.
107+
108+
68109

69110
[[additions]]
70111
== Additions

0 commit comments

Comments
 (0)