It changes between the editor modes (Edit / Preview / View Source Code).
Parameters:
Name | Type | Description |
---|---|---|
mode | string |
|
[callback] | function | RELEASE 2.12.0 OR ABOVE Callback function to be executed after editor mode change is completed |
Example:
// Toggle between preview / edit modes if (editor.isPreviewMode()) { editor.setMode('edit'); } else { editor.setMode('preview'); }
// Using callback functions (Release 2.12.0 or above) var callback = function () { console.log('done'); } editor.setMode('edit', callback);