Skip to content

Commit bb4220a

Browse files
authored
DOC-3392: Add programmatic mode.set example to readonly docs (#4056)
Add example showing editor.mode.set('readonly') and editor.mode.set('design') for runtime mode switching to address Context7 benchmark Q7 (25/100).
1 parent 66b19d7 commit bb4220a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

modules/ROOT/partials/configuration/readonly.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ tinymce.init({
2121

2222
liveDemo::readonly-demo[]
2323

24+
=== Example: switching modes programmatically
25+
26+
Use the xref:apis/tinymce.editormode.adoc#set[`+editor.mode.set()+`] API to switch between `+readonly+` and `+design+` (editable) modes at runtime:
27+
28+
[source,js]
29+
----
30+
const editor = tinymce.activeEditor;
31+
32+
// Switch to read-only
33+
editor.mode.set('readonly');
34+
35+
// Switch back to editable
36+
editor.mode.set('design');
37+
----
38+
2439
=== Behavior in `readonly` mode
2540

2641
[cols="1,3,1", options="header"]

0 commit comments

Comments
 (0)