From bfda9c595b60e845f3c8bd95a6d24c8fad945ed7 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Mon, 5 Feb 2018 15:35:00 +0000 Subject: [PATCH] Hide rich text behind feature flag --- .../app/coffee/infrastructure/Features.coffee | 2 ++ services/web/app/views/project/editor.pug | 9 +++++---- services/web/app/views/project/editor/editor.pug | 16 +++++++++------- .../coffee/ide/editor/EditorManager.coffee | 1 - 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/services/web/app/coffee/infrastructure/Features.coffee b/services/web/app/coffee/infrastructure/Features.coffee index a49e0ec124..6e39ee6370 100644 --- a/services/web/app/coffee/infrastructure/Features.coffee +++ b/services/web/app/coffee/infrastructure/Features.coffee @@ -14,5 +14,7 @@ module.exports = Features = return Settings.enableGithubSync when 'v1-return-message' return Settings.accountMerge? and Settings.overleaf? + when 'rich-text' + return Settings.showRichText else throw new Error("unknown feature: #{feature}") diff --git a/services/web/app/views/project/editor.pug b/services/web/app/views/project/editor.pug index 58c56bdce8..88ca3364b8 100644 --- a/services/web/app/views/project/editor.pug +++ b/services/web/app/views/project/editor.pug @@ -159,10 +159,11 @@ block requirejs window.uiConfig = JSON.parse('!{JSON.stringify(uiConfig).replace(/\//g, "\\/")}'); // TODO: inject based on environment - script( - src="http://localhost:3809/public/js/es/richText.js" - type="text/javascript" - ) + if hasFeature('rich-text') + script( + src="http://localhost:3809/public/js/es/richText.js" + type="text/javascript" + ) script( data-main=buildJsPath("ide.js", {hashedPath:false}), diff --git a/services/web/app/views/project/editor/editor.pug b/services/web/app/views/project/editor/editor.pug index 69864374f9..d1e2938714 100644 --- a/services/web/app/views/project/editor/editor.pug +++ b/services/web/app/views/project/editor/editor.pug @@ -30,8 +30,9 @@ div.full-size( i.fa.fa-arrow-left |   #{translate("open_a_file_on_the_left")} - .toolbar.toolbar-editor(ng-controller="EditorToolbarController") - button(ng-click="toggleRichText()") Rich Text + if hasFeature('rich-text') + .toolbar.toolbar-editor(ng-controller="EditorToolbarController") + button(ng-click="toggleRichText()") Rich Text #editor( ace-editor="editor", @@ -66,11 +67,12 @@ div.full-size( renderer-data="reviewPanel.rendererData" ) - #editor-rich-text( - cm-editor - ng-if="!editor.opening && editor.richText" - sharejs-doc="editor.sharejs_doc" - ) + if hasFeature('rich-text') + #editor-rich-text( + cm-editor + ng-if="!editor.opening && editor.richText" + sharejs-doc="editor.sharejs_doc" + ) include ./review-panel diff --git a/services/web/public/coffee/ide/editor/EditorManager.coffee b/services/web/public/coffee/ide/editor/EditorManager.coffee index 2b08605b9b..9c4d74e76f 100644 --- a/services/web/public/coffee/ide/editor/EditorManager.coffee +++ b/services/web/public/coffee/ide/editor/EditorManager.coffee @@ -192,4 +192,3 @@ define [ toggleRichText: () -> @$scope.editor.richText = !@$scope.editor.richText -