Sfoglia il codice sorgente

Use hard-coded feature flag for rich text

Alasdair Smith 8 anni fa
parent
commit
4202b9c717

+ 2 - 1
services/web/app/coffee/Features/Project/ProjectController.coffee

@@ -28,6 +28,7 @@ Modules = require '../../infrastructure/Modules'
 ProjectEntityHandler = require './ProjectEntityHandler'
 crypto = require 'crypto'
 { V1ConnectionError } = require '../Errors/Errors'
+Features = require('../../Infrastructure/Features')
 
 module.exports = ProjectController =
 
@@ -344,7 +345,7 @@ module.exports = ProjectController =
 					themes: THEME_LIST
 					maxDocLength: Settings.max_doc_length
 					useV2History: !!project.overleaf?.history?.display
-					showRichText: req.query?.rt == 'true'
+					richTextEnabled: Features.richTextEnabled()
 					showTestControls: req.query?.tc == 'true' || user.isAdmin
 					showPublishModal: req.query?.pm == 'true'
 				timer.done()

+ 4 - 0
services/web/app/coffee/infrastructure/Features.coffee

@@ -4,6 +4,10 @@ module.exports = Features =
 	externalAuthenticationSystemUsed: ->
 		Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
 
+	richTextEnabled: ->
+		isEnabled = true # Switch to false to disable
+		Settings.overleaf? and isEnabled
+
 	hasFeature: (feature) ->
 		switch feature
 			when 'homepage'

+ 1 - 0
services/web/app/views/project/editor.pug

@@ -133,6 +133,7 @@ block requirejs
 		window.maxDocLength = #{maxDocLength};
 		window.trackChangesState = data.trackChangesState;
 		window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
+		window.richTextEnabled = #{richTextEnabled}
 		window.requirejs = {
 			"paths" : {
 				"moment": "libs/#{lib('moment')}",

+ 1 - 1
services/web/app/views/project/editor/editor.pug

@@ -43,7 +43,7 @@ div.full-size(
 			ace-editor="editor",
 			ng-if="!editor.showRichText",
 			ng-show="!!editor.sharejs_doc && !editor.opening",
-			style=showRichText ? "top: 32px" : "",
+			style=richTextEnabled ? "top: 32px" : "",
 			theme="settings.theme",
 			keybindings="settings.mode",
 			font-size="settings.fontSize",