From 85313f1b5a696b88ac9be6538c33201cc2c109a2 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Mon, 16 Jul 2018 13:55:44 +0100 Subject: [PATCH] Check if rich text is enabled before using stored mode --- .../web/public/coffee/ide/editor/EditorManager.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/web/public/coffee/ide/editor/EditorManager.coffee b/services/web/public/coffee/ide/editor/EditorManager.coffee index 26ddc7dd33..5130e4796d 100644 --- a/services/web/public/coffee/ide/editor/EditorManager.coffee +++ b/services/web/public/coffee/ide/editor/EditorManager.coffee @@ -6,7 +6,7 @@ define [ "ide/editor/controllers/SavingNotificationController" ], (Document) -> class EditorManager - constructor: (@ide, @$scope, localStorage) -> + constructor: (@ide, @$scope, @localStorage) -> @$scope.editor = { sharejs_doc: null open_doc_id: null @@ -14,7 +14,7 @@ define [ opening: true trackChanges: false wantTrackChanges: false - showRichText: localStorage("editor.mode.#{@$scope.project_id}") == 'rich-text' + showRichText: @showRichText() } @$scope.$on "entity:selected", (event, entity) => @@ -41,6 +41,11 @@ define [ return if !value? @_syncTrackChangesState(@$scope.editor.sharejs_doc) + showRichText: () -> + if !window.richTextEnabled + return false + @localStorage("editor.mode.#{@$scope.project_id}") == 'rich-text' + autoOpenDoc: () -> open_doc_id = @ide.localStorage("doc.open_id.#{@$scope.project_id}") or