From 66339e1aa1d7decf6bcdc0489f4b838647128388 Mon Sep 17 00:00:00 2001 From: Karl Kemister-Sheppard Date: Mon, 13 Apr 2026 12:15:43 +1000 Subject: [PATCH] DOC-3392: Add programmatic mode.set example to readonly docs Add example showing editor.mode.set('readonly') and editor.mode.set('design') for runtime mode switching to address Context7 benchmark Q7 (25/100). --- modules/ROOT/partials/configuration/readonly.adoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/ROOT/partials/configuration/readonly.adoc b/modules/ROOT/partials/configuration/readonly.adoc index f5466b595a..a3fad8bb3c 100644 --- a/modules/ROOT/partials/configuration/readonly.adoc +++ b/modules/ROOT/partials/configuration/readonly.adoc @@ -21,6 +21,21 @@ tinymce.init({ liveDemo::readonly-demo[] +=== Example: switching modes programmatically + +Use the xref:apis/tinymce.editormode.adoc#set[`+editor.mode.set()+`] API to switch between `+readonly+` and `+design+` (editable) modes at runtime: + +[source,js] +---- +const editor = tinymce.activeEditor; + +// Switch to read-only +editor.mode.set('readonly'); + +// Switch back to editable +editor.mode.set('design'); +---- + === Behavior in `readonly` mode [cols="1,3,1", options="header"]