Skip to content

Commit dc6bd70

Browse files
authored
fix: incorrect detection of editor mode (#234)
1 parent c73d4ee commit dc6bd70

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/Editor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ const NON_TRIGGER_KEYS = {
153153
};
154154

155155
function formatValue(cm) {
156-
const mode = cm.options.mode;
156+
// sometimes the mode is stored under `mode` and other times under `mode.name` :/
157+
const mode = cm.options.mode.name || cm.options.mode;
157158
const value = cm.getValue();
158159
const formatted = beautify.format(mode, value);
159160
cm.setValue(formatted);

0 commit comments

Comments
 (0)