From 8ca656d3bc9cc5df55efc53cd3e57f655a4f4d62 Mon Sep 17 00:00:00 2001 From: M Fahru Date: Tue, 8 Nov 2022 18:43:09 -0700 Subject: [PATCH] Don't force user to cm6 if they have ace as editor preference GitOrigin-RevId: 78390fe420eb28b5731cb1cc719a0b53913509e1 --- .../web/frontend/js/ide/editor/EditorManager.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/services/web/frontend/js/ide/editor/EditorManager.js b/services/web/frontend/js/ide/editor/EditorManager.js index 9771960add..3d47cde589 100644 --- a/services/web/frontend/js/ide/editor/EditorManager.js +++ b/services/web/frontend/js/ide/editor/EditorManager.js @@ -176,6 +176,19 @@ export default EditorManager = (function () { return false } + // We will be restarting the survey later after some time + // Until then, we won't force user to use cm6 if they already use ace + const showCM6SwitchAwaySurvey = false + + if (!showCM6SwitchAwaySurvey) { + const sourceEditor = this.localStorage( + `editor.source_editor.${this.$scope.project_id}` + ) + + return sourceEditor === 'cm6' || sourceEditor == null + } + + // the key will be changed when we decided to restart the survey const hasSeenCM6SwitchAwaySurvey = this.localStorage( 'editor.has_seen_cm6_switch_away_survey' )