Page tree
Skip to end of metadata
Go to start of metadata

It changes between the editor modes (Edit / Preview / View Source Code).


Parameters:

Name

Type

Description

modestring
  • Edit Mode : 'edit'
  • Source Code View Mode : 'code'
  • Preview Mode : 'preview'
[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);
  • No labels